From 08318a904b22474890fd0bc78941bcdf9a7fbdcf Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 3 Dec 2015 16:04:12 -0800 Subject: [PATCH 001/326] New: First commit --- packages/typescript-eslint-parser/.eslintrc | 4 + packages/typescript-eslint-parser/.gitignore | 6 + packages/typescript-eslint-parser/.travis.yml | 8 + .../typescript-eslint-parser/CHANGELOG.md | 0 .../typescript-eslint-parser/CONTRIBUTING.md | 8 + packages/typescript-eslint-parser/LICENSE | 19 + packages/typescript-eslint-parser/Makefile.js | 286 + packages/typescript-eslint-parser/README.md | 41 + .../lib/ast-converter.js | 1026 +++ .../lib/ast-node-types.js | 119 + .../lib/comment-attachment.js | 183 + .../typescript-eslint-parser/lib/features.js | 114 + .../lib/token-translator.js | 271 + .../typescript-eslint-parser/package.json | 61 + packages/typescript-eslint-parser/parser.js | 266 + .../fixtures/ast/Additive-Operators.json | 217 + .../tests/fixtures/ast/Array-Initializer.json | 1198 ++++ .../fixtures/ast/Assignment-Operators.json | 1010 +++ .../ast/Automatic-semicolon-insertion.json | 1707 +++++ .../ast/Binary-Bitwise-Operators.json | 215 + .../fixtures/ast/Binary-Expressions.json | 1928 ++++++ .../ast/Binary-Logical-Operators.json | 572 ++ .../fixtures/ast/Bitwise-Shift-Operator.json | 215 + .../tests/fixtures/ast/Block.json | 199 + .../tests/fixtures/ast/Comments.json | 4322 ++++++++++++ .../fixtures/ast/Complex-Expression.json | 397 ++ .../fixtures/ast/Conditional-Operator.json | 345 + .../tests/fixtures/ast/Const-Statement.json | 370 + .../tests/fixtures/ast/Directive-Prolog.json | 332 + .../tests/fixtures/ast/Empty-Statement.json | 19 + .../fixtures/ast/Equality-Operators.json | 286 + .../fixtures/ast/Expression-Statement.json | 249 + .../fixtures/ast/Function-Definition.json | 1681 +++++ .../tests/fixtures/ast/Grouping-Operator.json | 222 + .../tests/fixtures/ast/If-Statement.json | 742 ++ .../tests/fixtures/ast/Invalid-syntax.json | 1334 ++++ .../fixtures/ast/Iteration-Statements.json | 2684 +++++++ .../fixtures/ast/Labelled-Statements.json | 268 + .../ast/Left-Hand-Side-Expression.json | 2188 ++++++ .../tests/fixtures/ast/Let-Statement.json | 427 ++ .../ast/Multiplicative-Operators.json | 215 + .../tests/fixtures/ast/Numeric-Literals.json | 780 +++ .../fixtures/ast/Object-Initializer.json | 4950 +++++++++++++ .../fixtures/ast/Postfix-Expressions.json | 326 + .../fixtures/ast/Primary-Expression.json | 335 + .../ast/Regular-Expression-Literals.json | 1215 ++++ .../fixtures/ast/Relational-Operators.json | 535 ++ .../tests/fixtures/ast/Source-elements.json | 21 + .../tests/fixtures/ast/Source-option.json | 304 + .../tests/fixtures/ast/String-Literals.json | 686 ++ .../tests/fixtures/ast/Tokenize.json | 1277 ++++ .../tests/fixtures/ast/Tolerant-parse.json | 6139 +++++++++++++++++ .../tests/fixtures/ast/Unary-Operators.json | 704 ++ .../fixtures/ast/Variable-Statement.json | 826 +++ .../tests/fixtures/ast/Whitespace.json | 254 + .../tests/fixtures/ast/break-statement.json | 450 ++ .../fixtures/ast/continue-statement.json | 523 ++ .../fixtures/ast/debugger-statement.json | 19 + .../tests/fixtures/ast/return-statement.json | 380 + .../tests/fixtures/ast/switch-statement.json | 368 + .../tests/fixtures/ast/throw-statement.json | 202 + .../tests/fixtures/ast/try-statement.json | 1080 +++ .../tests/fixtures/ast/with-statement.json | 339 + .../block-trailing-comment.result.js | 242 + .../block-trailing-comment.src.js | 4 + .../comment-within-condition.result.js | 262 + .../comment-within-condition.src.js | 2 + .../export-default-anonymous-class.result.js | 412 ++ .../export-default-anonymous-class.src.js | 10 + .../mix-line-and-block-comments.result.js | 340 + .../mix-line-and-block-comments.src.js | 3 + .../surrounding-call-comments.result.js | 390 ++ .../surrounding-call-comments.src.js | 5 + .../surrounding-debugger-comments.result.js | 318 + .../surrounding-debugger-comments.src.js | 5 + .../surrounding-return-comments.result.js | 319 + .../surrounding-return-comments.src.js | 5 + .../surrounding-throw-comments.result.js | 355 + .../surrounding-throw-comments.src.js | 5 + .../surrounding-while-loop-comments.result.js | 557 ++ .../surrounding-while-loop-comments.src.js | 1 + ...-fallthrough-comment-in-function.result.js | 775 +++ ...tch-fallthrough-comment-in-function.src.js | 9 + .../switch-fallthrough-comment.result.js | 573 ++ .../switch-fallthrough-comment.src.js | 7 + ...h-no-default-comment-in-function.result.js | 701 ++ ...itch-no-default-comment-in-function.src.js | 9 + ...ault-comment-in-nested-functions.result.js | 1588 +++++ ...default-comment-in-nested-functions.src.js | 12 + .../switch-no-default-comment.result.js | 353 + .../switch-no-default-comment.src.js | 5 + .../classes-and-generators.config.js | 4 + .../classes-and-generators.result.js | 334 + .../classes-and-generators.src.js | 4 + .../computed-generator.config.js | 4 + .../computed-generator.result.js | 442 ++ .../computed-generator.src.js | 4 + .../error-generator.config.js | 4 + .../error-generator.result.js | 6 + .../error-generator.src.js | 4 + .../error-no-class.config.js | 5 + .../error-no-class.result.js | 6 + .../error-no-class.src.js | 4 + .../error-static-no-generators.config.js | 4 + .../error-static-no-generators.result.js | 6 + .../error-static-no-generators.src.js | 4 + .../static-generators.config.js | 4 + .../static-generators.result.js | 352 + .../static-generators.src.js | 4 + .../default-param-arrow.config.js | 4 + .../default-param-arrow.result.js | 460 ++ .../default-param-arrow.src.js | 1 + .../default-param.config.js | 4 + .../default-param.result.js | 349 + .../default-param.src.js | 1 + .../local-eval-multi.config.js | 4 + .../local-eval-multi.result.js | 332 + .../local-eval-multi.src.js | 1 + .../local-eval.config.js | 4 + .../local-eval.result.js | 278 + .../local-eval.src.js | 1 + .../yield-default-param.config.js | 5 + .../yield-default-param.result.js | 459 ++ .../yield-default-param.src.js | 1 + .../arrow-param-array.config.js | 4 + .../arrow-param-array.result.js | 260 + .../arrow-param-array.src.js | 1 + .../arrow-param-nested-array.config.js | 4 + .../arrow-param-nested-array.result.js | 369 + .../arrow-param-nested-array.src.js | 1 + .../arrow-param-nested-object-named.config.js | 4 + .../arrow-param-nested-object-named.result.js | 594 ++ .../arrow-param-nested-object-named.src.js | 1 + .../arrow-param-nested-object.config.js | 4 + .../arrow-param-nested-object.result.js | 522 ++ .../arrow-param-nested-object.src.js | 1 + .../arrow-param-object.config.js | 4 + .../arrow-param-object.result.js | 299 + .../arrow-param-object.src.js | 1 + .../param-defaults-array.config.js | 4 + .../param-defaults-array.result.js | 314 + .../param-defaults-array.src.js | 1 + .../param-defaults-object-nested.config.js | 4 + .../param-defaults-object-nested.result.js | 757 ++ .../param-defaults-object-nested.src.js | 1 + .../param-defaults-object.config.js | 4 + .../param-defaults-object.result.js | 353 + .../param-defaults-object.src.js | 1 + .../array-const-undefined.config.js | 4 + .../array-const-undefined.result.js | 258 + .../array-const-undefined.src.js | 1 + .../array-let-undefined.config.js | 4 + .../array-let-undefined.result.js | 258 + .../array-let-undefined.src.js | 1 + .../object-const-named.config.js | 4 + .../object-const-named.result.js | 333 + .../object-const-named.src.js | 1 + .../object-const-undefined.config.js | 4 + .../object-const-undefined.result.js | 297 + .../object-const-undefined.src.js | 1 + .../object-let-named.config.js | 4 + .../object-let-named.result.js | 333 + .../object-let-named.src.js | 1 + .../object-let-undefined.config.js | 4 + .../object-let-undefined.result.js | 297 + .../object-let-undefined.src.js | 1 + .../param-array.config.js | 4 + .../param-array.result.js | 440 ++ .../param-array.src.js | 1 + .../param-object-short.config.js | 5 + .../param-object-short.result.js | 649 ++ .../param-object-short.src.js | 1 + .../param-object-wrapped.config.js | 4 + .../param-object-wrapped.result.js | 140 + .../param-object-wrapped.src.xjs | 1 + .../param-object.config.js | 4 + .../param-object.result.js | 591 ++ .../param-object.src.js | 1 + .../invalid-rest.config.js | 4 + .../invalid-rest.result.js | 6 + .../invalid-rest.src.js | 1 + .../object-rest.config.js | 4 + .../object-rest.result.js | 982 +++ .../object-rest.src.js | 1 + .../destructuring-and-forOf/loop.config.js | 4 + .../destructuring-and-forOf/loop.result.js | 273 + .../destructuring-and-forOf/loop.src.js | 1 + .../complex-destructured.config.js | 4 + .../complex-destructured.result.js | 496 ++ .../complex-destructured.src.js | 1 + .../destructured-array-literal.config.js | 4 + .../destructured-array-literal.result.js | 418 ++ .../destructured-array-literal.src.js | 1 + .../destructuring-param.config.js | 4 + .../destructuring-param.result.js | 511 ++ .../destructuring-param.src.js | 1 + ...omplex-destructured-spread-first.config.js | 4 + ...omplex-destructured-spread-first.result.js | 6 + ...r-complex-destructured-spread-first.src.js | 1 + .../multi-destructured.config.js | 4 + .../multi-destructured.result.js | 309 + .../multi-destructured.src.js | 1 + .../not-final-array-empty.config.js | 4 + .../not-final-array-empty.result.js | 273 + .../not-final-array-empty.src.js | 1 + .../not-final-array.config.js | 4 + .../not-final-array.result.js | 6 + .../not-final-array.src.js | 1 + .../single-destructured.config.js | 4 + .../single-destructured.result.js | 255 + .../single-destructured.src.js | 1 + .../var-complex-destructured.config.js | 4 + .../var-complex-destructured.result.js | 516 ++ .../var-complex-destructured.src.js | 1 + .../var-destructured-array-literal.config.js | 4 + .../var-destructured-array-literal.result.js | 438 ++ .../var-destructured-array-literal.src.js | 1 + .../var-multi-destructured.config.js | 4 + .../var-multi-destructured.result.js | 329 + .../var-multi-destructured.src.js | 1 + .../var-single-destructured.config.js | 4 + .../var-single-destructured.result.js | 275 + .../var-single-destructured.src.js | 1 + .../for-of-with-const-and-no-braces.config.js | 4 + .../for-of-with-const-and-no-braces.result.js | 364 + .../for-of-with-const-and-no-braces.src.js | 2 + .../for-of-with-let-and-no-braces.config.js | 4 + .../for-of-with-let-and-no-braces.result.js | 364 + .../for-of-with-let-and-no-braces.src.js | 2 + .../export-const-number.config.js | 4 + .../export-const-number.result.js | 223 + .../export-const-number.src.js | 1 + .../export-const-object.config.js | 4 + .../export-const-object.result.js | 222 + .../export-const-object.src.js | 1 + .../export-let-number.config.js | 4 + .../export-let-number.result.js | 223 + .../export-let-number.src.js | 1 + .../export-let-object.config.js | 4 + .../export-let-object.result.js | 222 + .../export-let-object.src.js | 1 + .../export-let.config.js | 4 + .../export-let.result.js | 169 + .../export-let.src.js | 1 + .../class-default-anonymous-extends.config.js | 4 + .../class-default-anonymous-extends.result.js | 254 + .../class-default-anonymous-extends.src.js | 1 + .../class-default-anonymous.config.js | 4 + .../class-default-anonymous.result.js | 201 + .../class-default-anonymous.src.js | 1 + .../class-default-extends.config.js | 4 + .../class-default-extends.result.js | 289 + .../class-default-extends.src.js | 1 + .../class-default.config.js | 4 + .../class-default.result.js | 236 + .../modules-and-classes/class-default.src.js | 1 + .../class-extends.config.js | 4 + .../class-extends.result.js | 273 + .../modules-and-classes/class-extends.src.js | 1 + .../modules-and-classes/class.config.js | 4 + .../modules-and-classes/class.result.js | 220 + .../modules-and-classes/class.src.js | 1 + .../proto-computed-property.config.js | 4 + .../proto-computed-property.result.js | 1083 +++ .../proto-computed-property.src.js | 9 + .../default-params.config.js | 4 + .../default-params.result.js | 1305 ++++ .../default-params.src.js | 7 + .../array-destructuring.config.js | 4 + .../array-destructuring.result.js | 462 ++ .../array-destructuring.src.js | 1 + .../error-no-shorthand.config.js | 4 + .../error-no-shorthand.result.js | 6 + .../error-no-shorthand.src.js | 1 + .../generator-object-literal-method.config.js | 4 + .../generator-object-literal-method.result.js | 498 ++ .../generator-object-literal-method.src.js | 1 + .../computed-method-property.config.js | 4 + .../computed-method-property.result.js | 498 ++ .../computed-method-property.src.js | 5 + .../shorthand-properties.config.js | 4 + .../shorthand-properties.result.js | 715 ++ .../shorthand-properties.src.js | 9 + .../arrow-rest-multi.config.js | 4 + .../arrow-rest-multi.result.js | 312 + .../arrow-rest-multi.src.js | 1 + .../arrow-rest.config.js | 4 + .../arrow-rest.result.js | 258 + .../arrow-rest.src.js | 1 + .../destructured-arrow-array.config.js | 5 + .../destructured-arrow-array.result.js | 406 ++ .../destructured-arrow-array.src.js | 1 + .../destructured-arrow-multi.config.js | 5 + .../destructured-arrow-multi.result.js | 698 ++ .../destructured-arrow-multi.src.js | 1 + .../destructured-arrow-object.config.js | 5 + .../destructured-arrow-object.result.js | 551 ++ .../destructured-arrow-object.src.js | 1 + .../error-attempted-spread-param.config.js | 5 + .../error-attempted-spread-param.result.js | 6 + .../error-attempted-spread-param.src.js | 1 + .../invalid-arrow-rest-params.config.js | 5 + .../invalid-arrow-rest-params.result.js | 6 + .../invalid-arrow-rest-params.src.js | 1 + .../template-strings-in-jsx-complex.config.js | 4 + .../template-strings-in-jsx-complex.result.js | 2525 +++++++ .../template-strings-in-jsx-complex.src.js | 14 + .../template-strings-in-jsx-multi.config.js | 4 + .../template-strings-in-jsx-multi.result.js | 560 ++ .../template-strings-in-jsx-multi.src.js | 1 + .../template-strings-in-jsx.config.js | 4 + .../template-strings-in-jsx.result.js | 429 ++ .../template-strings-in-jsx.src.js | 1 + .../template-strings-unicode-escape.config.js | 4 + .../template-strings-unicode-escape.result.js | 209 + .../template-strings-unicode-escape.src.js | 1 + .../as-param-with-params.result.js | 368 + .../as-param-with-params.src.js | 1 + .../arrowFunctions/as-param.result.js | 277 + .../arrowFunctions/as-param.src.js | 1 + .../arrowFunctions/basic.result.js | 169 + .../ecma-features/arrowFunctions/basic.src.js | 1 + .../block-body-not-object.result.js | 313 + .../block-body-not-object.src.js | 1 + .../arrowFunctions/block-body.result.js | 260 + .../arrowFunctions/block-body.src.js | 1 + .../arrowFunctions/error-dup-params.result.js | 6 + .../arrowFunctions/error-dup-params.src.js | 1 + .../error-missing-paren.result.js | 6 + .../arrowFunctions/error-missing-paren.src.js | 1 + .../arrowFunctions/error-not-arrow.result.js | 6 + .../arrowFunctions/error-not-arrow.src.js | 1 + .../error-numeric-param-multi.result.js | 6 + .../error-numeric-param-multi.src.js | 1 + .../error-numeric-param.result.js | 6 + .../arrowFunctions/error-numeric-param.src.js | 1 + .../error-reverse-arrow.result.js | 6 + .../arrowFunctions/error-reverse-arrow.src.js | 1 + .../error-strict-default-param-eval.result.js | 6 + .../error-strict-default-param-eval.src.js | 1 + .../error-strict-dup-params.result.js | 6 + .../error-strict-dup-params.src.js | 1 + .../error-strict-eval-return.result.js | 6 + .../error-strict-eval-return.src.js | 1 + .../error-strict-eval.result.js | 6 + .../arrowFunctions/error-strict-eval.src.js | 1 + .../error-strict-octal.result.js | 6 + .../arrowFunctions/error-strict-octal.src.js | 1 + .../error-strict-param-arguments.result.js | 6 + .../error-strict-param-arguments.src.js | 1 + .../error-strict-param-eval.result.js | 6 + .../error-strict-param-eval.src.js | 1 + .../error-strict-param-names.result.js | 6 + .../error-strict-param-names.src.js | 1 + ...-strict-param-no-paren-arguments.result.js | 6 + ...ror-strict-param-no-paren-arguments.src.js | 1 + ...error-strict-param-no-paren-eval.result.js | 6 + .../error-strict-param-no-paren-eval.src.js | 1 + .../arrowFunctions/error-two-lines.result.js | 6 + .../arrowFunctions/error-two-lines.src.js | 2 + .../error-wrapped-param.result.js | 6 + .../arrowFunctions/error-wrapped-param.src.js | 1 + .../arrowFunctions/expression.result.js | 205 + .../arrowFunctions/expression.src.js | 1 + .../arrowFunctions/iife.result.js | 336 + .../ecma-features/arrowFunctions/iife.src.js | 1 + .../arrowFunctions/multiple-params.result.js | 260 + .../arrowFunctions/multiple-params.src.js | 1 + .../arrowFunctions/no-auto-return.result.js | 350 + .../arrowFunctions/no-auto-return.src.js | 1 + .../not-strict-arguments.result.js | 170 + .../not-strict-arguments.src.js | 1 + .../not-strict-eval-params.result.js | 260 + .../not-strict-eval-params.src.js | 1 + .../arrowFunctions/not-strict-eval.result.js | 170 + .../arrowFunctions/not-strict-eval.src.js | 1 + .../arrowFunctions/not-strict-octal.result.js | 206 + .../arrowFunctions/not-strict-octal.src.js | 1 + .../return-arrow-function.result.js | 246 + .../return-arrow-function.src.js | 1 + .../arrowFunctions/return-sequence.result.js | 570 ++ .../arrowFunctions/return-sequence.src.js | 1 + .../single-param-parens.result.js | 206 + .../arrowFunctions/single-param-parens.src.js | 1 + .../single-param-return-identifier.result.js | 205 + .../single-param-return-identifier.src.js | 1 + .../arrowFunctions/single-param.result.js | 170 + .../arrowFunctions/single-param.src.js | 1 + .../binaryLiterals/invalid.result.js | 6 + .../binaryLiterals/invalid.src.js | 1 + .../binaryLiterals/lowercase.result.js | 94 + .../binaryLiterals/lowercase.src.js | 1 + .../binaryLiterals/uppercase.result.js | 94 + .../binaryLiterals/uppercase.src.js | 1 + .../blockBindings/const.result.js | 185 + .../ecma-features/blockBindings/const.src.js | 1 + .../blockBindings/let-in-switchcase.result.js | 477 ++ .../blockBindings/let-in-switchcase.src.js | 1 + .../ecma-features/blockBindings/let.result.js | 185 + .../ecma-features/blockBindings/let.src.js | 1 + .../class-accessor-properties.result.js | 609 ++ .../classes/class-accessor-properties.src.js | 1 + .../class-computed-static-method.result.js | 423 ++ .../class-computed-static-method.src.js | 1 + .../classes/class-expression.result.js | 184 + .../classes/class-expression.src.js | 1 + .../class-method-named-prototype.result.js | 351 + .../class-method-named-prototype.src.js | 1 + .../class-method-named-static.result.js | 369 + .../classes/class-method-named-static.src.js | 1 + .../classes/class-one-method-super.result.js | 476 ++ .../classes/class-one-method-super.src.js | 5 + .../classes/class-one-method.result.js | 351 + .../classes/class-one-method.src.js | 3 + ...ss-static-method-named-prototype.result.js | 406 ++ ...class-static-method-named-prototype.src.js | 1 + ...class-static-method-named-static.result.js | 387 ++ .../class-static-method-named-static.src.js | 1 + .../classes/class-static-method.result.js | 387 ++ .../classes/class-static-method.src.js | 1 + ...-methods-and-accessor-properties.result.js | 812 +++ ...tic-methods-and-accessor-properties.src.js | 1 + ...lass-two-computed-static-methods.result.js | 644 ++ .../class-two-computed-static-methods.src.js | 1 + ...two-methods-computed-constructor.result.js | 556 ++ ...ss-two-methods-computed-constructor.src.js | 1 + .../classes/class-two-methods-semi.result.js | 536 ++ .../classes/class-two-methods-semi.src.js | 1 + .../class-two-methods-three-semi.result.js | 572 ++ .../class-two-methods-three-semi.src.js | 1 + .../class-two-methods-two-semi.result.js | 554 ++ .../classes/class-two-methods-two-semi.src.js | 1 + .../classes/class-two-methods.result.js | 518 ++ .../classes/class-two-methods.src.js | 1 + ...static-methods-named-constructor.result.js | 554 ++ ...wo-static-methods-named-constructor.src.js | 1 + .../classes/class-with-constructor.result.js | 351 + .../classes/class-with-constructor.src.js | 1 + .../derived-class-assign-to-var.result.js | 329 + .../derived-class-assign-to-var.src.js | 1 + .../derived-class-expression.result.js | 238 + .../classes/derived-class-expression.src.js | 1 + .../classes/empty-class-double-semi.result.js | 183 + .../classes/empty-class-double-semi.src.js | 1 + .../classes/empty-class-semi.result.js | 201 + .../classes/empty-class-semi.src.js | 1 + .../classes/empty-class.result.js | 183 + .../ecma-features/classes/empty-class.src.js | 1 + .../empty-literal-derived-class.result.js | 237 + .../empty-literal-derived-class.src.js | 1 + .../invalid-class-declaration.result.js | 6 + .../classes/invalid-class-declaration.src.js | 1 + ...invalid-class-setter-declaration.result.js | 6 + .../invalid-class-setter-declaration.src.js | 1 + .../classes/named-class-expression.result.js | 219 + .../classes/named-class-expression.src.js | 1 + .../named-derived-class-expression.result.js | 273 + .../named-derived-class-expression.src.js | 1 + .../defaultParams/declaration.result.js | 295 + .../defaultParams/declaration.src.js | 1 + .../defaultParams/expression.result.js | 349 + .../defaultParams/expression.src.js | 1 + .../defaultParams/method.result.js | 479 ++ .../ecma-features/defaultParams/method.src.js | 1 + .../defaultParams/not-all-params.result.js | 495 ++ .../defaultParams/not-all-params.src.js | 1 + .../destructuring/array-member.result.js | 293 + .../destructuring/array-member.src.js | 1 + .../destructuring/array-to-array.result.js | 383 + .../destructuring/array-to-array.src.js | 1 + .../array-var-undefined.result.js | 258 + .../destructuring/array-var-undefined.src.js | 1 + .../defaults-array-all.result.js | 564 ++ .../destructuring/defaults-array-all.src.js | 1 + ...ults-array-longform-nested-multi.result.js | 775 +++ ...efaults-array-longform-nested-multi.src.js | 1 + .../defaults-array-multi.result.js | 420 ++ .../destructuring/defaults-array-multi.src.js | 1 + .../defaults-array-nested-all.result.js | 493 ++ .../defaults-array-nested-all.src.js | 1 + .../defaults-array-nested-multi.result.js | 421 ++ .../defaults-array-nested-multi.src.js | 1 + .../destructuring/defaults-array.result.js | 274 + .../destructuring/defaults-array.src.js | 1 + .../defaults-object-all.result.js | 681 ++ .../destructuring/defaults-object-all.src.js | 1 + .../defaults-object-longform-all.result.js | 789 +++ .../defaults-object-longform-all.src.js | 1 + .../defaults-object-longform-multi.result.js | 645 ++ .../defaults-object-longform-multi.src.js | 1 + .../defaults-object-longform.result.js | 387 ++ .../defaults-object-longform.src.js | 1 + .../defaults-object-mixed-multi.result.js | 573 ++ .../defaults-object-mixed-multi.src.js | 1 + .../defaults-object-multi.result.js | 537 ++ .../defaults-object-multi.src.js | 1 + .../defaults-object-nested-all.result.js | 646 ++ .../defaults-object-nested-all.src.js | 1 + .../defaults-object-nested-multi.result.js | 574 ++ .../defaults-object-nested-multi.src.js | 1 + .../destructuring/defaults-object.result.js | 333 + .../destructuring/defaults-object.src.js | 1 + .../destructured-array-catch.result.js | 917 +++ .../destructured-array-catch.src.js | 7 + .../destructured-object-catch.result.js | 956 +++ .../destructured-object-catch.src.js | 7 + .../invalid-defaults-object-assign.result.js | 6 + .../invalid-defaults-object-assign.src.js | 1 + .../destructuring/named-param.result.js | 331 + .../destructuring/named-param.src.js | 1 + .../destructuring/nested-array.result.js | 663 ++ .../destructuring/nested-array.src.js | 1 + .../destructuring/nested-object.result.js | 965 +++ .../destructuring/nested-object.src.js | 1 + .../destructuring/object-var-named.result.js | 333 + .../destructuring/object-var-named.src.js | 1 + .../object-var-undefined.result.js | 297 + .../destructuring/object-var-undefined.src.js | 1 + .../param-deafults-object.result.js | 6 + .../param-defaults-array.result.js | 350 + .../destructuring/param-defaults-array.src.js | 1 + .../param-defaults-object-nested.result.js | 719 ++ .../param-defaults-object-nested.src.js | 1 + .../param-defaults-object.result.js | 389 ++ .../param-defaults-object.src.js | 1 + .../params-array-wrapped.result.js | 403 ++ .../destructuring/params-array-wrapped.src.js | 1 + .../destructuring/params-array.result.js | 367 + .../destructuring/params-array.src.js | 1 + .../params-multi-object.result.js | 406 ++ .../destructuring/params-multi-object.src.js | 1 + .../params-nested-array.result.js | 460 ++ .../destructuring/params-nested-array.src.js | 1 + .../params-nested-object.result.js | 647 ++ .../destructuring/params-nested-object.src.js | 1 + .../params-object-wrapped.result.js | 481 ++ .../params-object-wrapped.src.js | 1 + .../destructuring/params-object.result.js | 445 ++ .../destructuring/params-object.src.js | 1 + .../destructuring/sparse-array.result.js | 293 + .../destructuring/sparse-array.src.js | 1 + .../property-spread.result.js | 859 +++ .../property-spread.src.js | 9 + .../single-spread.result.js | 787 +++ .../single-spread.src.js | 9 + .../two-spread.result.js | 747 ++ .../two-spread.src.js | 9 + ...for-of-with-function-initializer.result.js | 710 ++ .../for-of-with-function-initializer.src.js | 1 + .../for-of-with-var-and-braces.result.js | 419 ++ .../forOf/for-of-with-var-and-braces.src.js | 3 + .../for-of-with-var-and-no-braces.result.js | 364 + .../for-of-with-var-and-no-braces.src.js | 2 + ...-for-of-with-const-and-no-braces.result.js | 6 + ...lid-for-of-with-const-and-no-braces.src.js | 2 + ...id-for-of-with-let-and-no-braces.result.js | 6 + ...valid-for-of-with-let-and-no-braces.src.js | 2 + .../generators/anonymous-generator.result.js | 330 + .../generators/anonymous-generator.src.js | 1 + .../generators/double-yield.result.js | 367 + .../generators/double-yield.src.js | 1 + .../empty-generator-declaration.result.js | 239 + .../empty-generator-declaration.src.js | 1 + .../generator-declaration.result.js | 347 + .../generators/generator-declaration.src.js | 1 + .../generators/yield-delegation.result.js | 348 + .../generators/yield-delegation.src.js | 1 + .../yield-without-value-in-call.result.js | 404 ++ .../yield-without-value-in-call.src.js | 1 + .../yield-without-value-no-semi.result.js | 295 + .../yield-without-value-no-semi.src.js | 1 + .../generators/yield-without-value.result.js | 313 + .../generators/yield-without-value.src.js | 1 + .../globalReturn/return-identifier.result.js | 111 + .../globalReturn/return-identifier.src.js | 1 + .../globalReturn/return-no-arg.result.js | 76 + .../globalReturn/return-no-arg.src.js | 1 + .../globalReturn/return-true.result.js | 112 + .../globalReturn/return-true.src.js | 1 + .../jsx/embedded-comment.result.js | 344 + .../ecma-features/jsx/embedded-comment.src.js | 1 + .../jsx/embedded-conditional.result.js | 655 ++ .../jsx/embedded-conditional.src.js | 1 + .../embedded-invalid-js-identifier.result.js | 439 ++ .../jsx/embedded-invalid-js-identifier.src.js | 1 + .../ecma-features/jsx/embedded-tags.result.js | 710 ++ .../ecma-features/jsx/embedded-tags.src.js | 1 + .../jsx/empty-placeholder.result.js | 344 + .../jsx/empty-placeholder.src.js | 1 + .../jsx/escape-patterns.result.js | 995 +++ .../ecma-features/jsx/escape-patterns.src.js | 1 + ...invalid-attribute-missing-equals.result.js | 6 + .../invalid-attribute-missing-equals.src.js | 1 + .../jsx/invalid-attribute.result.js | 6 + .../jsx/invalid-attribute.src.js | 1 + .../jsx/invalid-broken-tag.result.js | 6 + .../jsx/invalid-broken-tag.src.js | 1 + .../invalid-computed-end-tag-name.result.js | 6 + .../jsx/invalid-computed-end-tag-name.src.js | 1 + ...lid-computed-string-end-tag-name.result.js | 6 + ...nvalid-computed-string-end-tag-name.src.js | 1 + .../jsx/invalid-embedded-expression.result.js | 6 + .../jsx/invalid-embedded-expression.src.js | 1 + .../invalid-leading-dot-tag-name.result.js | 6 + .../jsx/invalid-leading-dot-tag-name.src.js | 1 + ...ching-placeholder-in-closing-tag.result.js | 6 + ...matching-placeholder-in-closing-tag.src.js | 1 + .../invalid-mismatched-closing-tag.result.js | 6 + .../jsx/invalid-mismatched-closing-tag.src.js | 1 + .../invalid-mismatched-closing-tags.result.js | 6 + .../invalid-mismatched-closing-tags.src.js | 1 + .../invalid-mismatched-dot-tag-name.result.js | 6 + .../invalid-mismatched-dot-tag-name.src.js | 1 + ...invalid-mismatched-namespace-tag.result.js | 6 + .../invalid-mismatched-namespace-tag.src.js | 1 + ...losing-tag-attribute-placeholder.result.js | 6 + ...g-closing-tag-attribute-placeholder.src.js | 1 + .../jsx/invalid-missing-closing-tag.result.js | 6 + .../jsx/invalid-missing-closing-tag.src.js | 1 + .../invalid-missing-namespace-name.result.js | 6 + .../jsx/invalid-missing-namespace-name.src.js | 1 + .../invalid-missing-namespace-value.result.js | 6 + .../invalid-missing-namespace-value.src.js | 1 + .../invalid-missing-spread-operator.result.js | 6 + .../invalid-missing-spread-operator.src.js | 1 + ...nvalid-namespace-name-with-docts.result.js | 6 + .../invalid-namespace-name-with-docts.src.js | 1 + ...nvalid-namespace-value-with-dots.result.js | 557 ++ .../invalid-namespace-value-with-dots.src.js | 1 + ...id-no-common-parent-with-comment.result.js | 6 + ...valid-no-common-parent-with-comment.src.js | 1 + .../jsx/invalid-no-common-parent.result.js | 6 + .../jsx/invalid-no-common-parent.src.js | 1 + .../jsx/invalid-no-tag-name.result.js | 6 + .../jsx/invalid-no-tag-name.src.js | 1 + ...valid-placeholder-in-closing-tag.result.js | 6 + .../invalid-placeholder-in-closing-tag.src.js | 1 + .../invalid-trailing-dot-tag-name.result.js | 6 + .../jsx/invalid-trailing-dot-tag-name.src.js | 1 + .../jsx/invalid-unexpected-comma.result.js | 6 + .../jsx/invalid-unexpected-comma.src.js | 1 + .../jsx/japanese-characters.result.js | 273 + .../jsx/japanese-characters.src.js | 1 + .../jsx/less-than-operator.result.js | 293 + .../jsx/less-than-operator.src.js | 1 + .../jsx/multiple-blank-spaces.result.js | 311 + .../jsx/multiple-blank-spaces.src.js | 1 + ...ced-attribute-and-value-inserted.result.js | 962 +++ ...spaced-attribute-and-value-inserted.src.js | 1 + .../namespaced-name-and-attribute.result.js | 382 + .../jsx/namespaced-name-and-attribute.src.js | 1 + .../jsx/newslines-and-entities.result.js | 6 + .../jsx/newslines-and-entities.src.js | 1 + .../self-closing-tag-with-newline.result.js | 6 + .../jsx/self-closing-tag-with-newline.src.js | 1 + .../jsx/self-closing-tag.result.js | 185 + .../ecma-features/jsx/self-closing-tag.src.js | 1 + ...-attribute-and-regular-attribute.result.js | 401 ++ ...tor-attribute-and-regular-attribute.src.js | 1 + .../jsx/spread-operator-attributes.result.js | 293 + .../jsx/spread-operator-attributes.src.js | 1 + .../jsx/tag-names-with-dots.result.js | 415 ++ .../jsx/tag-names-with-dots.src.js | 1 + .../jsx/tag-names-with-multi-dots.result.js | 557 ++ .../jsx/tag-names-with-multi-dots.src.js | 1 + .../ecma-features/jsx/test-content.result.js | 311 + .../ecma-features/jsx/test-content.src.js | 1 + ...ailing-spread-operator-attribute.result.js | 597 ++ .../trailing-spread-operator-attribute.src.js | 1 + .../jsx/unknown-escape-pattern.result.js | 294 + .../jsx/unknown-escape-pattern.src.js | 1 + .../modules/error-delete.result.js | 6 + .../ecma-features/modules/error-delete.src.js | 2 + .../modules/error-function.result.js | 6 + .../modules/error-function.src.js | 4 + .../modules/error-strict.result.js | 6 + .../ecma-features/modules/error-strict.src.js | 5 + .../modules/export-default-array.result.js | 147 + .../modules/export-default-array.src.js | 1 + .../export-default-expression.result.js | 239 + .../modules/export-default-expression.src.js | 1 + .../modules/export-default-function.result.js | 204 + .../modules/export-default-function.src.js | 1 + .../export-default-named-function.result.js | 239 + .../export-default-named-function.src.js | 1 + .../modules/export-default-number.result.js | 130 + .../modules/export-default-number.src.js | 1 + .../modules/export-default-object.result.js | 260 + .../modules/export-default-object.src.js | 1 + .../modules/export-default-value.result.js | 129 + .../modules/export-default-value.src.js | 1 + .../modules/export-from-batch.result.js | 148 + .../modules/export-from-batch.src.js | 1 + .../modules/export-from-default.result.js | 240 + .../modules/export-from-default.src.js | 1 + .../export-from-named-as-default.result.js | 276 + .../export-from-named-as-default.src.js | 1 + .../export-from-named-as-specifier.result.js | 276 + .../export-from-named-as-specifier.src.js | 1 + .../export-from-named-as-specifiers.result.js | 365 + .../export-from-named-as-specifiers.src.js | 1 + .../modules/export-from-specifier.result.js | 240 + .../modules/export-from-specifier.src.js | 1 + .../modules/export-from-specifiers.result.js | 329 + .../modules/export-from-specifiers.src.js | 1 + .../modules/export-function.result.js | 223 + .../modules/export-function.src.js | 1 + .../modules/export-named-as-default.result.js | 222 + .../modules/export-named-as-default.src.js | 1 + .../export-named-as-specifier.result.js | 222 + .../modules/export-named-as-specifier.src.js | 1 + .../export-named-as-specifiers.result.js | 311 + .../modules/export-named-as-specifiers.src.js | 1 + .../modules/export-named-empty.result.js | 114 + .../modules/export-named-empty.src.js | 1 + .../modules/export-named-specifier.result.js | 186 + .../modules/export-named-specifier.src.js | 1 + .../export-named-specifiers-comma.result.js | 293 + .../export-named-specifiers-comma.src.js | 1 + .../modules/export-named-specifiers.result.js | 275 + .../modules/export-named-specifiers.src.js | 1 + .../export-var-anonymous-function.result.js | 315 + .../export-var-anonymous-function.src.js | 1 + .../modules/export-var-number.result.js | 223 + .../modules/export-var-number.src.js | 1 + .../modules/export-var.result.js | 169 + .../ecma-features/modules/export-var.src.js | 1 + ...ort-default-and-named-specifiers.result.js | 310 + ...import-default-and-named-specifiers.src.js | 1 + ...default-and-namespace-specifiers.result.js | 292 + ...rt-default-and-namespace-specifiers.src.js | 1 + .../modules/import-default-as.result.js | 275 + .../modules/import-default-as.src.js | 1 + .../modules/import-default.result.js | 185 + .../modules/import-default.src.js | 1 + .../modules/import-jquery.result.js | 167 + .../modules/import-jquery.src.js | 1 + .../modules/import-module.result.js | 113 + .../modules/import-module.src.js | 1 + .../import-named-as-specifier.result.js | 275 + .../modules/import-named-as-specifier.src.js | 1 + .../import-named-as-specifiers.result.js | 364 + .../modules/import-named-as-specifiers.src.js | 1 + .../modules/import-named-empty.result.js | 167 + .../modules/import-named-empty.src.js | 1 + .../modules/import-named-specifier.result.js | 239 + .../modules/import-named-specifier.src.js | 1 + .../import-named-specifiers-comma.result.js | 346 + .../import-named-specifiers-comma.src.js | 1 + .../modules/import-named-specifiers.result.js | 328 + .../modules/import-named-specifiers.src.js | 1 + .../import-namespace-specifier.result.js | 221 + .../modules/import-namespace-specifier.src.js | 1 + .../modules/import-null-as-nil.result.js | 257 + .../modules/import-null-as-nil.src.js | 1 + .../modules/invalid-await.result.js | 6 + .../modules/invalid-await.src.js | 1 + .../modules/invalid-class.result.js | 6 + .../modules/invalid-class.src.js | 1 + ...export-batch-missing-from-clause.result.js | 6 + ...id-export-batch-missing-from-clause.src.js | 1 + .../invalid-export-batch-token.result.js | 6 + .../modules/invalid-export-batch-token.src.js | 1 + .../invalid-export-default-equal.result.js | 6 + .../invalid-export-default-equal.src.js | 1 + .../invalid-export-default-token.result.js | 6 + .../invalid-export-default-token.src.js | 1 + .../modules/invalid-export-default.result.js | 6 + .../modules/invalid-export-default.src.js | 1 + .../invalid-export-named-default.result.js | 6 + .../invalid-export-named-default.src.js | 1 + ...invalid-export-named-extra-comma.result.js | 6 + .../invalid-export-named-extra-comma.src.js | 1 + ...nvalid-export-named-middle-comma.result.js | 6 + .../invalid-export-named-middle-comma.src.js | 1 + ...efault-after-named-after-default.result.js | 6 + ...t-default-after-named-after-default.src.js | 1 + ...valid-import-default-after-named.result.js | 6 + .../invalid-import-default-after-named.src.js | 1 + ...default-missing-module-specifier.result.js | 6 + ...rt-default-missing-module-specifier.src.js | 1 + ...-import-default-module-specifier.result.js | 6 + ...lid-import-default-module-specifier.src.js | 1 + .../modules/invalid-import-default.result.js | 6 + .../modules/invalid-import-default.src.js | 1 + ...-import-missing-module-specifier.result.js | 6 + ...lid-import-missing-module-specifier.src.js | 1 + .../invalid-import-module-specifier.result.js | 6 + .../invalid-import-module-specifier.src.js | 1 + ...invalid-import-named-after-named.result.js | 6 + .../invalid-import-named-after-named.src.js | 1 + ...lid-import-named-after-namespace.result.js | 6 + ...nvalid-import-named-after-namespace.src.js | 1 + ...lid-import-named-as-missing-from.result.js | 6 + ...nvalid-import-named-as-missing-from.src.js | 1 + ...invalid-import-named-extra-comma.result.js | 6 + .../invalid-import-named-extra-comma.src.js | 1 + ...nvalid-import-named-middle-comma.result.js | 6 + .../invalid-import-named-middle-comma.src.js | 1 + ...lid-import-namespace-after-named.result.js | 6 + ...nvalid-import-namespace-after-named.src.js | 1 + ...alid-import-namespace-missing-as.result.js | 6 + ...invalid-import-namespace-missing-as.src.js | 1 + .../newTarget/invalid-new-target.result.js | 6 + .../newTarget/invalid-new-target.src.js | 1 + .../invalid-unknown-property.result.js | 6 + .../newTarget/invalid-unknown-property.src.js | 1 + .../newTarget/simple-new-target.result.js | 421 ++ .../newTarget/simple-new-target.src.js | 3 + .../computed-addition-property.result.js | 425 ++ .../computed-addition-property.src.js | 3 + .../computed-and-identifier.result.js | 426 ++ .../computed-and-identifier.src.js | 1 + .../computed-getter-and-setter.result.js | 647 ++ .../computed-getter-and-setter.src.js | 1 + .../computed-string-property.result.js | 352 + .../computed-string-property.src.js | 3 + .../computed-variable-property.result.js | 351 + .../computed-variable-property.src.js | 3 + ...valid-computed-variable-property.result.js | 6 + .../invalid-computed-variable-property.src.js | 3 + ...alone-computed-variable-property.result.js | 6 + ...andalone-computed-variable-property.src.js | 1 + ...ndalone-expression-with-addition.result.js | 370 + ...standalone-expression-with-addition.src.js | 1 + ...tandalone-expression-with-method.result.js | 388 ++ .../standalone-expression-with-method.src.js | 1 + .../standalone-expression.result.js | 296 + .../standalone-expression.src.js | 1 + .../proto-property.result.js | 6 + .../proto-property.src.js | 8 + .../proto-string-property.result.js | 6 + .../proto-string-property.src.js | 8 + .../strict-duplicate-properties.result.js | 518 ++ .../strict-duplicate-properties.src.js | 6 + ...rict-duplicate-string-properties.result.js | 520 ++ .../strict-duplicate-string-properties.src.js | 6 + .../invalid-method-no-braces.result.js | 6 + .../invalid-method-no-braces.src.js | 3 + .../method-property.result.js | 462 ++ .../method-property.src.js | 5 + .../simple-method-named-get.result.js | 387 ++ .../simple-method-named-get.src.js | 4 + .../simple-method-named-set.result.js | 387 ++ .../simple-method-named-set.src.js | 4 + .../simple-method-with-argument.result.js | 424 ++ .../simple-method-with-argument.src.js | 5 + .../simple-method-with-string-name.result.js | 388 ++ .../simple-method-with-string-name.src.js | 4 + .../simple-method.result.js | 387 ++ .../simple-method.src.js | 4 + .../string-name-method-property.result.js | 463 ++ .../string-name-method-property.src.js | 5 + .../shorthand-properties.result.js | 719 ++ .../shorthand-properties.src.js | 9 + .../octalLiterals/invalid.result.js | 6 + .../octalLiterals/invalid.src.js | 1 + .../octalLiterals/lowercase.result.js | 94 + .../octalLiterals/lowercase.src.js | 1 + .../octalLiterals/strict-uppercase.result.js | 166 + .../octalLiterals/strict-uppercase.src.js | 2 + .../octalLiterals/uppercase.result.js | 94 + .../octalLiterals/uppercase.src.js | 1 + .../regex-u-extended-escape.result.js | 194 + .../regexUFlag/regex-u-extended-escape.src.js | 1 + .../regex-u-invalid-extended-escape.result.js | 6 + .../regex-u-invalid-extended-escape.src.js | 1 + .../regexUFlag/regex-u-simple.result.js | 194 + .../regexUFlag/regex-u-simple.src.js | 1 + .../regexYFlag/regexp-y-simple.result.js | 194 + .../regexYFlag/regexp-y-simple.src.js | 1 + .../restParams/basic-rest.result.js | 347 + .../restParams/basic-rest.src.js | 1 + .../restParams/error-no-default.result.js | 6 + .../restParams/error-no-default.src.js | 1 + .../restParams/error-not-last.result.js | 6 + .../restParams/error-not-last.src.js | 1 + .../func-expression-multi.result.js | 404 ++ .../restParams/func-expression-multi.src.js | 1 + .../restParams/func-expression.result.js | 350 + .../restParams/func-expression.src.js | 1 + .../restParams/invalid-rest-param.result.js | 6 + .../restParams/invalid-rest-param.src.js | 1 + .../restParams/single-rest.result.js | 293 + .../restParams/single-rest.src.js | 1 + .../spread/error-invalid-if.result.js | 6 + .../spread/error-invalid-if.src.js | 1 + .../spread/error-invalid-sequence.result.js | 6 + .../spread/error-invalid-sequence.src.js | 1 + .../spread/multi-function-call.result.js | 273 + .../spread/multi-function-call.src.js | 1 + .../spread/not-final-param.result.js | 273 + .../spread/not-final-param.src.js | 1 + .../spread/simple-function-call.result.js | 219 + .../spread/simple-function-call.src.js | 1 + .../templateStrings/deeply-nested.result.js | 462 ++ .../templateStrings/deeply-nested.src.js | 1 + .../escape-characters.result.js | 209 + .../templateStrings/escape-characters.src.js | 1 + .../templateStrings/expressions.result.js | 671 ++ .../templateStrings/expressions.src.js | 4 + .../multi-line-template-string.result.js | 117 + .../multi-line-template-string.src.js | 6 + .../templateStrings/octal-literal.result.js | 6 + .../templateStrings/octal-literal.src.js | 1 + .../simple-template-string.result.js | 117 + .../simple-template-string.src.js | 1 + .../single-dollar-sign.result.js | 209 + .../templateStrings/single-dollar-sign.src.js | 1 + .../tagged-no-placeholders.result.js | 170 + .../tagged-no-placeholders.src.js | 1 + .../tagged-template-string.result.js | 722 ++ .../tagged-template-string.src.js | 4 + .../basic-string-literal.result.js | 94 + .../basic-string-literal.src.js | 1 + .../complex-string-literal.result.js | 94 + .../complex-string-literal.src.js | 1 + .../invalid-empty-escape.result.js | 6 + .../invalid-empty-escape.src.js | 1 + .../invalid-too-large-escape.result.js | 6 + .../invalid-too-large-escape.src.js | 1 + .../tests/fixtures/parse/all-pieces.json | 186 + .../fixtures/tokenize/const-result.tokens.js | 93 + .../fixtures/tokenize/let-result.tokens.js | 93 + .../tokenize/regex-in-parens-result.tokens.js | 169 + .../tokenize/regexp-u-result.tokens.js | 97 + .../regexp-u-unicode-escape-result.tokens.js | 37 + .../tokenize/regexp-y-result.tokens.js | 97 + .../template-string-embedded-result.tokens.js | 129 + ...template-string-embedded2-result.tokens.js | 255 + ...mplate-string-expressions-result.tokens.js | 201 + .../template-string-simple-result.tokens.js | 93 + .../tests/lib/.eslintrc | 2 + .../tests/lib/attach-comments.js | 93 + .../tests/lib/ecma-features.js | 190 + .../tests/lib/parse.js | 80 + .../tests/lib/tokenize.js | 162 + 937 files changed, 163645 insertions(+) create mode 100644 packages/typescript-eslint-parser/.eslintrc create mode 100644 packages/typescript-eslint-parser/.gitignore create mode 100644 packages/typescript-eslint-parser/.travis.yml create mode 100644 packages/typescript-eslint-parser/CHANGELOG.md create mode 100644 packages/typescript-eslint-parser/CONTRIBUTING.md create mode 100644 packages/typescript-eslint-parser/LICENSE create mode 100644 packages/typescript-eslint-parser/Makefile.js create mode 100644 packages/typescript-eslint-parser/README.md create mode 100644 packages/typescript-eslint-parser/lib/ast-converter.js create mode 100644 packages/typescript-eslint-parser/lib/ast-node-types.js create mode 100644 packages/typescript-eslint-parser/lib/comment-attachment.js create mode 100644 packages/typescript-eslint-parser/lib/features.js create mode 100644 packages/typescript-eslint-parser/lib/token-translator.js create mode 100644 packages/typescript-eslint-parser/package.json create mode 100644 packages/typescript-eslint-parser/parser.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Block.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js create mode 100644 packages/typescript-eslint-parser/tests/lib/.eslintrc create mode 100644 packages/typescript-eslint-parser/tests/lib/attach-comments.js create mode 100644 packages/typescript-eslint-parser/tests/lib/ecma-features.js create mode 100644 packages/typescript-eslint-parser/tests/lib/parse.js create mode 100644 packages/typescript-eslint-parser/tests/lib/tokenize.js diff --git a/packages/typescript-eslint-parser/.eslintrc b/packages/typescript-eslint-parser/.eslintrc new file mode 100644 index 000000000000..57a7ad7f5455 --- /dev/null +++ b/packages/typescript-eslint-parser/.eslintrc @@ -0,0 +1,4 @@ +env: + node: true + +extends: eslint diff --git a/packages/typescript-eslint-parser/.gitignore b/packages/typescript-eslint-parser/.gitignore new file mode 100644 index 000000000000..4b4cc07f1961 --- /dev/null +++ b/packages/typescript-eslint-parser/.gitignore @@ -0,0 +1,6 @@ +build +coverage +node_modules +npm-debug.log +_test.js + diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml new file mode 100644 index 000000000000..c943be513d44 --- /dev/null +++ b/packages/typescript-eslint-parser/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +sudo: false +node_js: + - "0.10" + - "0.12" + - 4 +after_success: + - npm run coveralls diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/typescript-eslint-parser/CONTRIBUTING.md b/packages/typescript-eslint-parser/CONTRIBUTING.md new file mode 100644 index 000000000000..15897e0cefa5 --- /dev/null +++ b/packages/typescript-eslint-parser/CONTRIBUTING.md @@ -0,0 +1,8 @@ +# Contributing Code + +Please sign our [Contributor License Agreement](http://eslint.org/cla) + +# Full Documentation + +Our full contribution guidelines can be found at: +http://eslint.org/docs/developer-guide/contributing diff --git a/packages/typescript-eslint-parser/LICENSE b/packages/typescript-eslint-parser/LICENSE new file mode 100644 index 000000000000..3e580c355a96 --- /dev/null +++ b/packages/typescript-eslint-parser/LICENSE @@ -0,0 +1,19 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js new file mode 100644 index 000000000000..713a4378c8be --- /dev/null +++ b/packages/typescript-eslint-parser/Makefile.js @@ -0,0 +1,286 @@ +/** + * @fileoverview Build file + * @author nzakas + */ +/*global cat, cp, echo, exec, exit, find, mkdir, mv, rm, target, test*/ + +"use strict"; + +/* eslint no-console: 0*/ +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +require("shelljs/make"); + +var checker = require("npm-license"), + dateformat = require("dateformat"), + nodeCLI = require("shelljs-nodecli"), + semver = require("semver"); + +//------------------------------------------------------------------------------ +// Settings +//------------------------------------------------------------------------------ + +var OPEN_SOURCE_LICENSES = [ + /MIT/, /BSD/, /Apache/, /ISC/, /WTF/, /Public Domain/ +]; + +//------------------------------------------------------------------------------ +// Data +//------------------------------------------------------------------------------ + +var NODE_MODULES = "./node_modules/", + TEMP_DIR = "./tmp/", + BUILD_DIR = "./build/", + + // Utilities - intentional extra space at the end of each string + MOCHA = NODE_MODULES + "mocha/bin/_mocha ", + + // Files + MAKEFILE = "./Makefile.js", + /*eslint-disable no-use-before-define */ + JS_FILES = find("lib/").filter(fileType("js")).join(" ") + " espree.js", + TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "); + /*eslint-enable no-use-before-define */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Generates a function that matches files with a particular extension. + * @param {string} extension The file extension (i.e. "js") + * @returns {Function} The function to pass into a filter method. + * @private + */ +function fileType(extension) { + return function(filename) { + return filename.substring(filename.lastIndexOf(".") + 1) === extension; + }; +} + +/** + * Executes a command and returns the output instead of printing it to stdout. + * @param {string} cmd The command string to execute. + * @returns {string} The result of the executed command. + */ +function execSilent(cmd) { + return exec(cmd, { silent: true }).output; +} + +/** + * Creates a release version tag and pushes to origin. + * @param {string} type The type of release to do (patch, minor, major) + * @returns {void} + */ +function release(type) { + var newVersion; + + target.test(); + newVersion = execSilent("npm version " + type).trim(); + target.changelog(); + + // add changelog to commit + exec("git add CHANGELOG.md"); + exec("git commit --amend --no-edit"); + + // replace existing tag + exec("git tag -f " + newVersion); + + // push all the things + exec("git push origin master --tags"); + exec("npm publish"); +} + + +/** + * Splits a command result to separate lines. + * @param {string} result The command result string. + * @returns {array} The separated lines. + */ +function splitCommandResultToLines(result) { + return result.trim().split("\n"); +} + +function getVersionTags() { + var tags = splitCommandResultToLines(exec("git tag", { silent: true }).output); + + return tags.reduce(function(list, tag) { + if (semver.valid(tag)) { + list.push(tag); + } + return list; + }, []).sort(semver.compare); +} + +//------------------------------------------------------------------------------ +// Tasks +//------------------------------------------------------------------------------ + +target.all = function() { + target.test(); +}; + +target.lint = function() { + var errors = 0, + lastReturn; + + echo("Validating Makefile.js"); + lastReturn = nodeCLI.exec("eslint", MAKEFILE); + if (lastReturn.code !== 0) { + errors++; + } + + echo("Validating JavaScript files"); + lastReturn = nodeCLI.exec("eslint", JS_FILES); + if (lastReturn.code !== 0) { + errors++; + } + + echo("Validating JavaScript test files"); + lastReturn = nodeCLI.exec("eslint", TEST_FILES); + if (lastReturn.code !== 0) { + errors++; + } + + if (errors) { + exit(1); + } +}; + +target.test = function() { + // target.lint(); + + var errors = 0, + lastReturn; + + lastReturn = nodeCLI.exec("istanbul", "cover", MOCHA, "-- -c", TEST_FILES); + + if (lastReturn.code !== 0) { + errors++; + } + + if (errors) { + exit(1); + } + + // target.checkLicenses(); +}; + +target.docs = function() { + echo("Generating documentation"); + nodeCLI.exec("jsdoc", "-d jsdoc lib"); + echo("Documentation has been output to /jsdoc"); +}; + +target.browserify = function() { + + // 1. create temp and build directory + if (!test("-d", TEMP_DIR)) { + mkdir(TEMP_DIR); + mkdir(TEMP_DIR + "/lib"); + } + + if (!test("-d", BUILD_DIR)) { + mkdir(BUILD_DIR); + } + + // 2. copy files into temp directory + cp("-r", "lib/*", TEMP_DIR + "/lib"); + cp("espree.js", TEMP_DIR); + cp("package.json", TEMP_DIR); + + + // 3. browserify the temp directory + nodeCLI.exec("browserify", TEMP_DIR + "espree.js", "-o", BUILD_DIR + "espree.js", "-s espree"); + + // 4. remove temp directory + rm("-r", TEMP_DIR); +}; + +target.changelog = function() { + + // get most recent two tags + var tags = getVersionTags(), + rangeTags = tags.slice(tags.length - 2), + now = new Date(), + timestamp = dateformat(now, "mmmm d, yyyy"); + + // output header + (rangeTags[1] + " - " + timestamp + "\n").to("CHANGELOG.tmp"); + + // get log statements + var logs = exec("git log --pretty=format:\"* %s (%an)\" " + rangeTags.join(".."), {silent: true}).output.split(/\n/g); + logs = logs.filter(function(line) { + return line.indexOf("Merge pull request") === -1 && line.indexOf("Merge branch") === -1; + }); + logs.push(""); // to create empty lines + logs.unshift(""); + + // output log statements + logs.join("\n").toEnd("CHANGELOG.tmp"); + + // switch-o change-o + cat("CHANGELOG.tmp", "CHANGELOG.md").to("CHANGELOG.md.tmp"); + rm("CHANGELOG.tmp"); + rm("CHANGELOG.md"); + mv("CHANGELOG.md.tmp", "CHANGELOG.md"); +}; + +target.checkLicenses = function() { + + function isPermissible(dependency) { + var licenses = dependency.licenses; + + if (Array.isArray(licenses)) { + return licenses.some(function(license) { + return isPermissible({ + name: dependency.name, + licenses: license + }); + }); + } + + return OPEN_SOURCE_LICENSES.some(function(license) { + return license.test(licenses); + }); + } + + echo("Validating licenses"); + + checker.init({ + start: __dirname + }, function(deps) { + var impermissible = Object.keys(deps).map(function(dependency) { + return { + name: dependency, + licenses: deps[dependency].licenses + }; + }).filter(function(dependency) { + return !isPermissible(dependency); + }); + + if (impermissible.length) { + impermissible.forEach(function (dependency) { + console.error("%s license for %s is impermissible.", + dependency.licenses, + dependency.name + ); + }); + exit(1); + } + }); +}; + +target.patch = function() { + release("patch"); +}; + +target.minor = function() { + release("minor"); +}; + +target.major = function() { + release("major"); +}; diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md new file mode 100644 index 000000000000..5fefde1d3054 --- /dev/null +++ b/packages/typescript-eslint-parser/README.md @@ -0,0 +1,41 @@ +# TypeScript ESLint Parser (Experimental) + +An parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint. + +**Important:** This parser is still in the very early stages and is considered experimental. There are likely a lot of bugs. You should not rely on this in a production environment yet. + +## Usage + +Install: + +``` +npm i typescript-eslint-parser --save +``` + +And in your ESLint configuration file: + +``` +"parser": "typescript-eslint-parser" +``` + +## Help Wanted! + +If you're familiar with TypeScript and ESLint, and you'd like to see this project progress, please consider contributing. We need people with a good knowledge of TypeScript to ensure this parser is useful. + +## Contributing + +Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/typescript-eslint-parser/issues). + +TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. + +## Build Commands + +* `npm test` - run all linting and tests +* `npm run lint` - run all linting + +## Development Plan + +* **Phase 1:** Full ES6 support, stripping out all TypeScript-specific syntax. +* **Phase 2:** Add JSX support. +* **Phase 3:** Add support for top-level TypeScript syntax. +* **Phase 4:** Add support for types. diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js new file mode 100644 index 000000000000..efa8e78fcc2b --- /dev/null +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -0,0 +1,1026 @@ +/** + * @fileoverview Converts TypeScript AST into ESTree format. + * @author Nicholas C. Zakas + * @copyright 2015 Fred K. Schott. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var ts = require("typescript"), + assign = require("object-assign"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +var SyntaxKind = ts.SyntaxKind, + TokenClass = ts.TokenClass; + +var ASSIGNMENT_OPERATORS = [ + SyntaxKind.EqualsToken, + SyntaxKind.PlusEqualsToken, + SyntaxKind.MinusEqualsToken, + SyntaxKind.AsteriskEqualsToken, + SyntaxKind.SlashEqualsToken, + SyntaxKind.PercentEqualsToken, + SyntaxKind.LessThanLessThanEqualsToken, + SyntaxKind.GreaterThanGreaterThanEqualsToken, + SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, + SyntaxKind.AmpersandEqualsToken, + SyntaxKind.BarEqualsToken, + SyntaxKind.CaretEqualsToken +]; + +var LOGICAL_OPERATORS = [ + SyntaxKind.BarBarToken, + SyntaxKind.AmpersandAmpersandToken +]; + +var TOKEN_TO_TEXT = {}; +TOKEN_TO_TEXT[SyntaxKind.OpenBraceToken] = "{"; +TOKEN_TO_TEXT[SyntaxKind.CloseBraceToken] = "}"; +TOKEN_TO_TEXT[SyntaxKind.OpenParenToken] = "("; +TOKEN_TO_TEXT[SyntaxKind.CloseParenToken] = ")"; +TOKEN_TO_TEXT[SyntaxKind.OpenBracketToken] = "["; +TOKEN_TO_TEXT[SyntaxKind.CloseBracketToken] = "]"; +TOKEN_TO_TEXT[SyntaxKind.DotToken] = "."; +TOKEN_TO_TEXT[SyntaxKind.DotDotDotToken] = "..."; +TOKEN_TO_TEXT[SyntaxKind.SemicolonToken] = ";"; +TOKEN_TO_TEXT[SyntaxKind.CommaToken] = ","; +TOKEN_TO_TEXT[SyntaxKind.LessThanToken] = "<"; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanToken] = ">"; +TOKEN_TO_TEXT[SyntaxKind.LessThanEqualsToken] = "<="; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanEqualsToken] = ">="; +TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsToken] = "=="; +TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsToken] = "!="; +TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsEqualsToken] = "==="; +TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsEqualsToken] = "!=="; +TOKEN_TO_TEXT[SyntaxKind.EqualsGreaterThanToken] = "=>"; +TOKEN_TO_TEXT[SyntaxKind.PlusToken] = "+"; +TOKEN_TO_TEXT[SyntaxKind.MinusToken] = "-"; +TOKEN_TO_TEXT[SyntaxKind.AsteriskToken] = "*"; +TOKEN_TO_TEXT[SyntaxKind.SlashToken] = "/"; +TOKEN_TO_TEXT[SyntaxKind.PercentToken] = "%"; +TOKEN_TO_TEXT[SyntaxKind.PlusPlusToken] = "++"; +TOKEN_TO_TEXT[SyntaxKind.MinusMinusToken] = "--"; +TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanToken] = "<<"; +TOKEN_TO_TEXT[SyntaxKind.LessThanSlashToken] = ">"; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanToken] = ">>>"; +TOKEN_TO_TEXT[SyntaxKind.AmpersandToken] = "&"; +TOKEN_TO_TEXT[SyntaxKind.BarToken] = "|"; +TOKEN_TO_TEXT[SyntaxKind.CaretToken] = "^"; +TOKEN_TO_TEXT[SyntaxKind.ExclamationToken] = "!"; +TOKEN_TO_TEXT[SyntaxKind.TildeToken] = "~"; +TOKEN_TO_TEXT[SyntaxKind.AmpersandAmpersandToken] = "&&"; +TOKEN_TO_TEXT[SyntaxKind.BarBarToken] = "||"; +TOKEN_TO_TEXT[SyntaxKind.QuestionToken] = "?"; +TOKEN_TO_TEXT[SyntaxKind.ColonToken] = ":"; +TOKEN_TO_TEXT[SyntaxKind.EqualsToken] = "="; +TOKEN_TO_TEXT[SyntaxKind.PlusEqualsToken] = "+="; +TOKEN_TO_TEXT[SyntaxKind.MinusEqualsToken] = "-="; +TOKEN_TO_TEXT[SyntaxKind.AsteriskEqualsToken] = "*="; +TOKEN_TO_TEXT[SyntaxKind.SlashEqualsToken] = "/="; +TOKEN_TO_TEXT[SyntaxKind.PercentEqualsToken] = "%="; +TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanEqualsToken] = "<<="; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanEqualsToken] = ">>="; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken] = ">>>="; +TOKEN_TO_TEXT[SyntaxKind.AmpersandEqualsToken] = "&="; +TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|="; +TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^="; +TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; + +function isESTreeClassMember(node) { + return node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.SemicolonClassElement; +} + +function isComma(token) { + return token.kind === SyntaxKind.CommaToken; +} + +function isAssignmentOperator(operator) { + return ASSIGNMENT_OPERATORS.indexOf(operator) > -1; +} + +function isLogicalOperator(operator) { + return LOGICAL_OPERATORS.indexOf(operator) > -1; +} + +function getBinaryExpressionType(operator) { + if (isAssignmentOperator(operator)) { + return "AssignmentExpression"; + } else if (isLogicalOperator(operator)) { + return "LogicalExpression"; + } else { + return "BinaryExpression"; + } +} + +function getLocFor(start, end, ast) { + var startLoc = ast.getLineAndCharacterOfPosition(start), + endLoc = ast.getLineAndCharacterOfPosition(end); + + return { + start: { + line: startLoc.line + 1, + column: startLoc.character + }, + end: { + line: endLoc.line + 1, + column: endLoc.character + } + }; +} + +function getLoc(nodeOrToken, ast) { + return getLocFor(nodeOrToken.getStart(), nodeOrToken.end, ast); + // var start = nodeOrToken.getStart(), + // startLoc = ast.getLineAndCharacterOfPosition(start), + // endLoc = ast.getLineAndCharacterOfPosition(nodeOrToken.end); + + // return { + // start: { + // line: startLoc.line + 1, + // column: startLoc.character + // }, + // end: { + // line: endLoc.line + 1, + // column: endLoc.character + // } + // }; +} + + + +function convertError(error) { + + var loc = error.file.getLineAndCharacterOfPosition(error.start); + + return { + index: error.start, + lineNumber: loc.line + 1, + column: loc.character, + message: error.message + }; +} + +function getTokenType(token) { + + // Need two checks for keywords since some are also identifiers + if (token.originalKeywordKind) { + return "Keyword"; + } + + if (token.kind >= 68 && token.kind <= 112) { + return "Keyword"; + } + + switch (token.kind) { + case SyntaxKind.NumericLiteral: + return "Numeric"; + + case SyntaxKind.StringLiteral: + return "String"; + + case SyntaxKind.RegularExpressionLiteral: + return "RegularExpression"; + + case SyntaxKind.Identifier: + case SyntaxKind.ConstructorKeyword: + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + return "Identifier" + } + + + if (token.kind >= 15 && token.kind <= 66) { + return "Punctuator"; + } + + + + if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && token.kind <= SyntaxKind.TemplateTail) { + return "Template"; + } + + + return "Unknown"; +} + +function convertToken(token, ast) { + + var start = token.getStart(), + value = ast.text.slice(start, token.end), + newToken = { + type: getTokenType(token), + value: value, + range: [start, token.end], + loc: getLoc(token, ast) + }; + + if (newToken.type === "RegularExpression") { + newToken.regex = { + pattern: value.slice(1, value.lastIndexOf("/")), + flags: value.slice(value.lastIndexOf("/") + 1) + }; + } + + return newToken; +} + +function convertTokens(ast) { + var token = ast.getFirstToken(), + converted, + result = []; + + while (token) { + converted = convertToken(token, ast); + if (converted) { + result.push(converted); + } + + token = ts.findNextToken(token, ast); + } + + return result; +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = function(ast) { + + if (ast.parseDiagnostics.length) { + throw convertError(ast.parseDiagnostics[0]); + } + + function convert(node, parent) { + + // exit early for null and undefined + if (!node) { + return null; + } + + var result = { + type: "", + range: [node.getStart(), node.end], + loc: getLoc(node, ast) + }; + + function simplyCopy() { + assign(result, { + type: SyntaxKind[node.kind] + }); + } + + function convertChild(child) { + return convert(child, node); + } + + switch (node.kind) { + case SyntaxKind.SourceFile: + assign(result, { + type: "Program", + body: node.statements.map(convertChild), + sourceType: node.externalModuleIndicator ? "module": "script" + }); + break; + + case SyntaxKind.Block: + assign(result, { + type: "BlockStatement", + body: node.statements.map(convertChild) + }); + break; + + case SyntaxKind.Identifier: + assign(result, { + type: "Identifier", + name: node.text + }); + break; + + case SyntaxKind.WithStatement: + assign(result, { + type: "WithStatement", + object: convertChild(node.expression), + body: convertChild(node.statement) + }); + break; + + // Control Flow + + case SyntaxKind.ReturnStatement: + assign(result, { + type: "ReturnStatement", + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.LabeledStatement: + assign(result, { + type: "LabeledStatement", + label: convertChild(node.label), + body: convertChild(node.statement) + }); + break; + + case SyntaxKind.BreakStatement: + case SyntaxKind.ContinueStatement: + assign(result, { + type: SyntaxKind[node.kind], + label: convertChild(node.label) + }); + break; + + // Choice + + case SyntaxKind.IfStatement: + assign(result, { + type: "IfStatement", + test: convertChild(node.expression), + consequent: convertChild(node.thenStatement), + alternate: convertChild(node.elseStatement) + }); + break; + + case SyntaxKind.SwitchStatement: + assign(result, { + type: "SwitchStatement", + discriminant: convertChild(node.expression), + cases: node.caseBlock.clauses.map(convertChild) + }); + break; + + case SyntaxKind.CaseClause: + case SyntaxKind.DefaultClause: + assign(result, { + type: "SwitchCase", + test: convertChild(node.expression), + consequent: node.statements.map(convertChild) + }); + break; + + // Exceptions + + case SyntaxKind.ThrowStatement: + assign(result, { + type: "ThrowStatement", + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.TryStatement: + assign(result, { + type: "TryStatement", + handler: convertChild(node.catchClause), + finalizer: convertChild(node.finallyBlock) + }); + break; + + case SyntaxKind.CatchClause: + assign(result, { + type: "CatchClause", + param: convertChild(node.variableDeclaration.name), + body: convertChild(node.block) + }); + break; + + + // Loops + + case SyntaxKind.WhileStatement: + assign(result, { + type: "WhileStatement", + test: convertChild(node.expression), + body: convertChild(node.statement) + }); + break; + + case SyntaxKind.DoWhileStatement: + assign(result, { + type: "DoWhileStatement", + test: convertChild(node.expression), + body: convertChild(node.statement) + }); + break; + + case SyntaxKind.ForStatement: + assign(result, { + type: "ForStatement", + init: convertChild(node.initializer), + test: convertChild(node.condition), + update: convertChild(node.incrementor), + body: convertChild(node.statement) + }); + break; + + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: + assign(result, { + type: SyntaxKind[node.kind], + left: convertChild(node.initializer), + right: convertChild(node.expression), + body: convertChild(node.statement) + }); + break; + + // Declarations + + case SyntaxKind.FunctionDeclaration: + assign(result, { + type: "FunctionDeclaration", + id: convertChild(node.name), + generator: !!node.asteriskToken, + expression: false, + params: node.parameters.map(convertChild), + body: convertChild(node.body) + }); + break; + + case SyntaxKind.VariableDeclaration: + assign(result, { + type: "VariableDeclarator", + id: convertChild(node.name), + init: convertChild(node.initializer) + }); + break; + + case SyntaxKind.VariableStatement: + assign(result, { + type: "VariableDeclaration", + declarations: node.declarationList.declarations.map(convertChild), + kind: (node.declarationList.flags ? (node.declarationList.flags === ts.NodeFlags.Let ? "let" : "const") : "var") + }); + break; + + // Expressions + + case SyntaxKind.ExpressionStatement: + assign(result, { + type: "ExpressionStatement", + expression: convertChild(node.expression) + }); + break; + + case SyntaxKind.ThisKeyword: + assign(result, { + type: "ThisExpression" + }); + break; + + case SyntaxKind.ArrayLiteralExpression: + + // TypeScript uses ArrayLiteralExpression in destructuring assignment, too + if (parent.kind === SyntaxKind.BinaryExpression && node === parent.left) { + assign(result, { + type: "ArrayPattern", + elements: node.elements.map(convertChild) + }); + } else { + assign(result, { + type: "ArrayExpression", + elements: node.elements.map(convertChild) + }); + } + break; + + case SyntaxKind.ObjectLiteralExpression: + assign(result, { + type: "ObjectExpression", + properties: node.properties.map(convertChild) + }); + break; + + case SyntaxKind.PropertyAssignment: + assign(result, { + type: "Property", + key: convertChild(node.name), + value: convertChild(node.initializer), + computed: false, + method: false, + shorthand: false, + kind: "init" + }); + break; + + case SyntaxKind.ShorthandPropertyAssignment: + assign(result, { + type: "Property", + key: convertChild(node.name), + value: convertChild(node.name), + computed: false, + method: false, + shorthand: true, + kind: "init" + }); + break; + + case SyntaxKind.ComputedPropertyName: + + if (parent.kind === SyntaxKind.ObjectLiteralExpression) { + assign(result, { + type: "Property", + key: convertChild(node.name), + value: convertChild(node.name), + computed: false, + method: false, + shorthand: true, + kind: "init" + }); + } else { + return convertChild(node.expression); + } + break; + + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: + + // TODO: double-check that these positions are correct + var methodLoc = ast.getLineAndCharacterOfPosition(node.name.end + 1), + method = { + type: "FunctionExpression", + id: null, + params: node.parameters.map(convertChild), + generator: false, + expression: false, + body: convertChild(node.body), + range: [ node.name.end, result.range[1]], + loc: { + start: { + line: methodLoc.line + 1, + column: methodLoc.character + }, + end: result.loc.end + } + }; + + if (parent.kind === SyntaxKind.ObjectLiteralExpression) { + assign(result, { + type: "Property", + key: convertChild(node.name), + value: method, + computed: false, + method: false, + shorthand: false, + kind: "init" + }); + + } else { // class + var methodNameIsComputed = (node.name.kind === SyntaxKind.ComputedPropertyName); + assign(result, { + type: "MethodDefinition", + key: convertChild(node.name), + value: method, + computed: methodNameIsComputed, + static: Boolean(node.flags & ts.NodeFlags.Static), + kind: "method" + }); + } + + if (node.kind === SyntaxKind.GetAccessor) { + result.kind = "get"; + } else if (node.kind === SyntaxKind.SetAccessor) { + result.kind = "set"; + } else if (!result.static && node.name.kind === SyntaxKind.StringLiteral && node.name.text === "constructor") { + result.kind = "constructor"; + } + break; + + // TypeScript uses this even for static methods named "constructor" + case SyntaxKind.Constructor: + + var constructorIsStatic = Boolean(node.flags & ts.NodeFlags.Static), + firstConstructorToken = constructorIsStatic ? ts.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), + constructorOffset = 11, + constructorStartOffset = constructorOffset + firstConstructorToken.getStart() - node.getFirstToken().getStart(), + constructorLoc = ast.getLineAndCharacterOfPosition(result.range[0] + constructorStartOffset), + constructor = { + type: "FunctionExpression", + id: null, + params: node.parameters.map(convertChild), + generator: false, + expression: false, + body: convertChild(node.body), + range: [ result.range[0] + constructorStartOffset, result.range[1]], + loc: { + start: { + line: constructorLoc.line + 1, + column: constructorLoc.character + }, + end: result.loc.end + } + }; + + var constructorIdentifierLoc = ast.getLineAndCharacterOfPosition(firstConstructorToken.getStart()), + constructorIsComputed = !!node.name && (node.name.kind === SyntaxKind.ComputedPropertyName), + constructorKey; + + if (constructorIsComputed) { + constructorKey = { + type: "Literal", + value: "constructor", + raw: node.name.getText(), + range: [ firstConstructorToken.getStart(), firstConstructorToken.end ], + loc: { + start: { + line: constructorIdentifierLoc.line + 1, + column: constructorIdentifierLoc.character + }, + end: { + line: constructor.loc.start.line, + column: constructor.loc.start.column + } + } + }; + } else { + constructorKey = { + type: "Identifier", + name: "constructor", + range: [ firstConstructorToken.getStart(), firstConstructorToken.end ], + loc: { + start: { + line: constructorIdentifierLoc.line + 1, + column: constructorIdentifierLoc.character + }, + end: { + line: constructor.loc.start.line, + column: constructor.loc.start.column + } + } + }; + } + + assign(result, { + type: "MethodDefinition", + key: constructorKey, + value: constructor, + computed: constructorIsComputed, + static: constructorIsStatic, + kind: (constructorIsStatic || constructorIsComputed) ? "method" : "constructor" + }); + break; + + case SyntaxKind.FunctionExpression: + assign(result, { + type: "FunctionExpression", + id: convertChild(node.name), + generator: !!node.asteriskToken, + params: node.parameters.map(convertChild), + body: convertChild(node.body), + expression: false + }); + break; + + case SyntaxKind.SuperKeyword: + assign(result, { + type: "Super" + }); + break; + + case SyntaxKind.SpreadElementExpression: + assign(result, { + type: "SpreadElement", + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.ArrayBindingPattern: + assign(result, { + type: "ArrayPattern", + elements: node.elements.map(convertChild) + }); + break; + + case SyntaxKind.ArrowFunction: + assign(result, { + type: "ArrowFunctionExpression", + generator: false, + id: null, + params: node.parameters.map(convertChild), + body: convertChild(node.body), + expression: node.body.kind !== SyntaxKind.Block + }); + break; + + case SyntaxKind.YieldExpression: + assign(result, { + type: "YieldExpression", + delegate: !!node.asteriskToken, + argument: convertChild(node.expression) + }); + break; + + // Template Literals + + case SyntaxKind.NoSubstitutionTemplateLiteral: + assign(result, { + type: "TemplateLiteral", + quasis: [ + { + type: "TemplateElement", + value: { + raw: ast.text.slice(node.getStart() + 1, node.end - 1), + cooked: node.text + }, + tail: true, + range: result.range, + loc: result.loc + } + ], + expressions: [] + }); + break; + + case SyntaxKind.TemplateExpression: + assign(result, { + type: "TemplateLiteral", + quasis: [ convertChild(node.head) ], + expressions: [] + }); + + node.templateSpans.forEach(function(templateSpan) { + result.expressions.push(convertChild(templateSpan.expression)); + result.quasis.push(convertChild(templateSpan.literal)); + }); + break; + + case SyntaxKind.TaggedTemplateExpression: + assign(result, { + type: "TaggedTemplateExpression", + tag: convertChild(node.tag), + quasi: convertChild(node.template) + }); + break; + + case SyntaxKind.TemplateHead: + case SyntaxKind.TemplateMiddle: + case SyntaxKind.TemplateTail: + var tail = (node.kind === SyntaxKind.TemplateTail); + assign(result, { + type: "TemplateElement", + value: { + raw: ast.text.slice(node.getStart() + 1, node.end - (tail ? 1 : 2)), + cooked: node.text + }, + tail: tail + }); + break; + + // Patterns + + // Note: TypeScript uses this for both spread and rest expressions + case SyntaxKind.SpreadElementExpression: + assign(result, { + type: "SpreadElement", + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.Parameter: + + if (node.dotDotDotToken) { + assign(result, { + type: "RestElement", + argument: convertChild(node.name) + }); + } else if (node.initializer) { + assign(result, { + type: "AssignmentPattern", + left: convertChild(node.name), + right: convertChild(node.initializer) + }); + } else { + return convert(node.name, parent); + } + + break; + + // Classes + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + var lastClassToken = node.heritageClauses ? node.heritageClauses[node.heritageClauses.length - 1] : node.name; + if (!lastClassToken) { // no name + lastClassToken = node.getFirstToken(); + } + + var openBrace = ts.findNextToken(lastClassToken, ast); + + assign(result, { + type: SyntaxKind[node.kind], + id: convertChild(node.name), + body: { + type: "ClassBody", + body: [], + + // TODO: Fix location info + range: [ openBrace.getStart(), result.range[1] ], + loc: getLocFor(openBrace.getStart(), node.end, ast) + }, + superClass: (node.heritageClauses ? convertChild(node.heritageClauses[0].types[0].expression) : null), + }); + + var filteredMembers = node.members.filter(isESTreeClassMember); + if (filteredMembers.length) { + result.body.body = filteredMembers.map(convertChild); + } + + break; + + // Unary Operations + + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: + assign(result, { + // ESTree uses UpdateExpression for ++/-- + type: /^(?:\+\+|\-\-)$/.test(TOKEN_TO_TEXT[node.operator.kind]) ? "UpdateExpression" : "UnaryExpression", + operator: SyntaxKind[node.operator], + prefix: node.kind === SyntaxKind.PrefixUnaryExpression, + argument: convertChild(node.operand) + }); + break; + + // Binary Operations + + case SyntaxKind.BinaryExpression: + + // TypeScript uses BinaryExpression for sequences as well + if (isComma(node.operatorToken)) { + assign(result, { + type: "SequenceExpression", + expressions: [] + }); + + var left = convertChild(node.left), + right = convertChild(node.right); + + if (left.type === "SequenceExpression") { + result.expressions = result.expressions.concat(left.expressions); + } else { + result.expressions.push(left); + } + + if (right.type === "SequenceExpression") { + result.expressions = result.expressions.concat(right.expressions); + } else { + result.expressions.push(right); + } + + } else { + assign(result, { + type: getBinaryExpressionType(node.operatorToken), + operator: TOKEN_TO_TEXT[node.operatorToken.kind], + left: convertChild(node.left), + right: convertChild(node.right) + }); + } + break; + + case SyntaxKind.PropertyAccessExpression: + assign(result, { + type: "MemberExpression", + object: convertChild(node.expression), + property: convertChild(node.name), + computed: false + }); + break; + + case SyntaxKind.ElementAccessExpression: + assign(result, { + type: "MemberExpression", + object: convertChild(node.expression), + property: convertChild(node.argumentExpression), + computed: true + }); + break; + + case SyntaxKind.ConditionalExpression: + assign(result, { + type: "ConditionalExpression", + test: convertChild(node.condition), + consequent: convertChild(node.whenTrue), + alternate: convertChild(node.whenFalse) + }); + break; + + case SyntaxKind.CallExpression: + assign(result, { + type: "CallExpression", + callee: convertChild(node.expression), + arguments: node.arguments.map(convertChild) + }); + break; + + case SyntaxKind.NewExpression: + assign(result, { + type: "NewExpression", + callee: convertChild(node.expression), + arguments: node.arguments.map(convertChild) + }); + break; + + + + // Literals + + case SyntaxKind.StringLiteral: + assign(result, { + type: "Literal", + value: node.text, + raw: ast.text.slice(result.range[0], result.range[1]) + }); + break; + + case SyntaxKind.NumericLiteral: + assign(result, { + type: "Literal", + value: Number(node.text), + raw: ast.text.slice(result.range[0], result.range[1]) + }); + break; + + case SyntaxKind.RegularExpressionLiteral: + assign(result, { + type: "Literal", + value: Number(node.text), + raw: node.text, + regex: { + pattern: node.text.slice(1, node.text.lastIndexOf("/")), + flags: node.text.slice(node.text.lastIndexOf("/") + 1) + } + }); + break; + + case SyntaxKind.TrueKeyword: + assign(result, { + type: "Literal", + value: "true" + }); + break; + + case SyntaxKind.FalseKeyword: + assign(result, { + type: "Literal", + value: "false" + }); + break; + + case SyntaxKind.NullKeyword: + assign(result, { + type: "Literal", + value: "null" + }); + break; + + case SyntaxKind.EmptyStatement: + case SyntaxKind.DebuggerStatement: + simplyCopy(); + break; + + // TypeScript specific + + case SyntaxKind.ParenthesizedExpression: + return convert(node.expression, parent); + + default: + console.log(node.kind); + result = null; + } + + return result; + } + + + + var estree = convert(ast); + estree.tokens = convertTokens(ast); + return estree; + +}; diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js new file mode 100644 index 000000000000..ec9eaa1fbe37 --- /dev/null +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -0,0 +1,119 @@ +/** + * @fileoverview The AST node types produced by the parser. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + AssignmentExpression: "AssignmentExpression", + AssignmentPattern: "AssignmentPattern", + ArrayExpression: "ArrayExpression", + ArrayPattern: "ArrayPattern", + ArrowFunctionExpression: "ArrowFunctionExpression", + BlockStatement: "BlockStatement", + BinaryExpression: "BinaryExpression", + BreakStatement: "BreakStatement", + CallExpression: "CallExpression", + CatchClause: "CatchClause", + ClassBody: "ClassBody", + ClassDeclaration: "ClassDeclaration", + ClassExpression: "ClassExpression", + ConditionalExpression: "ConditionalExpression", + ContinueStatement: "ContinueStatement", + DoWhileStatement: "DoWhileStatement", + DebuggerStatement: "DebuggerStatement", + EmptyStatement: "EmptyStatement", + ExperimentalRestProperty: "ExperimentalRestProperty", + ExperimentalSpreadProperty: "ExperimentalSpreadProperty", + ExpressionStatement: "ExpressionStatement", + ForStatement: "ForStatement", + ForInStatement: "ForInStatement", + ForOfStatement: "ForOfStatement", + FunctionDeclaration: "FunctionDeclaration", + FunctionExpression: "FunctionExpression", + Identifier: "Identifier", + IfStatement: "IfStatement", + Literal: "Literal", + LabeledStatement: "LabeledStatement", + LogicalExpression: "LogicalExpression", + MemberExpression: "MemberExpression", + MetaProperty: "MetaProperty", + MethodDefinition: "MethodDefinition", + NewExpression: "NewExpression", + ObjectExpression: "ObjectExpression", + ObjectPattern: "ObjectPattern", + Program: "Program", + Property: "Property", + RestElement: "RestElement", + ReturnStatement: "ReturnStatement", + SequenceExpression: "SequenceExpression", + SpreadElement: "SpreadElement", + Super: "Super", + SwitchCase: "SwitchCase", + SwitchStatement: "SwitchStatement", + TaggedTemplateExpression: "TaggedTemplateExpression", + TemplateElement: "TemplateElement", + TemplateLiteral: "TemplateLiteral", + ThisExpression: "ThisExpression", + ThrowStatement: "ThrowStatement", + TryStatement: "TryStatement", + UnaryExpression: "UnaryExpression", + UpdateExpression: "UpdateExpression", + VariableDeclaration: "VariableDeclaration", + VariableDeclarator: "VariableDeclarator", + WhileStatement: "WhileStatement", + WithStatement: "WithStatement", + YieldExpression: "YieldExpression", + JSXIdentifier: "JSXIdentifier", + JSXNamespacedName: "JSXNamespacedName", + JSXMemberExpression: "JSXMemberExpression", + JSXEmptyExpression: "JSXEmptyExpression", + JSXExpressionContainer: "JSXExpressionContainer", + JSXElement: "JSXElement", + JSXClosingElement: "JSXClosingElement", + JSXOpeningElement: "JSXOpeningElement", + JSXAttribute: "JSXAttribute", + JSXSpreadAttribute: "JSXSpreadAttribute", + JSXText: "JSXText", + ExportDefaultDeclaration: "ExportDefaultDeclaration", + ExportNamedDeclaration: "ExportNamedDeclaration", + ExportAllDeclaration: "ExportAllDeclaration", + ExportSpecifier: "ExportSpecifier", + ImportDeclaration: "ImportDeclaration", + ImportSpecifier: "ImportSpecifier", + ImportDefaultSpecifier: "ImportDefaultSpecifier", + ImportNamespaceSpecifier: "ImportNamespaceSpecifier" +}; diff --git a/packages/typescript-eslint-parser/lib/comment-attachment.js b/packages/typescript-eslint-parser/lib/comment-attachment.js new file mode 100644 index 000000000000..b0f033dceac1 --- /dev/null +++ b/packages/typescript-eslint-parser/lib/comment-attachment.js @@ -0,0 +1,183 @@ +/** + * @fileoverview Attaches comments to the AST. + * @author Nicholas C. Zakas + * @copyright 2015 Nicholas C. Zakas. All rights reserved. + * @copyright 2011-2013 Ariya Hidayat + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var astNodeTypes = require("./ast-node-types"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +var extra = { + trailingComments: [], + leadingComments: [], + bottomRightStack: [] +}; + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + + reset: function() { + extra.trailingComments = []; + extra.leadingComments = []; + extra.bottomRightStack = []; + }, + + addComment: function(comment) { + extra.trailingComments.push(comment); + extra.leadingComments.push(comment); + }, + + processComment: function(node) { + var lastChild, + trailingComments, + i; + + if (node.type === astNodeTypes.Program) { + if (node.body.length > 0) { + return; + } + } + + if (extra.trailingComments.length > 0) { + + /* + * If the first comment in trailingComments comes after the + * current node, then we're good - all comments in the array will + * come after the node and so it's safe to add then as official + * trailingComments. + */ + if (extra.trailingComments[0].range[0] >= node.range[1]) { + trailingComments = extra.trailingComments; + extra.trailingComments = []; + } else { + + /* + * Otherwise, if the first comment doesn't come after the + * current node, that means we have a mix of leading and trailing + * comments in the array and that leadingComments contains the + * same items as trailingComments. Reset trailingComments to + * zero items and we'll handle this by evaluating leadingComments + * later. + */ + extra.trailingComments.length = 0; + } + } else { + if (extra.bottomRightStack.length > 0 && + extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments && + extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments[0].range[0] >= node.range[1]) { + trailingComments = extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments; + delete extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments; + } + } + + // Eating the stack. + while (extra.bottomRightStack.length > 0 && extra.bottomRightStack[extra.bottomRightStack.length - 1].range[0] >= node.range[0]) { + lastChild = extra.bottomRightStack.pop(); + } + + if (lastChild) { + if (lastChild.leadingComments) { + if (lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) { + node.leadingComments = lastChild.leadingComments; + delete lastChild.leadingComments; + } else { + // A leading comment for an anonymous class had been stolen by its first MethodDefinition, + // so this takes back the leading comment. + // See Also: https://github.com/eslint/espree/issues/158 + for (i = lastChild.leadingComments.length - 2; i >= 0; --i) { + if (lastChild.leadingComments[i].range[1] <= node.range[0]) { + node.leadingComments = lastChild.leadingComments.splice(0, i + 1); + break; + } + } + } + } + } else if (extra.leadingComments.length > 0) { + + if (extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) { + node.leadingComments = extra.leadingComments; + extra.leadingComments = []; + } else { + + // https://github.com/eslint/espree/issues/2 + + /* + * In special cases, such as return (without a value) and + * debugger, all comments will end up as leadingComments and + * will otherwise be eliminated. This extra step runs when the + * bottomRightStack is empty and there are comments left + * in leadingComments. + * + * This loop figures out the stopping point between the actual + * leading and trailing comments by finding the location of the + * first comment that comes after the given node. + */ + for (i = 0; i < extra.leadingComments.length; i++) { + if (extra.leadingComments[i].range[1] > node.range[0]) { + break; + } + } + + /* + * Split the array based on the location of the first comment + * that comes after the node. Keep in mind that this could + * result in an empty array, and if so, the array must be + * deleted. + */ + node.leadingComments = extra.leadingComments.slice(0, i); + if (node.leadingComments.length === 0) { + delete node.leadingComments; + } + + /* + * Similarly, trailing comments are attached later. The variable + * must be reset to null if there are no trailing comments. + */ + trailingComments = extra.leadingComments.slice(i); + if (trailingComments.length === 0) { + trailingComments = null; + } + } + } + + if (trailingComments) { + node.trailingComments = trailingComments; + } + + extra.bottomRightStack.push(node); + } + +}; diff --git a/packages/typescript-eslint-parser/lib/features.js b/packages/typescript-eslint-parser/lib/features.js new file mode 100644 index 000000000000..850d675b5398 --- /dev/null +++ b/packages/typescript-eslint-parser/lib/features.js @@ -0,0 +1,114 @@ +/** + * @fileoverview The list of feature flags supported by the parser and their default + * settings. + * @author Nicholas C. Zakas + * @copyright 2015 Fred K. Schott. All rights reserved. + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = { + + // enable parsing of arrow functions + arrowFunctions: false, + + // enable parsing of let and const + blockBindings: false, + + // enable parsing of destructured arrays and objects + destructuring: false, + + // enable parsing of regex u flag + regexUFlag: false, + + // enable parsing of regex y flag + regexYFlag: false, + + // enable parsing of template strings + templateStrings: false, + + // enable parsing binary literals + binaryLiterals: false, + + // enable parsing ES6 octal literals + octalLiterals: false, + + // enable parsing unicode code point escape sequences + unicodeCodePointEscapes: true, + + // enable parsing of default parameters + defaultParams: false, + + // enable parsing of rest parameters + restParams: false, + + // enable parsing of for-of statements + forOf: false, + + // enable parsing computed object literal properties + objectLiteralComputedProperties: false, + + // enable parsing of shorthand object literal methods + objectLiteralShorthandMethods: false, + + // enable parsing of shorthand object literal properties + objectLiteralShorthandProperties: false, + + // Allow duplicate object literal properties (except '__proto__') + objectLiteralDuplicateProperties: false, + + // enable parsing of generators/yield + generators: false, + + // support the spread operator + spread: false, + + // enable parsing of classes + classes: false, + + // enable parsing of new.target + newTarget: false, + + // enable parsing of modules + modules: false, + + // React JSX parsing + jsx: false, + + // allow return statement in global scope + globalReturn: false, + + // allow experimental object rest/spread + experimentalObjectRestSpread: false +}; diff --git a/packages/typescript-eslint-parser/lib/token-translator.js b/packages/typescript-eslint-parser/lib/token-translator.js new file mode 100644 index 000000000000..ae7aed153c88 --- /dev/null +++ b/packages/typescript-eslint-parser/lib/token-translator.js @@ -0,0 +1,271 @@ +/** + * @fileoverview Translates tokens between Acorn format and Esprima format. + * @author Nicholas C. Zakas + * @copyright 2015 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* eslint no-underscore-dangle: 0 */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// none! + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + + +// Esprima Token Types +var Token = { + Boolean: "Boolean", + EOF: "", + Identifier: "Identifier", + Keyword: "Keyword", + Null: "Null", + Numeric: "Numeric", + Punctuator: "Punctuator", + String: "String", + RegularExpression: "RegularExpression", + Template: "Template", + JSXIdentifier: "JSXIdentifier", + JSXText: "JSXText" +}; + +/** + * Converts part of a template into an Esprima token. + * @param {AcornToken[]} tokens The Acorn tokens representing the template. + * @param {string} code The source code. + * @returns {EsprimaToken} The Esprima equivalent of the template token. + * @private + */ +function convertTemplatePart(tokens, code) { + var firstToken = tokens[0], + lastTemplateToken = tokens[tokens.length - 1]; + + var token = { + type: Token.Template, + value: code.slice(firstToken.start, lastTemplateToken.end) + }; + + if (firstToken.loc) { + token.loc = { + start: firstToken.loc.start, + end: lastTemplateToken.loc.end + }; + } + + if (firstToken.range) { + token.range = [firstToken.range[0], lastTemplateToken.range[1]]; + } + + return token; +} + +/** + * Contains logic to translate Acorn tokens into Esprima tokens. + * @param {Object} acornTokTypes The Acorn token types. + * @param {string} code The source code Acorn is parsing. This is necessary + * to correct the "value" property of some tokens. + * @constructor + */ +function TokenTranslator(acornTokTypes, code) { + + // token types + this._acornTokTypes = acornTokTypes; + + // token buffer for templates + this._tokens = []; + + // track the last curly brace + this._curlyBrace = null; + + // the source code + this._code = code; + +} + +TokenTranslator.prototype = { + constructor: TokenTranslator, + + /** + * Translates a single Esprima token to a single Acorn token. This may be + * inaccurate due to how templates are handled differently in Esprima and + * Acorn, but should be accurate for all other tokens. + * @param {AcornToken} token The Acorn token to translate. + * @param {Object} extra Espree extra object. + * @returns {EsprimaToken} The Esprima version of the token. + */ + translate: function(token, extra) { + + var type = token.type, + tt = this._acornTokTypes, + result = { + type: "", + value: token.value, + range: token.range, + loc: token.loc + }; + + if (type === tt.name) { + result.type = Token.Identifier; + + // TODO: See if this is an Acorn bug + if (result.value === "static") { + result.type = Token.Keyword; + } + + } else if (type === tt.semi || type === tt.comma || + type === tt.parenL || type === tt.parenR || + type === tt.braceL || type === tt.braceR || + type === tt.dot || type === tt.bracketL || + type === tt.colon || type === tt.question || + type === tt.bracketR || type === tt.ellipsis || + type === tt.arrow || type === tt.jsxTagStart || + type === tt.jsxTagEnd || (type.binop && !type.keyword) || + type.isAssign) { + + result.type = Token.Punctuator; + result.value = this._code.slice(token.start, token.end); + } else if (type === tt.jsxName) { + result.type = Token.JSXIdentifier; + } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { + result.type = Token.JSXText; + } else if (type.keyword) { + if (type.keyword === "true" || type.keyword === "false") { + result.type = Token.Boolean; + } else if (type.keyword === "null") { + result.type = Token.Null; + } else { + result.type = Token.Keyword; + } + } else if (type === tt.num) { + result.type = Token.Numeric; + result.value = this._code.slice(token.start, token.end); + } else if (type === tt.string) { + + if (extra.jsxAttrValueToken) { + extra.jsxAttrValueToken = false; + result.type = Token.JSXText; + } else { + result.type = Token.String; + } + + result.value = this._code.slice(token.start, token.end); + } else if (type === tt.regexp) { + result.type = Token.RegularExpression; + var value = token.value; + result.regex = { + flags: value.flags, + pattern: value.pattern + }; + result.value = "/" + value.pattern + "/" + value.flags; + } + + return result; + }, + + /** + * Function to call during Acorn's onToken handler. + * @param {AcornToken} token The Acorn token. + * @param {Object} extra The Espree extra object. + * @returns {void} + */ + onToken: function(token, extra) { + + var that = this, + tt = this._acornTokTypes, + tokens = extra.tokens, + templateTokens = this._tokens; + + /** + * Flushes the buffered template tokens and resets the template + * tracking. + * @returns {void} + * @private + */ + function translateTemplateTokens() { + tokens.push(convertTemplatePart(that._tokens, that._code)); + that._tokens = []; + } + + if (token.type === tt.eof) { + + // might be one last curlyBrace + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + } + + return; + } + + if (token.type === tt.backQuote) { + templateTokens.push(token); + + // it's the end + if (templateTokens.length > 1) { + translateTemplateTokens(); + } + + return; + } else if (token.type === tt.dollarBraceL) { + templateTokens.push(token); + translateTemplateTokens(); + return; + } else if (token.type === tt.braceR) { + + // if there's already a curly, it's not part of the template + if (this._curlyBrace) { + + tokens.push(this.translate(this._curlyBrace, extra)); + } + + // store new curly for later + this._curlyBrace = token; + return; + } else if (token.type === tt.template) { + if (this._curlyBrace) { + templateTokens.push(this._curlyBrace); + this._curlyBrace = null; + } + + templateTokens.push(token); + return; + } + + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + this._curlyBrace = null; + } + + tokens.push(this.translate(token, extra)); + } +}; + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +module.exports = TokenTranslator; diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json new file mode 100644 index 000000000000..6d951ca97278 --- /dev/null +++ b/packages/typescript-eslint-parser/package.json @@ -0,0 +1,61 @@ +{ + "name": "typescript-eslint-parser", + "description": "An Esprima-style parser for TypeScript", + "author": "Nicholas C. Zakas ", + "homepage": "https://github.com/eslint/espree", + "main": "parser.js", + "version": "0.0.0", + "files": [ + "lib", + "parser.js" + ], + "engines": { + "node": ">=0.10.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/eslint/typescript-eslint-parser.git" + }, + "bugs": { + "url": "https://github.com/eslint/typescript-eslint-parser/issues" + }, + "licenses": [ + { + "type": "BSD", + "url": "http://github.com/nzakas/espree/raw/master/LICENSE" + } + ], + "devDependencies": { + "chai": "^1.10.0", + "dateformat": "^1.0.11", + "eslint": "^1.8.0", + "eslint-config-eslint": "^1.0.1", + "istanbul": "~0.2.6", + "leche": "^1.0.1", + "mocha": "^2.0.1", + "npm-license": "^0.2.3", + "semver": "^4.1.1", + "shelljs": "^0.3.0", + "shelljs-nodecli": "^0.1.1" + }, + "keywords": [ + "ast", + "ecmascript", + "javascript", + "typescript", + "parser", + "syntax", + "eslint" + ], + "scripts": { + "test": "node Makefile.js test", + "lint": "node Makefile.js lint", + "patch": "node Makefile.js patch", + "minor": "node Makefile.js minor", + "major": "node Makefile.js major" + }, + "dependencies": { + "object-assign": "^4.0.1", + "typescript": "^1.6.2" + } +} diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js new file mode 100644 index 000000000000..da7045905026 --- /dev/null +++ b/packages/typescript-eslint-parser/parser.js @@ -0,0 +1,266 @@ +/** + * @fileoverview Parser that converts TypeScript into ESTree format. + * Copyright 2015 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*eslint no-undefined:0, no-use-before-define: 0*/ + +"use strict"; + +var astNodeTypes = require("./lib/ast-node-types"), + commentAttachment = require("./lib/comment-attachment"), + TokenTranslator = require("./lib/token-translator"), + acornJSX = require("acorn-jsx/inject"), + ts = require("typescript"); + +var lookahead, + extra, + lastToken; + +function resetExtra() { + extra = { + tokens: null, + range: false, + loc: false, + comment: false, + comments: [], + tolerant: false, + errors: [], + strict: false, + ecmaFeatures: {} + }; +} + + + +//------------------------------------------------------------------------------ +// Parser +//------------------------------------------------------------------------------ + + +function parse(code, options) { + + var program, + toString = String, + translator, + acornOptions = { + ecmaVersion: 5 + }; + + if (typeof code !== "string" && !(code instanceof String)) { + code = toString(code); + } + + resetExtra(); + commentAttachment.reset(); + + if (typeof options !== "undefined") { + extra.range = (typeof options.range === "boolean") && options.range; + extra.loc = (typeof options.loc === "boolean") && options.loc; + extra.attachComment = (typeof options.attachComment === "boolean") && options.attachComment; + + if (extra.loc && options.source !== null && options.source !== undefined) { + extra.source = toString(options.source); + } + + if (typeof options.tokens === "boolean" && options.tokens) { + extra.tokens = []; + // translator = new TokenTranslator(tt, code); + } + if (typeof options.comment === "boolean" && options.comment) { + extra.comment = true; + extra.comments = []; + } + if (typeof options.tolerant === "boolean" && options.tolerant) { + extra.errors = []; + } + if (extra.attachComment) { + extra.range = true; + extra.comments = []; + commentAttachment.reset(); + } + + if (options.sourceType === "module") { + extra.ecmaFeatures = { + arrowFunctions: true, + binaryLiterals: true, + blockBindings: true, + classes: true, + destructuring: true, + forOf: true, + generators: true, + modules: true, + objectLiteralComputedProperties: true, + objectLiteralDuplicateProperties: true, + objectLiteralShorthandMethods: true, + objectLiteralShorthandProperties: true, + octalLiterals: true, + regexUFlag: true, + regexYFlag: true, + restParams: true, + spread: true, + templateStrings: true, + unicodeCodePointEscapes: true, + }; + acornOptions.ecmaVersion = 6; + acornOptions.sourceType = "module"; + } + + // apply parsing flags after sourceType to allow overriding + if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { + + var flags = Object.keys(options.ecmaFeatures); + + // if it's a module, augment the ecmaFeatures + flags.forEach(function(key) { + var value = extra.ecmaFeatures[key] = options.ecmaFeatures[key]; + + if (value) { + switch (key) { + case "globalReturn": + acornOptions.allowReturnOutsideFunction = true; + break; + + case "modules": + acornOptions.sourceType = "module"; + // falls through + + default: + acornOptions.ecmaVersion = 6; + } + } + }); + + } + + var FILENAME = "eslint.ts"; + + var compilerHost = { + fileExists: function() { + return true; + }, + getCanonicalFileName: function() { + return FILENAME; + }, + getCurrentDirectory: function() { + return ""; + }, + getDefaultLibFileName: function() { + return "lib.d.ts"; + }, + + // TODO: Support Windows CRLF + getNewLine: function() { + return "\n"; + }, + getSourceFile: function(filename) { + return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); + }, + readFile: function() { + return null; + }, + useCaseSensitiveFileNames: function() { + return true; + }, + writeFile: function() { + return null; + } + }; + + var program = ts.createProgram([FILENAME], { + noResolve: true, + target: ts.ScriptTarget.Latest, + jsx: extra.ecmaFeatures.jsx ? "preserve" : undefined + }, compilerHost); + + var ast = program.getSourceFile(FILENAME); + + if (extra.attachComment || extra.comment) { + acornOptions.onComment = function() { + var comment = convertAcornCommentToEsprimaComment.apply(this, arguments); + extra.comments.push(comment); + + if (extra.attachComment) { + commentAttachment.addComment(comment); + } + }; + } + + if (extra.range) { + acornOptions.ranges = true; + } + + if (extra.loc) { + acornOptions.locations = true; + } + + if (extra.ecmaFeatures.jsx) { + if (extra.ecmaFeatures.spread !== false) { + extra.ecmaFeatures.spread = true; + } + acornOptions.plugins = { jsx: true }; + } + } + + + // if (extra.comment || extra.attachComment) { + // ast.comments = extra.comments; + // } + + // if (extra.tokens) { + // ast.tokens = extra.tokens; + // } + var convert = require("./lib/ast-converter"); + return convert(ast); + + // return ast; +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +exports.version = require("./package.json").version; + +exports.parse = parse; + +// Deep copy. +/* istanbul ignore next */ +exports.Syntax = (function () { + var name, types = {}; + + if (typeof Object.create === "function") { + types = Object.create(null); + } + + for (name in astNodeTypes) { + if (astNodeTypes.hasOwnProperty(name)) { + types[name] = astNodeTypes[name]; + } + } + + if (typeof Object.freeze === "function") { + Object.freeze(types); + } + + return types; +}()); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json new file mode 100644 index 000000000000..38952f10473c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json @@ -0,0 +1,217 @@ +{ + "x + y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "x - y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "\"use strict\" + 42": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json new file mode 100644 index 000000000000..072c4e3d4348 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json @@ -0,0 +1,1198 @@ +{ + "x = []": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ] + }, + "x = [ ]": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x = [ 42 ]": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "x = [ 42, ]": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "x = [ ,, 42 ]": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + null, + null, + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "x = [ 1, 2, 3, ]": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "x = [ 1, 2,, 3, ]": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + null, + { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "日本語 = []": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "日本語", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "T‿ = []": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "T‿", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "T‌ = []": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "T‌", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "T‍ = []": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "T‍", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "ⅣⅡ = []": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "ⅣⅡ", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "ⅣⅡ = []": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "ⅣⅡ", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json new file mode 100644 index 000000000000..b03cfde17daa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json @@ -0,0 +1,1010 @@ +{ + "x = 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "eval = 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "arguments = 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "x *= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "*=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x /= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "/=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x %= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "%=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x += 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "+=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x -= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "-=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x <<= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "<<=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "x >>= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": ">>=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "x >>>= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": ">>>=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x &= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "&=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x ^= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "^=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x |= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "|=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json new file mode 100644 index 000000000000..d1e681950216 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json @@ -0,0 +1,1707 @@ +{ + "{ x\n++y }": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "{ x\n--y }": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 2, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "var x /* comment */;": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "{ var x = 14, y = 3\nz; }": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "kind": "var", + "range": [ + 2, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "z", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "while (true) { continue\nthere; }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "while (true) { continue // Comment\nthere; }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "while (true) { continue /* Multiline\nComment */there; }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 47, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 13, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "while (true) { break\nthere; }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "while (true) { break // Comment\nthere; }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 13, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "while (true) { break /* Multiline\nComment */there; }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "there", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 44, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 13, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "(function(){ return\nx; })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 11, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "(function(){ return // Comment\nx; })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 11, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "(function(){ return/* Multiline\nComment */x; })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ], + "range": [ + 11, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "{ throw error\nerror; }": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 2, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "{ throw error// Comment\nerror; }": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 2, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "error", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "{ throw error/* Multiline\nComment */error; }": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "error", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 2, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "error", + "range": [ + 36, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "range": [ + 36, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json new file mode 100644 index 000000000000..4502ac1b474e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json @@ -0,0 +1,215 @@ +{ + "x & y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "x ^ y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "x | y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json new file mode 100644 index 000000000000..2fd02552715c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json @@ -0,0 +1,1928 @@ +{ + "x + y + z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x - y + z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x + y - z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x - y - z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x + y * z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x + y / z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "/", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x - y % z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x * y * z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x * y / z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "/", + "left": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x * y % z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x % y * z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x << y << z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "x | y | z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x & y & z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x ^ y ^ z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x & y | z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x | y ^ z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x | y & z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json new file mode 100644 index 000000000000..c1eef8d20f25 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json @@ -0,0 +1,572 @@ +{ + "x || y": { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x && y": { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x || y || z": { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "x && y && z": { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "x || y && z": { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "x || y ^ z": { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json new file mode 100644 index 000000000000..a024ab9f6a41 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json @@ -0,0 +1,215 @@ +{ + "x << y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x >> y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">>", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x >>> y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">>>", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Block.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Block.json new file mode 100644 index 000000000000..bf48af39640e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Block.json @@ -0,0 +1,199 @@ +{ + "{ foo }": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "foo", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "{ doThis(); doThat(); }": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThis", + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [], + "range": [ + 2, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 12, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "arguments": [], + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 12, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "{}": { + "type": "BlockStatement", + "body": [], + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json new file mode 100644 index 000000000000..e2bec3ddea8a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json @@ -0,0 +1,4322 @@ +{ + "/* block comment */ 42": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "42 /* block comment 1 */ /* block comment 2 */": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "trailingComments": [ + { + "type": "Block", + "value": " block comment 1 ", + "range": [ + 3, + 24 + ] + }, + { + "type": "Block", + "value": " block comment 2 ", + "range": [ + 25, + 46 + ] + } + ] + }, + "range": [ + 0, + 46 + ] + } + ], + "range": [ + 0, + 46 + ], + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " block comment 1 ", + "range": [ + 3, + 24 + ] + }, + { + "type": "Block", + "value": " block comment 2 ", + "range": [ + 25, + 46 + ] + } + ], + "tokens": [ + { + "type": "Numeric", + "range": [ + 0, + 2 + ], + "value": "42" + } + ] + }, + "var p1;/* block comment 1 */ /* block comment 2 */": { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Program", + "body": [ + { + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "VariableDeclaration", + "declarations": [ + { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "VariableDeclarator", + "id": { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "name": "p1" + }, + "init": null + } + ], + "kind": "var", + "trailingComments": [ + { + "range": [ + 7, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "Block", + "value": " block comment 1 " + }, + { + "range": [ + 29, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "type": "Block", + "value": " block comment 2 " + } + ] + } + ], + "sourceType": "script", "comments": [ + { + "range": [ + 7, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "type": "Block", + "value": " block comment 1 " + }, + { + "range": [ + 29, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "type": "Block", + "value": " block comment 2 " + } + ], + "tokens": [ + { + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "type": "Keyword", + "value": "var" + }, + { + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Identifier", + "value": "p1" + }, + { + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "type": "Punctuator", + "value": ";" + } + ] + }, + "/*42*/": { + "range": [ + 6, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Program", + "body": [], + "sourceType": "script", "leadingComments": [ + { + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Block", + "value": "42" + } + ], + "comments": [ + { + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "type": "Block", + "value": "42" + } + ], + "tokens": [] + }, + "(a + /* assignmenr */b ) * c": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 5, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] + }, + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "right": { + "type": "Identifier", + "name": "c", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 5, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] + }, + "/* assignmenr */\n a = b": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + } + ], + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " assignmenr ", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + }, + "42 /*The*/ /*Answer*/": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "The", + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Block", + "value": "Answer", + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] + }, + "42 /*the*/ /*answer*/": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ] + }, + "range": [ + 0, + 21 + ] + } + ], + "range": [ + 0, + 21 + ], + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "the", + "range": [ + 3, + 10 + ] + }, + { + "type": "Block", + "value": "answer", + "range": [ + 11, + 21 + ] + } + ] + }, + "42 /* the * answer */": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "42 /* The * answer */": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " The * answer ", + "range": [ + 3, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] + }, + "/* multiline\ncomment\nshould\nbe\nignored */ 42": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 42, + 44 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "/*a\r\nb*/ 42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "a\r\nb", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ] + } + ], + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "a\r\nb", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ] + }, + "/*a\rb*/ 42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "a\rb", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ] + }, + "/*a\nb*/ 42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "a\nb", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ] + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "a\nb", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ] + }, + "/*a\nc*/ 42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "a\nc", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ] + } + ], + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "a\nc", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + } + } + ] + }, + "// one\\n": { + "type": "Program", + "body": [], + "range": [ + 8, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", "leadingComments": [ + { + "type": "Line", + "value": " one\\n", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "comments": [ + { + "type": "Line", + "value": " one\\n", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ] + }, + "// line comment\n42": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "42 // line comment": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " line comment", + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " line comment", + "range": [ + 3, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] + }, + "// Hello, world!\n42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + } + ], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + }, + "// Hello, world!\n": { + "type": "Program", + "body": [], + "range": [ + 17, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + }, + "// Hallo, world!\n": { + "type": "Program", + "body": [], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " Hallo, world!", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + }, + "//\n42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": "", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ] + } + ], + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": "", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ] + }, + "//": { + "type": "Program", + "body": [], + "range": [ + 2, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": "", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + } + ] + }, + "// ": { + "type": "Program", + "body": [], + "range": [ + 3, + 3 + ], + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " ", + "range": [ + 0, + 3 + ] + } + ] + }, + "/**/42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ] + } + ], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ] + }, + "42/**/": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": "", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ] + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": "", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ] + }, + "// Hello, world!\n\n// Another hello\n42": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Line", + "value": " Another hello", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ] + } + ], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " Hello, world!", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Line", + "value": " Another hello", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ] + }, + "if (x) { doThat() // Some comment\n }": { + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "arguments": [], + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 18, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ] + }, + "range": [ + 9, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 2, + "column": 1 + } + } + } + ], + "range": [ + 7, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 18, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ] + }, + "if (x) { // Some comment\ndoThat(); }": { + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "arguments": [], + "range": [ + 25, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 9, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] + } + ], + "range": [ + 7, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " Some comment", + "range": [ + 9, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] + }, + "if (x) { /* Some comment */ doThat() }": { + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 28, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "arguments": [], + "range": [ + 28, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 28, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ] + } + ], + "range": [ + 7, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "alternate": null, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 9, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ] + }, + "if (x) { doThat() /* Some comment */ }": { + "type": "Program", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "arguments": [], + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ] + }, + "range": [ + 9, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 7, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "alternate": null, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " Some comment ", + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ] + }, + "switch (answer) { case 42: /* perfect */ bingo() }": { + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "bingo", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "arguments": [], + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 41, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 27, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ] + } + ], + "range": [ + 18, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 27, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ] + }, + "switch (answer) { case 42: bingo() /* perfect */ }": { + "type": "Program", + "body": [ + { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "bingo", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "arguments": [], + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 35, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ] + }, + "range": [ + 27, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 18, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "range": [ + 0, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " perfect ", + "range": [ + 35, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ] + }, + "/* header */ (function(){ var version = 1; }).call(this)": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "version", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 30, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "kind": "var", + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 24, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 46, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "range": [ + 13, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 50 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 51, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 13, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "range": [ + 13, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " header ", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ] + } + ], + "range": [ + 13, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " header ", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ] + }, + "(function(){ var version = 1; /* sync */ }).call(this)": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "version", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 17, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "kind": "var", + "range": [ + 13, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": " sync ", + "range": [ + 30, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ] + } + ], + "range": [ + 11, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " sync ", + "range": [ + 30, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ] + }, + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + } + } + ], + "range": [ + 0, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " sync ", + "range": [ + 30, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ] + }, + " comment": { + "type": "Program", + "body": [], + "range": [ + 11, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " comment", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] + }, + " comment": { + "type": "Program", + "body": [], + "range": [ + 14, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Line", + "value": " comment", + "range": [ + 3, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] + }, + " \t /* block comment */ --> comment": { + "type": "Program", + "body": [], + "range": [ + 35, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " block comment ", + "range": [ + 3, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Line", + "value": " comment", + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ] + }, + "/* block comment */--> comment": { + "type": "Program", + "body": [], + "range": [ + 30, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "sourceType": "script", "comments": [ + { + "type": "Block", + "value": " block comment ", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Line", + "value": " comment", + "range": [ + 19, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ] + }, + "/* not comment*/; i-->0": { + "type": "Program", + "body": [ + { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">", + "left": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "i", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "prefix": false, + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 18, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "--", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ] + }, + "while (i-->0) {}": { + "type": "WhileStatement", + "test": { + "type": "BinaryExpression", + "operator": ">", + "left": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "i", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": false, + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json new file mode 100644 index 000000000000..39c21c43075b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json @@ -0,0 +1,397 @@ +{ + "a || b && c | d ^ e & f == g < h >>> i + j * k": { + "type": "ExpressionStatement", + "expression": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "|", + "left": { + "type": "Identifier", + "name": "c", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "^", + "left": { + "type": "Identifier", + "name": "d", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "&", + "left": { + "type": "Identifier", + "name": "e", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "==", + "left": { + "type": "Identifier", + "name": "f", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "g", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": ">>>", + "left": { + "type": "Identifier", + "name": "h", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "i", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "j", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "right": { + "type": "Identifier", + "name": "k", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 37, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 31, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 27, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 22, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 18, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 14, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 10, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 5, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json new file mode 100644 index 000000000000..06db73a75620 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json @@ -0,0 +1,345 @@ +{ + "y ? 1 : 2": { + "type": "ExpressionStatement", + "expression": { + "type": "ConditionalExpression", + "test": { + "type": "Identifier", + "name": "y", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "consequent": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "alternate": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "x && y ? 1 : 2": { + "type": "ExpressionStatement", + "expression": { + "type": "ConditionalExpression", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "consequent": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "alternate": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "x = (0) ? 1 : 2": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ConditionalExpression", + "test": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "consequent": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "alternate": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json new file mode 100644 index 000000000000..684f8147ac05 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json @@ -0,0 +1,370 @@ +{ + "const x = 42": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "kind": "const", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "{ const x = 42 }": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "const", + "range": [ + 2, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "{ const x = 14, y = 3, z = 1977 }": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "z", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "init": { + "type": "Literal", + "value": 1977, + "raw": "1977", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 23, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "kind": "const", + "range": [ + 2, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json new file mode 100644 index 000000000000..2c5f7951f609 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json @@ -0,0 +1,332 @@ +{ + "(function () { 'use\\x20strict'; with (i); }())": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use\\x20strict'", + "range": [ + 15, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "i", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 13, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "arguments": [], + "range": [ + 1, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "(function () { 'use\\nstrict'; with (i); }())": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use\nstrict", + "raw": "'use\\nstrict'", + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "i", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 30, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 13, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "arguments": [], + "range": [ + 1, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json new file mode 100644 index 000000000000..4a1f85a244d8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json @@ -0,0 +1,19 @@ +{ + ";": { + "type": "EmptyStatement", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json new file mode 100644 index 000000000000..c5cab39fbe60 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json @@ -0,0 +1,286 @@ +{ + "x == y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "==", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x != y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "!=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x === y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x !== y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json new file mode 100644 index 000000000000..f67bb5c5e598 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json @@ -0,0 +1,249 @@ +{ + "x": { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "x, y": { + "type": "ExpressionStatement", + "expression": { + "type": "SequenceExpression", + "expressions": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "name": "y", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "\\u0061": { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "a\\u0061": { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "aa", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "\\u0061a": { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "aa", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "\\u0061a ": { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "aa", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json new file mode 100644 index 000000000000..4592ad265c57 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json @@ -0,0 +1,1681 @@ +{ + "function hello() { sayHi(); }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 19, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "function eval() { }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "function arguments() { }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "function test(t, t) { }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "t", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "name": "t", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "(function test(t, t) { })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "t", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "t", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "function eval() { function inner() { \"use strict\" } }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "inner", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + "range": [ + 37, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 50 + } + } + } + ], + "range": [ + 35, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 18, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 51 + } + } + } + ], + "range": [ + 16, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + } + }, + "function hello(a) { sayHi(); }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "arguments": [], + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 20, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "function hello(a, b) { sayHi(); }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "arguments": [], + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 23, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 21, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "var hi = function() { sayHi() };": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "arguments": [], + "range": [ + 22, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 9, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 4, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "var hi = function eval() { };": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 9, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 4, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "var hi = function arguments() { };": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 9, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 4, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "var hello = function hi() { sayHi() };": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "hi", + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sayHi", + "range": [ + 28, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "arguments": [], + "range": [ + 28, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 28, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 26, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 12, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 4, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "(function(){})": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "function universe(__proto__) { }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "universe", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "__proto__", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "function test() { \"use strict\" + 42; }": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "test", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 18, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 18, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 16, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json new file mode 100644 index 000000000000..0bac15ebe2af --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json @@ -0,0 +1,222 @@ +{ + "(1) + (2 ) + 3": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "right": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "4 + 5 << (6)": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<<", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 5, + "raw": "5", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 6, + "raw": "6", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json new file mode 100644 index 000000000000..b774be8a3c4f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json @@ -0,0 +1,742 @@ +{ + "if (morning) goodMorning()": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "goodMorning", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "alternate": null, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "if (morning) (function(){})": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 24, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "alternate": null, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "if (morning) var x = 0;": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "kind": "var", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "alternate": null, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "if (morning) function a(){}": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 13, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "alternate": null, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "if (morning) goodMorning(); else goodDay()": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "morning", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "goodMorning", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "goodDay", + "range": [ + 33, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "arguments": [], + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "if (true) that()\n; else;": { + "type": "IfStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "arguments": [], + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "alternate": { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + "if (true) that(); else;": { + "type": "IfStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "arguments": [], + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "alternate": { + "type": "EmptyStatement", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json new file mode 100644 index 000000000000..0b301962c156 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json @@ -0,0 +1,1334 @@ +{ + "{": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected end of input" + }, + "}": { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token }" + }, + "3ea": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3in []": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3e": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3e+": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3e-": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3x": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3x0": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "0x": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "09": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "018": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "01a": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3in[]": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "0x3in[]": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\"Hello\nWorld\"": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "x\\": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "x\\u005c": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "x\\u002a": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "var x = /(s/g": { + "index": 13, + "lineNumber": 1, + "column": 14, + "message": "Error: Line 1: Invalid regular expression" + }, + "a\\u": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\\ua": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "/": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid regular expression: missing /" + }, + "/test": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Invalid regular expression: missing /" + }, + "/test\n/": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Invalid regular expression: missing /" + }, + "var x = /[a-z]/\\ux": { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "var x = /[a-z\n]/\\ux": { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Invalid regular expression: missing /" + }, + "var x = /[a-z]/\\\\ux": { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "var x = /[P QR]/\\\\u0067": { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "3 = 4": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "func() = 4": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "(1 + 1) = 10": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "1++": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "1--": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "++1": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "--1": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "for((1 + 1) in list) process(x);": { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Invalid left-hand side in for-in" + }, + "[": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected end of input" + }, + "[,": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected end of input" + }, + "1 + {": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" + }, + "1 + { t:t ": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected end of input" + }, + "1 + { t:t,": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected end of input" + }, + "var x = /\n/": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Invalid regular expression: missing /" + }, + "var x = \"\n": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "var if = 42": { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token if" + }, + "i #= 42": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "i + 2 = 42": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "+i = 42": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Invalid left-hand side in assignment" + }, + "1 + (": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" + }, + "\n\n\n{": { + "index": 4, + "lineNumber": 4, + "column": 2, + "message": "Error: Line 4: Unexpected end of input" + }, + "\n/* Some multiline\ncomment */\n)": { + "index": 30, + "lineNumber": 4, + "column": 1, + "message": "Error: Line 4: Unexpected token )" + }, + "{ set 1 }": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected number" + }, + "{ get 2 }": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected number" + }, + "({ set: s(if) { } })": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token if" + }, + "({ set s(.) { } })": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token ." + }, + "({ set s() { } })": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token )" + }, + "({ set: s() { } })": { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected token {" + }, + "({ set: s(a, b) { } })": { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Error: Line 1: Unexpected token {" + }, + "({ get: g(d) { } })": { + "index": 13, + "lineNumber": 1, + "column": 14, + "message": "Error: Line 1: Unexpected token {" + }, + "({ get i() { }, i: 42 })": { + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" + }, + "({ i: 42, get i() { } })": { + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" + }, + "({ set i(x) { }, i: 42 })": { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" + }, + "({ i: 42, set i(x) { } })": { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" + }, + "({ get i() { }, get i() { } })": { + "index": 27, + "lineNumber": 1, + "column": 28, + "message": "Error: Line 1: Object literal may not have multiple get/set accessors with the same name" + }, + "({ set i(x) { }, set i(x) { } })": { + "index": 29, + "lineNumber": 1, + "column": 30, + "message": "Error: Line 1: Object literal may not have multiple get/set accessors with the same name" + }, + "function t(if) { }": { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token if" + }, + "function t(true) { }": { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token true" + }, + "function t(false) { }": { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token false" + }, + "function t(null) { }": { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Unexpected token null" + }, + "function null() { }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token null" + }, + "function true() { }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token true" + }, + "function false() { }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token false" + }, + "function if() { }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token if" + }, + "a b;": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected identifier" + }, + "if.a;": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ." + }, + "a if;": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token if" + }, + "a class;": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected reserved word" + }, + "break\n": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Illegal break statement" + }, + "break 1;": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected number" + }, + "continue\n": { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Illegal continue statement" + }, + "continue 2;": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected number" + }, + "throw": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" + }, + "throw;": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected token ;" + }, + "throw\n": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Illegal newline after throw" + }, + "for (var i, i2 in {});": { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Unexpected token in" + }, + "for ((i in {}));": { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token )" + }, + "for (i + 1 in {});": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Invalid left-hand side in for-in" + }, + "for (+i in {});": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Invalid left-hand side in for-in" + }, + "if(false)": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected end of input" + }, + "if(false) doThis(); else": { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Unexpected end of input" + }, + "do": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected end of input" + }, + "while(false)": { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Unexpected end of input" + }, + "for(;;)": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected end of input" + }, + "with(x)": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected end of input" + }, + "try { }": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Missing catch or finally after try" + }, + "try {} catch (42) {} ": { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected number" + }, + "try {} catch (answer()) {} ": { + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Error: Line 1: Unexpected token (" + }, + "try {} catch (-x) {} ": { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token -" + }, + "‿ = 10": { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "const x = 12, y;": { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Const must be initialized" + }, + "const x, y = 12;": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Const must be initialized" + }, + "const x;": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Const must be initialized" + }, + "if(true) let a = 1;": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token let" + }, + "if(true) const a = 1;": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token const" + }, + "switch (c) { default: default: }": { + "index": 30, + "lineNumber": 1, + "column": 31, + "message": "Error: Line 1: More than one default clause in switch statement" + }, + "new X().\"s\"": { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected string" + }, + "/*": { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "/*\n\n\n": { + "index": 5, + "lineNumber": 4, + "column": 1, + "message": "Error: Line 4: Unexpected token ILLEGAL" + }, + "/**": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "/*\n\n*": { + "index": 5, + "lineNumber": 3, + "column": 2, + "message": "Error: Line 3: Unexpected token ILLEGAL" + }, + "/*hello": { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "/*hello *": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\n]": { + "index": 1, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" + }, + "\r]": { + "index": 1, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" + }, + "\r\n]": { + "index": 2, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" + }, + "\n\r]": { + "index": 2, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected token ]" + }, + "//\r\n]": { + "index": 4, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected token ]" + }, + "//\n\r]": { + "index": 4, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected token ]" + }, + "/a\\\n/": { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Invalid regular expression: missing /" + }, + "//\r \n]": { + "index": 5, + "lineNumber": 3, + "column": 1, + "message": "Error: Line 3: Unexpected token ]" + }, + "/*\r\n*/]": { + "index": 6, + "lineNumber": 2, + "column": 3, + "message": "Error: Line 2: Unexpected token ]" + }, + "/*\n\r*/]": { + "index": 6, + "lineNumber": 3, + "column": 3, + "message": "Error: Line 3: Unexpected token ]" + }, + "/*\r \n*/]": { + "index": 7, + "lineNumber": 3, + "column": 3, + "message": "Error: Line 3: Unexpected token ]" + }, + "\\\\": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\\u005c": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\\x": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\\u0000": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "‌ = []": { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "‍ = []": { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\"\\": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "\"\\u": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + "try { } catch() {}": { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Unexpected token )" + }, + "return": { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Illegal return statement" + }, + "break": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Illegal break statement" + }, + "continue": { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Illegal continue statement" + }, + "switch (x) { default: continue; }": { + "index": 31, + "lineNumber": 1, + "column": 32, + "message": "Error: Line 1: Illegal continue statement" + }, + "do { x } *": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Unexpected token *" + }, + "while (true) { break x; }": { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Undefined label 'x'" + }, + "while (true) { continue x; }": { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Undefined label 'x'" + }, + "x: while (true) { (function () { break x; }); }": { + "index": 40, + "lineNumber": 1, + "column": 41, + "message": "Error: Line 1: Undefined label 'x'" + }, + "x: while (true) { (function () { continue x; }); }": { + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Undefined label 'x'" + }, + "x: while (true) { (function () { break; }); }": { + "index": 39, + "lineNumber": 1, + "column": 40, + "message": "Error: Line 1: Illegal break statement" + }, + "x: while (true) { (function () { continue; }); }": { + "index": 42, + "lineNumber": 1, + "column": 43, + "message": "Error: Line 1: Illegal continue statement" + }, + "x: while (true) { x: while (true) { } }": { + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Error: Line 1: Label 'x' has already been declared" + }, + "(function () { 'use strict'; delete i; }())": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Delete of an unqualified identifier in strict mode." + }, + "(function () { 'use strict'; with (i); }())": { + "index": 29, + "lineNumber": 1, + "column": 30, + "message": "Error: Line 1: Strict mode code may not include a with statement" + }, + "function hello() {'use strict'; ({ i: 42, i: 42 }) }": { + "index": 47, + "lineNumber": 1, + "column": 48, + "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" + }, + "function hello() {'use strict'; ({ hasOwnProperty: 42, hasOwnProperty: 42 }) }": { + "index": 73, + "lineNumber": 1, + "column": 74, + "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" + }, + "function hello() {'use strict'; var eval = 10; }": { + "index": 40, + "lineNumber": 1, + "column": 41, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; var arguments = 10; }": { + "index": 45, + "lineNumber": 1, + "column": 46, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; try { } catch (eval) { } }": { + "index": 51, + "lineNumber": 1, + "column": 52, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; try { } catch (arguments) { } }": { + "index": 56, + "lineNumber": 1, + "column": 57, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; eval = 10; }": { + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" + }, + "function hello() {'use strict'; arguments = 10; }": { + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" + }, + "function hello() {'use strict'; ++eval; }": { + "index": 38, + "lineNumber": 1, + "column": 39, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; --eval; }": { + "index": 38, + "lineNumber": 1, + "column": 39, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; ++arguments; }": { + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; --arguments; }": { + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; eval++; }": { + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; eval--; }": { + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; arguments++; }": { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; arguments--; }": { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + }, + "function hello() {'use strict'; function eval() { } }": { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; function arguments() { } }": { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "function eval() {'use strict'; }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "function arguments() {'use strict'; }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; (function eval() { }()) }": { + "index": 42, + "lineNumber": 1, + "column": 43, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; (function arguments() { }()) }": { + "index": 42, + "lineNumber": 1, + "column": 43, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "(function eval() {'use strict'; })()": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "(function arguments() {'use strict'; })()": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "function hello() {'use strict'; ({ s: function eval() { } }); }": { + "index": 47, + "lineNumber": 1, + "column": 48, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "(function package() {'use strict'; })()": { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() {'use strict'; ({ i: 10, set s(eval) { } }); }": { + "index": 48, + "lineNumber": 1, + "column": 49, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "function hello() {'use strict'; ({ set s(eval) { } }); }": { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "function hello() {'use strict'; ({ s: function s(eval) { } }); }": { + "index": 49, + "lineNumber": 1, + "column": 50, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "function hello(eval) {'use strict';}": { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "function hello(arguments) {'use strict';}": { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "function hello() { 'use strict'; function inner(eval) {} }": { + "index": 48, + "lineNumber": 1, + "column": 49, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "function hello() { 'use strict'; function inner(arguments) {} }": { + "index": 48, + "lineNumber": 1, + "column": 49, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + " \"\\1\"; 'use strict';": { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { 'use strict'; \"\\1\"; }": { + "index": 33, + "lineNumber": 1, + "column": 34, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { 'use strict'; 021; }": { + "index": 33, + "lineNumber": 1, + "column": 34, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { 'use strict'; ({ \"\\1\": 42 }); }": { + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { 'use strict'; ({ 021: 42 }); }": { + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { \"octal directive\\1\"; \"use strict\"; }": { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { \"octal directive\\1\"; \"octal directive\\2\"; \"use strict\"; }": { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { \"use strict\"; function inner() { \"octal directive\\1\"; } }": { + "index": 52, + "lineNumber": 1, + "column": 53, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + }, + "function hello() { \"use strict\"; var implements; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var interface; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var package; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var private; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var protected; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var public; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var static; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var yield; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello() { \"use strict\"; var let; }": { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function hello(static) { \"use strict\"; }": { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function static() { \"use strict\"; }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function eval(a) { \"use strict\"; }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "function arguments(a) { \"use strict\"; }": { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + }, + "var yield": { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token yield" + }, + "var let": { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Error: Line 1: Unexpected token let" + }, + "\"use strict\"; function static() { }": { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function a(t, t) { \"use strict\"; }": { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + }, + "function a(eval) { \"use strict\"; }": { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "function a(package) { \"use strict\"; }": { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "function a() { \"use strict\"; function b(t, t) { }; }": { + "index": 43, + "lineNumber": 1, + "column": 44, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + }, + "(function a(t, t) { \"use strict\"; })": { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + }, + "function a() { \"use strict\"; (function b(t, t) { }); }": { + "index": 44, + "lineNumber": 1, + "column": 45, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + }, + "(function a(eval) { \"use strict\"; })": { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + }, + "(function a(package) { \"use strict\"; })": { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Error: Line 1: Use of future reserved word in strict mode" + }, + "__proto__: __proto__: 42;": { + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Label '__proto__' has already been declared" + }, + "\"use strict\"; function t(__proto__, __proto__) { }": { + "index": 36, + "lineNumber": 1, + "column": 37, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + }, + "\"use strict\"; x = { __proto__: 42, __proto__: 43 }": { + "index": 48, + "lineNumber": 1, + "column": 49, + "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" + }, + "\"use strict\"; x = { get __proto__() { }, __proto__: 43 }": { + "index": 54, + "lineNumber": 1, + "column": 55, + "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" + }, + "var": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected end of input" + }, + "let": { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Unexpected end of input" + }, + "const": { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Error: Line 1: Unexpected end of input" + }, + "{ ; ; ": { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Error: Line 1: Unexpected end of input" + }, + "function t() { ; ; ": { + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Error: Line 1: Unexpected end of input" + }, + "left = (aSize.width/2) - ()": { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Unexpected token )" + }, + "switch(x) { case 'x': break;\n": { + "index": 31, + "lineNumber": 2, + "column": 1, + "message": "Error: Line 2: Unexpected end of input" + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json new file mode 100644 index 000000000000..c3861d3ac204 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json @@ -0,0 +1,2684 @@ +{ + "do keep(); while (true)": { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "keep", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "do keep(); while (true);": { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "keep", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "do { x++; y--; } while (x < 10)": { + "type": "DoWhileStatement", + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": false, + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": false, + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "range": [ + 3, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "{ do { } while (false) false }": { + "type": "BlockStatement", + "body": [ + { + "type": "DoWhileStatement", + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "test": { + "type": "Literal", + "value": false, + "raw": "false", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 2, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": false, + "raw": "false", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "do that();while (true)": { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "do that()\n;while (true)": { + "type": "DoWhileStatement", + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "that", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 3, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 3, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "while (true) doSomething()": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doSomething", + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "while (x < 10) { x++; y--; }": { + "type": "WhileStatement", + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "prefix": false, + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "y", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "prefix": false, + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "for(;;);": { + "type": "ForStatement", + "init": null, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "for(;;){}": { + "type": "ForStatement", + "init": null, + "test": null, + "update": null, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "for(x = 0;;);": { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "for(var x = 0;;);": { + "type": "ForStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "kind": "var", + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "for(let x = 0;;);": { + "type": "ForStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "kind": "let", + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "for(var x = 0, y = 1;;);": { + "type": "ForStatement", + "init": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "kind": "var", + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "test": null, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "for(x = 0; x < 42;);": { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "update": null, + "body": { + "type": "EmptyStatement", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "for(x = 0; x < 42; x++);": { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "update": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "prefix": false, + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "for(x = 0; x < 42; x++) process(x);": { + "type": "ForStatement", + "init": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "update": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "prefix": false, + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 24, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "for(x in list) process(x);": { + "type": "ForInStatement", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 15, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 15, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 15, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "each": false, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "for (var x in list) process(x);": { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": null, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "each": false, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "for (var x in list) process(x);": { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": null, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "var", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "each": false, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "for (let x in list) process(x);": { + "type": "ForInStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": null, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "let", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "list", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "process", + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "each": false, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json new file mode 100644 index 000000000000..a37d11ddf95c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json @@ -0,0 +1,268 @@ +{ + "start: for (;;) break start": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "body": { + "type": "ForStatement", + "init": null, + "test": null, + "update": null, + "body": { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 7, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "start: while (true) break start": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "start", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 7, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "__proto__: test": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "Identifier", + "name": "test", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json new file mode 100644 index 000000000000..8b23bae1d9b7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json @@ -0,0 +1,2188 @@ +{ + "new Button": { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Button", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "arguments": [], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "new Button()": { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Button", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "arguments": [], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "new new foo": { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "new new foo()": { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "arguments": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "new foo().bar()": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "arguments": [], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "arguments": [], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "new foo[bar]": { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "arguments": [], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "new foo.bar()": { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "( new foo).bar()": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "arguments": [], + "range": [ + 2, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "arguments": [], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "foo(bar, baz)": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "bar", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "name": "baz", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "( foo )()": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "universe.milkyway": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "universe.milkyway.solarsystem": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "solarsystem", + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "universe.milkyway.solarsystem.Earth": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "solarsystem", + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "name": "Earth", + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "universe[galaxyName, otherUselessName]": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "SequenceExpression", + "expressions": [ + { + "type": "Identifier", + "name": "galaxyName", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "name": "otherUselessName", + "range": [ + 21, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 9, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "universe[galaxyName]": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxyName", + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "universe[42].galaxies": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "universe(42).galaxies": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "universe(42).galaxies(14, 3, 77).milkyway": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "galaxies", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Literal", + "value": 77, + "raw": "77", + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "property": { + "type": "Identifier", + "name": "milkyway", + "range": [ + 33, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "earth.asia.Indonesia.prepareForElection(2014)": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "earth", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "asia", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "Indonesia", + "range": [ + 11, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "prepareForElection", + "range": [ + 21, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": 2014, + "raw": "2014", + "range": [ + 40, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "universe.if": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "if", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "universe.true": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "true", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "universe.false": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "false", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "universe.null": { + "type": "ExpressionStatement", + "expression": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "universe", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "null", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json new file mode 100644 index 000000000000..40a06abf6a0c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json @@ -0,0 +1,427 @@ +{ + "let x": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "kind": "let", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "{ let x }": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": null, + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "kind": "let", + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "{ let x = 42 }": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "kind": "let", + "range": [ + 2, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "{ let x = 14, y = 3, z = 1977 }": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "z", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "init": { + "type": "Literal", + "value": 1977, + "raw": "1977", + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "kind": "let", + "range": [ + 2, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json new file mode 100644 index 000000000000..418f1f35ba3a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json @@ -0,0 +1,215 @@ +{ + "x * y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "x / y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "/", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "x % y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "%", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json new file mode 100644 index 000000000000..8ff062fecb8c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json @@ -0,0 +1,780 @@ +{ + "0": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "3": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 0, + 1 + ] + }, + "range": [ + 0, + 1 + ] + } + ], + "range": [ + 0, + 1 + ], + "sourceType": "script", "tokens": [ + { + "type": "Numeric", + "value": "3", + "range": [ + 0, + 1 + ] + } + ] + }, + "5": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 5, + "raw": "5", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ] + }, + "42": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + ".14": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0.14, + "raw": ".14", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "3.14159": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3.14159, + "raw": "3.14159", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "6.02214179e+23": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 6.02214179e+23, + "raw": "6.02214179e+23", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "1.492417830e-10": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 1.49241783e-10, + "raw": "1.492417830e-10", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "0x0": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0x0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "0x0;": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0x0", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "0e+100 ": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0e+100", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "0e+100": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0e+100", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "0xabc": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2748, + "raw": "0xabc", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "0xdef": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3567, + "raw": "0xdef", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "0X1A": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 26, + "raw": "0X1A", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "0x10": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 16, + "raw": "0x10", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "0x100": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 256, + "raw": "0x100", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "0X04": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 4, + "raw": "0X04", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "02": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "02", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "012": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 10, + "raw": "012", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "0012": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 10, + "raw": "0012", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json new file mode 100644 index 000000000000..d38fe7f111f1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json @@ -0,0 +1,4950 @@ +{ + "x = {}": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x = { }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "x = { answer: 42 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "answer", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "kind": "init", + "range": [ + 6, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "x = { if: 42 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "if", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "kind": "init", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "x = { true: 42 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "true", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "init", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "x = { false: 42 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "false", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "kind": "init", + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "x = { null: 42 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "null", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "kind": "init", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "x = { \"answer\": 42 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "answer", + "raw": "\"answer\"", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "kind": "init", + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "x = { x: 1, x: 2 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "value": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "kind": "init", + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "x = { get width() { return m_width } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "m_width", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 20, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "kind": "get", + "range": [ + 6, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "x = { get undef() {} }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "undef", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "get", + "range": [ + 6, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "x = { get if() {} }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "if", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "kind": "get", + "range": [ + 6, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "x = { get true() {} }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "true", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "get", + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "x = { get false() {} }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "false", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "get", + "range": [ + 6, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "x = { get null() {} }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "null", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "get", + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "x = { get \"undef\"() {} }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "undef", + "raw": "\"undef\"", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "kind": "get", + "range": [ + 6, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "x = { get 10() {} }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "kind": "get", + "range": [ + 6, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "x = { set width(w) { m_width = w } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_width", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "x = { set if(w) { m_if = w } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "if", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_if", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 18, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 16, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 12, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "kind": "set", + "range": [ + 6, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "x = { set true(w) { m_true = w } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "true", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_true", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "kind": "set", + "range": [ + 6, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "x = { set false(w) { m_false = w } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "false", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_false", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 21, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "x = { set null(w) { m_null = w } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "null", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_null", + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "kind": "set", + "range": [ + 6, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "x = { set \"null\"(w) { m_null = w } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "null", + "raw": "\"null\"", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_null", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 22, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 16, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "x = { set 10(w) { m_null = w } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "w", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_null", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "right": { + "type": "Identifier", + "name": "w", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 18, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 16, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 12, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "kind": "set", + "range": [ + 6, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "x = { get: 42 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "get", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "kind": "init", + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "x = { set: 43 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "set", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "value": { + "type": "Literal", + "value": 43, + "raw": "43", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "kind": "init", + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "x = { __proto__: 2 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "kind": "init", + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "x = {\"__proto__\": 2 }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"", + "range": [ + 5, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "init", + "range": [ + 5, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "x = { get width() { return m_width }, set width(width) { m_width = width; } }": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "m_width", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 20, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "kind": "get", + "range": [ + 6, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "width", + "range": [ + 42, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "width", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "m_width", + "range": [ + 57, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 64 + } + } + }, + "right": { + "type": "Identifier", + "name": "width", + "range": [ + 67, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 67 + }, + "end": { + "line": 1, + "column": 72 + } + } + }, + "range": [ + 57, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 72 + } + } + }, + "range": [ + 57, + 73 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 73 + } + } + } + ], + "range": [ + 55, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 47, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 75 + } + } + }, + "kind": "set", + "range": [ + 38, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 75 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 4, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 77 + } + } + }, + "range": [ + 0, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 77 + } + } + }, + "range": [ + 0, + 77 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 77 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json new file mode 100644 index 000000000000..8f241ff50dc3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json @@ -0,0 +1,326 @@ +{ + "x++": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "prefix": false, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "x--": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "prefix": false, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "eval++": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "prefix": false, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "eval--": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "prefix": false, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "arguments++": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "prefix": false, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "arguments--": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "prefix": false, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json new file mode 100644 index 000000000000..86c0681f08fa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json @@ -0,0 +1,335 @@ +{ + "this\n": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ThisExpression", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "this", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ] + }, + "null\n": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Null", + "value": "null", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ] + }, + "\n 42\n\n": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 0 + } + } + } + ], + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 0 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Numeric", + "value": "42", + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 6 + } + } + } + ] + }, + "(1 + 2 ) * 3": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json new file mode 100644 index 000000000000..da59d8c05657 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json @@ -0,0 +1,1215 @@ +{ + "var x = /[a-z]/i": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/[a-z]/i", + "raw": "/[a-z]/i", + "regex": { + "pattern": "[a-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[a-z]/i", + "regex": { + "pattern": "[a-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + }, + "var x = /[x-z]/i": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ] + }, + "init": { + "type": "Literal", + "value": "/[x-z]/i", + "raw": "/[x-z]/i", + "regex": { + "pattern": "[x-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ] + }, + "range": [ + 4, + 16 + ] + } + ], + "kind": "var", + "range": [ + 0, + 16 + ] + } + ], + "range": [ + 0, + 16 + ], + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ] + }, + { + "type": "RegularExpression", + "value": "/[x-z]/i", + "regex": { + "pattern": "[x-z]", + "flags": "i" + }, + "range": [ + 8, + 16 + ] + } + ] + }, + "var x = /[a-c]/i": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/[a-c]/i", + "raw": "/[a-c]/i", + "regex": { + "pattern": "[a-c]", + "flags": "i" + }, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "kind": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[a-c]/i", + "regex": { + "pattern": "[a-c]", + "flags": "i" + }, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] + }, + "var x = /[P QR]/i": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/[P QR]/i", + "raw": "/[P QR]/i", + "regex": { + "pattern": "[P QR]", + "flags": "i" + }, + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[P QR]/i", + "regex": { + "pattern": "[P QR]", + "flags": "i" + }, + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] + }, + "var x = /[\\]/]/": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/[\\]/]/", + "raw": "/[\\]/]/", + "regex": { + "pattern": "[\\]/]", + "flags": "" + }, + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 4, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/[\\]/]/", + "regex": { + "pattern": "[\\]/]", + "flags": "" + }, + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] + }, + "var x = /foo\\/bar/": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/foo\\/bar/", + "raw": "/foo\\/bar/", + "regex": { + "pattern": "foo\\/bar", + "flags": "" + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/foo\\/bar/", + "regex": { + "pattern": "foo\\/bar", + "flags": "" + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] + }, + "var x = /=([^=\\s])+/g": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/=([^=\\s])+/g", + "raw": "/=([^=\\s])+/g", + "regex": { + "pattern": "=([^=\\s])+", + "flags": "g" + }, + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 4, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "RegularExpression", + "value": "/=([^=\\s])+/g", + "regex": { + "pattern": "=([^=\\s])+", + "flags": "g" + }, + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] + }, + "var x = /42/g.test": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Literal", + "value": "/42/g", + "raw": "/42/g", + "regex": { + "pattern": "42", + "flags": "g" + }, + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "test", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json new file mode 100644 index 000000000000..d09a5aef8424 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json @@ -0,0 +1,535 @@ +{ + "x < y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "x > y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "x <= y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x >= y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": ">=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x in y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "in", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "x instanceof y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "instanceof", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "x < y < z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json new file mode 100644 index 000000000000..00a98c0352a9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json @@ -0,0 +1,21 @@ +{ + "": { + "type": "Program", + "body": [], + "range": [ + 0, + 0 + ], + "loc": { + "start": { + "line": 0, + "column": 0 + }, + "end": { + "line": 0, + "column": 0 + } + }, + "sourceType": "script", "tokens": [] + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json new file mode 100644 index 000000000000..f3f84d7c93aa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json @@ -0,0 +1,304 @@ +{ + "x + y - z": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "-", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "z", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + }, + "source": "42.js" + } + }, + "a + (b < (c * d)) + e": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "source": "42.js" + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "source": "42.js" + } + }, + "right": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "c", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "d", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "source": "42.js" + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + }, + "source": "42.js" + } + }, + "range": [ + 5, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 16 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + }, + "source": "42.js" + } + }, + "right": { + "type": "Identifier", + "name": "e", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + }, + "source": "42.js" + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + }, + "source": "42.js" + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json b/packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json new file mode 100644 index 000000000000..9617d9cb805e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json @@ -0,0 +1,686 @@ +{ + "\"Hello\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello", + "raw": "\"Hello\"", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "\n\r\t\u000b\b\f\\'\"\u0000", + "raw": "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "\"\\u0061\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "a", + "raw": "\"\\u0061\"", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "\"\\x61\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "a", + "raw": "\"\\x61\"", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "\"\\u00\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "u00", + "raw": "\"\\u00\"", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "\"\\xt\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "xt", + "raw": "\"\\xt\"", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "\"Hello\\nworld\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\nworld", + "raw": "\"Hello\\nworld\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "\"Hello\\\nworld\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Helloworld", + "raw": "\"Hello\\\nworld\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "\"Hello\\02World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\u0002World", + "raw": "\"Hello\\02World\"", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "\"Hello\\012World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\nWorld", + "raw": "\"Hello\\012World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "\"Hello\\122World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "HelloRWorld", + "raw": "\"Hello\\122World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "\"Hello\\0122World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\n2World", + "raw": "\"Hello\\0122World\"", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "\"Hello\\312World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "HelloÊWorld", + "raw": "\"Hello\\312World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "\"Hello\\412World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello!2World", + "raw": "\"Hello\\412World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "\"Hello\\812World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello812World", + "raw": "\"Hello\\812World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "\"Hello\\712World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello92World", + "raw": "\"Hello\\712World\"", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "\"Hello\\0World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\u0000World", + "raw": "\"Hello\\0World\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "\"Hello\\\r\nworld\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Helloworld", + "raw": "\"Hello\\\r\nworld\"", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + "\"Hello\\1World\"": { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "Hello\u0001World", + "raw": "\"Hello\\1World\"", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json new file mode 100644 index 000000000000..06400daa5f64 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json @@ -0,0 +1,1277 @@ +{ + "tokenize(/42/)": [ + { + "type": "Identifier", + "value": "tokenize", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "regex": { + "pattern": "42", + "flags": "" + }, + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "if (false) { /42/ }": [ + { + "type": "Keyword", + "value": "if", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "regex": { + "pattern": "42", + "flags": "" + }, + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "with (false) /42/": [ + { + "type": "Keyword", + "value": "with", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "regex": { + "pattern": "42", + "flags": "" + }, + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "(false) /42/": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "function f(){} /42/": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "regex": { + "pattern": "42", + "flags": "" + }, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "function(){} /42": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "{} /42": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "[function(){} /42]": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + ";function f(){} /42/": [ + { + "type": "Punctuator", + "value": ";", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "regex": { + "pattern": "42", + "flags": "" + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "void /42/": [ + { + "type": "Keyword", + "value": "void", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "RegularExpression", + "value": "/42/", + "regex": { + "pattern": "42", + "flags": "" + }, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "/42/": [ + { + "type": "RegularExpression", + "value": "/42/", + "regex": { + "pattern": "42", + "flags": "" + }, + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "foo[/42]": [ + { + "type": "Identifier", + "value": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "[a] / b": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "": [], + "/42": { + "tokenize": true, + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid regular expression: missing /" + }, + "foo[/42": { + "tokenize": true, + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Error: Line 1: Invalid regular expression: missing /" + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json new file mode 100644 index 000000000000..44b2f96108c9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json @@ -0,0 +1,6139 @@ +{ + "return": { + "type": "Program", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", "errors": [ + { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Illegal return statement" + } + ] + }, + "(function () { 'use strict'; with (i); }())": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "i", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 29, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 13, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + "arguments": [], + "range": [ + 1, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", "errors": [ + { + "index": 29, + "lineNumber": 1, + "column": 30, + "message": "Error: Line 1: Strict mode code may not include a with statement" + } + ] + }, + "(function () { 'use strict'; 021 }())": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 17, + "raw": "021", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 13, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "arguments": [], + "range": [ + 1, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "sourceType": "script", "errors": [ + { + "index": 29, + "lineNumber": 1, + "column": 30, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ] + }, + "\"use strict\"; delete x": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "delete", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "prefix": true, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "sourceType": "script", "errors": [ + { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Delete of an unqualified identifier in strict mode." + } + ] + }, + "\"use strict\"; try {} catch (eval) {}": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "eval", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 21, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "finalizer": null, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", "errors": [ + { + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; try {} catch (arguments) {}": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "arguments", + "range": [ + 28, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 39, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 21, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "finalizer": null, + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", "errors": [ + { + "index": 37, + "lineNumber": 1, + "column": 38, + "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; var eval;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "init": null, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", "errors": [ + { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; var arguments;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "init": null, + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", "errors": [ + { + "index": 27, + "lineNumber": 1, + "column": 28, + "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; eval = 0;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "eval", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", "errors": [ + { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" + } + ] + }, + "\"use strict\"; eval++;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "prefix": false, + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", "errors": [ + { + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + } + ] + }, + "\"use strict\"; --eval;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "prefix": true, + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "sourceType": "script", "errors": [ + { + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + } + ] + }, + "\"use strict\"; arguments = 0;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "arguments", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 14, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 14, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "sourceType": "script", "errors": [ + { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" + } + ] + }, + "\"use strict\"; arguments--;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "prefix": false, + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 14, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" + } + ] + }, + "\"use strict\"; ++arguments;": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "prefix": true, + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 14, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "sourceType": "script", "errors": [ + { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" + } + ] + }, + "\"use strict\";x={y:1,y:1}": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "value": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "init", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "value": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "kind": "init", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "sourceType": "script", "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" + } + ] + }, + "\"use strict\"; function eval() {};": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "sourceType": "script", "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; function arguments() {};": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; function interface() {};": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "interface", + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 35, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "sourceType": "script", "errors": [ + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Use of future reserved word in strict mode" + } + ] + }, + "\"use strict\"; (function eval() {});": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 14, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "sourceType": "script", "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; (function arguments() {});": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 14, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" + } + ] + }, + "\"use strict\"; (function interface() {});": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "interface", + "range": [ + 24, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 14, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "sourceType": "script", "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Use of future reserved word in strict mode" + } + ] + }, + "\"use strict\"; function f(eval) {};": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "sourceType": "script", "errors": [ + { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ] + }, + "\"use strict\"; function f(arguments) {};": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "arguments", + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", "errors": [ + { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ] + }, + "\"use strict\"; function f(foo, foo) {};": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "foo", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "foo", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 36, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 14, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "sourceType": "script", "errors": [ + { + "index": 31, + "lineNumber": 1, + "column": 32, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + } + ] + }, + "\"use strict\"; (function f(eval) {});": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", "errors": [ + { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ] + }, + "\"use strict\"; (function f(arguments) {});": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "arguments", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", "errors": [ + { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ] + }, + "\"use strict\"; (function f(foo, foo) {});": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "foo", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "foo", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 15, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "sourceType": "script", "errors": [ + { + "index": 32, + "lineNumber": 1, + "column": 33, + "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" + } + ] + }, + "\"use strict\"; x = { set f(eval) {} }": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "f", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "set", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 18, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "sourceType": "script", "errors": [ + { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" + } + ] + }, + "function hello() { \"octal directive\\1\"; \"use strict\"; }": { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "hello", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "octal directive\u0001", + "raw": "\"octal directive\\1\"", + "range": [ + 19, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 19, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 40, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + "range": [ + 40, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 53 + } + } + } + ], + "range": [ + 17, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "sourceType": "script", "errors": [ + { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ] + }, + "\"\\1\"; 'use strict';": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "\u0001", + "raw": "\"\\1\"", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "'use strict'", + "range": [ + 6, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "sourceType": "script", "errors": [ + { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ] + }, + "\"use strict\"; var x = { 014: 3}": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": 12, + "raw": "014", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "value": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "kind": "init", + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 18, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "script", "errors": [ + { + "index": 24, + "lineNumber": 1, + "column": 25, + "message": "Error: Line 1: Octal literals are not allowed in strict mode." + } + ] + }, + "\"use strict\"; var x = { get i() {}, get i() {} }": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "kind": "get", + "range": [ + 24, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 44, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "kind": "get", + "range": [ + 36, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 22, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + "range": [ + 18, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "sourceType": "script", "errors": [ + { + "index": 46, + "lineNumber": 1, + "column": 47, + "message": "Error: Line 1: Object literal may not have multiple get/set accessors with the same name" + } + ] + }, + "\"use strict\"; var x = { i: 42, get i() {} }": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "kind": "init", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 39, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 36, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "kind": "get", + "range": [ + 31, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 22, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 18, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "sourceType": "script", "errors": [ + { + "index": 41, + "lineNumber": 1, + "column": 42, + "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" + } + ] + }, + "\"use strict\"; var x = { set i(x) {}, i: 42 }": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 29, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "kind": "set", + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "method": false, + "shorthand": false, + "computed": false + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "i", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "value": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 40, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "kind": "init", + "range": [ + 37, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 22, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 18, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "kind": "var", + "range": [ + 14, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 44 + } + } + } + ], + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "sourceType": "script", "errors": [ + { + "index": 42, + "lineNumber": 1, + "column": 43, + "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" + } + ] + }, + "foo(\"bar\") = baz": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "foo", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "bar", + "raw": "\"bar\"", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "baz", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", "errors": [ + { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ] + }, + "1 = 2": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "sourceType": "script", "errors": [ + { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ] + }, + "3++": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "prefix": false, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", "errors": [ + { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ] + }, + "--4": { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "sourceType": "script", "errors": [ + { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Error: Line 1: Invalid left-hand side in assignment" + } + ] + }, + "for (5 in []) {}": { + "type": "Program", + "body": [ + { + "type": "ForInStatement", + "left": { + "type": "Literal", + "value": 5, + "raw": "5", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "each": false, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "sourceType": "script", "errors": [ + { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Error: Line 1: Invalid left-hand side in for-in" + } + ] + }, + "var x = /[P QR]/\\g": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/[P QR]/g", + "raw": "/[P QR]/\\g", + "regex": { + "pattern": "[P QR]", + "flags": "g" + }, + "range": [ + 8, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "sourceType": "script", "errors": [ + { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ] + }, + "var x = /[P QR]/\\\\u0067": { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": "/[P QR]/g", + "raw": "/[P QR]/\\\\u0067", + "regex": { + "pattern": "[P QR]", + "flags": "g" + }, + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 4, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", "errors": [ + { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Error: Line 1: Unexpected token ILLEGAL" + }, + { + "index": 23, + "lineNumber": 1, + "column": 24, + "message": "Error: Line 1: Unexpected token ILLEGAL" + } + ] + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json new file mode 100644 index 000000000000..92cf4e639037 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json @@ -0,0 +1,704 @@ +{ + "++x": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "--x": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "prefix": true, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "++eval": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": true, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "--eval": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "eval", + "range": [ + 2, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": true, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "++arguments": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "++", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": true, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "--arguments": { + "type": "ExpressionStatement", + "expression": { + "type": "UpdateExpression", + "operator": "--", + "argument": { + "type": "Identifier", + "name": "arguments", + "range": [ + 2, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "prefix": true, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "+x": { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "+", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "-x": { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "-", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "~x": { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "~", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "!x": { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "prefix": true, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "void x": { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "void", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "prefix": true, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "delete x": { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "delete", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": true, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "typeof x": { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "prefix": true, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json new file mode 100644 index 000000000000..a5e1c1a1ffc9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json @@ -0,0 +1,826 @@ +{ + "var x": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "var x, y;": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": null, + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "init": null, + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "var x = 42": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "var eval = 42, arguments = 42": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "eval", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "arguments", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "init": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "var x = 14, y = 3, z = 1977": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "Literal", + "value": 14, + "raw": "14", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "y", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 12, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "z", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "init": { + "type": "Literal", + "value": 1977, + "raw": "1977", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 19, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "var implements, interface, package": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "implements", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": null, + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "interface", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "init": null, + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "package", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "init": null, + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "var private, protected, public, static": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "private", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "init": null, + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "protected", + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "init": null, + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "public", + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "init": null, + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "static", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "init": null, + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json new file mode 100644 index 000000000000..1dc081ab28ee --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json @@ -0,0 +1,254 @@ +{ + "new \t\u000b\f  ᠎              a": { + "type": "ExpressionStatement", + "expression": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "a", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "arguments": [], + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "{0\n1\r2
3
4}": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "range": [ + 1, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "range": [ + 3, + 5 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "range": [ + 5, + 7 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json new file mode 100644 index 000000000000..a1606c07dd6d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json @@ -0,0 +1,450 @@ +{ + "while (true) { break }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "done: while (true) { break done }": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 19, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 6, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "done: while (true) { break done; }": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "range": [ + 19, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 6, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "__proto__: while (true) { break __proto__; }": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "range": [ + 24, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 11, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json new file mode 100644 index 000000000000..d6fc698816e6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json @@ -0,0 +1,523 @@ +{ + "while (true) { continue; }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "while (true) { continue }": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 7, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": null, + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 13, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "done: while (true) { continue done }": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 21, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 19, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 6, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "done: while (true) { continue done; }": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": { + "type": "Identifier", + "name": "done", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 21, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 19, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 6, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + "__proto__: while (true) { continue __proto__; }": { + "type": "LabeledStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "body": { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ContinueStatement", + "label": { + "type": "Identifier", + "name": "__proto__", + "range": [ + 35, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 26, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "range": [ + 24, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 11, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json new file mode 100644 index 000000000000..db1e5f1a8b9e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json @@ -0,0 +1,19 @@ +{ + "debugger;": { + "type": "DebuggerStatement", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json new file mode 100644 index 000000000000..0e8afbf550ed --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json @@ -0,0 +1,380 @@ +{ + "(function(){ return })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "(function(){ return; })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": null, + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 11, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "(function(){ return x; })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "range": [ + 11, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "(function(){ return x * y })": { + "type": "ExpressionStatement", + "expression": { + "type": "FunctionExpression", + "id": null, + "params": [], + + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "range": [ + 11, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + + "generator": false, + "expression": false, + "range": [ + 1, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json new file mode 100644 index 000000000000..50068e71782f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json @@ -0,0 +1,368 @@ +{ + "switch (x) {}": { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "cases": [], + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "switch (answer) { case 42: hi(); break; }": { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "hi", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "arguments": [], + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 18, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 0, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "switch (answer) { case 42: hi(); break; default: break }": { + "type": "SwitchStatement", + "discriminant": { + "type": "Identifier", + "name": "answer", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "consequent": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "hi", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "arguments": [], + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + } + ], + "range": [ + 18, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "SwitchCase", + "test": null, + "consequent": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 40, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 55 + } + } + } + ], + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json new file mode 100644 index 000000000000..5f673b84354a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json @@ -0,0 +1,202 @@ +{ + "throw x;": { + "type": "ThrowStatement", + "argument": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "throw x * y": { + "type": "ThrowStatement", + "argument": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "throw { message: \"Error\" }": { + "type": "ThrowStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "message", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "Literal", + "value": "Error", + "raw": "\"Error\"", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "kind": "init", + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "method": false, + "shorthand": false, + "computed": false + } + ], + "range": [ + 6, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json new file mode 100644 index 000000000000..0413194c53d8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json @@ -0,0 +1,1080 @@ +{ + "try { } catch (e) { }": { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "finalizer": null, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "try { } catch (eval) { }": { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "eval", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 8, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "finalizer": null, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "try { } catch (arguments) { }": { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "arguments", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 8, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "finalizer": null, + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "try { } catch (e) { say(e) }": { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "say", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 20, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 20, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 8, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "finalizer": null, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "try { } finally { cleanup(stuff) }": { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "handler": null, + "finalizer": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 18, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "stuff", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 18, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "range": [ + 16, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "try { doThat(); } catch (e) { say(e) }": { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "arguments": [], + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "say", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 28, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 18, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "finalizer": null, + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "try { doThat(); } catch (e) { say(e) } finally { cleanup(stuff) }": { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doThat", + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "arguments": [], + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "say", + "range": [ + 30, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "range": [ + 28, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "range": [ + 18, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "finalizer": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 49, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "stuff", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 62 + } + } + } + ], + "range": [ + 49, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 63 + } + } + }, + "range": [ + 49, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 64 + } + } + } + ], + "range": [ + 47, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 65 + } + } + }, + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 65 + } + } + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json new file mode 100644 index 000000000000..6371d7218d63 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json @@ -0,0 +1,339 @@ +{ + "with (x) foo = bar": { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "with (x) foo = bar;": { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "with (x) { foo = bar }": { + "type": "WithStatement", + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 11, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 11, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js new file mode 100644 index 000000000000..68b99c7693bc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js @@ -0,0 +1,242 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 0, + 26 + ], + "body": [ + { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 0, + 26 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 6, + 10 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 6, + 9 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 6, + 7 + ], + "name": "a" + }, + "arguments": [] + }, + "trailingComments": [ + { + "type": "Line", + "value": "comment", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": "comment", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 25, + 26 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.src.js new file mode 100644 index 000000000000..2a6819ff0b13 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.src.js @@ -0,0 +1,4 @@ +{ + a(); + //comment +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js new file mode 100644 index 000000000000..8e81b74f819d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js @@ -0,0 +1,262 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "range": [ + 10, + 30 + ], + "body": [ + { + "type": "IfStatement", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "range": [ + 10, + 30 + ], + "test": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 25, + 26 + ], + "name": "a", + "leadingComments": [ + { + "type": "Block", + "value": " bar ", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ] + }, + "consequent": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "range": [ + 28, + 30 + ], + "body": [] + }, + "alternate": null, + "leadingComments": [ + { + "type": "Block", + "value": " foo ", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " foo ", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Block", + "value": " bar ", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "if", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "range": [ + 10, + 12 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "range": [ + 29, + 30 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.src.js new file mode 100644 index 000000000000..b997605defc4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.src.js @@ -0,0 +1,2 @@ +/* foo */ +if (/* bar */ a) {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js new file mode 100644 index 000000000000..34b376b6f57f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js @@ -0,0 +1,412 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "method1", + "range": [ + 103, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 110, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 103, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 9, + "column": 5 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * this is method1.\n ", + "range": [ + 63, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + } + ], + "static": false + } + ], + "range": [ + 57, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + "range": [ + 51, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + "range": [ + 36, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * this is anonymous class.\n ", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ] + } + ], + "sourceType": "module", + "range": [ + 36, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": "*\n * this is anonymous class.\n ", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n * this is method1.\n ", + "range": [ + 63, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 36, + 42 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 43, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 51, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "method1", + "range": [ + 103, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 8, + "column": 12 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.src.js new file mode 100644 index 000000000000..d0a26e4ede9e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.src.js @@ -0,0 +1,10 @@ +/** + * this is anonymous class. + */ +export default class { + /** + * this is method1. + */ + method1(){ + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js new file mode 100644 index 000000000000..6024712eb5d8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js @@ -0,0 +1,340 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 6, + 28 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 6, + 28 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "range": [ + 10, + 27 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 10, + 13 + ], + "name": "zzz", + "trailingComments": [ + { + "type": "Block", + "value": "aaa", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + ] + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "range": [ + 24, + 27 + ], + "value": 777, + "raw": "777", + "leadingComments": [ + { + "type": "Line", + "value": "foo", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "aaa", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + ] + } + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "Line", + "value": "foo", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Line", + "value": "bar", + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + } + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": "foo", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "aaa", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Line", + "value": "bar", + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "range": [ + 6, + 9 + ] + }, + { + "type": "Identifier", + "value": "zzz", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 10, + 13 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Numeric", + "value": "777", + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "range": [ + 24, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.src.js new file mode 100644 index 000000000000..c49bcf6bcad6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.src.js @@ -0,0 +1,3 @@ +//foo +var zzz /*aaa*/ = 777; +//bar diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js new file mode 100644 index 000000000000..7b842d5cbaac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js @@ -0,0 +1,390 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 60 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 60 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 13, + 60 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 36, + 42 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 36, + 41 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 36, + 39 + ], + "name": "foo" + }, + "arguments": [] + }, + "leadingComments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": " after ", + "range": [ + 47, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Block", + "value": " after ", + "range": [ + 47, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 36, + 39 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 39, + 40 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 59, + 60 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.src.js new file mode 100644 index 000000000000..6cbc4bf61de5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.src.js @@ -0,0 +1,5 @@ +function a() { + /* before */ + foo(); + /* after */ +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js new file mode 100644 index 000000000000..7aa523331587 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js @@ -0,0 +1,318 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 63 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 63 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 13, + 63 + ], + "body": [ + { + "type": "DebuggerStatement", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 36, + 45 + ], + "leadingComments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": " after ", + "range": [ + 50, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Block", + "value": " after ", + "range": [ + 50, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Keyword", + "value": "debugger", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 36, + 44 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 44, + 45 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 62, + 63 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.src.js new file mode 100644 index 000000000000..b292546b44fb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.src.js @@ -0,0 +1,5 @@ +function a() { + /* before */ + debugger; + /* after */ +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js new file mode 100644 index 000000000000..c95b5cd54f38 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js @@ -0,0 +1,319 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 61 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 61 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 13, + 61 + ], + "body": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 36, + 43 + ], + "argument": null, + "leadingComments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": " after ", + "range": [ + 48, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Block", + "value": " after ", + "range": [ + 48, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 36, + 42 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 60, + 61 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.src.js new file mode 100644 index 000000000000..ae67152408fb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.src.js @@ -0,0 +1,5 @@ +function a() { + /* before */ + return; + /* after */ +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js new file mode 100644 index 000000000000..77d7b49b159b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js @@ -0,0 +1,355 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 63 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 63 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 13, + 63 + ], + "body": [ + { + "type": "ThrowStatement", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 36, + 45 + ], + "argument": { + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 42, + 44 + ], + "value": 55, + "raw": "55" + }, + "leadingComments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": " after ", + "range": [ + 50, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " before ", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Block", + "value": " after ", + "range": [ + 50, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Keyword", + "value": "throw", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 36, + 41 + ] + }, + { + "type": "Numeric", + "value": "55", + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 42, + 44 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 44, + 45 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 62, + 63 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.src.js new file mode 100644 index 000000000000..0ebc974917b4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.src.js @@ -0,0 +1,5 @@ +function a() { + /* before */ + throw 55; + /* after */ +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js new file mode 100644 index 000000000000..fe5017ec788d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js @@ -0,0 +1,557 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "range": [ + 0, + 68 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "range": [ + 0, + 68 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "f" + }, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "range": [ + 13, + 68 + ], + "body": [ + { + "type": "WhileStatement", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 30, + 46 + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 37, + 41 + ], + "value": true, + "raw": "true" + }, + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 43, + 46 + ], + "body": [] + }, + "leadingComments": [ + { + "type": "Block", + "value": " infinite ", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ] + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 66 + } + }, + "range": [ + 57, + 66 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + }, + "range": [ + 61, + 65 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + }, + "range": [ + 61, + 65 + ], + "name": "each" + }, + "init": null + } + ], + "kind": "var", + "leadingComments": [ + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Block", + "value": " infinite ", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Block", + "value": " bar ", + "range": [ + 47, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Keyword", + "value": "while", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 30, + 35 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Boolean", + "value": "true", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 37, + 41 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 43, + 44 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "range": [ + 57, + 60 + ] + }, + { + "type": "Identifier", + "value": "each", + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 65 + } + }, + "range": [ + 61, + 65 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 65 + }, + "end": { + "line": 1, + "column": 66 + } + }, + "range": [ + 65, + 66 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 67 + }, + "end": { + "line": 1, + "column": 68 + } + }, + "range": [ + 67, + 68 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.src.js new file mode 100644 index 000000000000..2134f68be4fe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.src.js @@ -0,0 +1 @@ +function f() { /* infinite */ while (true) { } /* bar */ var each; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js new file mode 100644 index 000000000000..fb00392ee840 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js @@ -0,0 +1,775 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 0, + 141 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 0, + 141 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "name": "bar" + }, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "foo" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 18, + 141 + ], + "body": [ + { + "type": "SwitchStatement", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "range": [ + 24, + 139 + ], + "discriminant": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 31, + 34 + ], + "name": "foo" + }, + "cases": [ + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "range": [ + 61, + 68 + ], + "consequent": [], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "range": [ + 66, + 67 + ], + "value": 1, + "raw": "1" + }, + "leadingComments": [ + { + "type": "Line", + "value": " foo", + "range": [ + 46, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + ], + "trailingComments": [ + { + "type": "Line", + "value": " falls through", + "range": [ + 81, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 28 + } + } + } + ] + }, + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 7, + "column": 19 + } + }, + "range": [ + 106, + 133 + ], + "consequent": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 19 + } + }, + "range": [ + 126, + 133 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 18 + } + }, + "range": [ + 126, + 132 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 16 + } + }, + "range": [ + 126, + 130 + ], + "name": "doIt" + }, + "arguments": [] + } + } + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "range": [ + 111, + 112 + ], + "value": 2, + "raw": "2" + }, + "leadingComments": [ + { + "type": "Line", + "value": " falls through", + "range": [ + 81, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 28 + } + } + } + ] + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " foo", + "range": [ + 46, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Line", + "value": " falls through", + "range": [ + 81, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 28 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Keyword", + "value": "switch", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 24, + 30 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 31, + 34 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 61, + 65 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "range": [ + 66, + 67 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "range": [ + 67, + 68 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 106, + 110 + ] + }, + { + "type": "Numeric", + "value": "2", + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "range": [ + 111, + 112 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "range": [ + 112, + 113 + ] + }, + { + "type": "Identifier", + "value": "doIt", + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 16 + } + }, + "range": [ + 126, + 130 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 17 + } + }, + "range": [ + 130, + 131 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 18 + } + }, + "range": [ + 131, + 132 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 19 + } + }, + "range": [ + 132, + 133 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "range": [ + 138, + 139 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 140, + 141 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.src.js new file mode 100644 index 000000000000..e71465ae63f7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.src.js @@ -0,0 +1,9 @@ +function bar(foo) { + switch(foo) { + // foo + case 1: + // falls through + case 2: + doIt(); + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js new file mode 100644 index 000000000000..5441cb4ca32d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js @@ -0,0 +1,573 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 0, + 91 + ], + "body": [ + { + "type": "SwitchStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 0, + 91 + ], + "discriminant": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "name": "foo" + }, + "cases": [ + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 29, + 36 + ], + "consequent": [], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 34, + 35 + ], + "value": 1, + "raw": "1" + }, + "leadingComments": [ + { + "type": "Line", + "value": " foo", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "trailingComments": [ + { + "type": "Line", + "value": " falls through", + "range": [ + 45, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ] + }, + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "range": [ + 66, + 89 + ], + "consequent": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "range": [ + 82, + 89 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "range": [ + 82, + 88 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 82, + 86 + ], + "name": "doIt" + }, + "arguments": [] + } + } + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + }, + "range": [ + 71, + 72 + ], + "value": 2, + "raw": "2" + }, + "leadingComments": [ + { + "type": "Line", + "value": " falls through", + "range": [ + 45, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " foo", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Line", + "value": " falls through", + "range": [ + 45, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 29, + 33 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 8 + } + }, + "range": [ + 66, + 70 + ] + }, + { + "type": "Numeric", + "value": "2", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + }, + "range": [ + 71, + 72 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "range": [ + 72, + 73 + ] + }, + { + "type": "Identifier", + "value": "doIt", + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 82, + 86 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "range": [ + 86, + 87 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "range": [ + 87, + 88 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "range": [ + 88, + 89 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 90, + 91 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.src.js new file mode 100644 index 000000000000..3b8bb8eed40d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.src.js @@ -0,0 +1,7 @@ +switch(foo) { + // foo + case 1: + // falls through + case 2: + doIt(); +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js new file mode 100644 index 000000000000..416a8a21da7f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js @@ -0,0 +1,701 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 0, + 133 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 0, + 133 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "name": "bar" + }, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "a" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 16, + 133 + ], + "body": [ + { + "type": "SwitchStatement", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "range": [ + 22, + 131 + ], + "discriminant": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 30, + 31 + ], + "name": "a" + }, + "cases": [ + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "range": [ + 43, + 69 + ], + "consequent": [ + { + "type": "BreakStatement", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "range": [ + 63, + 69 + ], + "label": null + } + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 48, + 49 + ], + "value": 2, + "raw": "2" + } + }, + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "range": [ + 78, + 104 + ], + "consequent": [ + { + "type": "BreakStatement", + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "range": [ + 98, + 104 + ], + "label": null + } + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 83, + 84 + ], + "value": 1, + "raw": "1" + }, + "trailingComments": [ + { + "type": "Line", + "value": "no default", + "range": [ + 113, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ] + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": "no default", + "range": [ + 113, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Keyword", + "value": "switch", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 22, + 28 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 43, + 47 + ] + }, + { + "type": "Numeric", + "value": "2", + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 48, + 49 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 49, + 50 + ] + }, + { + "type": "Keyword", + "value": "break", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "range": [ + 63, + 68 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "range": [ + 68, + 69 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 78, + 82 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 83, + 84 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "range": [ + 84, + 85 + ] + }, + { + "type": "Keyword", + "value": "break", + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 17 + } + }, + "range": [ + 98, + 103 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "range": [ + 103, + 104 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + }, + "range": [ + 130, + 131 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 132, + 133 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.src.js new file mode 100644 index 000000000000..80983bd211ab --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.src.js @@ -0,0 +1,9 @@ +function bar(a) { + switch (a) { + case 2: + break; + case 1: + break; + //no default + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js new file mode 100644 index 000000000000..53ce0a5f8e36 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js @@ -0,0 +1,1588 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 2 + } + }, + "range": [ + 0, + 287 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 2 + } + }, + "range": [ + 0, + 287 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + }, + "range": [ + 0, + 286 + ], + "operator": "=", + "left": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "name": "module" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ], + "name": "exports" + }, + "computed": false + }, + "right": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 12, + "column": 1 + } + }, + "range": [ + 17, + 286 + ], + "id": null, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 26, + 33 + ], + "name": "context" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 12, + "column": 1 + } + }, + "range": [ + 35, + 286 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + }, + "range": [ + 42, + 283 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "range": [ + 51, + 61 + ], + "name": "isConstant" + }, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "range": [ + 62, + 66 + ], + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 10, + "column": 5 + } + }, + "range": [ + 68, + 283 + ], + "body": [ + { + "type": "SwitchStatement", + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "range": [ + 78, + 255 + ], + "discriminant": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "range": [ + 86, + 95 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "range": [ + 86, + 90 + ], + "name": "node" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "range": [ + 91, + 95 + ], + "name": "type" + }, + "computed": false + }, + "cases": [ + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 6, + "column": 81 + } + }, + "range": [ + 111, + 219 + ], + "consequent": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 81 + } + }, + "range": [ + 154, + 219 + ], + "argument": { + "type": "CallExpression", + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 80 + } + }, + "range": [ + 161, + 218 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 33 + } + }, + "range": [ + 161, + 171 + ], + "name": "isConstant" + }, + "arguments": [ + { + "type": "MemberExpression", + "loc": { + "start": { + "line": 6, + "column": 34 + }, + "end": { + "line": 6, + "column": 79 + } + }, + "range": [ + 172, + 217 + ], + "object": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 6, + "column": 34 + }, + "end": { + "line": 6, + "column": 50 + } + }, + "range": [ + 172, + 188 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 34 + }, + "end": { + "line": 6, + "column": 38 + } + }, + "range": [ + 172, + 176 + ], + "name": "node" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 50 + } + }, + "range": [ + 177, + 188 + ], + "name": "expressions" + }, + "computed": false + }, + "property": { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 6, + "column": 51 + }, + "end": { + "line": 6, + "column": 78 + } + }, + "range": [ + 189, + 216 + ], + "left": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 6, + "column": 51 + }, + "end": { + "line": 6, + "column": 74 + } + }, + "range": [ + 189, + 212 + ], + "object": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 6, + "column": 51 + }, + "end": { + "line": 6, + "column": 67 + } + }, + "range": [ + 189, + 205 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 51 + }, + "end": { + "line": 6, + "column": 55 + } + }, + "range": [ + 189, + 193 + ], + "name": "node" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 56 + }, + "end": { + "line": 6, + "column": 67 + } + }, + "range": [ + 194, + 205 + ], + "name": "expressions" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 68 + }, + "end": { + "line": 6, + "column": 74 + } + }, + "range": [ + 206, + 212 + ], + "name": "length" + }, + "computed": false + }, + "operator": "-", + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 6, + "column": 77 + }, + "end": { + "line": 6, + "column": 78 + } + }, + "range": [ + 215, + 216 + ], + "value": 1, + "raw": "1" + } + }, + "computed": true + } + ] + } + } + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 37 + } + }, + "range": [ + 116, + 136 + ], + "value": "SequenceExpression", + "raw": "\"SequenceExpression\"" + }, + "trailingComments": [ + { + "type": "Line", + "value": " no default", + "range": [ + 232, + 245 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 25 + } + } + } + ] + } + ] + }, + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 21 + } + }, + "range": [ + 264, + 277 + ], + "argument": { + "type": "Literal", + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 20 + } + }, + "range": [ + 271, + 276 + ], + "value": false, + "raw": "false" + }, + "leadingComments": [ + { + "type": "Line", + "value": " no default", + "range": [ + 232, + 245 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 25 + } + } + } + ] + } + ] + }, + "expression": false, + "generator": false + } + ] + }, + "expression": false, + "generator": false + } + } + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": " no default", + "range": [ + 232, + 245 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 25 + } + } + } + ], + "tokens": [ + { + "type": "Identifier", + "value": "module", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "exports", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 17, + 25 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Identifier", + "value": "context", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 26, + 33 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "range": [ + 42, + 50 + ] + }, + { + "type": "Identifier", + "value": "isConstant", + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "range": [ + 51, + 61 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "range": [ + 61, + 62 + ] + }, + { + "type": "Identifier", + "value": "node", + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "range": [ + 62, + 66 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "range": [ + 66, + 67 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "range": [ + 68, + 69 + ] + }, + { + "type": "Keyword", + "value": "switch", + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "range": [ + 78, + 84 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "range": [ + 85, + 86 + ] + }, + { + "type": "Identifier", + "value": "node", + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "range": [ + 86, + 90 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "range": [ + 90, + 91 + ] + }, + { + "type": "Identifier", + "value": "type", + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "range": [ + 91, + 95 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + }, + "range": [ + 95, + 96 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "range": [ + 97, + 98 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 16 + } + }, + "range": [ + 111, + 115 + ] + }, + { + "type": "String", + "value": "\"SequenceExpression\"", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 37 + } + }, + "range": [ + 116, + 136 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "range": [ + 136, + 137 + ] + }, + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 22 + } + }, + "range": [ + 154, + 160 + ] + }, + { + "type": "Identifier", + "value": "isConstant", + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 33 + } + }, + "range": [ + 161, + 171 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 6, + "column": 34 + } + }, + "range": [ + 171, + 172 + ] + }, + { + "type": "Identifier", + "value": "node", + "loc": { + "start": { + "line": 6, + "column": 34 + }, + "end": { + "line": 6, + "column": 38 + } + }, + "range": [ + 172, + 176 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 39 + } + }, + "range": [ + 176, + 177 + ] + }, + { + "type": "Identifier", + "value": "expressions", + "loc": { + "start": { + "line": 6, + "column": 39 + }, + "end": { + "line": 6, + "column": 50 + } + }, + "range": [ + 177, + 188 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 6, + "column": 50 + }, + "end": { + "line": 6, + "column": 51 + } + }, + "range": [ + 188, + 189 + ] + }, + { + "type": "Identifier", + "value": "node", + "loc": { + "start": { + "line": 6, + "column": 51 + }, + "end": { + "line": 6, + "column": 55 + } + }, + "range": [ + 189, + 193 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 6, + "column": 55 + }, + "end": { + "line": 6, + "column": 56 + } + }, + "range": [ + 193, + 194 + ] + }, + { + "type": "Identifier", + "value": "expressions", + "loc": { + "start": { + "line": 6, + "column": 56 + }, + "end": { + "line": 6, + "column": 67 + } + }, + "range": [ + 194, + 205 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 6, + "column": 67 + }, + "end": { + "line": 6, + "column": 68 + } + }, + "range": [ + 205, + 206 + ] + }, + { + "type": "Identifier", + "value": "length", + "loc": { + "start": { + "line": 6, + "column": 68 + }, + "end": { + "line": 6, + "column": 74 + } + }, + "range": [ + 206, + 212 + ] + }, + { + "type": "Punctuator", + "value": "-", + "loc": { + "start": { + "line": 6, + "column": 75 + }, + "end": { + "line": 6, + "column": 76 + } + }, + "range": [ + 213, + 214 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 6, + "column": 77 + }, + "end": { + "line": 6, + "column": 78 + } + }, + "range": [ + 215, + 216 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 6, + "column": 78 + }, + "end": { + "line": 6, + "column": 79 + } + }, + "range": [ + 216, + 217 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 6, + "column": 79 + }, + "end": { + "line": 6, + "column": 80 + } + }, + "range": [ + 217, + 218 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 80 + }, + "end": { + "line": 6, + "column": 81 + } + }, + "range": [ + 218, + 219 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "range": [ + 254, + 255 + ] + }, + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 14 + } + }, + "range": [ + 264, + 270 + ] + }, + { + "type": "Boolean", + "value": "false", + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 20 + } + }, + "range": [ + 271, + 276 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 21 + } + }, + "range": [ + 276, + 277 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + }, + "range": [ + 282, + 283 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + }, + "range": [ + 285, + 286 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + }, + "range": [ + 286, + 287 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.src.js new file mode 100644 index 000000000000..03508aea0a72 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.src.js @@ -0,0 +1,12 @@ +module.exports = function(context) { + + function isConstant(node) { + switch (node.type) { + case "SequenceExpression": + return isConstant(node.expressions[node.expressions.length - 1]); + // no default + } + return false; + } + +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js new file mode 100644 index 000000000000..0294fcb3817e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js @@ -0,0 +1,353 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 58 + ], + "body": [ + { + "type": "SwitchStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 58 + ], + "discriminant": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "a" + }, + "cases": [ + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 17, + 39 + ], + "consequent": [ + { + "type": "BreakStatement", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 33, + 39 + ], + "label": null + } + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 22, + 23 + ], + "value": 1, + "raw": "1" + }, + "trailingComments": [ + { + "type": "Line", + "value": "no default", + "range": [ + 44, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + ] + } + ] + } + ], + "sourceType": "script", + "comments": [ + { + "type": "Line", + "value": "no default", + "range": [ + 44, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + ], + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 17, + 21 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Keyword", + "value": "break", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 33, + 38 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 57, + 58 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.src.js new file mode 100644 index 000000000000..5febe2bccac5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.src.js @@ -0,0 +1,5 @@ +switch (a) { + case 1: + break; + //no default +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js new file mode 100644 index 000000000000..65354f7e2f68 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + generators: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js new file mode 100644 index 000000000000..8519dad6bb68 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js @@ -0,0 +1,334 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "bar", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 20, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 13, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "static": false + } + ], + "range": [ + 10, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js new file mode 100644 index 000000000000..ca3360a7460b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js @@ -0,0 +1,4 @@ +class Foo { + *bar() { + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js new file mode 100644 index 000000000000..b8d550c328bd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + generators: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js new file mode 100644 index 000000000000..561edb151345 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js @@ -0,0 +1,442 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Symbol", + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "iterator", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 15, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 34, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 31, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + "kind": "method", + "computed": true, + "range": [ + 13, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "static": false + } + ], + "range": [ + 10, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "Symbol", + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "iterator", + "range": [ + 22, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js new file mode 100644 index 000000000000..7646f9fecfee --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js @@ -0,0 +1,4 @@ +class Foo { + *[Symbol.iterator]() { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js new file mode 100644 index 000000000000..93e315c3fb1b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + generators: false +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js new file mode 100644 index 000000000000..4b195c07a466 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 16, + "lineNumber": 2, + "column": 5, + "message": "Unexpected token *" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js new file mode 100644 index 000000000000..a35a8c89aa95 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js @@ -0,0 +1,4 @@ +class Foo { + *bar() { + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js new file mode 100644 index 000000000000..0fcd9d994938 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js @@ -0,0 +1,5 @@ +module.exports = { + classes: false, + objectLiteralShorthandMethods: false, + generators: false +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js new file mode 100644 index 000000000000..28e10338f64b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 0, + "lineNumber": 1, + "column": 1, + "message": "Unexpected reserved word" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js new file mode 100644 index 000000000000..a35a8c89aa95 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js @@ -0,0 +1,4 @@ +class Foo { + *bar() { + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js new file mode 100644 index 000000000000..93e315c3fb1b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + generators: false +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js new file mode 100644 index 000000000000..8e587ffdd601 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 20, + "lineNumber": 2, + "column": 9, + "message": "Unexpected token *" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js new file mode 100644 index 000000000000..24da58ebf114 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js @@ -0,0 +1,4 @@ +class Foo { + static *bar() { + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js new file mode 100644 index 000000000000..65354f7e2f68 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + generators: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js new file mode 100644 index 000000000000..e90ba96dd87b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js @@ -0,0 +1,352 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 13, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "static": true + } + ], + "range": [ + 10, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js new file mode 100644 index 000000000000..24da58ebf114 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js @@ -0,0 +1,4 @@ +class Foo { + static *bar() { + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js new file mode 100644 index 000000000000..6b23d86af28a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js @@ -0,0 +1,4 @@ +module.exports = { + defaultParams: true, + arrowFunctions: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js new file mode 100644 index 000000000000..b243043867ab --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js @@ -0,0 +1,460 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "c", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js new file mode 100644 index 000000000000..1ddfc6d19249 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js @@ -0,0 +1 @@ +(a, b=(c)=>{}) => {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js new file mode 100644 index 000000000000..6b23d86af28a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js @@ -0,0 +1,4 @@ +module.exports = { + defaultParams: true, + arrowFunctions: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js new file mode 100644 index 000000000000..87788d2e861c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js @@ -0,0 +1,349 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "right": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "body": { + "type": "BinaryExpression", + "operator": "*", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js new file mode 100644 index 000000000000..b331559eacd7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js @@ -0,0 +1 @@ +(x=1) => x * x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js new file mode 100644 index 000000000000..6b23d86af28a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js @@ -0,0 +1,4 @@ +module.exports = { + defaultParams: true, + arrowFunctions: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js new file mode 100644 index 000000000000..95e002336273 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js @@ -0,0 +1,332 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js new file mode 100644 index 000000000000..404864045043 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js @@ -0,0 +1 @@ +(eval, a = 10) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js new file mode 100644 index 000000000000..6b23d86af28a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js @@ -0,0 +1,4 @@ +module.exports = { + defaultParams: true, + arrowFunctions: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js new file mode 100644 index 000000000000..03b1de5e43b1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js @@ -0,0 +1,278 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "body": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "eval", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Numeric", + "value": "42", + "range": [ + 15, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js new file mode 100644 index 000000000000..136339954fe9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js @@ -0,0 +1 @@ +(eval = 10) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js new file mode 100644 index 000000000000..3e5bd9b5d12d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js @@ -0,0 +1,5 @@ +module.exports = { + defaultParams: true, + arrowFunctions: true, + generators: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js new file mode 100644 index 000000000000..bf1cc87d4495 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js @@ -0,0 +1,459 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "yield" + }, + "range": [ + 17, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 16, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 16, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 14, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "yield", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js new file mode 100644 index 000000000000..fafac7f8064c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js @@ -0,0 +1 @@ +function *g() { (x = yield) => {} } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js new file mode 100644 index 000000000000..bb2224135c4f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js @@ -0,0 +1,260 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js new file mode 100644 index 000000000000..c2f38722e62b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js @@ -0,0 +1 @@ +([y]) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js new file mode 100644 index 000000000000..ffa6bf69f3f4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js @@ -0,0 +1,369 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js new file mode 100644 index 000000000000..75bb19b495b8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js @@ -0,0 +1 @@ +([y, [x]]) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js new file mode 100644 index 000000000000..b12cd6a926ca --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js @@ -0,0 +1,594 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "value": { + "type": "Identifier", + "name": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "value": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "value": { + "type": "Identifier", + "name": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 13, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 12, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 10, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "range": [ + 1, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 2, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js new file mode 100644 index 000000000000..c2a809e04a22 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js @@ -0,0 +1 @@ +({foo: y, a:{bar: x}}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js new file mode 100644 index 000000000000..549b2f507105 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js @@ -0,0 +1,522 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "value": { + "type": "Identifier", + "name": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "value": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "value": { + "type": "Identifier", + "name": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 1, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js new file mode 100644 index 000000000000..177cd72468dd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js @@ -0,0 +1 @@ +({y, a:{x}}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js new file mode 100644 index 000000000000..e9bd579742a3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js @@ -0,0 +1,299 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "value": { + "type": "Identifier", + "name": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + } + ], + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js new file mode 100644 index 000000000000..7f6a1fb1436e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js @@ -0,0 +1 @@ +({y}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js new file mode 100644 index 000000000000..f82d26850135 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js @@ -0,0 +1,314 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ArrayPattern", + "elements": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js new file mode 100644 index 000000000000..7fa2d1940626 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js @@ -0,0 +1 @@ +([x = 10]) => x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js new file mode 100644 index 000000000000..90dec70c4f6e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js @@ -0,0 +1,757 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "value": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "z", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "z", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 10, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "range": [ + 1, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "body": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "z", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 29, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 26, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js new file mode 100644 index 000000000000..410eed8cc78f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js @@ -0,0 +1 @@ +({x = 10, y: { z = 10 }}) => [x, z] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js new file mode 100644 index 000000000000..66e72f8be7f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js new file mode 100644 index 000000000000..4115ffae6036 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js @@ -0,0 +1,353 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 2, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "body": { + "type": "Identifier", + "name": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js new file mode 100644 index 000000000000..c6b403750620 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js @@ -0,0 +1 @@ +({x = 10}) => x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js new file mode 100644 index 000000000000..6256cf3759b5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js new file mode 100644 index 000000000000..a18b273865b3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js @@ -0,0 +1,258 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "const", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js new file mode 100644 index 000000000000..0ff51d044822 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js @@ -0,0 +1 @@ +const [a] = []; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js new file mode 100644 index 000000000000..6256cf3759b5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js new file mode 100644 index 000000000000..cd35dfa56c76 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js @@ -0,0 +1,258 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "kind": "let", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js new file mode 100644 index 000000000000..c705f581d5a1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js @@ -0,0 +1 @@ +let [a] = []; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js new file mode 100644 index 000000000000..6256cf3759b5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js new file mode 100644 index 000000000000..e4e5349f54fc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js @@ -0,0 +1,333 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 6, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "kind": "const", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js new file mode 100644 index 000000000000..67a0d1a4e9c7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js @@ -0,0 +1 @@ +const {a:b} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js new file mode 100644 index 000000000000..6256cf3759b5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js new file mode 100644 index 000000000000..797767742fe0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js @@ -0,0 +1,297 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "const", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js new file mode 100644 index 000000000000..80b78cb8d264 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js @@ -0,0 +1 @@ +const {a} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js new file mode 100644 index 000000000000..6256cf3759b5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js new file mode 100644 index 000000000000..08a692cd9861 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js @@ -0,0 +1,333 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "let", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js new file mode 100644 index 000000000000..53b1654cb828 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js @@ -0,0 +1 @@ +let {a:b} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js new file mode 100644 index 000000000000..6256cf3759b5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js new file mode 100644 index 000000000000..fe8c833f3fd2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js @@ -0,0 +1,297 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "kind": "let", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js new file mode 100644 index 000000000000..51c02f8b6ed1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js @@ -0,0 +1 @@ +let {a} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js new file mode 100644 index 000000000000..b549aa41da36 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js @@ -0,0 +1,4 @@ +module.exports = { + defaultParams: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js new file mode 100644 index 000000000000..c8c278a56b90 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js @@ -0,0 +1,440 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 11, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js new file mode 100644 index 000000000000..b233ca5bd452 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js @@ -0,0 +1 @@ +function f([x] = [1]) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js new file mode 100644 index 000000000000..0642270c4aa5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js @@ -0,0 +1,5 @@ +module.exports = { + defaultParams: true, + destructuring: true, + objectLiteralShorthandMethods: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js new file mode 100644 index 000000000000..1a1299bb6ea5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js @@ -0,0 +1,649 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "f", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "value": { + "type": "Identifier", + "name": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + } + ], + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "value": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 11, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": false, + "range": [ + 2, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js new file mode 100644 index 000000000000..0821397f396c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js @@ -0,0 +1 @@ +({f({x} = {x: 10}) {}}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js new file mode 100644 index 000000000000..b549aa41da36 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js @@ -0,0 +1,4 @@ +module.exports = { + defaultParams: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js new file mode 100644 index 000000000000..ee4ffedaca35 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js @@ -0,0 +1,140 @@ +module.exports = { + "type": "Program", + "body": [ + { + type: 'ExpressionStatement', + expression: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'f', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'ObjectPattern', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'x', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + value: { + type: 'Identifier', + name: 'x', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + kind: 'init', + method: false, + shorthand: true, + computed: false, + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }], + range: [14, 17], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 17 } + } + }], + defaults: [{ + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'x', + range: [21, 22], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + } + }, + value: { + type: 'Literal', + value: 10, + raw: '10', + range: [24, 26], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 26 } + } + }, + kind: 'init', + method: false, + shorthand: false, + computed: false, + range: [21, 26], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 26 } + } + }], + range: [20, 27], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 27 } + } + }], + body: { + type: 'BlockStatement', + body: [], + range: [29, 31], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 31 } + } + }, + rest: null, + generator: false, + expression: false, + range: [5, 31], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 31 } + } + }, + kind: 'init', + method: false, + shorthand: false, + computed: false, + range: [2, 31], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 31 } + } + }], + range: [1, 32], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 32 } + } + }, + range: [0, 33], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 33 } + } + } + ] +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs new file mode 100644 index 000000000000..1740302f8291 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs @@ -0,0 +1 @@ +({f: function({x} = {x: 10}) {}}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js new file mode 100644 index 000000000000..b549aa41da36 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js @@ -0,0 +1,4 @@ +module.exports = { + defaultParams: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js new file mode 100644 index 000000000000..eff80734859b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js @@ -0,0 +1,591 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "Identifier", + "name": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "value": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 19, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 13, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "tokens": [ + { + "type": "Identifier", + "value": "f", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 4, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js new file mode 100644 index 000000000000..753d7b471310 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js @@ -0,0 +1 @@ +f = function({x} = {x: 10}) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js new file mode 100644 index 000000000000..f407ad5aee4c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js @@ -0,0 +1,4 @@ +module.exports = { + destructuring: true, + experimentalObjectRestSpread: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js new file mode 100644 index 000000000000..96d8256364fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Unexpected token ." +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js new file mode 100644 index 000000000000..a38d92cf9298 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js @@ -0,0 +1 @@ +var { x, y, ...foo.bar } = { x: 1, y: 2, a: 3, b: 4 }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js new file mode 100644 index 000000000000..f407ad5aee4c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js @@ -0,0 +1,4 @@ +module.exports = { + destructuring: true, + experimentalObjectRestSpread: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js new file mode 100644 index 000000000000..04af44a06839 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js @@ -0,0 +1,982 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "value": { + "type": "Identifier", + "name": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "value": { + "type": "Identifier", + "name": "y", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "ExperimentalRestProperty", + "argument": { + "type": "Identifier", + "name": "z", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "range": [ + 12, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "value": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "y", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "value": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "value": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 35, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "value": { + "type": "Literal", + "value": 4, + "raw": "4", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 41, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + } + } + } + ], + "range": [ + 21, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "range": [ + 4, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js new file mode 100644 index 000000000000..4d733791c65d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js @@ -0,0 +1 @@ +var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js new file mode 100644 index 000000000000..56a38343032a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + forOf: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js new file mode 100644 index 000000000000..85206496a6c9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ForOfStatement", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "foo", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "body": { + "type": "EmptyStatement", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 9, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js new file mode 100644 index 000000000000..7751aeddd636 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js @@ -0,0 +1 @@ +for ([a] of foo); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js new file mode 100644 index 000000000000..dc67f75b492f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js @@ -0,0 +1,496 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "c", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "right": { + "type": "Identifier", + "name": "d", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js new file mode 100644 index 000000000000..a14d109bf05d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js @@ -0,0 +1 @@ +[{ a, b }, ...c] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js new file mode 100644 index 000000000000..15e5387f1f3f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js @@ -0,0 +1,418 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "name": "c", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 7, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "d", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js new file mode 100644 index 000000000000..1a8ecca05ecd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js @@ -0,0 +1 @@ +[a, ...[b, c]] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js new file mode 100644 index 000000000000..25c29996c2f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js @@ -0,0 +1,511 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "params": [ + { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "ok", + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "range": [ + 18, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "range": [ + 11, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "ok", + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js new file mode 100644 index 000000000000..28bec5ed0b4e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js @@ -0,0 +1 @@ +function a([a, b, ...[ok]]) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js new file mode 100644 index 000000000000..b833630af047 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js @@ -0,0 +1,6 @@ +module.exports = { + index: 1, + column: 2, + lineNumber: 1, + message: "Assigning to rvalue" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js new file mode 100644 index 000000000000..eee98799d22b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js @@ -0,0 +1 @@ +[...c, { a, b }] = d; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js new file mode 100644 index 000000000000..d639c8045d5d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js @@ -0,0 +1,309 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js new file mode 100644 index 000000000000..c7f6aa97b292 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js @@ -0,0 +1 @@ +[a, ...b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js new file mode 100644 index 000000000000..c54ecee9697f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js new file mode 100644 index 000000000000..6154cfe049dd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js @@ -0,0 +1 @@ +[...a, ] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js new file mode 100644 index 000000000000..b833630af047 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js @@ -0,0 +1,6 @@ +module.exports = { + index: 1, + column: 2, + lineNumber: 1, + message: "Assigning to rvalue" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js new file mode 100644 index 000000000000..cb9a2a141cc8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js @@ -0,0 +1 @@ +[...a, b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js new file mode 100644 index 000000000000..5e6629e76dcd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js @@ -0,0 +1,255 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js new file mode 100644 index 000000000000..0be6e5d967b2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js @@ -0,0 +1 @@ +[...a] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js new file mode 100644 index 000000000000..bb7d46b4ea0d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js @@ -0,0 +1,516 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ArrayPattern", + "elements": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 5, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "c", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 4, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "init": { + "type": "Identifier", + "name": "d", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 4, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js new file mode 100644 index 000000000000..dabf00dc6ecb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js @@ -0,0 +1 @@ +var [{ a, b }, ...c] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js new file mode 100644 index 000000000000..b75cd2d5287f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js @@ -0,0 +1,438 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "b", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "name": "c", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 11, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "range": [ + 4, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "init": { + "type": "Identifier", + "name": "d", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 4, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js new file mode 100644 index 000000000000..ed56a2030533 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js @@ -0,0 +1 @@ +var [a, ...[b, c]] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js new file mode 100644 index 000000000000..ec1b7c6724ea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js @@ -0,0 +1,329 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "init": { + "type": "Identifier", + "name": "c", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js new file mode 100644 index 000000000000..897bcba9d9b1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js @@ -0,0 +1 @@ +var [a, ...b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js new file mode 100644 index 000000000000..c93db2bb065a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js @@ -0,0 +1,4 @@ +module.exports = { + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js new file mode 100644 index 000000000000..7498e1cb6cb5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js @@ -0,0 +1,275 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "ArrayPattern", + "elements": [ + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "a", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": { + "type": "Identifier", + "name": "b", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js new file mode 100644 index 000000000000..e6dc8d642048 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js @@ -0,0 +1 @@ +var [...a] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js new file mode 100644 index 000000000000..eb87cca63057 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js @@ -0,0 +1,4 @@ +module.exports = { + forOf: true, + blockBindings: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js new file mode 100644 index 000000000000..4c190b97489a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js @@ -0,0 +1,364 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ForOfStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": null, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "let", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doSomething", + "range": [ + 23, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "arguments": [], + "range": [ + 23, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 23, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "doSomething", + "range": [ + 23, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js new file mode 100644 index 000000000000..7d9d367e23a0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js @@ -0,0 +1,2 @@ +for (let x of foo) + doSomething(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js new file mode 100644 index 000000000000..eb87cca63057 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js @@ -0,0 +1,4 @@ +module.exports = { + forOf: true, + blockBindings: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js new file mode 100644 index 000000000000..4c190b97489a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js @@ -0,0 +1,364 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ForOfStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "init": null, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "kind": "let", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "doSomething", + "range": [ + 23, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "arguments": [], + "range": [ + 23, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + "range": [ + 23, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "for", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 11, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "doSomething", + "range": [ + 23, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js new file mode 100644 index 000000000000..7d9d367e23a0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js @@ -0,0 +1,2 @@ +for (let x of foo) + doSomething(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js new file mode 100644 index 000000000000..4e67c7999a3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js new file mode 100644 index 000000000000..92936e7cf474 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js @@ -0,0 +1,223 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "init": { + "type": "Literal", + "value": 3, + "raw": "3", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "kind": "const", + "range": [ + 7, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js new file mode 100644 index 000000000000..0146d2af06d6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js @@ -0,0 +1 @@ +export const foo = 3; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js new file mode 100644 index 000000000000..4e67c7999a3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js new file mode 100644 index 000000000000..a302a9045b79 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js @@ -0,0 +1,222 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 19, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "kind": "const", + "range": [ + 7, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js new file mode 100644 index 000000000000..5a76a5bcfab7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js @@ -0,0 +1 @@ +export const foo = {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js new file mode 100644 index 000000000000..4e67c7999a3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js new file mode 100644 index 000000000000..82d22d706a0b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js @@ -0,0 +1,223 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": { + "type": "Literal", + "value": 2, + "raw": "2", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "kind": "let", + "range": [ + 7, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js new file mode 100644 index 000000000000..a3bcdb0d8122 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js @@ -0,0 +1 @@ +export let foo = 2; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js new file mode 100644 index 000000000000..4e67c7999a3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js new file mode 100644 index 000000000000..c4f1c05cd9b2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js @@ -0,0 +1,222 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 11, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "kind": "let", + "range": [ + 7, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js new file mode 100644 index 000000000000..12613c647f39 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js @@ -0,0 +1 @@ +export let foo = {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js new file mode 100644 index 000000000000..4e67c7999a3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js @@ -0,0 +1,4 @@ +module.exports = { + blockBindings: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js new file mode 100644 index 000000000000..0313428a124b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js @@ -0,0 +1,169 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "init": null, + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "kind": "let", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js new file mode 100644 index 000000000000..c2aed8a392ad --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js @@ -0,0 +1 @@ +export let bar; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js new file mode 100644 index 000000000000..dccb693a66d0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js new file mode 100644 index 000000000000..b2579354d258 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js @@ -0,0 +1,254 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": null, + "superClass": { + "type": "Identifier", + "name": "bar", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 15, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js new file mode 100644 index 000000000000..97e4cc63d048 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js @@ -0,0 +1 @@ +export default class extends bar {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js new file mode 100644 index 000000000000..dccb693a66d0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js new file mode 100644 index 000000000000..707bc8108009 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js @@ -0,0 +1,201 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 21, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js new file mode 100644 index 000000000000..b8260ae06fcc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js @@ -0,0 +1 @@ +export default class {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js new file mode 100644 index 000000000000..dccb693a66d0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js new file mode 100644 index 000000000000..659b026d937f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js @@ -0,0 +1,289 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "superClass": { + "type": "Identifier", + "name": "bar", + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 37, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 15, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 25, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js new file mode 100644 index 000000000000..dfdd2554f233 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js @@ -0,0 +1 @@ +export default class foo extends bar {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js new file mode 100644 index 000000000000..dccb693a66d0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js new file mode 100644 index 000000000000..96465b5e661b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js @@ -0,0 +1,236 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js new file mode 100644 index 000000000000..b9b30a7d5926 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js @@ -0,0 +1 @@ +export default class foo {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js new file mode 100644 index 000000000000..dccb693a66d0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js new file mode 100644 index 000000000000..0384f1371458 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "superClass": { + "type": "Identifier", + "name": "bar", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "range": [ + 7, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js new file mode 100644 index 000000000000..abbbd194cf56 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js @@ -0,0 +1 @@ +export class foo extends bar {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js new file mode 100644 index 000000000000..dccb693a66d0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js @@ -0,0 +1,4 @@ +module.exports = { + classes: true, + modules: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js new file mode 100644 index 000000000000..628a1cc96524 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js @@ -0,0 +1,220 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 7, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "EmptyStatement", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js new file mode 100644 index 000000000000..2d677350efdd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js @@ -0,0 +1 @@ +export class foo {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js new file mode 100644 index 000000000000..4dc6605483f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralDuplicateProperties: true, + objectLiteralComputedProperties: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js new file mode 100644 index 000000000000..14a6d40ae203 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js @@ -0,0 +1,1083 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "proto", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "range": [ + 19, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + ], + "kind": "var", + "range": [ + 15, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"", + "range": [ + 44, + 55 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "value": { + "type": "Identifier", + "name": "proto", + "range": [ + 58, + 63 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": true, + "range": [ + 43, + 63 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Property", + "key": { + "type": "Literal", + "value": "__proto__", + "raw": "\"__proto__\"", + "range": [ + 67, + 78 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "value": { + "type": "Identifier", + "name": "proto", + "range": [ + 81, + 86 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": true, + "range": [ + 66, + 86 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Property", + "key": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Literal", + "value": "__", + "raw": "\"__\"", + "range": [ + 90, + 94 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + "right": { + "type": "Literal", + "value": "proto", + "raw": "\"proto\"", + "range": [ + 97, + 104 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "range": [ + 90, + 104 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "right": { + "type": "Literal", + "value": "__", + "raw": "\"__\"", + "range": [ + 107, + 111 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "range": [ + 90, + 111 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "value": { + "type": "Identifier", + "name": "proto", + "range": [ + 114, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": true, + "range": [ + 89, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 31 + } + } + } + ], + "range": [ + 40, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + "range": [ + 36, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 9, + "column": 1 + } + } + } + ], + "kind": "var", + "range": [ + 32, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 122 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "proto", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 44, + 55 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "proto", + "range": [ + 58, + 63 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"__proto__\"", + "range": [ + 67, + 78 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "proto", + "range": [ + 81, + 86 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "String", + "value": "\"__\"", + "range": [ + 90, + 94 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "String", + "value": "\"proto\"", + "range": [ + 97, + 104 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "String", + "value": "\"__\"", + "range": [ + 107, + 111 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "proto", + "range": [ + 114, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js new file mode 100644 index 000000000000..d7fc93f96b07 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js @@ -0,0 +1,9 @@ +"use strict"; + +var proto = {}; + +var x = { + ["__proto__"]: proto, + ["__proto__"]: proto, + ["__" + "proto" + "__"]: proto +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js new file mode 100644 index 000000000000..695d353ec6af --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralShorthandMethods: true, + defaultParams: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js new file mode 100644 index 000000000000..7796c83e4ecc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js @@ -0,0 +1,1305 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "Literal", + "value": "use strict", + "raw": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "baz", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "a", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 11 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 38, + 40 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 29, + 40 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": false, + "range": [ + 26, + 40 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 54, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 14 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 58, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 46, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": false, + "range": [ + 43, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "toast", + "range": [ + 63, + 68 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "name": "b", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "right": { + "type": "Literal", + "value": 10, + "raw": "10", + "range": [ + 76, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + "range": [ + 72, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "c", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 83, + 85 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 68, + 85 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": false, + "range": [ + 63, + 85 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 23 + } + } + } + ], + "range": [ + 23, + 87 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + "range": [ + 19, + 87 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 7, + "column": 1 + } + } + } + ], + "kind": "var", + "range": [ + 15, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 7, + "column": 2 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 88 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 34, + 36 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 54, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "toast", + "range": [ + 63, + 68 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "10", + "range": [ + 76, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js new file mode 100644 index 000000000000..b196d3234c1e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js @@ -0,0 +1,7 @@ +"use strict"; + +var x = { + baz(a = 10) {}, + foo(a, b = 10) {}, + toast(a, b = 10, c) {} +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js new file mode 100644 index 000000000000..93bc6ff64bbf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralShorthandMethods: true, + destructuring: true +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js new file mode 100644 index 000000000000..bfcd7212c112 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js @@ -0,0 +1,462 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "x", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 5, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": false, + "range": [ + 3, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 1, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js new file mode 100644 index 000000000000..c78cc0dcc444 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js @@ -0,0 +1 @@ +({ x([ a, b ]){} }); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js new file mode 100644 index 000000000000..a93e5488c7ba --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralShorthandMethods: false, + generators: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js new file mode 100644 index 000000000000..bf0222ccafff --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 10, + "lineNumber": 1, + "column": 11, + "message": "Unexpected token *" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js new file mode 100644 index 000000000000..1ae2612b5515 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js @@ -0,0 +1 @@ +var x = { *test () { yield *v } }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js new file mode 100644 index 000000000000..5555feec4d2f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralShorthandMethods: true, + generators: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js new file mode 100644 index 000000000000..a2685d85aa9d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js @@ -0,0 +1,498 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "test", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "Identifier", + "name": "v", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "delegate": true, + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 16, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": false, + "range": [ + 10, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "range": [ + 8, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 4, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 21, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "v", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js new file mode 100644 index 000000000000..1ae2612b5515 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js @@ -0,0 +1 @@ +var x = { *test () { yield *v } }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js new file mode 100644 index 000000000000..f8d2a83cdd3e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralShorthandMethods: true, + objectLiteralComputedProperties: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js new file mode 100644 index 000000000000..5ec21b4d14de --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js @@ -0,0 +1,498 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 32, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 19 + } + } + } + ], + "range": [ + 22, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 19, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "kind": "init", + "method": true, + "shorthand": false, + "computed": true, + "range": [ + 14, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + } + ], + "range": [ + 8, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "range": [ + 4, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js new file mode 100644 index 000000000000..30e3c778e0b1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js @@ -0,0 +1,5 @@ +var x = { + [foo]() { + return bar; + } +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js new file mode 100644 index 000000000000..a5a7e4d79fe2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js @@ -0,0 +1,4 @@ +module.exports = { + objectLiteralShorthandProperties: true, + experimentalObjectRestSpread: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js new file mode 100644 index 000000000000..c911790dfbea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js @@ -0,0 +1,715 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": null, + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "get", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + "init": null, + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "set", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + "init": null, + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "x", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "foo", + "range": [ + 42, + 45 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "value": { + "type": "Identifier", + "name": "foo", + "range": [ + 42, + 45 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 42, + 45 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "get", + "range": [ + 51, + 54 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "value": { + "type": "Identifier", + "name": "get", + "range": [ + 51, + 54 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 51, + 54 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "ExperimentalSpreadProperty", + "argument": { + "type": "Identifier", + "name": "set", + "range": [ + 63, + 66 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 10 + } + } + } + ], + "range": [ + 36, + 68 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + "range": [ + 32, + 68 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 9, + "column": 1 + } + } + } + ], + "kind": "var", + "range": [ + 28, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 42, + 45 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 51, + 54 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 60, + 63 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 63, + 66 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js new file mode 100644 index 000000000000..11d8c39bfa8b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js @@ -0,0 +1,9 @@ +var foo, + get, + set; + +var x = { + foo, + get, + ...set +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js new file mode 100644 index 000000000000..37664407347f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + restParams: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js new file mode 100644 index 000000000000..3371536ef20c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js @@ -0,0 +1,312 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js new file mode 100644 index 000000000000..09ec648ae18e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js @@ -0,0 +1 @@ +(a, ...b) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js new file mode 100644 index 000000000000..37664407347f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js @@ -0,0 +1,4 @@ +module.exports = { + arrowFunctions: true, + restParams: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js new file mode 100644 index 000000000000..a0a52817347f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js @@ -0,0 +1,258 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js new file mode 100644 index 000000000000..fae03351a18a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js @@ -0,0 +1 @@ +(...a) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js new file mode 100644 index 000000000000..4ef77f98f31f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js @@ -0,0 +1,5 @@ +module.exports = { + arrowFunctions: true, + restParams: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js new file mode 100644 index 000000000000..59a035190b09 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js @@ -0,0 +1,406 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + } + ], + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js new file mode 100644 index 000000000000..9c56a46d6b31 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js @@ -0,0 +1 @@ +({ a }, ...b) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js new file mode 100644 index 000000000000..4ef77f98f31f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js @@ -0,0 +1,5 @@ +module.exports = { + arrowFunctions: true, + restParams: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js new file mode 100644 index 000000000000..355dc59d2efe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js @@ -0,0 +1,698 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "value": { + "type": "Identifier", + "name": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "c", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "value": { + "type": "Identifier", + "name": "c", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "range": [ + 1, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "e", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "f", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 31, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js new file mode 100644 index 000000000000..49f55da3b4c8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js @@ -0,0 +1 @@ +({ a: b, c }, [d, e], ...f) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js new file mode 100644 index 000000000000..4ef77f98f31f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js @@ -0,0 +1,5 @@ +module.exports = { + arrowFunctions: true, + restParams: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js new file mode 100644 index 000000000000..78d2d2bde7d5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js @@ -0,0 +1,551 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "value": { + "type": "ArrayPattern", + "elements": [ + { + "type": "Identifier", + "name": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "name": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ], + "range": [ + 6, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ], + "range": [ + 1, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "RestElement", + "argument": { + "type": "Identifier", + "name": "c", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 25, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js new file mode 100644 index 000000000000..0aa03bd886ff --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js @@ -0,0 +1 @@ +({ a: [a, b] }, ...c) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js new file mode 100644 index 000000000000..4ef77f98f31f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js @@ -0,0 +1,5 @@ +module.exports = { + arrowFunctions: true, + restParams: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js new file mode 100644 index 000000000000..7cb67f68f7fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 11, + "lineNumber": 1, + "column": 12, + "description": "Unexpected token [" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js new file mode 100644 index 000000000000..00c0e530c37b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js @@ -0,0 +1 @@ +(a, ...[b]) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js new file mode 100644 index 000000000000..2cd5f3c10c93 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js @@ -0,0 +1,5 @@ +module.exports = { + arrowFunctions: true, + spread: true, + destructuring: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js new file mode 100644 index 000000000000..376a1438960f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Unexpected token ..." +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js new file mode 100644 index 000000000000..2d0036ad542e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js @@ -0,0 +1 @@ +var x = (a, ...b) => {}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js new file mode 100644 index 000000000000..0ac8d1008be0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js @@ -0,0 +1,4 @@ +module.exports = { + jsx: true, + templateStrings: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js new file mode 100644 index 000000000000..ea75734a95c6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js @@ -0,0 +1,2525 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "React", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "require", + "range": [ + 12, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "react/addons", + "raw": "'react/addons'", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 12, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "range": [ + 4, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 35 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "MyComponent", + "range": [ + 42, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "React", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "createClass", + "range": [ + 62, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + "range": [ + 56, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "render", + "range": [ + 78, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "div", + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 118, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "div", + "range": [ + 242, + 245 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + "range": [ + 240, + 246 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "children": [ + { + "type": "Literal", + "value": "\n ", + "raw": "\n ", + "range": [ + 123, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "div", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "myProp", + "range": [ + 137, + 143 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "value": { + "type": "JSXExpressionContainer", + "expression": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 168, + 170 + ], + "loc": { + "start": { + "line": 7, + "column": 44 + }, + "end": { + "line": 7, + "column": 46 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 148, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "props", + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 34 + } + } + }, + "range": [ + 148, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "something", + "range": [ + 159, + 168 + ], + "loc": { + "start": { + "line": 7, + "column": 35 + }, + "end": { + "line": 7, + "column": 44 + } + } + }, + "range": [ + 148, + 168 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 44 + } + } + } + ], + "range": [ + 145, + 170 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 46 + } + } + }, + "range": [ + 144, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 47 + } + } + }, + "range": [ + 137, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 47 + } + } + } + ], + "range": [ + 132, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 49 + } + } + }, + "closingElement": null, + "children": [], + "range": [ + 132, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 49 + } + } + }, + { + "type": "Literal", + "value": "\n ", + "raw": "\n ", + "range": [ + 173, + 182 + ], + "loc": { + "start": { + "line": 7, + "column": 49 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "div", + "range": [ + 183, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 12 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "differentProp", + "range": [ + 187, + 200 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + "value": { + "type": "JSXExpressionContainer", + "expression": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 202, + 205 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 228, + 230 + ], + "loc": { + "start": { + "line": 8, + "column": 54 + }, + "end": { + "line": 8, + "column": 56 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 205, + 209 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "props", + "range": [ + 210, + 215 + ], + "loc": { + "start": { + "line": 8, + "column": 36 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + "range": [ + 205, + 215 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "anotherThing", + "range": [ + 216, + 228 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 54 + } + } + }, + "range": [ + 205, + 228 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 54 + } + } + } + ], + "range": [ + 202, + 230 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 56 + } + } + }, + "range": [ + 201, + 231 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 57 + } + } + }, + "range": [ + 187, + 231 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 57 + } + } + } + ], + "range": [ + 182, + 233 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 59 + } + } + }, + "closingElement": null, + "children": [], + "range": [ + 182, + 233 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 59 + } + } + }, + { + "type": "Literal", + "value": "\n ", + "raw": "\n ", + "range": [ + 233, + 240 + ], + "loc": { + "start": { + "line": 8, + "column": 59 + }, + "end": { + "line": 9, + "column": 6 + } + } + } + ], + "range": [ + 118, + 246 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 103, + 253 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 10, + "column": 6 + } + } + } + ], + "range": [ + 97, + 257 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 86, + 257 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 78, + 257 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], + "range": [ + 74, + 259 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 12, + "column": 1 + } + } + } + ], + "range": [ + 56, + 260 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + "range": [ + 42, + 260 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 12, + "column": 2 + } + } + } + ], + "kind": "var", + "range": [ + 38, + 261 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "module", + "range": [ + 263, + 269 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "exports", + "range": [ + 270, + 277 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + "range": [ + 263, + 277 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "MyComponent", + "range": [ + 280, + 291 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "range": [ + 263, + 291 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "range": [ + 263, + 292 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 29 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 292 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 29 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "React", + "range": [ + 4, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "require", + "range": [ + 12, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "String", + "value": "'react/addons'", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "MyComponent", + "range": [ + 42, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "React", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "createClass", + "range": [ + 62, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": "Identifier", + "value": "render", + "range": [ + 78, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 103, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 119, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "JSXText", + "value": "\n ", + "range": [ + 123, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 133, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "JSXIdentifier", + "value": "myProp", + "range": [ + 137, + 143 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Template", + "value": "`${", + "range": [ + 145, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 148, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 7, + "column": 28 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "props", + "range": [ + 153, + 158 + ], + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 7, + "column": 34 + }, + "end": { + "line": 7, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "something", + "range": [ + 159, + 168 + ], + "loc": { + "start": { + "line": 7, + "column": 35 + }, + "end": { + "line": 7, + "column": 44 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 168, + 170 + ], + "loc": { + "start": { + "line": 7, + "column": 44 + }, + "end": { + "line": 7, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 46 + }, + "end": { + "line": 7, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 7, + "column": 47 + }, + "end": { + "line": 7, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 48 + }, + "end": { + "line": 7, + "column": 49 + } + } + }, + { + "type": "JSXText", + "value": "\n ", + "range": [ + 173, + 182 + ], + "loc": { + "start": { + "line": 7, + "column": 49 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 183, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 12 + } + } + }, + { + "type": "JSXIdentifier", + "value": "differentProp", + "range": [ + 187, + 200 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Template", + "value": "`${", + "range": [ + 202, + 205 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 205, + 209 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 8, + "column": 35 + }, + "end": { + "line": 8, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "props", + "range": [ + 210, + 215 + ], + "loc": { + "start": { + "line": 8, + "column": 36 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 8, + "column": 41 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": "Identifier", + "value": "anotherThing", + "range": [ + 216, + 228 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 54 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 228, + 230 + ], + "loc": { + "start": { + "line": 8, + "column": 54 + }, + "end": { + "line": 8, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 230, + 231 + ], + "loc": { + "start": { + "line": 8, + "column": 56 + }, + "end": { + "line": 8, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 231, + 232 + ], + "loc": { + "start": { + "line": 8, + "column": 57 + }, + "end": { + "line": 8, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 8, + "column": 58 + }, + "end": { + "line": 8, + "column": 59 + } + } + }, + { + "type": "JSXText", + "value": "\n ", + "range": [ + 233, + 240 + ], + "loc": { + "start": { + "line": 8, + "column": 59 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 240, + 241 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 241, + 242 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 242, + 245 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 252, + 253 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 258, + 259 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 259, + 260 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 260, + 261 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "module", + "range": [ + 263, + 269 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 269, + 270 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "exports", + "range": [ + 270, + 277 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 278, + 279 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "MyComponent", + "range": [ + 280, + 291 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js new file mode 100644 index 000000000000..340bc7245f8b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js @@ -0,0 +1,14 @@ +var React = require('react/addons'); + +var MyComponent = React.createClass({ + render: function() { + return ( +
+
+
+
+ ); + } +}); + +module.exports = MyComponent; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js new file mode 100644 index 000000000000..0ac8d1008be0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js @@ -0,0 +1,4 @@ +module.exports = { + jsx: true, + templateStrings: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js new file mode 100644 index 000000000000..26dbb21e0c9e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js @@ -0,0 +1,560 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + "selfClosing": false, + "attributes": [], + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "closingElement": { + "type": "JSXClosingElement", + "name": { + "type": "JSXIdentifier", + "name": "a", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "expression": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + } + ], + "expressions": [ + { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + } + ], + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "range": [ + 3, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "JSXExpressionContainer", + "expression": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "expressions": [], + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ], + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Template", + "value": "`${", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 8, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Template", + "value": "``", + "range": [ + 12, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js new file mode 100644 index 000000000000..e8f0a6010909 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js @@ -0,0 +1 @@ +{`${1}`}{``} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js new file mode 100644 index 000000000000..0ac8d1008be0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js @@ -0,0 +1,4 @@ +module.exports = { + jsx: true, + templateStrings: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js new file mode 100644 index 000000000000..7293ee259732 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js @@ -0,0 +1,429 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "JSXElement", + "openingElement": { + "type": "JSXOpeningElement", + "name": { + "type": "JSXIdentifier", + "name": "foo", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + "selfClosing": true, + "attributes": [ + { + "type": "JSXAttribute", + "name": { + "type": "JSXIdentifier", + "name": "bar", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "value": { + "type": "JSXExpressionContainer", + "expression": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "baz", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 10, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "range": [ + 9, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + "range": [ + 5, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 19 + } + } + } + ], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "closingElement": null, + "children": [], + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "foo", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXIdentifier", + "value": "bar", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Template", + "value": "`${", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js new file mode 100644 index 000000000000..e3edcd339071 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js @@ -0,0 +1 @@ + diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js new file mode 100644 index 000000000000..34cf505fc9d6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js @@ -0,0 +1,4 @@ +module.exports = { + unicodeCodePointEscapes: true, + templateStrings: true +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js new file mode 100644 index 000000000000..93d224cfd08f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js @@ -0,0 +1,209 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "ts", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "init": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "\\\\u{000042}\\\\u0042\\\\x42\\\\u0\\\\102\\\\A", + "cooked": "\\u{000042}\\u0042\\x42\\u0\\102\\A" + }, + "tail": true, + "range": [ + 9, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "expressions": [], + "range": [ + 9, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + "range": [ + 4, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 46 + } + } + } + ], + "kind": "var", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "ts", + "range": [ + 4, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Template", + "value": "`\\\\u{000042}\\\\u0042\\\\x42\\\\u0\\\\102\\\\A`", + "range": [ + 9, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js new file mode 100644 index 000000000000..165980e6eac5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js @@ -0,0 +1 @@ +var ts = `\\u{000042}\\u0042\\x42\\u0\\102\\A`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js new file mode 100644 index 000000000000..84bb130698eb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js @@ -0,0 +1,368 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "name": "foo" + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "y" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "body": [] + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 11, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.src.js new file mode 100644 index 000000000000..248cc450ad83 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.src.js @@ -0,0 +1 @@ +foo((x, y) => {}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js new file mode 100644 index 000000000000..2221e208724e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js @@ -0,0 +1,277 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "name": "foo" + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ], + "body": [] + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.src.js new file mode 100644 index 000000000000..fffb35c56227 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.src.js @@ -0,0 +1 @@ +foo(() => {}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js new file mode 100644 index 000000000000..2ccbb7643d66 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js @@ -0,0 +1,169 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "id": null, + "generator": false, + "expression": true, + "params": [], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 6, + 12 + ], + "value": "test", + "raw": "\"test\"" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 3, + 5 + ] + }, + { + "type": "String", + "value": "\"test\"", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 6, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.src.js new file mode 100644 index 000000000000..ad0d3df63fe9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.src.js @@ -0,0 +1 @@ +() => "test"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js new file mode 100644 index 000000000000..cdb182883b05 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js @@ -0,0 +1,313 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "e" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 5, + 18 + ], + "body": [ + { + "type": "LabeledStatement", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 7, + 16 + ], + "body": { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "value": 42, + "raw": "42" + } + }, + "label": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 7, + 12 + ], + "name": "label" + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 2, + 4 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Identifier", + "value": "label", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 7, + 12 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.src.js new file mode 100644 index 000000000000..5ee5169b312b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.src.js @@ -0,0 +1 @@ +e => { label: 42 }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js new file mode 100644 index 000000000000..ccbffc2b8484 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js @@ -0,0 +1,260 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "e" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 5, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ], + "value": 42, + "raw": "42" + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 2, + 4 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.src.js new file mode 100644 index 000000000000..f7902e3a3386 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.src.js @@ -0,0 +1 @@ +e => { 42; }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js new file mode 100644 index 000000000000..5d4b9d858619 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Argument name clash" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.src.js new file mode 100644 index 000000000000..38395bd1c5d0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.src.js @@ -0,0 +1 @@ +(a, a) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js new file mode 100644 index 000000000000..310984a68740 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Unexpected token (" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.src.js new file mode 100644 index 000000000000..e17b13c8d6da --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.src.js @@ -0,0 +1 @@ +(a, (b)) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js new file mode 100644 index 000000000000..9b47c568d591 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 26, + "lineNumber": 1, + "column": 27, + "message": "Unexpected token )" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.src.js new file mode 100644 index 000000000000..72cbc0fc5d85 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.src.js @@ -0,0 +1 @@ +left = (aSize.width/2) - () \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js new file mode 100644 index 000000000000..fc83515848ba --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Assigning to rvalue" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.src.js new file mode 100644 index 000000000000..e4b6d3900abb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.src.js @@ -0,0 +1 @@ +(10, 20) => 0; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js new file mode 100644 index 000000000000..fc83515848ba --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Assigning to rvalue" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.src.js new file mode 100644 index 000000000000..0ce82a509cb3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.src.js @@ -0,0 +1 @@ +(10) => 0; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js new file mode 100644 index 000000000000..90dd78ab9316 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Unexpected token )" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.src.js new file mode 100644 index 000000000000..31aa8cee2ae4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.src.js @@ -0,0 +1 @@ +() <= 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js new file mode 100644 index 000000000000..431716c65020 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Assigning to eval in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.src.js new file mode 100644 index 000000000000..4f8c006ac014 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.src.js @@ -0,0 +1 @@ +"use strict"; (eval = 10) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js new file mode 100644 index 000000000000..c3f08bb3211b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Argument name clash" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.src.js new file mode 100644 index 000000000000..f93258b365f4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.src.js @@ -0,0 +1 @@ +"use strict"; (a, a) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js new file mode 100644 index 000000000000..d7e7dda5f6bf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Binding eval in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.src.js new file mode 100644 index 000000000000..4a9a5d2c3010 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.src.js @@ -0,0 +1 @@ +"use strict"; (eval) => 42 \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js new file mode 100644 index 000000000000..f542ae32a6ad --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Binding eval in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.src.js new file mode 100644 index 000000000000..6bba987d7e07 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.src.js @@ -0,0 +1 @@ +(eval) => { "use strict"; 42 } \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js new file mode 100644 index 000000000000..6eedac5c9740 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 21, + "lineNumber": 1, + "column": 22, + "message": "Invalid number" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.src.js new file mode 100644 index 000000000000..e199dc28811f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.src.js @@ -0,0 +1 @@ +"use strict"; (a) => 00; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js new file mode 100644 index 000000000000..875b7471a522 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Binding arguments in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.src.js new file mode 100644 index 000000000000..15617f88e041 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.src.js @@ -0,0 +1 @@ +"use strict"; (arguments, a) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js new file mode 100644 index 000000000000..d7e7dda5f6bf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Binding eval in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.src.js new file mode 100644 index 000000000000..672a5206c66d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.src.js @@ -0,0 +1 @@ +"use strict"; (eval, a) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js new file mode 100644 index 000000000000..d7e7dda5f6bf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Binding eval in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.src.js new file mode 100644 index 000000000000..672a5206c66d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.src.js @@ -0,0 +1 @@ +"use strict"; (eval, a) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js new file mode 100644 index 000000000000..bbdeb9a4725a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Binding arguments in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.src.js new file mode 100644 index 000000000000..40c40bf9436f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.src.js @@ -0,0 +1 @@ +"use strict"; arguments => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js new file mode 100644 index 000000000000..1d1998fa3780 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Binding eval in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.src.js new file mode 100644 index 000000000000..87f875602b53 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.src.js @@ -0,0 +1 @@ +"use strict"; eval => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js new file mode 100644 index 000000000000..a74418b697cd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Unexpected token )" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.src.js new file mode 100644 index 000000000000..22213ad116bc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.src.js @@ -0,0 +1,2 @@ +var a = () + => 0; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js new file mode 100644 index 000000000000..dce37a901455 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Unexpected token (" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.src.js new file mode 100644 index 000000000000..77cf2b5b8381 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.src.js @@ -0,0 +1 @@ +((a)) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js new file mode 100644 index 000000000000..51eeaeaf3d12 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js @@ -0,0 +1,205 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 1, + 7 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "x" + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 3, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.src.js new file mode 100644 index 000000000000..046e74ece9c3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.src.js @@ -0,0 +1 @@ +(x => x); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js new file mode 100644 index 000000000000..4f81cb16fb32 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js @@ -0,0 +1,336 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "e" + } + ], + "body": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 6, + 22 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 8, + 20 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 8, + 16 + ], + "name": "property" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "value": 42, + "raw": "42" + }, + "kind": "init" + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 2, + 4 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "property", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 8, + 16 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.src.js new file mode 100644 index 000000000000..37a088a0f158 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.src.js @@ -0,0 +1 @@ +e => ({ property: 42 }); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js new file mode 100644 index 000000000000..936fcec2c748 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js @@ -0,0 +1,260 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "b" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "value": "test", + "raw": "\"test\"" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "String", + "value": "\"test\"", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.src.js new file mode 100644 index 000000000000..26ac16e44cfa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.src.js @@ -0,0 +1 @@ +(a, b) => "test"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js new file mode 100644 index 000000000000..c0effed7c807 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js @@ -0,0 +1,350 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "b" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 10, + 17 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "value": 42, + "raw": "42" + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.src.js new file mode 100644 index 000000000000..2c9dd12d0481 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.src.js @@ -0,0 +1 @@ +(a, b) => { 42; }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js new file mode 100644 index 000000000000..56728311cf35 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js @@ -0,0 +1,170 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "name": "arguments" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ], + "value": 42, + "raw": "42" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.src.js new file mode 100644 index 000000000000..7ea5c0a45076 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.src.js @@ -0,0 +1 @@ +arguments => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js new file mode 100644 index 000000000000..b09455900db3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js @@ -0,0 +1,260 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 1, + 5 + ], + "name": "eval" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ], + "value": 42, + "raw": "42" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "eval", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 1, + 5 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.src.js new file mode 100644 index 000000000000..5a51236aa6f8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.src.js @@ -0,0 +1 @@ +(eval, a) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js new file mode 100644 index 000000000000..9c396d94531a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js @@ -0,0 +1,170 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 0, + 4 + ], + "name": "eval" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 8, + 10 + ], + "value": 42, + "raw": "42" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "eval", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 0, + 4 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 5, + 7 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 8, + 10 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.src.js new file mode 100644 index 000000000000..db0c68fe0aef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.src.js @@ -0,0 +1 @@ +eval => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js new file mode 100644 index 000000000000..335364d0c93b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js @@ -0,0 +1,206 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ], + "value": 0, + "raw": "00" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 4, + 6 + ] + }, + { + "type": "Numeric", + "value": "00", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.src.js new file mode 100644 index 000000000000..0e6918d7d43c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.src.js @@ -0,0 +1 @@ +(a) => 00; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js new file mode 100644 index 000000000000..fc4798d0b251 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js @@ -0,0 +1,246 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + } + ], + "body": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 5, + 12 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "y" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ], + "value": 42, + "raw": "42" + } + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 2, + 4 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.src.js new file mode 100644 index 000000000000..535922a77760 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.src.js @@ -0,0 +1 @@ +x => y => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js new file mode 100644 index 000000000000..48a3212fa534 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js @@ -0,0 +1,570 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "x" + } + ], + "body": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 8, + 27 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "y" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "z" + } + ], + "body": { + "type": "SequenceExpression", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 19, + 26 + ], + "expressions": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "x" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "name": "y" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "z" + } + ] + } + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 4, + 6 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.src.js new file mode 100644 index 000000000000..ee165aec01a0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.src.js @@ -0,0 +1 @@ +(x) => ((y, z) => (x, y, z)); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js new file mode 100644 index 000000000000..888b7f32c466 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js @@ -0,0 +1,206 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "e" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 7, + 13 + ], + "value": "test", + "raw": "\"test\"" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "e", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 4, + 6 + ] + }, + { + "type": "String", + "value": "\"test\"", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 7, + 13 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.src.js new file mode 100644 index 000000000000..cf5e9932c5e7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.src.js @@ -0,0 +1 @@ +(e) => "test"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js new file mode 100644 index 000000000000..e8811ef079f7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js @@ -0,0 +1,205 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "sun" + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "name": "earth" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "sun", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ] + }, + { + "type": "Identifier", + "value": "earth", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.src.js new file mode 100644 index 000000000000..fdbaa2c998ee --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.src.js @@ -0,0 +1 @@ +(sun) => earth; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js new file mode 100644 index 000000000000..a6964f0f8241 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js @@ -0,0 +1,170 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "id": null, + "generator": false, + "expression": true, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "e" + } + ], + "body": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "value": "test", + "raw": "\"test\"" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "e", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 2, + 4 + ] + }, + { + "type": "String", + "value": "\"test\"", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.src.js new file mode 100644 index 000000000000..49a04ad0bcf9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.src.js @@ -0,0 +1 @@ +e => "test"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js new file mode 100644 index 000000000000..7790809d3e38 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Unexpected token 2" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.src.js new file mode 100644 index 000000000000..719fc33cbe40 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.src.js @@ -0,0 +1 @@ +0b102; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js new file mode 100644 index 000000000000..88fde0b28b5c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js @@ -0,0 +1,94 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "value": 5, + "raw": "0b101" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0b101", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.src.js new file mode 100644 index 000000000000..edde9a3b5977 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.src.js @@ -0,0 +1 @@ +0b101; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js new file mode 100644 index 000000000000..257a1d018070 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js @@ -0,0 +1,94 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "value": 5, + "raw": "0B101" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0B101", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.src.js new file mode 100644 index 000000000000..9cb6f2fb1b5c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.src.js @@ -0,0 +1 @@ +0B101; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js new file mode 100644 index 000000000000..b32ab6c2da7e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js @@ -0,0 +1,185 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 6, + 15 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ], + "name": "foo" + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ], + "name": "bar" + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.src.js new file mode 100644 index 000000000000..70b0430bf3e2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.src.js @@ -0,0 +1 @@ +const foo = bar; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js new file mode 100644 index 000000000000..cf99908240a7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js @@ -0,0 +1,477 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 0, + 47 + ], + "body": [ + { + "type": "SwitchStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 0, + 47 + ], + "discriminant": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 8, + 14 + ], + "name": "answer" + }, + "cases": [ + { + "type": "SwitchCase", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 18, + 45 + ], + "consequent": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 27, + 38 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 31, + 37 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ], + "name": "t" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 35, + 37 + ], + "value": 42, + "raw": "42" + } + } + ], + "kind": "let" + }, + { + "type": "BreakStatement", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 39, + 45 + ], + "label": null + } + ], + "test": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ], + "value": 42, + "raw": "42" + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "switch", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "answer", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 8, + 14 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Keyword", + "value": "case", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 18, + 22 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 27, + 30 + ] + }, + { + "type": "Identifier", + "value": "t", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 35, + 37 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Keyword", + "value": "break", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 39, + 44 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 46, + 47 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.src.js new file mode 100644 index 000000000000..5df03fa0b726 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.src.js @@ -0,0 +1 @@ +switch (answer) { case 42: let t = 42; break; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js new file mode 100644 index 000000000000..1f25b12ca960 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js @@ -0,0 +1,185 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 4, + 13 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 10, + 13 + ], + "name": "bar" + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 10, + 13 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.src.js new file mode 100644 index 000000000000..c85081ab6c40 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.src.js @@ -0,0 +1 @@ +let foo = bar; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js new file mode 100644 index 000000000000..3898fc4279fe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js @@ -0,0 +1,609 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 8, + 31 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 9, + 18 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "a" + }, + "static": false, + "kind": "get", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 14, + 18 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 19, + 29 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ], + "name": "b" + }, + "static": false, + "kind": "set", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 24, + 29 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "c" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 27, + 29 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 19, + 22 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.src.js new file mode 100644 index 000000000000..5788395aaa33 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.src.js @@ -0,0 +1 @@ +class A {get a(){} set b(c){};}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js new file mode 100644 index 000000000000..c5bef576c882 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js @@ -0,0 +1,423 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 8, + 25 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 9, + 23 + ], + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "a" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 19, + 23 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 21, + 23 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.src.js new file mode 100644 index 000000000000..f960fe06cd30 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.src.js @@ -0,0 +1 @@ +class A {static [a](){};}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js new file mode 100644 index 000000000000..cd76eedc6f92 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js @@ -0,0 +1,184 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "expression": { + "type": "ClassExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ], + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ], + "body": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 1, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.src.js new file mode 100644 index 000000000000..ac7ea1bef0c9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.src.js @@ -0,0 +1 @@ +(class {}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js new file mode 100644 index 000000000000..b2c670a25bf0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js @@ -0,0 +1,351 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 8, + 23 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 9, + 22 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 9, + 18 + ], + "name": "prototype" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 18, + 22 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 20, + 22 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "prototype", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 9, + 18 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.src.js new file mode 100644 index 000000000000..5f8f86aeebe0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.src.js @@ -0,0 +1 @@ +class A {prototype(){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js new file mode 100644 index 000000000000..44dae390a7dc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js @@ -0,0 +1,369 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 8, + 21 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 9, + 19 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ], + "name": "static" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 15, + 19 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 17, + 19 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.src.js new file mode 100644 index 000000000000..4b8882f7305c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.src.js @@ -0,0 +1 @@ +class A {static(){};}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js new file mode 100644 index 000000000000..cedacd90f617 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js @@ -0,0 +1,476 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 44 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 43 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 8, + 43 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 14, + 41 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 15 + ], + "name": "a" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 15, + 41 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 17, + 41 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "range": [ + 27, + 35 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 27, + 34 + ], + "callee": { + "type": "Super", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 27, + 32 + ] + }, + "arguments": [] + } + } + ] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 43, + 44 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Keyword", + "value": "super", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 27, + 32 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 43, + 44 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.src.js new file mode 100644 index 000000000000..304405d389ef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.src.js @@ -0,0 +1,5 @@ +class A { + a(){ + super(); + } +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js new file mode 100644 index 000000000000..8da6753786e9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js @@ -0,0 +1,351 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 0, + 21 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 8, + 21 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 14, + 19 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 15 + ], + "name": "a" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 15, + 19 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 17, + 19 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 21, + 22 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 21, + 22 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.src.js new file mode 100644 index 000000000000..cbae5822e572 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.src.js @@ -0,0 +1,3 @@ +class A { + a(){} +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js new file mode 100644 index 000000000000..4d12287e78c0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js @@ -0,0 +1,406 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 0, + 34 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 8, + 34 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 9, + 33 + ], + "computed": true, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 17, + 28 + ], + "value": "prototype", + "raw": "\"prototype\"" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 29, + 33 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 31, + 33 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "String", + "value": "\"prototype\"", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 17, + 28 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.src.js new file mode 100644 index 000000000000..9a2019e9b33c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.src.js @@ -0,0 +1 @@ +class A {static ["prototype"](){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js new file mode 100644 index 000000000000..a3a091f95c18 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js @@ -0,0 +1,387 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 8, + 28 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 9, + 26 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 16, + 22 + ], + "name": "static" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 22, + 26 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 24, + 26 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 16, + 22 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.src.js new file mode 100644 index 000000000000..947d978d328b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.src.js @@ -0,0 +1 @@ +class A {static static(){};}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js new file mode 100644 index 000000000000..b632292bdc16 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js @@ -0,0 +1,387 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 8, + 23 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 9, + 21 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "a" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 17, + 21 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.src.js new file mode 100644 index 000000000000..dea98b8d153d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.src.js @@ -0,0 +1 @@ +class A {static a(){};}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js new file mode 100644 index 000000000000..695061fde4d4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js @@ -0,0 +1,812 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "range": [ + 0, + 59 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "range": [ + 0, + 58 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "range": [ + 8, + 58 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 9, + 21 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "a" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 17, + 21 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 22, + 38 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ], + "name": "a" + }, + "static": true, + "kind": "get", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 34, + 38 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 36, + 38 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 39, + 56 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 50, + 51 + ], + "name": "a" + }, + "static": true, + "kind": "set", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 51, + 56 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 52, + 53 + ], + "name": "b" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 54, + 56 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "range": [ + 58, + 59 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 22, + 28 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 29, + 32 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 39, + 45 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 46, + 49 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 52, + 53 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 53, + 54 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "range": [ + 54, + 55 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "range": [ + 57, + 58 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "range": [ + 58, + 59 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.src.js new file mode 100644 index 000000000000..5efab6d986b6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.src.js @@ -0,0 +1 @@ +class A {static a(){} static get a(){} static set a(b){} }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js new file mode 100644 index 000000000000..a211ad003f94 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js @@ -0,0 +1,644 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 0, + 39 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 0, + 38 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 8, + 38 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 9, + 22 + ], + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "a" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 18, + 22 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 20, + 22 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 24, + 37 + ], + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ], + "name": "b" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 33, + 37 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 35, + 37 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 24, + 30 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.src.js new file mode 100644 index 000000000000..8a3d1cf96ae8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.src.js @@ -0,0 +1 @@ +class A {static[a](){}; static[b](){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js new file mode 100644 index 000000000000..23254af70614 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js @@ -0,0 +1,556 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 0, + 48 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 0, + 47 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 8, + 47 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 9, + 26 + ], + "computed": false, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 9, + 22 + ], + "value": "constructor", + "raw": "\"constructor\"" + }, + "static": false, + "kind": "constructor", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 22, + 26 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 24, + 26 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 27, + 46 + ], + "computed": true, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 28, + 41 + ], + "value": "constructor", + "raw": "\"constructor\"" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 42, + 46 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 44, + 46 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 47, + 48 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "String", + "value": "\"constructor\"", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 9, + 22 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "String", + "value": "\"constructor\"", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 28, + 41 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 43, + 44 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 46, + 47 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 47, + 48 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.src.js new file mode 100644 index 000000000000..66a3500ba613 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.src.js @@ -0,0 +1 @@ +class A {"constructor"(){} ["constructor"](){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js new file mode 100644 index 000000000000..0760b4db2eed --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js @@ -0,0 +1,536 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 8, + 21 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 10, + 14 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 15, + 20 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "b" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 16, + 20 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.src.js new file mode 100644 index 000000000000..eae3cf562544 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.src.js @@ -0,0 +1 @@ +class A {a(){};b(){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js new file mode 100644 index 000000000000..1015e28f28fa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js @@ -0,0 +1,572 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 8, + 23 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 10, + 15 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "a" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 11, + 15 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "b" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 17, + 21 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.src.js new file mode 100644 index 000000000000..db2c06ce65d4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.src.js @@ -0,0 +1 @@ +class A {;a(){};b(){};}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js new file mode 100644 index 000000000000..e41ba85718bf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js @@ -0,0 +1,554 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 8, + 22 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 10, + 14 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 15, + 20 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "b" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 16, + 20 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.src.js new file mode 100644 index 000000000000..30f2b72c83b6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.src.js @@ -0,0 +1 @@ +class A {a(){};b(){};}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js new file mode 100644 index 000000000000..d977942316ea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js @@ -0,0 +1,518 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 8, + 20 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 10, + 14 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 14, + 19 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "b" + }, + "static": false, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 15, + 19 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 17, + 19 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.src.js new file mode 100644 index 000000000000..b30e1d968e3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.src.js @@ -0,0 +1 @@ +class A {a(){}b(){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js new file mode 100644 index 000000000000..3c6cd8060493 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js @@ -0,0 +1,554 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 0, + 56 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "range": [ + 0, + 55 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "range": [ + 8, + 55 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 9, + 31 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 16, + 27 + ], + "name": "constructor" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 27, + 31 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 29, + 31 + ], + "body": [] + } + } + }, + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 32, + 54 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "range": [ + 39, + 50 + ], + "name": "constructor" + }, + "static": true, + "kind": "method", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 50, + 54 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 52, + 54 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 55, + 56 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ] + }, + { + "type": "Identifier", + "value": "constructor", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 16, + 27 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Keyword", + "value": "static", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 32, + 38 + ] + }, + { + "type": "Identifier", + "value": "constructor", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "range": [ + 39, + 50 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 52, + 53 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 53, + 54 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 55 + } + }, + "range": [ + 54, + 55 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 55, + 56 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.src.js new file mode 100644 index 000000000000..57bbee9df047 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.src.js @@ -0,0 +1 @@ +class A {static constructor(){} static constructor(){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js new file mode 100644 index 000000000000..d07c97385724 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js @@ -0,0 +1,351 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 8, + 25 + ], + "body": [ + { + "type": "MethodDefinition", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 9, + 24 + ], + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 9, + 20 + ], + "name": "constructor" + }, + "static": false, + "kind": "constructor", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 20, + 24 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 22, + 24 + ], + "body": [] + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "constructor", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 9, + 20 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.src.js new file mode 100644 index 000000000000..00fcd7be15ef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.src.js @@ -0,0 +1 @@ +class A {constructor(){}}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js new file mode 100644 index 000000000000..1d4702683ab0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js @@ -0,0 +1,329 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 4, + 27 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "ClassExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 8, + 27 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "A" + }, + "superClass": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ], + "value": 0, + "raw": "0" + }, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 25, + 27 + ], + "body": [] + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 8, + 13 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Keyword", + "value": "extends", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 16, + 23 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.src.js new file mode 100644 index 000000000000..fba446ff6e45 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.src.js @@ -0,0 +1 @@ +var x = class A extends 0{}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js new file mode 100644 index 000000000000..1a3068b64d44 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js @@ -0,0 +1,238 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "expression": { + "type": "ClassExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 1, + 18 + ], + "id": null, + "superClass": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "value": 0, + "raw": "0" + }, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ], + "body": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 1, + 6 + ] + }, + { + "type": "Keyword", + "value": "extends", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.src.js new file mode 100644 index 000000000000..b5e6e62ea087 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.src.js @@ -0,0 +1 @@ +(class extends 0{}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js new file mode 100644 index 000000000000..f0bc32e953c4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js @@ -0,0 +1,183 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 8, + 10 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.src.js new file mode 100644 index 000000000000..a650fd681397 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.src.js @@ -0,0 +1 @@ +class A {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js new file mode 100644 index 000000000000..319c6f97856c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js @@ -0,0 +1,201 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.src.js new file mode 100644 index 000000000000..e14455cbb559 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.src.js @@ -0,0 +1 @@ +class A {;}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js new file mode 100644 index 000000000000..f0bc32e953c4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js @@ -0,0 +1,183 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 8, + 10 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.src.js new file mode 100644 index 000000000000..a650fd681397 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.src.js @@ -0,0 +1 @@ +class A {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js new file mode 100644 index 000000000000..53facc1e96f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js @@ -0,0 +1,237 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "body": [ + { + "type": "ClassDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "A" + }, + "superClass": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "value": 0, + "raw": "0" + }, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Keyword", + "value": "extends", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 8, + 15 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.src.js new file mode 100644 index 000000000000..5903f34f08bd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.src.js @@ -0,0 +1 @@ +class A extends 0 {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js new file mode 100644 index 000000000000..f29098ce0d23 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Unexpected token {" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.src.js new file mode 100644 index 000000000000..c3498222f8fa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.src.js @@ -0,0 +1 @@ +class {}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js new file mode 100644 index 000000000000..89b2125e2f72 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "setter should have exactly one param" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.src.js new file mode 100644 index 000000000000..98433ba8b00a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.src.js @@ -0,0 +1 @@ +class A { set foo() {}}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js new file mode 100644 index 000000000000..e12b248af8e4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js @@ -0,0 +1,219 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "ClassExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 1, + 11 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "A" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "body": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 1, + 6 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.src.js new file mode 100644 index 000000000000..9829e5d0ddd1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.src.js @@ -0,0 +1 @@ +(class A {}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js new file mode 100644 index 000000000000..5d1d55a04d3f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "expression": { + "type": "ClassExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 1, + 20 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "A" + }, + "superClass": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "value": 0, + "raw": "0" + }, + "body": { + "type": "ClassBody", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "body": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "class", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 1, + 6 + ] + }, + { + "type": "Identifier", + "value": "A", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Keyword", + "value": "extends", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 9, + 16 + ] + }, + { + "type": "Numeric", + "value": "0", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.src.js new file mode 100644 index 000000000000..cb8f8a94b99b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.src.js @@ -0,0 +1 @@ +(class A extends 0{}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js new file mode 100644 index 000000000000..12c025f7fe75 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js @@ -0,0 +1,295 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "f" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 11, + 16 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "a" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "value": 1, + "raw": "1" + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.src.js new file mode 100644 index 000000000000..7885715f86b0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.src.js @@ -0,0 +1 @@ +function f(a = 1) {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js new file mode 100644 index 000000000000..9ca8637fceb1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js @@ -0,0 +1,349 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + }, + "right": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 4, + 22 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 13, + 18 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "value": 1, + "raw": "1" + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 20, + 22 + ], + "body": [] + } + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.src.js new file mode 100644 index 000000000000..25993b363d55 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.src.js @@ -0,0 +1 @@ +x = function(y = 1) {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js new file mode 100644 index 000000000000..91261a8cb2d1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js @@ -0,0 +1,479 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 4, + 27 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 6, + 25 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "f" + }, + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 9, + 25 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 18, + 21 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "a" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "value": 1, + "raw": "1" + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ], + "body": [] + } + }, + "kind": "init" + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 9, + 17 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.src.js new file mode 100644 index 000000000000..2537287de022 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.src.js @@ -0,0 +1 @@ +x = { f: function(a=1) {} } \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js new file mode 100644 index 000000000000..0c15e55781a2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js @@ -0,0 +1,495 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 0, + 36 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 0, + 36 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 4, + 35 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 10, + 35 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "a" + }, + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 22, + 28 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "name": "b" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 26, + 28 + ], + "value": 42, + "raw": "42" + } + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ], + "name": "c" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 33, + 35 + ], + "body": [] + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 10, + 18 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 26, + 28 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.src.js new file mode 100644 index 000000000000..3bfab96a2698 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.src.js @@ -0,0 +1 @@ +var foo = function(a, b = 42, c) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js new file mode 100644 index 000000000000..52d6ad89b4de --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "elements": [ + { + "type": "MemberExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 1, + 5 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 1, + 3 + ], + "name": "ok" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "v" + }, + "computed": false + } + ] + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 20, + "raw": "20" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "ok", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 1, + 3 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Identifier", + "value": "v", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "20", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.src.js new file mode 100644 index 000000000000..ca7265689821 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.src.js @@ -0,0 +1 @@ +[ok.v] = 20; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js new file mode 100644 index 000000000000..38d81c2f6a2b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js @@ -0,0 +1,383 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "b" + } + ] + }, + "right": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "b" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "a" + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.src.js new file mode 100644 index 000000000000..e03adeba1880 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.src.js @@ -0,0 +1 @@ +[a, b] = [b, a]; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js new file mode 100644 index 000000000000..a5a9465df657 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js @@ -0,0 +1,258 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + } + ] + }, + "init": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ], + "elements": [] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.src.js new file mode 100644 index 000000000000..a802dde0d6b0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.src.js @@ -0,0 +1 @@ +var [a] = []; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js new file mode 100644 index 000000000000..ebcef30c72f8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js @@ -0,0 +1,564 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 4, + 30 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 4, + 26 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + }, + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 13, + 18 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "value": 5, + "raw": "5" + } + }, + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 20, + 25 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "name": "z" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ], + "value": 1, + "raw": "1" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.src.js new file mode 100644 index 000000000000..7fa55d7113f0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.src.js @@ -0,0 +1 @@ +var [x = 10, y = 5, z = 1] = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js new file mode 100644 index 000000000000..02a44ef85d86 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js @@ -0,0 +1,775 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 0, + 39 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 0, + 39 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 4, + 38 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 4, + 34 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 5, + 9 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "x" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 11, + 15 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "y" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "y" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 17, + 32 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "z" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 20, + 32 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 22, + 31 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "name": "a" + }, + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 25, + 31 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "a" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 29, + 31 + ], + "value": 10, + "raw": "10" + } + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ], + "name": "b" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 29, + 31 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.src.js new file mode 100644 index 000000000000..7845a89ab06d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.src.js @@ -0,0 +1 @@ +var {x: x, y: y, z: { a: a = 10} } = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js new file mode 100644 index 000000000000..4b82bbdac83d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js @@ -0,0 +1,420 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 4, + 22 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 4, + 18 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "z" + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.src.js new file mode 100644 index 000000000000..e0030d18850c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.src.js @@ -0,0 +1 @@ +var [x = 10, y, z] = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js new file mode 100644 index 000000000000..6623c7044922 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js @@ -0,0 +1,493 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 4, + 27 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 4, + 23 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + }, + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 13, + 22 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 15, + 21 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "z" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ], + "value": 10, + "raw": "10" + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.src.js new file mode 100644 index 000000000000..1925b1e2da93 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.src.js @@ -0,0 +1 @@ +var [x = 10, [ z = 10]] = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js new file mode 100644 index 000000000000..75b4a2e9bfc3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js @@ -0,0 +1,421 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 4, + 23 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 4, + 19 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + }, + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 13, + 18 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "z" + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.src.js new file mode 100644 index 000000000000..aa0c025c20aa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.src.js @@ -0,0 +1 @@ +var [x = 10, [ z ]] = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js new file mode 100644 index 000000000000..f54cdab8d108 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js @@ -0,0 +1,274 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 1, + 5 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 3, + 5 + ], + "value": 10, + "raw": "10" + } + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 3, + 5 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.src.js new file mode 100644 index 000000000000..f95384c66e05 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.src.js @@ -0,0 +1 @@ +[x=10] = x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js new file mode 100644 index 000000000000..bfc0d019c324 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js @@ -0,0 +1,681 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 4, + 30 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 4, + 26 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 13, + 18 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 13, + 18 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "value": 5, + "raw": "5" + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 20, + 25 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "name": "z" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 20, + 25 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "name": "z" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ], + "value": 1, + "raw": "1" + } + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.src.js new file mode 100644 index 000000000000..d56d776aabc7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.src.js @@ -0,0 +1 @@ +var {x = 10, y = 5, z = 1} = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js new file mode 100644 index 000000000000..0759bf020d61 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js @@ -0,0 +1,789 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 0, + 42 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 0, + 42 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 4, + 41 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 4, + 37 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 5, + 14 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 8, + 14 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "value": 10, + "raw": "10" + } + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 16, + 25 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "y" + }, + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 19, + 25 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "y" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ], + "value": 10, + "raw": "10" + } + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 27, + 36 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ], + "name": "z" + }, + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 30, + 36 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ], + "name": "z" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 34, + 36 + ], + "value": 10, + "raw": "10" + } + }, + "kind": "init" + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 34, + 36 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.src.js new file mode 100644 index 000000000000..df414e99e402 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.src.js @@ -0,0 +1 @@ +var {x: x = 10, y: y = 10, z: z = 10} = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js new file mode 100644 index 000000000000..e718bf10620d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js @@ -0,0 +1,645 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 4, + 31 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 4, + 27 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 5, + 9 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "x" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 11, + 20 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "y" + }, + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 14, + 20 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "y" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "value": 10, + "raw": "10" + } + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 22, + 26 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "name": "z" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "z" + }, + "kind": "init" + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.src.js new file mode 100644 index 000000000000..c48fc3b89460 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.src.js @@ -0,0 +1 @@ +var {x: x, y: y = 10, z: z} = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js new file mode 100644 index 000000000000..84200af904d8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js @@ -0,0 +1,387 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 4, + 21 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 4, + 17 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 6, + 15 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "x" + }, + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ], + "value": 10, + "raw": "10" + } + }, + "kind": "init" + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "name": "x" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.src.js new file mode 100644 index 000000000000..f030020d5c02 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.src.js @@ -0,0 +1 @@ +var { x: x = 10 } = x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js new file mode 100644 index 000000000000..a3e20a520368 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js @@ -0,0 +1,573 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 4, + 25 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 4, + 21 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 8, + 17 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "y" + }, + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 11, + 17 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "y" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ], + "value": 10, + "raw": "10" + } + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "z" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "z" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.src.js new file mode 100644 index 000000000000..3c186ea51cd9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.src.js @@ -0,0 +1 @@ +var {x, y: y = 10, z} = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js new file mode 100644 index 000000000000..f7540e0e8cd1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js @@ -0,0 +1,537 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 4, + 22 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 4, + 18 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "z" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "z" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.src.js new file mode 100644 index 000000000000..48796e029fb4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.src.js @@ -0,0 +1 @@ +var {x = 10, y, z} = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js new file mode 100644 index 000000000000..7b4322f4f074 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js @@ -0,0 +1,646 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 4, + 30 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 4, + 26 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 13, + 25 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 16, + 25 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 18, + 24 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "z" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 18, + 24 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "z" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 22, + 24 + ], + "value": 10, + "raw": "10" + } + } + } + ] + }, + "kind": "init" + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 22, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.src.js new file mode 100644 index 000000000000..ebf4aa8a643d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.src.js @@ -0,0 +1 @@ +var {x = 10, y: { z = 10}} = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js new file mode 100644 index 000000000000..f4fbd8d2b4df --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js @@ -0,0 +1,574 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 4, + 26 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 4, + 22 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 13, + 21 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "y" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "z" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "z" + } + } + ] + }, + "kind": "init" + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.src.js new file mode 100644 index 000000000000..603208cc936d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.src.js @@ -0,0 +1 @@ +var {x = 10, y: { z }} = a; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js new file mode 100644 index 000000000000..e3c0d880e194 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js @@ -0,0 +1,333 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ], + "value": 10, + "raw": "10" + } + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "x" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.src.js new file mode 100644 index 000000000000..8735e3d0fe7a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.src.js @@ -0,0 +1 @@ +var {x = 10} = x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js new file mode 100644 index 000000000000..d77c2cc04aeb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js @@ -0,0 +1,917 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "range": [ + 0, + 72 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 0, + 71 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 16, + 71 + ], + "body": [ + { + "type": "TryStatement", + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 20, + 69 + ], + "block": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 24, + 46 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "range": [ + 30, + 42 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 34, + 41 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 34, + 37 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ], + "name": "b" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 40, + 41 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ] + }, + "handler": { + "type": "CatchClause", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 49, + 69 + ], + "param": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "range": [ + 55, + 62 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 56, + 61 + ], + "name": "stack" + } + ] + }, + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 64, + 69 + ], + "body": [] + } + }, + "finalizer": null + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "range": [ + 71, + 72 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Keyword", + "value": "try", + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 20, + 23 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 30, + 33 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Keyword", + "value": "catch", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 49, + 54 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + }, + "range": [ + 54, + 55 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Identifier", + "value": "stack", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 56, + 61 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "range": [ + 61, + 62 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + }, + "range": [ + 62, + 63 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + }, + "range": [ + 64, + 65 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 68, + 69 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 70, + 71 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "range": [ + 71, + 72 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.src.js new file mode 100644 index 000000000000..e187c79d3822 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.src.js @@ -0,0 +1,7 @@ +function x({a}) { + try { + var {b} = a; + } + catch([stack]) { + } +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js new file mode 100644 index 000000000000..6d4aaa5eeffa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js @@ -0,0 +1,956 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "range": [ + 0, + 72 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 0, + 71 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "a" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 16, + 71 + ], + "body": [ + { + "type": "TryStatement", + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 20, + 69 + ], + "block": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 24, + 46 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "range": [ + 30, + 42 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 34, + 41 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 34, + 37 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ], + "name": "b" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 40, + 41 + ], + "name": "a" + } + } + ], + "kind": "var" + } + ] + }, + "handler": { + "type": "CatchClause", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 49, + 69 + ], + "param": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "range": [ + 55, + 62 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 56, + 61 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 56, + 61 + ], + "name": "stack" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 56, + 61 + ], + "name": "stack" + } + } + ] + }, + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 64, + 69 + ], + "body": [] + } + }, + "finalizer": null + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "range": [ + 71, + 72 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Keyword", + "value": "try", + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 20, + 23 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 30, + 33 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Keyword", + "value": "catch", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 49, + 54 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + }, + "range": [ + 54, + 55 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Identifier", + "value": "stack", + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 56, + 61 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "range": [ + 61, + 62 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + }, + "range": [ + 62, + 63 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + }, + "range": [ + 64, + 65 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "range": [ + 68, + 69 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "range": [ + 70, + 71 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + }, + "range": [ + 71, + 72 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.src.js new file mode 100644 index 000000000000..2d2d277b17a6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.src.js @@ -0,0 +1,7 @@ +function x({a}) { + try { + var {b} = a; + } + catch({stack}) { + } +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js new file mode 100644 index 000000000000..93be6358d304 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js @@ -0,0 +1,6 @@ +module.exports = { + lineNumber: 1, + index: 9, + column: 10, + message: "Unexpected token =" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.src.js new file mode 100644 index 000000000000..f4c0d85bef87 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.src.js @@ -0,0 +1 @@ +({ Object=0, String=0 }) = {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js new file mode 100644 index 000000000000..ea977284ac36 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js @@ -0,0 +1,331 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "operator": "=", + "left": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 1, + 23 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 3, + 21 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 3, + 15 + ], + "name": "responseText" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 17, + 21 + ], + "name": "text" + }, + "kind": "init" + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 27, + 30 + ], + "name": "res" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "responseText", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 3, + 15 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "text", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 17, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Identifier", + "value": "res", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 27, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js new file mode 100644 index 000000000000..b45ac689fa8f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js @@ -0,0 +1 @@ +({ responseText: text }) = res; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js new file mode 100644 index 000000000000..f3fd16b810f8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js @@ -0,0 +1,663 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 4, + 30 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + null, + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 10, + 15 + ], + "elements": [ + null, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "z" + } + ] + } + ] + }, + "init": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 19, + 30 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "value": 1, + "raw": "1" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "value": 2, + "raw": "2" + }, + { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 24, + 29 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "value": 3, + "raw": "3" + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ], + "value": 4, + "raw": "4" + } + ] + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Numeric", + "value": "2", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Numeric", + "value": "3", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Numeric", + "value": "4", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.src.js new file mode 100644 index 000000000000..1cf79a3aa752 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.src.js @@ -0,0 +1 @@ +var [x, , [, z]] = [1,2,[3,4]]; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js new file mode 100644 index 000000000000..c9ee5d14eb77 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js @@ -0,0 +1,965 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 0, + 53 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 0, + 53 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 4, + 52 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 4, + 24 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 5, + 9 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "y" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 11, + 22 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "z" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 14, + 22 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 16, + 20 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "a" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "b" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 27, + 52 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 29, + 35 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ], + "name": "x" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 32, + 35 + ], + "value": "3", + "raw": "\"3\"" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "range": [ + 37, + 50 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ], + "name": "z" + }, + "value": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "range": [ + 40, + 50 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 42, + 48 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 42, + 43 + ], + "name": "a" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 45, + 48 + ], + "value": "b", + "raw": "\"b\"" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "String", + "value": "\"3\"", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 32, + 35 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 43, + 44 + ] + }, + { + "type": "String", + "value": "\"b\"", + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 45, + 48 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "range": [ + 49, + 50 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 52, + 53 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.src.js new file mode 100644 index 000000000000..3f6c5d2ec278 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.src.js @@ -0,0 +1 @@ +var {x: y, z: { a: b } } = { x: "3", z: { a: "b" } }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js new file mode 100644 index 000000000000..7eaa658db5ae --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js @@ -0,0 +1,333 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 4, + 14 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 4, + 9 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "b" + }, + "kind": "init" + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "properties": [] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.src.js new file mode 100644 index 000000000000..8a2d98a6946a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.src.js @@ -0,0 +1 @@ +var {a:b} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js new file mode 100644 index 000000000000..8b79126305a9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js @@ -0,0 +1,297 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ], + "properties": [] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.src.js new file mode 100644 index 000000000000..945bf61102bd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.src.js @@ -0,0 +1 @@ +var {a} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js new file mode 100644 index 000000000000..002ada8ee2c3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 14, + "lineNumber": 1, + "column": 15, + "description": "Unexpected token =" +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js new file mode 100644 index 000000000000..906c058a588f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js @@ -0,0 +1,350 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 11, + 19 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 12, + 18 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ], + "value": 10, + "raw": "10" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 21, + 23 + ], + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.src.js new file mode 100644 index 000000000000..e2545e8519ac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.src.js @@ -0,0 +1 @@ +function a([x = 10]) {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js new file mode 100644 index 000000000000..6e811298622c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js @@ -0,0 +1,719 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 0, + 39 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 0, + 38 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 11, + 34 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 12, + 18 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 12, + 18 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ], + "value": 10, + "raw": "10" + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 20, + 33 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "name": "y" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 23, + 33 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 25, + 31 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "z" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 25, + 31 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "z" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 29, + 31 + ], + "value": 10, + "raw": "10" + } + } + } + ] + }, + "kind": "init" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 36, + 38 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 29, + 31 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.src.js new file mode 100644 index 000000000000..baf01aa25d68 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.src.js @@ -0,0 +1 @@ +function a({x = 10, y: { z = 10 }}) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js new file mode 100644 index 000000000000..2b2644572bd2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js @@ -0,0 +1,389 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 11, + 19 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 12, + 18 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 12, + 18 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ], + "value": 10, + "raw": "10" + } + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 21, + 23 + ], + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.src.js new file mode 100644 index 000000000000..a18df31a40c6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.src.js @@ -0,0 +1 @@ +function a({x = 10}) {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js new file mode 100644 index 000000000000..c4fda76dea27 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js @@ -0,0 +1,403 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 1, + 23 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "x" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 12, + 20 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "a" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "b" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 21, + 23 + ], + "body": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.src.js new file mode 100644 index 000000000000..b623ac7f45b7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.src.js @@ -0,0 +1 @@ +(function x([ a, b ]){}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js new file mode 100644 index 000000000000..e8c902877dcd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js @@ -0,0 +1,367 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 11, + 19 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "a" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "b" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 20, + 22 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.src.js new file mode 100644 index 000000000000..fda9c68945b0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.src.js @@ -0,0 +1 @@ +function x([ a, b ]){}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js new file mode 100644 index 000000000000..b2a460de33f3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js @@ -0,0 +1,406 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "a" + }, + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 14, + 19 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "b" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 20, + 22 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.src.js new file mode 100644 index 000000000000..1b212bc385af --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.src.js @@ -0,0 +1 @@ +function x(a, { b }){}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js new file mode 100644 index 000000000000..980e0c19e0e1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js @@ -0,0 +1,460 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 11, + 23 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + }, + null, + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 17, + 22 + ], + "elements": [ + null, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "name": "z" + } + ] + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 25, + 27 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.src.js new file mode 100644 index 000000000000..6544066786ea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.src.js @@ -0,0 +1 @@ +function a([x, , [, z]]) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js new file mode 100644 index 000000000000..c6f7786a6eaf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js @@ -0,0 +1,647 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 0, + 36 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 11, + 31 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 12, + 16 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "y" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 18, + 29 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "z" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 21, + 29 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 23, + 27 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ], + "name": "a" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ], + "name": "b" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 33, + 35 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.src.js new file mode 100644 index 000000000000..78e865b16bfd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.src.js @@ -0,0 +1 @@ +function a({x: y, z: { a: b } }) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js new file mode 100644 index 000000000000..fac97e31ac6c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js @@ -0,0 +1,481 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 1, + 23 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "x" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 12, + 20 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "a" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "b" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 21, + 23 + ], + "body": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.src.js new file mode 100644 index 000000000000..c9f34398d78b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.src.js @@ -0,0 +1 @@ +(function x({ a, b }){}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js new file mode 100644 index 000000000000..0acce76590ba --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js @@ -0,0 +1,445 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 11, + 19 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "a" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "b" + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 20, + 22 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.src.js new file mode 100644 index 000000000000..5a71f3507199 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.src.js @@ -0,0 +1 @@ +function x({ a, b }){}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js new file mode 100644 index 000000000000..b694b8007caf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + null, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "b" + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "name": "array" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "array", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.src.js new file mode 100644 index 000000000000..d17fce97a39b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.src.js @@ -0,0 +1 @@ +[a,,b] = array; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js new file mode 100644 index 000000000000..25637c84f674 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js @@ -0,0 +1,859 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 0, + 83 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 0, + 26 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "name": "get" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "name": "set" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 28, + 83 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 32, + 82 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 36, + 82 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 42, + 50 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "name": "foo" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 47, + 50 + ], + "name": "foo" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "range": [ + 56, + 64 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 56, + 59 + ], + "name": "get" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "range": [ + 61, + 64 + ], + "name": "get" + }, + "kind": "init" + }, + { + "type": "ExperimentalSpreadProperty", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "range": [ + 70, + 80 + ], + "argument": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "range": [ + 73, + 80 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 73, + 76 + ], + "name": "set" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "range": [ + 77, + 80 + ], + "name": "foo" + }, + "computed": false + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 28, + 31 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 47, + 50 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 56, + 59 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + }, + "range": [ + 59, + 60 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "range": [ + 61, + 64 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + }, + "range": [ + 64, + 65 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 70, + 73 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 73, + 76 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 11 + } + }, + "range": [ + 76, + 77 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "range": [ + 77, + 80 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 81, + 82 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 82, + 83 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.src.js new file mode 100644 index 000000000000..1ef4ef44c8a6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.src.js @@ -0,0 +1,9 @@ +var foo, + get, + set; + +var x = { + foo: foo, + get: get, + ...set.foo +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js new file mode 100644 index 000000000000..f2afb48d3de8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js @@ -0,0 +1,787 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 0, + 79 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 0, + 26 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "name": "get" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "name": "set" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 28, + 79 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 32, + 78 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 36, + 78 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 42, + 50 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "name": "foo" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 47, + 50 + ], + "name": "foo" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "range": [ + 56, + 64 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 56, + 59 + ], + "name": "get" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "range": [ + 61, + 64 + ], + "name": "get" + }, + "kind": "init" + }, + { + "type": "ExperimentalSpreadProperty", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 70, + 76 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 73, + 76 + ], + "name": "set" + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 28, + 31 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 47, + 50 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 56, + 59 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + }, + "range": [ + 59, + 60 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "range": [ + 61, + 64 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + }, + "range": [ + 64, + 65 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 70, + 73 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 73, + 76 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 77, + 78 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 78, + 79 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.src.js new file mode 100644 index 000000000000..e287012c47b9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.src.js @@ -0,0 +1,9 @@ +var foo, + get, + set; + +var x = { + foo: foo, + get: get, + ...set +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js new file mode 100644 index 000000000000..15a023481c19 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js @@ -0,0 +1,747 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 0, + 77 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 0, + 26 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "name": "get" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "name": "set" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 28, + 77 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 32, + 76 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 36, + 76 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 42, + 50 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "name": "foo" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 47, + 50 + ], + "name": "foo" + }, + "kind": "init" + }, + { + "type": "ExperimentalSpreadProperty", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 10 + } + }, + "range": [ + 56, + 62 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 10 + } + }, + "range": [ + 59, + 62 + ], + "name": "get" + } + }, + { + "type": "ExperimentalSpreadProperty", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 68, + 74 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 71, + 74 + ], + "name": "set" + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 28, + 31 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 47, + 50 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 56, + 59 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 10 + } + }, + "range": [ + 59, + 62 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "range": [ + 62, + 63 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 68, + 71 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 71, + 74 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 75, + 76 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 76, + 77 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.src.js new file mode 100644 index 000000000000..85d5f34a0076 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.src.js @@ -0,0 +1,9 @@ +var foo, + get, + set; + +var x = { + foo: foo, + ...get, + ...set +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js new file mode 100644 index 000000000000..344e65bf91c2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js @@ -0,0 +1,710 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "range": [ + 0, + 64 + ], + "body": [ + { + "type": "ForOfStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "range": [ + 0, + 64 + ], + "left": { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 5, + 43 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 9, + 43 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "i" + }, + "init": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 13, + 43 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 24, + 43 + ], + "body": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 26, + 41 + ], + "argument": { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 33, + 41 + ], + "left": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 33, + 35 + ], + "value": 10, + "raw": "10" + }, + "operator": "in", + "right": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 39, + 41 + ], + "elements": [] + } + } + } + ] + } + } + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 47, + 51 + ], + "name": "list" + }, + "body": { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "range": [ + 53, + 64 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "range": [ + 53, + 63 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "range": [ + 53, + 60 + ], + "name": "process" + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "range": [ + 61, + 62 + ], + "name": "x" + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ] + }, + { + "type": "Identifier", + "value": "i", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 13, + 21 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 26, + 32 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 33, + 35 + ] + }, + { + "type": "Keyword", + "value": "in", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 36, + 38 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 39, + 40 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Identifier", + "value": "of", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 44, + 46 + ] + }, + { + "type": "Identifier", + "value": "list", + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 47, + 51 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Identifier", + "value": "process", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 60 + } + }, + "range": [ + 53, + 60 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "range": [ + 60, + 61 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "range": [ + 61, + 62 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 63 + } + }, + "range": [ + 62, + 63 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 63 + }, + "end": { + "line": 1, + "column": 64 + } + }, + "range": [ + 63, + 64 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.src.js new file mode 100644 index 000000000000..be6ee7a07961 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.src.js @@ -0,0 +1 @@ +for (var i = function() { return 10 in [] } of list) process(x); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js new file mode 100644 index 000000000000..ce4f928359c9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js @@ -0,0 +1,419 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 0, + 41 + ], + "body": [ + { + "type": "ForOfStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 0, + 41 + ], + "left": { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 5, + 10 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "init": null + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 14, + 17 + ], + "name": "foo" + }, + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 19, + 41 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 25, + 39 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 25, + 38 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 25, + 36 + ], + "name": "doSomething" + }, + "arguments": [] + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "of", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 11, + 13 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 14, + 17 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Identifier", + "value": "doSomething", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 25, + 36 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 40, + 41 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.src.js new file mode 100644 index 000000000000..090dccf02df6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.src.js @@ -0,0 +1,3 @@ +for (var x of foo) { + doSomething(); +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js new file mode 100644 index 000000000000..8d08ddec5272 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js @@ -0,0 +1,364 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 0, + 37 + ], + "body": [ + { + "type": "ForOfStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 0, + 37 + ], + "left": { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 5, + 10 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + }, + "init": null + } + ], + "kind": "var" + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 14, + 17 + ], + "name": "foo" + }, + "body": { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 23, + 37 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 23, + 36 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 23, + 34 + ], + "name": "doSomething" + }, + "arguments": [] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "of", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 11, + 13 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 14, + 17 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "doSomething", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 23, + 34 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 36, + 37 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.src.js new file mode 100644 index 000000000000..3e0f665bcb3f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.src.js @@ -0,0 +1,2 @@ +for (var x of foo) + doSomething(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js new file mode 100644 index 000000000000..d709253768ed --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Unexpected token const" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.src.js new file mode 100644 index 000000000000..409abfa0c48b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.src.js @@ -0,0 +1,2 @@ +for (const x of foo) + doSomething(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js new file mode 100644 index 000000000000..37b724046e5d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Unexpected token let" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.src.js new file mode 100644 index 000000000000..7d9d367e23a0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.src.js @@ -0,0 +1,2 @@ +for (let x of foo) + doSomething(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js new file mode 100644 index 000000000000..d08884d29395 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js @@ -0,0 +1,330 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 1, + 25 + ], + "id": null, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 14, + 25 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 16, + 23 + ], + "expression": { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 16, + 23 + ], + "delegate": false, + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "name": "v" + } + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ] + }, + { + "type": "Identifier", + "value": "v", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.src.js new file mode 100644 index 000000000000..e582946f6565 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.src.js @@ -0,0 +1 @@ +(function* () { yield v }); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js new file mode 100644 index 000000000000..343c7241bfac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js @@ -0,0 +1,367 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 0, + 34 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 0, + 34 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 1, + 32 + ], + "id": null, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 14, + 32 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 16, + 30 + ], + "expression": { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 16, + 30 + ], + "delegate": false, + "argument": { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 22, + 30 + ], + "delegate": false, + "argument": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 28, + 30 + ], + "value": 10, + "raw": "10" + } + } + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 22, + 27 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 28, + 30 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.src.js new file mode 100644 index 000000000000..e026a3373e9f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.src.js @@ -0,0 +1 @@ +(function* () { yield yield 10 }); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js new file mode 100644 index 000000000000..7e864c55e8ff --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js @@ -0,0 +1,239 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "t" + }, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "t", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js new file mode 100644 index 000000000000..669935546a20 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.src.js @@ -0,0 +1 @@ +function* t() {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js new file mode 100644 index 000000000000..b3a22b030dae --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js @@ -0,0 +1,347 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 10, + 14 + ], + "name": "test" + }, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 18, + 30 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 20, + 28 + ], + "expression": { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 20, + 28 + ], + "delegate": true, + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ], + "name": "v" + } + } + } + ] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "test", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 10, + 14 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 20, + 25 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Identifier", + "value": "v", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.src.js new file mode 100644 index 000000000000..3690a57479ab --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.src.js @@ -0,0 +1 @@ +function* test () { yield *v }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js new file mode 100644 index 000000000000..d34a0d8f581e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js @@ -0,0 +1,348 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 1, + 26 + ], + "id": null, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 14, + 26 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 16, + 24 + ], + "expression": { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 16, + 24 + ], + "delegate": true, + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ], + "name": "v" + } + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Identifier", + "value": "v", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.src.js new file mode 100644 index 000000000000..fc14d64df717 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.src.js @@ -0,0 +1 @@ +(function* () { yield *v }); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js new file mode 100644 index 000000000000..b721c0ef7d64 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js @@ -0,0 +1,404 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 1, + 28 + ], + "id": null, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 14, + 28 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 16, + 26 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 16, + 25 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ], + "name": "fn" + }, + "arguments": [ + { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 19, + 24 + ], + "delegate": false, + "argument": null + } + ] + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "fn", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 19, + 24 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.src.js new file mode 100644 index 000000000000..d30055ca0870 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.src.js @@ -0,0 +1 @@ +(function* () { fn(yield); }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js new file mode 100644 index 000000000000..fd5821464be0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js @@ -0,0 +1,295 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 1, + 23 + ], + "id": null, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 14, + 23 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "expression": { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "delegate": false, + "argument": null + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.src.js new file mode 100644 index 000000000000..5fc869289ee9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.src.js @@ -0,0 +1 @@ +(function* () { yield }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js new file mode 100644 index 000000000000..96b2eb7021b6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js @@ -0,0 +1,313 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "expression": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 1, + 24 + ], + "id": null, + "generator": true, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 14, + 24 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 16, + 22 + ], + "expression": { + "type": "YieldExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "delegate": false, + "argument": null + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Keyword", + "value": "yield", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.src.js new file mode 100644 index 000000000000..75c83be2ff92 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.src.js @@ -0,0 +1 @@ +(function* () { yield; }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js new file mode 100644 index 000000000000..f6a7a06127eb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js @@ -0,0 +1,111 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "name": "fooz" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Identifier", + "value": "fooz", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.src.js new file mode 100644 index 000000000000..aa6758b0cd89 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.src.js @@ -0,0 +1 @@ +return fooz; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js new file mode 100644 index 000000000000..9eeaf9d8440c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js @@ -0,0 +1,76 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 0, + 7 + ], + "body": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 0, + 7 + ], + "argument": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.src.js new file mode 100644 index 000000000000..f312410bd34c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.src.js @@ -0,0 +1 @@ +return; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js new file mode 100644 index 000000000000..612b75277c76 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js @@ -0,0 +1,112 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "argument": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "value": true, + "raw": "true" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Boolean", + "value": "true", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.src.js new file mode 100644 index 000000000000..c1c6922d1dfe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.src.js @@ -0,0 +1 @@ +return true; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.result.js new file mode 100644 index 000000000000..d27c45476bea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.result.js @@ -0,0 +1,344 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 0, + 33 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 0, + 33 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 28, + 32 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ], + "name": "a" + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 3, + 28 + ], + "expression": { + "type": "JSXEmptyExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 4, + 27 + ] + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.src.js new file mode 100644 index 000000000000..9ccfd89113d4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.src.js @@ -0,0 +1 @@ +{/* this is a comment */}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js new file mode 100644 index 000000000000..e0109e5cf36b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js @@ -0,0 +1,655 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "attributes": [ + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 3, + 24 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "b" + }, + "value": { + "type": "JSXExpressionContainer", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 5, + 24 + ], + "expression": { + "type": "ConditionalExpression", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 6, + 23 + ], + "test": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "x" + }, + "consequent": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 10, + 15 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 10, + 15 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "c" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + }, + "alternate": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 18, + 23 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 18, + 23 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "d" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "?", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "JSXIdentifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "JSXIdentifier", + "value": "d", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.src.js new file mode 100644 index 000000000000..44134ac352b9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.src.js @@ -0,0 +1 @@ + : } />; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js new file mode 100644 index 000000000000..ceb36c2efde0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js @@ -0,0 +1,439 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 0, + 42 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 0, + 42 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 0, + 41 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "div" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 35, + 41 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 37, + 40 + ], + "name": "div" + } + }, + "children": [ + { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ], + "name": "br" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 11, + 35 + ], + "value": "7x invalid-js-identifier", + "raw": "7x invalid-js-identifier" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "JSXIdentifier", + "value": "br", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "JSXText", + "value": "7x invalid-js-identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 11, + 35 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 37, + 40 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.src.js new file mode 100644 index 000000000000..5138ffb14237 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.src.js @@ -0,0 +1 @@ +

7x invalid-js-identifier
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.result.js new file mode 100644 index 000000000000..696360b6dfb7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.result.js @@ -0,0 +1,710 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "range": [ + 0, + 58 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "range": [ + 0, + 58 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "range": [ + 0, + 57 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "range": [ + 0, + 57 + ], + "attributes": [ + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 11, + 21 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 11, + 15 + ], + "name": "left" + }, + "value": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "a" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 22, + 54 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 22, + 27 + ], + "name": "right" + }, + "value": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 28, + 54 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 28, + 31 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ], + "name": "b" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 50, + 54 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 52, + 53 + ], + "name": "b" + } + }, + "children": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "range": [ + 31, + 50 + ], + "value": "monkeys /> gorillas", + "raw": "monkeys /> gorillas" + } + ] + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 1, + 10 + ], + "name": "LeftRight" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "LeftRight", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 1, + 10 + ] + }, + { + "type": "JSXIdentifier", + "value": "left", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 11, + 15 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "JSXIdentifier", + "value": "right", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 22, + 27 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "JSXText", + "value": "monkeys /> gorillas", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 50 + } + }, + "range": [ + 31, + 50 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 52, + 53 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 53, + 54 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 56 + }, + "end": { + "line": 1, + "column": 57 + } + }, + "range": [ + 56, + 57 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 58 + } + }, + "range": [ + 57, + 58 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.src.js new file mode 100644 index 000000000000..48260fa6544a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.src.js @@ -0,0 +1 @@ + right=monkeys /> gorillas />; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js new file mode 100644 index 000000000000..163a34226558 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js @@ -0,0 +1,344 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 5, + 9 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + } + }, + "children": [ + { + "type": "JSXExpressionContainer", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 3, + 5 + ], + "expression": { + "type": "JSXEmptyExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 4, + 4 + ] + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.src.js new file mode 100644 index 000000000000..7e7ae12a57fa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.src.js @@ -0,0 +1 @@ +
{}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.result.js new file mode 100644 index 000000000000..a21e5ebd998d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.result.js @@ -0,0 +1,995 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "range": [ + 0, + 84 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "range": [ + 0, + 84 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 83 + } + }, + "range": [ + 0, + 83 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 83 + } + }, + "range": [ + 0, + 83 + ], + "attributes": [ + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 3, + 10 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "b" + }, + "value": { + "type": "JSXExpressionContainer", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 5, + 10 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ], + "value": " ", + "raw": "\" \"" + } + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 11, + 16 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "c" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "value": " ", + "raw": "\" \"" + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 17, + 26 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "d" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 19, + 26 + ], + "value": "&", + "raw": "\"&\"" + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 27, + 43 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ], + "name": "e" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 29, + 43 + ], + "value": "id=1&group=2", + "raw": "\"id=1&group=2\"" + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "range": [ + 44, + 59 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ], + "name": "f" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "range": [ + 46, + 59 + ], + "value": "�", + "raw": "\"�\"" + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 71 + } + }, + "range": [ + 60, + 71 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "range": [ + 60, + 61 + ], + "name": "g" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 71 + } + }, + "range": [ + 62, + 71 + ], + "value": "{*;", + "raw": "\"{*;\"" + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 72 + }, + "end": { + "line": 1, + "column": 80 + } + }, + "range": [ + 72, + 80 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 72 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "range": [ + 72, + 73 + ], + "name": "h" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 74 + }, + "end": { + "line": 1, + "column": 80 + } + }, + "range": [ + 74, + 80 + ], + "value": "&#x;", + "raw": "\"&#x;\"" + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "String", + "value": "\" \"", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "JSXIdentifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "JSXText", + "value": "\" \"", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "JSXIdentifier", + "value": "d", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "JSXText", + "value": "\"&\"", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 19, + 26 + ] + }, + { + "type": "JSXIdentifier", + "value": "e", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "JSXText", + "value": "\"id=1&group=2\"", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 29, + 43 + ] + }, + { + "type": "JSXIdentifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "JSXText", + "value": "\"�\"", + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 59 + } + }, + "range": [ + 46, + 59 + ] + }, + { + "type": "JSXIdentifier", + "value": "g", + "loc": { + "start": { + "line": 1, + "column": 60 + }, + "end": { + "line": 1, + "column": 61 + } + }, + "range": [ + 60, + 61 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 62 + } + }, + "range": [ + 61, + 62 + ] + }, + { + "type": "JSXText", + "value": "\"{*;\"", + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 71 + } + }, + "range": [ + 62, + 71 + ] + }, + { + "type": "JSXIdentifier", + "value": "h", + "loc": { + "start": { + "line": 1, + "column": 72 + }, + "end": { + "line": 1, + "column": 73 + } + }, + "range": [ + 72, + 73 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 73 + }, + "end": { + "line": 1, + "column": 74 + } + }, + "range": [ + 73, + 74 + ] + }, + { + "type": "JSXText", + "value": "\"&#x;\"", + "loc": { + "start": { + "line": 1, + "column": 74 + }, + "end": { + "line": 1, + "column": 80 + } + }, + "range": [ + 74, + 80 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 81 + }, + "end": { + "line": 1, + "column": 82 + } + }, + "range": [ + 81, + 82 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 82 + }, + "end": { + "line": 1, + "column": 83 + } + }, + "range": [ + 82, + 83 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 83 + }, + "end": { + "line": 1, + "column": 84 + } + }, + "range": [ + 83, + 84 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.src.js new file mode 100644 index 000000000000..b218700ab0f5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js new file mode 100644 index 000000000000..f9489fcc874e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Unexpected token \"app\"" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.src.js new file mode 100644 index 000000000000..c4bdb625c16c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.src.js @@ -0,0 +1 @@ +
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js new file mode 100644 index 000000000000..3cea2521d1ce --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "JSX value should be either an expression or a quoted JSX text" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.src.js new file mode 100644 index 000000000000..a3d16ade8f01 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js new file mode 100644 index 000000000000..ace1f56b029d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Unterminated string constant" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.src.js new file mode 100644 index 000000000000..20899cb988ae --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js new file mode 100644 index 000000000000..674267de5c7e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 2, + "lineNumber": 1, + "column": 3, + "message": "Unexpected token [" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.src.js new file mode 100644 index 000000000000..059be0b3c2a0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js new file mode 100644 index 000000000000..efba70a02b42 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Unexpected token ;" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.src.js new file mode 100644 index 000000000000..032a56b3d7e1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.src.js @@ -0,0 +1 @@ +{"str";}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js new file mode 100644 index 000000000000..1550ffb84edd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Unexpected token ." +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.src.js new file mode 100644 index 000000000000..297c850a4931 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.src.js @@ -0,0 +1 @@ +<.a>; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js new file mode 100644 index 000000000000..24994140cbb3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 27, + "lineNumber": 1, + "column": 28, + "message": "Unexpected token {" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.src.js new file mode 100644 index 000000000000..e2b8b4aabcc6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.src.js @@ -0,0 +1 @@ +
stuff
; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js new file mode 100644 index 000000000000..19d15dbd4ad1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Expected corresponding JSX closing tag for " +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.src.js new file mode 100644 index 000000000000..70b531344460 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js new file mode 100644 index 000000000000..b8926778fa64 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Unterminated JSX contents" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.src.js new file mode 100644 index 000000000000..cdb02a657ee0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js new file mode 100644 index 000000000000..6d1e78bfdd7a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Expected corresponding JSX closing tag for " +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.src.js new file mode 100644 index 000000000000..aed52724e824 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js new file mode 100644 index 000000000000..96c689a0cb21 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Expected corresponding JSX closing tag for " +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.src.js new file mode 100644 index 000000000000..bbda65c72d7c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js new file mode 100644 index 000000000000..c6715eabcaf4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "JSX attributes must only be assigned a non-empty expression" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js new file mode 100644 index 000000000000..b6d9a638840e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js new file mode 100644 index 000000000000..801a1aa2a434 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Unterminated JSX contents" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.src.js new file mode 100644 index 000000000000..7c7493261deb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js new file mode 100644 index 000000000000..d6f5dfb0fae0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Unexpected token :" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.src.js new file mode 100644 index 000000000000..203ca0836b8f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.src.js @@ -0,0 +1 @@ +<:a />; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js new file mode 100644 index 000000000000..2b0fd9e782cf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Unterminated regular expression" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.src.js new file mode 100644 index 000000000000..52bc77e33ac1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js new file mode 100644 index 000000000000..b2f52e846266 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Unexpected token props" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.src.js new file mode 100644 index 000000000000..2d96e2fa71cb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.src.js @@ -0,0 +1 @@ +
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js new file mode 100644 index 000000000000..03f355f8b8f6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Unexpected token :" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.src.js new file mode 100644 index 000000000000..4c9e774a3c74 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js new file mode 100644 index 000000000000..465439f35d02 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js @@ -0,0 +1,557 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 0, + 7 + ], + "attributes": [], + "name": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 1, + 6 + ], + "object": { + "type": "JSXNamespacedName", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "namespace": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "b" + } + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "c" + } + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 7, + 15 + ], + "name": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "object": { + "type": "JSXNamespacedName", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "namespace": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "b" + } + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "c" + } + } + }, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "JSXIdentifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "JSXIdentifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.src.js new file mode 100644 index 000000000000..f3a9fdc0e4f8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js new file mode 100644 index 000000000000..bf2e5e6ebb2f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 49, + "lineNumber": 1, + "column": 50, + "message": "Adjacent JSX elements must be wrapped in an enclosing tag" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.src.js new file mode 100644 index 000000000000..0c8bde149a88 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.src.js @@ -0,0 +1 @@ +var x =
one
/* intervening comment */
two
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js new file mode 100644 index 000000000000..c453466eb5a3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 22, + "lineNumber": 1, + "column": 23, + "message": "Adjacent JSX elements must be wrapped in an enclosing tag" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.src.js new file mode 100644 index 000000000000..7f8c0f612b39 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.src.js @@ -0,0 +1 @@ +var x =
one
two
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js new file mode 100644 index 000000000000..5f0ea4d3c6e6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Unexpected token /" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.src.js new file mode 100644 index 000000000000..a365ca6f5564 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js new file mode 100644 index 000000000000..b4d7ad288279 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Unexpected token {" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.src.js new file mode 100644 index 000000000000..cff69dd9a082 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.src.js @@ -0,0 +1 @@ +
stuff
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js new file mode 100644 index 000000000000..9412307c135a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Unexpected token >" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.src.js new file mode 100644 index 000000000000..40585f15c755 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js new file mode 100644 index 000000000000..d24f10ca484f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.src.js new file mode 100644 index 000000000000..afdfc83b1575 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.result.js new file mode 100644 index 000000000000..d3f1e2ca243a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "日本語" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "name": "日本語" + } + }, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "日本語", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "JSXIdentifier", + "value": "日本語", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.src.js new file mode 100644 index 000000000000..750d3539568e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.src.js @@ -0,0 +1 @@ +<日本語>; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.result.js new file mode 100644 index 000000000000..6be31bd84662 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "expression": { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "left": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 1, + 8 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 1, + 8 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 2, + 5 + ], + "name": "div" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + }, + "operator": "<", + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 2, + 5 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.src.js new file mode 100644 index 000000000000..d2b623552527 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.src.js @@ -0,0 +1 @@ +(
) < x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js new file mode 100644 index 000000000000..fa4913638a97 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js @@ -0,0 +1,311 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + } + }, + "children": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 3, + 7 + ], + "value": " ", + "raw": " " + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "JSXText", + "value": " ", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 3, + 7 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.src.js new file mode 100644 index 000000000000..8283d5e183d2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.src.js @@ -0,0 +1 @@ + ; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js new file mode 100644 index 000000000000..d2a62e5c6c5c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js @@ -0,0 +1,962 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 0, + 41 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 0, + 41 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 0, + 40 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "attributes": [ + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 3, + 14 + ], + "name": { + "type": "JSXNamespacedName", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 3, + 8 + ], + "namespace": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "n" + }, + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "name": "foo" + } + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "value": "bar", + "raw": "\"bar\"" + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 36, + 40 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ], + "name": "a" + } + }, + "children": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "value": " ", + "raw": " " + }, + { + "type": "JSXExpressionContainer", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 16, + 23 + ], + "expression": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 17, + 22 + ], + "name": "value" + } + }, + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ], + "value": " ", + "raw": " " + }, + { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 24, + 36 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ], + "name": "b" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 32, + 36 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ], + "name": "b" + } + }, + "children": [ + { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 27, + 32 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 27, + 32 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ], + "name": "c" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + ] + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "JSXIdentifier", + "value": "n", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "JSXIdentifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "JSXText", + "value": "\"bar\"", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "JSXText", + "value": " ", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "value", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 17, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "JSXText", + "value": " ", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "JSXIdentifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 39, + 40 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.src.js new file mode 100644 index 000000000000..6cd67fa28f0f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.src.js @@ -0,0 +1 @@ + {value} ; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js new file mode 100644 index 000000000000..49e53910114c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js @@ -0,0 +1,382 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "attributes": [ + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "name": { + "type": "JSXNamespacedName", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "namespace": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "n" + }, + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "v" + } + }, + "value": null + } + ], + "name": { + "type": "JSXNamespacedName", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "namespace": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "n" + }, + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "a" + } + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "n", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "JSXIdentifier", + "value": "n", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "JSXIdentifier", + "value": "v", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.src.js new file mode 100644 index 000000000000..eb59e59d6b6b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js new file mode 100644 index 000000000000..5664539c5e5a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Expecting Unicode escape sequence \\uXXXX" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.src.js new file mode 100644 index 000000000000..adcbb4c63a2c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.src.js @@ -0,0 +1 @@ +\nbar\nbaz\r\n; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js new file mode 100644 index 000000000000..2941702078d2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 3, + "lineNumber": 1, + "column": 4, + "message": "Expecting Unicode escape sequence \\uXXXX" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.src.js new file mode 100644 index 000000000000..11d5cedfff0b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js new file mode 100644 index 000000000000..a44cbb89d871 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js @@ -0,0 +1,185 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.src.js new file mode 100644 index 000000000000..461e8955c72a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js new file mode 100644 index 000000000000..52d352cf28e3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js @@ -0,0 +1,401 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 0, + 36 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 0, + 36 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "attributes": [ + { + "type": "JSXSpreadAttribute", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 5, + 15 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "name": "props" + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 16, + 32 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 16, + 20 + ], + "name": "post" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 21, + 32 + ], + "value": "attribute", + "raw": "\"attribute\"" + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "div" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ] + }, + { + "type": "Identifier", + "value": "props", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "JSXIdentifier", + "value": "post", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 16, + 20 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "JSXText", + "value": "\"attribute\"", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 21, + 32 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.src.js new file mode 100644 index 000000000000..ee11c44f484f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.src.js @@ -0,0 +1 @@ +
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js new file mode 100644 index 000000000000..62b59ca383c0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "attributes": [ + { + "type": "JSXSpreadAttribute", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 5, + 15 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "name": "props" + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "div" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ] + }, + { + "type": "Identifier", + "value": "props", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.src.js new file mode 100644 index 000000000000..99d6539aae2e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.src.js @@ -0,0 +1 @@ +
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js new file mode 100644 index 000000000000..f70ee28065a9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js @@ -0,0 +1,415 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "attributes": [], + "name": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "object": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "b" + } + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 5, + 11 + ], + "name": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "object": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "b" + } + } + }, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.src.js new file mode 100644 index 000000000000..6d5813d15dfa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js new file mode 100644 index 000000000000..ce3d3aed1b20 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js @@ -0,0 +1,557 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 0, + 7 + ], + "attributes": [], + "name": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 1, + 6 + ], + "object": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "object": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "b" + } + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "c" + } + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 7, + 15 + ], + "name": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "object": { + "type": "JSXMemberExpression", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "object": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "b" + } + }, + "property": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "c" + } + } + }, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "JSXIdentifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "JSXIdentifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.src.js new file mode 100644 index 000000000000..78a3d60d40d7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.src.js @@ -0,0 +1 @@ +; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.result.js new file mode 100644 index 000000000000..5d7495063e3f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.result.js @@ -0,0 +1,311 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "div" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 18, + 24 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ], + "name": "div" + } + }, + "children": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 5, + 18 + ], + "value": "@test content", + "raw": "@test content" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "JSXText", + "value": "@test content", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 5, + 18 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.src.js new file mode 100644 index 000000000000..ffaed57254f4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.src.js @@ -0,0 +1 @@ +
@test content
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js new file mode 100644 index 000000000000..2179b523b439 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js @@ -0,0 +1,597 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 0, + 54 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 0, + 54 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 0, + 53 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 0, + 47 + ], + "attributes": [ + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 5, + 18 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "name": "pre" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 9, + 18 + ], + "value": "leading", + "raw": "\"leading\"" + } + }, + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 19, + 35 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 19, + 23 + ], + "name": "pre2" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 24, + 35 + ], + "value": "attribute", + "raw": "\"attribute\"" + } + }, + { + "type": "JSXSpreadAttribute", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 36, + 46 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 40, + 45 + ], + "name": "props" + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "div" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 47, + 53 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 49, + 52 + ], + "name": "div" + } + }, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "JSXIdentifier", + "value": "pre", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "JSXText", + "value": "\"leading\"", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 9, + 18 + ] + }, + { + "type": "JSXIdentifier", + "value": "pre2", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 19, + 23 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "JSXText", + "value": "\"attribute\"", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 24, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 37, + 40 + ] + }, + { + "type": "Identifier", + "value": "props", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 40, + 45 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 46, + 47 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 47, + 48 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 49 + } + }, + "range": [ + 48, + 49 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 49 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "range": [ + 49, + 52 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 52 + }, + "end": { + "line": 1, + "column": 53 + } + }, + "range": [ + 52, + 53 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 53 + }, + "end": { + "line": 1, + "column": 54 + } + }, + "range": [ + 53, + 54 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.src.js new file mode 100644 index 000000000000..ee9ab396dbff --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.src.js @@ -0,0 +1 @@ +
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js new file mode 100644 index 000000000000..4e6a8873f192 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js @@ -0,0 +1,294 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "attributes": [ + { + "type": "JSXAttribute", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 3, + 20 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "b" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 5, + 20 + ], + "value": "¬anentity;", + "raw": "\"¬anentity;\"" + } + } + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + "selfClosing": true + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "JSXIdentifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "JSXText", + "value": "\"¬anentity;\"", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 5, + 20 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.src.js new file mode 100644 index 000000000000..d300d95f45ca --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.src.js @@ -0,0 +1 @@ +
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js new file mode 100644 index 000000000000..9eeb5c87a9bb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 19, + "lineNumber": 2, + "column": 1, + "message": "Deleting local variable in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.src.js new file mode 100644 index 000000000000..eb6dc52a826d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.src.js @@ -0,0 +1,2 @@ +import x from "x"; +delete x; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js new file mode 100644 index 000000000000..1ad46aabcb0d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 16, + "lineNumber": 2, + "column": 2, + "message": "'import' and 'export' may only appear at the top level" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.src.js new file mode 100644 index 000000000000..cdc0cd394494 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.src.js @@ -0,0 +1,4 @@ +function x() { + export default friends; +} + diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js new file mode 100644 index 000000000000..5a85a9686dcc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 28, + "lineNumber": 3, + "column": 1, + "message": "'with' in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.src.js new file mode 100644 index 000000000000..a17a321127ac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.src.js @@ -0,0 +1,5 @@ +import house from "house"; + +with (house) { + console.log(roof); +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js new file mode 100644 index 000000000000..6aec5680b6c5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js @@ -0,0 +1,147 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "body": [ + { + "type": "ExportDefaultDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "declaration": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ], + "elements": [] + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.src.js new file mode 100644 index 000000000000..d6d1738de67e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.src.js @@ -0,0 +1 @@ +export default []; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js new file mode 100644 index 000000000000..b9e8b977911f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js @@ -0,0 +1,239 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "ExportDefaultDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "declaration": { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "left": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "value": 1, + "raw": "1" + }, + "operator": "+", + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "value": 2, + "raw": "2" + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "+", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Numeric", + "value": "2", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.src.js new file mode 100644 index 000000000000..f30c184a1ae0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.src.js @@ -0,0 +1 @@ +export default (1 + 2); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js new file mode 100644 index 000000000000..383afa4210b9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js @@ -0,0 +1,204 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "ExportDefaultDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "declaration": { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 15, + 29 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 27, + 29 + ], + "body": [] + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 15, + 23 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.src.js new file mode 100644 index 000000000000..ea9b101e1c22 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.src.js @@ -0,0 +1 @@ +export default function () {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js new file mode 100644 index 000000000000..9fbc71a5e615 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js @@ -0,0 +1,239 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "body": [ + { + "type": "ExportDefaultDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "declaration": { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 15, + 32 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "name": "foo" + }, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 30, + 32 + ], + "body": [] + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 15, + 23 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.src.js new file mode 100644 index 000000000000..386baca17315 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.src.js @@ -0,0 +1 @@ +export default function foo() {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js new file mode 100644 index 000000000000..e90a1fc1e114 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js @@ -0,0 +1,130 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "body": [ + { + "type": "ExportDefaultDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "declaration": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ], + "value": 42, + "raw": "42" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Numeric", + "value": "42", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.src.js new file mode 100644 index 000000000000..7a4e8a723a40 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.src.js @@ -0,0 +1 @@ +export default 42; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js new file mode 100644 index 000000000000..fd5403f42af1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js @@ -0,0 +1,260 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "body": [ + { + "type": "ExportDefaultDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "declaration": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 15, + 25 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 17, + 23 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 17, + 20 + ], + "name": "foo" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ], + "value": 1, + "raw": "1" + }, + "kind": "init" + } + ] + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 17, + 20 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.src.js new file mode 100644 index 000000000000..f8266ca25f5d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.src.js @@ -0,0 +1 @@ +export default { foo: 1 }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js new file mode 100644 index 000000000000..efb2f087ef15 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js @@ -0,0 +1,129 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExportDefaultDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "declaration": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ], + "name": "foo" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 7, + 14 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.src.js new file mode 100644 index 000000000000..f7b318b3f637 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.src.js @@ -0,0 +1 @@ +export default foo; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js new file mode 100644 index 000000000000..389efcd3ef4c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js @@ -0,0 +1,148 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "body": [ + { + "type": "ExportAllDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 14, + 19 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 9, + 13 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 14, + 19 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.src.js new file mode 100644 index 000000000000..9ec8f63ab2fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.src.js @@ -0,0 +1 @@ +export * from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js new file mode 100644 index 000000000000..3b80ac33fe4b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js @@ -0,0 +1,240 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 8, + 15 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 8, + 15 + ], + "name": "default" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 8, + 15 + ], + "name": "default" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 22, + 27 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 8, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 17, + 21 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 22, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.src.js new file mode 100644 index 000000000000..2c7930d925cb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.src.js @@ -0,0 +1 @@ +export {default} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js new file mode 100644 index 000000000000..8ee014b07606 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js @@ -0,0 +1,276 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 8, + 22 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ], + "name": "default" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 29, + 34 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 24, + 28 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 29, + 34 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.src.js new file mode 100644 index 000000000000..5be9a685aabd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.src.js @@ -0,0 +1 @@ +export {foo as default} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js new file mode 100644 index 000000000000..f9ab0f990889 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js @@ -0,0 +1,276 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 8, + 18 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ], + "name": "bar" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 25, + 30 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 20, + 24 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 25, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.src.js new file mode 100644 index 000000000000..9fff903bd969 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.src.js @@ -0,0 +1 @@ +export {foo as bar} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js new file mode 100644 index 000000000000..136629250063 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js @@ -0,0 +1,365 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 0, + 40 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 0, + 40 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 8, + 22 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ], + "name": "default" + } + }, + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "name": "bar" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "name": "bar" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 34, + 39 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 29, + 33 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 34, + 39 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 39, + 40 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.src.js new file mode 100644 index 000000000000..4461d79e3bf3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.src.js @@ -0,0 +1 @@ +export {foo as default, bar} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js new file mode 100644 index 000000000000..1d3a6b83a44f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js @@ -0,0 +1,240 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 18, + 23 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 13, + 17 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 18, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.src.js new file mode 100644 index 000000000000..83b7b67c51ce --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.src.js @@ -0,0 +1 @@ +export {foo} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js new file mode 100644 index 000000000000..9b2dc6fe608a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js @@ -0,0 +1,329 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + } + }, + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 23, + 28 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 18, + 22 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 23, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.src.js new file mode 100644 index 000000000000..35c2762a2954 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.src.js @@ -0,0 +1 @@ +export {foo, bar} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js new file mode 100644 index 000000000000..b59434772fb2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js @@ -0,0 +1,223 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "declaration": { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 7, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 16, + 19 + ], + "name": "foo" + }, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ], + "body": [] + } + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 7, + 15 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 16, + 19 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.src.js new file mode 100644 index 000000000000..768586d72c59 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.src.js @@ -0,0 +1 @@ +export function foo () {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js new file mode 100644 index 000000000000..86a57870d177 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js @@ -0,0 +1,222 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 8, + 22 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ], + "name": "default" + } + } + ], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.src.js new file mode 100644 index 000000000000..5d32a24de0a9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.src.js @@ -0,0 +1 @@ +export {foo as default}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js new file mode 100644 index 000000000000..66bf9005b102 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js @@ -0,0 +1,222 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 8, + 18 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ], + "name": "bar" + } + } + ], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.src.js new file mode 100644 index 000000000000..e7820a6f027c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.src.js @@ -0,0 +1 @@ +export {foo as bar}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js new file mode 100644 index 000000000000..6ac7d47a262a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js @@ -0,0 +1,311 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 8, + 22 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ], + "name": "default" + } + }, + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "name": "bar" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ], + "name": "bar" + } + } + ], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 15, + 22 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 24, + 27 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.src.js new file mode 100644 index 000000000000..ff57927839e8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.src.js @@ -0,0 +1 @@ +export {foo as default, bar}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js new file mode 100644 index 000000000000..04d96aaf7c97 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js @@ -0,0 +1,114 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "declaration": null, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.src.js new file mode 100644 index 000000000000..cb0ff5c3b541 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.src.js @@ -0,0 +1 @@ +export {}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js new file mode 100644 index 000000000000..05e6245e5087 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js @@ -0,0 +1,186 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + } + } + ], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.src.js new file mode 100644 index 000000000000..df5f5e609e93 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.src.js @@ -0,0 +1 @@ +export {foo}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js new file mode 100644 index 000000000000..75467b133c3a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + } + }, + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + } + } + ], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.src.js new file mode 100644 index 000000000000..61bc40fd77ea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.src.js @@ -0,0 +1 @@ +export {foo, bar,}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js new file mode 100644 index 000000000000..eec1bef75d8e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js @@ -0,0 +1,275 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "foo" + } + }, + { + "type": "ExportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + }, + "exported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + } + } + ], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.src.js new file mode 100644 index 000000000000..fdbc94275097 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.src.js @@ -0,0 +1 @@ +export {foo, bar}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js new file mode 100644 index 000000000000..bfc762dd8c21 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js @@ -0,0 +1,315 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "declaration": { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 7, + 32 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 11, + 31 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ], + "name": "foo" + }, + "init": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 17, + 31 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 29, + 31 + ], + "body": [] + } + } + } + ], + "kind": "var" + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 17, + 25 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.src.js new file mode 100644 index 000000000000..f8af28821237 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.src.js @@ -0,0 +1 @@ +export var foo = function () {}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js new file mode 100644 index 000000000000..471bfa3b18e7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js @@ -0,0 +1,223 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "declaration": { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 7, + 19 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 11, + 18 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ], + "name": "foo" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "value": 1, + "raw": "1" + } + } + ], + "kind": "var" + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.src.js new file mode 100644 index 000000000000..e2e71aa4fc6d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.src.js @@ -0,0 +1 @@ +export var foo = 1; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js new file mode 100644 index 000000000000..25534f39cb7a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js @@ -0,0 +1,169 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "ExportNamedDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "declaration": { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 7, + 15 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ], + "name": "bar" + }, + "init": null + } + ], + "kind": "var" + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.src.js new file mode 100644 index 000000000000..62da3e60183c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.src.js @@ -0,0 +1 @@ +export var bar; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js new file mode 100644 index 000000000000..9f13762ed3bf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js @@ -0,0 +1,310 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "name": "foo" + } + }, + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 23, + 28 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 18, + 22 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 23, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.src.js new file mode 100644 index 000000000000..e544977b3acf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.src.js @@ -0,0 +1 @@ +import foo, {bar} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js new file mode 100644 index 000000000000..0a6962efb7ac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js @@ -0,0 +1,292 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "name": "foo" + } + }, + { + "type": "ImportNamespaceSpecifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 12, + 20 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 17, + 20 + ], + "name": "bar" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 26, + 31 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 17, + 20 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 21, + 25 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 26, + 31 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.src.js new file mode 100644 index 000000000000..084fa0cdd14a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.src.js @@ -0,0 +1 @@ +import foo, * as bar from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js new file mode 100644 index 000000000000..eebf0b855ff7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js @@ -0,0 +1,275 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "specifiers": [ + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 8, + 22 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 8, + 15 + ], + "name": "default" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 19, + 22 + ], + "name": "foo" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 29, + 34 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Keyword", + "value": "default", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 8, + 15 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 16, + 18 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 19, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 24, + 28 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 29, + 34 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.src.js new file mode 100644 index 000000000000..96c936db1040 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.src.js @@ -0,0 +1 @@ +import {default as foo} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js new file mode 100644 index 000000000000..302d67eaaa1b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js @@ -0,0 +1,185 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "name": "foo" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 11, + 15 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 16, + 21 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.src.js new file mode 100644 index 000000000000..8d1420050a85 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.src.js @@ -0,0 +1 @@ +import foo from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js new file mode 100644 index 000000000000..d9f86150c9b0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js @@ -0,0 +1,167 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "$" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 14, + 22 + ], + "value": "jquery", + "raw": "\"jquery\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Identifier", + "value": "$", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 9, + 13 + ] + }, + { + "type": "String", + "value": "\"jquery\"", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 14, + 22 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.src.js new file mode 100644 index 000000000000..ea74241b4bab --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.src.js @@ -0,0 +1 @@ +import $ from "jquery" diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js new file mode 100644 index 000000000000..3db364e76fd7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js @@ -0,0 +1,113 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 7, + 12 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 7, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.src.js new file mode 100644 index 000000000000..c0748305d535 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.src.js @@ -0,0 +1 @@ +import "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js new file mode 100644 index 000000000000..0990b1ae8958 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js @@ -0,0 +1,275 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "specifiers": [ + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 8, + 18 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ], + "name": "baz" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 25, + 30 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Identifier", + "value": "baz", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 20, + 24 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 25, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.src.js new file mode 100644 index 000000000000..769f3b3d0cb2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.src.js @@ -0,0 +1 @@ +import {bar as baz} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js new file mode 100644 index 000000000000..29bc59fa5dff --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js @@ -0,0 +1,364 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 0, + 36 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 0, + 36 + ], + "specifiers": [ + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 8, + 18 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ], + "name": "baz" + } + }, + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ], + "name": "xyz" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ], + "name": "xyz" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 30, + 35 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ] + }, + { + "type": "Identifier", + "value": "baz", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "xyz", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 25, + 29 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 30, + 35 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.src.js new file mode 100644 index 000000000000..5198ead3cde7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.src.js @@ -0,0 +1 @@ +import {bar as baz, xyz} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js new file mode 100644 index 000000000000..eee15feb5e58 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js @@ -0,0 +1,167 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "specifiers": [], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 15, + 20 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 10, + 14 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 15, + 20 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.src.js new file mode 100644 index 000000000000..5faab37ebb44 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.src.js @@ -0,0 +1 @@ +import {} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js new file mode 100644 index 000000000000..531a0c3ca71a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js @@ -0,0 +1,239 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "specifiers": [ + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 18, + 23 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 13, + 17 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 18, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.src.js new file mode 100644 index 000000000000..fc80c74dd71d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.src.js @@ -0,0 +1 @@ +import {bar} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js new file mode 100644 index 000000000000..da3b7c5fef29 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js @@ -0,0 +1,346 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "specifiers": [ + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + } + }, + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "baz" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "baz" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 24, + 29 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "baz", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 19, + 23 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 24, + 29 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.src.js new file mode 100644 index 000000000000..c2e95853d61f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.src.js @@ -0,0 +1 @@ +import {bar, baz,} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js new file mode 100644 index 000000000000..ae83c96e25b3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js @@ -0,0 +1,328 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "specifiers": [ + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ], + "name": "bar" + } + }, + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "baz" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "baz" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 23, + 28 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "baz", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 18, + 22 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 23, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.src.js new file mode 100644 index 000000000000..2fb83c2349cc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.src.js @@ -0,0 +1 @@ +import {bar, baz} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js new file mode 100644 index 000000000000..442bcf2c392a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js @@ -0,0 +1,221 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "specifiers": [ + { + "type": "ImportNamespaceSpecifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 7, + 15 + ], + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ], + "name": "foo" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 21, + 26 + ], + "value": "foo", + "raw": "\"foo\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "*", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 16, + 20 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 21, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.src.js new file mode 100644 index 000000000000..e55c0775003b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.src.js @@ -0,0 +1 @@ +import * as foo from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js new file mode 100644 index 000000000000..51de8627bfee --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js @@ -0,0 +1,257 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 0, + 33 + ], + "body": [ + { + "type": "ImportDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 0, + 33 + ], + "specifiers": [ + { + "type": "ImportSpecifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 9, + 20 + ], + "imported": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 9, + 13 + ], + "name": "null" + }, + "local": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 17, + 20 + ], + "name": "nil" + } + } + ], + "source": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 28, + 33 + ], + "value": "bar", + "raw": "\"bar\"" + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "import", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Null", + "value": "null", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 9, + 13 + ] + }, + { + "type": "Identifier", + "value": "as", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ] + }, + { + "type": "Identifier", + "value": "nil", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 17, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Identifier", + "value": "from", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 23, + 27 + ] + }, + { + "type": "String", + "value": "\"bar\"", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 28, + 33 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.src.js new file mode 100644 index 000000000000..ced8a86bb836 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.src.js @@ -0,0 +1 @@ +import { null as nil } from "bar" diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js new file mode 100644 index 000000000000..17d1ba596975 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 11, + "lineNumber": 1, + "column": 12, + "message": "Unexpected token await" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.src.js new file mode 100644 index 000000000000..91cd4f3b2b1f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.src.js @@ -0,0 +1 @@ +export var await; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js new file mode 100644 index 000000000000..25e055bd7778 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Unexpected token class" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.src.js new file mode 100644 index 000000000000..a6e68e983892 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.src.js @@ -0,0 +1 @@ +export default class {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js new file mode 100644 index 000000000000..f2375cd29e10 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 9, + "lineNumber": 2, + "column": 1, + "message": "Unexpected token" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.src.js new file mode 100644 index 000000000000..3f576881e6c5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.src.js @@ -0,0 +1 @@ +export * diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js new file mode 100644 index 000000000000..fa80be05a7cf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Unexpected token +" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.src.js new file mode 100644 index 000000000000..32cb28ea92ba --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.src.js @@ -0,0 +1 @@ +export * + diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js new file mode 100644 index 000000000000..2307539dc9c4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Unexpected token =" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.src.js new file mode 100644 index 000000000000..0dfb038eb536 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.src.js @@ -0,0 +1 @@ +export default = 42 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js new file mode 100644 index 000000000000..7d0e4da8a8bf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Unexpected token default" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.src.js new file mode 100644 index 000000000000..a0af03d2e65f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.src.js @@ -0,0 +1 @@ +export {default} + diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js new file mode 100644 index 000000000000..3bfa9d5e8484 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 20, + "lineNumber": 1, + "column": 21, + "message": "Unexpected token \"foo\"" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.src.js new file mode 100644 index 000000000000..8dfa0a19a948 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.src.js @@ -0,0 +1 @@ +export default from "foo" diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js new file mode 100644 index 000000000000..7d0e4da8a8bf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "Unexpected token default" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.src.js new file mode 100644 index 000000000000..8f3cde5c9618 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.src.js @@ -0,0 +1 @@ +export {default} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js new file mode 100644 index 000000000000..71fbc25e548b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.src.js new file mode 100644 index 000000000000..40bb7fe8ade6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.src.js @@ -0,0 +1 @@ +export {foo,baz,,} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js new file mode 100644 index 000000000000..2650c22f80fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.src.js new file mode 100644 index 000000000000..ff3424cc6027 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.src.js @@ -0,0 +1 @@ +export {foo,,baz} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js new file mode 100644 index 000000000000..3840ae72d6f7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 17, + "lineNumber": 1, + "column": 18, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.src.js new file mode 100644 index 000000000000..69aac7e8e153 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.src.js @@ -0,0 +1 @@ +import foo, {bar}, foo from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js new file mode 100644 index 000000000000..2650c22f80fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.src.js new file mode 100644 index 000000000000..5be12dab64a6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.src.js @@ -0,0 +1 @@ +import {bar}, foo from "foo" diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js new file mode 100644 index 000000000000..67cd07b5c473 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 11, + "lineNumber": 2, + "column": 1, + "message": "Unexpected token" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.src.js new file mode 100644 index 000000000000..ddf557475a4a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.src.js @@ -0,0 +1 @@ +import foo diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js new file mode 100644 index 000000000000..9b520a58fb3f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Unexpected token bar" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.src.js new file mode 100644 index 000000000000..16e3ea289785 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.src.js @@ -0,0 +1 @@ +import foo from bar; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js new file mode 100644 index 000000000000..b2c0d7d9d1ea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 7, + "lineNumber": 1, + "column": 8, + "message": "Unexpected token default" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.src.js new file mode 100644 index 000000000000..6399a1a6620d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.src.js @@ -0,0 +1 @@ +import default from "foo" diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js new file mode 100644 index 000000000000..56b2c92b4f4e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 20, + "lineNumber": 2, + "column": 1, + "message": "Unexpected token" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.src.js new file mode 100644 index 000000000000..338ebc128b7e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.src.js @@ -0,0 +1 @@ +import { foo, bar } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js new file mode 100644 index 000000000000..27e1b80c2af6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Unexpected token bar" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.src.js new file mode 100644 index 000000000000..15dda167c6bd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.src.js @@ -0,0 +1 @@ +export {foo} from bar diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js new file mode 100644 index 000000000000..2650c22f80fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.src.js new file mode 100644 index 000000000000..a0557bf0ea54 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.src.js @@ -0,0 +1 @@ +import {bar}, {foo} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js new file mode 100644 index 000000000000..397186ec4a3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 15, + "lineNumber": 1, + "column": 16, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.src.js new file mode 100644 index 000000000000..24cede9de625 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.src.js @@ -0,0 +1 @@ +import * as foo, {bar} from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js new file mode 100644 index 000000000000..1df2bf9e2061 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 24, + "lineNumber": 2, + "column": 1, + "message": "Unexpected token" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.src.js new file mode 100644 index 000000000000..5d7daedfbd96 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.src.js @@ -0,0 +1 @@ +import {default as foo} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js new file mode 100644 index 000000000000..71fbc25e548b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 16, + "lineNumber": 1, + "column": 17, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.src.js new file mode 100644 index 000000000000..fd0b19b89bd5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.src.js @@ -0,0 +1 @@ +import {foo,baz,,} from 'toast'; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js new file mode 100644 index 000000000000..2650c22f80fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.src.js new file mode 100644 index 000000000000..467552325fd2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.src.js @@ -0,0 +1 @@ +import {foo,,baz} from 'toast'; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js new file mode 100644 index 000000000000..2650c22f80fd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.src.js new file mode 100644 index 000000000000..09d0d344e633 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.src.js @@ -0,0 +1 @@ +import {bar}, * as foo from "foo"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js new file mode 100644 index 000000000000..cf21fb2c1ca6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 9, + "lineNumber": 1, + "column": 10, + "message": "Unexpected token from" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.src.js new file mode 100644 index 000000000000..4382a94adbfb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.src.js @@ -0,0 +1 @@ +import * from "foo" diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js new file mode 100644 index 000000000000..deaf3293e3c8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 8, + "lineNumber": 1, + "column": 9, + "message": "new.target can only be used in functions" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.src.js new file mode 100644 index 000000000000..46b13d0e56be --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.src.js @@ -0,0 +1 @@ +var x = new.target; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js new file mode 100644 index 000000000000..52de9c60e12a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 25, + "lineNumber": 1, + "column": 26, + "message": "The only valid meta property for new is new.target" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.src.js new file mode 100644 index 000000000000..dc1b123d55d7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.src.js @@ -0,0 +1 @@ +var f = function() { new.unknown_property; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js new file mode 100644 index 000000000000..50b45bf23871 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js @@ -0,0 +1,421 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 0, + 40 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 0, + 40 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "f" + }, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 13, + 40 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 19, + 38 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 23, + 37 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 23, + 24 + ], + "name": "x" + }, + "init": { + "type": "MetaProperty", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 27, + 37 + ], + "meta": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 27, + 30 + ], + "name": "new" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 31, + 37 + ], + "name": "target" + } + } + } + ], + "kind": "var" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 19, + 22 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Keyword", + "value": "new", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 27, + 30 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Identifier", + "value": "target", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 31, + 37 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 39, + 40 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.src.js new file mode 100644 index 000000000000..44b77c7aacb6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.src.js @@ -0,0 +1,3 @@ +function f() { + var x = new.target; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js new file mode 100644 index 000000000000..d9878c12dcbf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js @@ -0,0 +1,425 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 0, + 29 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 4, + 28 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 8, + 28 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 14, + 26 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 15, + 20 + ], + "left": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 15, + 16 + ], + "value": 5, + "raw": "5" + }, + "operator": "+", + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 19, + 20 + ], + "value": 5, + "raw": "5" + } + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 23, + 26 + ], + "name": "foo" + }, + "kind": "init" + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "+", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 23, + 26 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.src.js new file mode 100644 index 000000000000..9c3cf5a43a0a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.src.js @@ -0,0 +1,3 @@ +var x = { + [5 + 5]: foo +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js new file mode 100644 index 000000000000..223995bf502d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js @@ -0,0 +1,426 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 1, + 17 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 2, + 9 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "x" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ], + "value": 10, + "raw": "10" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 11, + 16 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "y" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "value": 20, + "raw": "20" + }, + "kind": "init" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Numeric", + "value": "20", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.src.js new file mode 100644 index 000000000000..cbc10a6adc96 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.src.js @@ -0,0 +1 @@ +({[x]: 10, y: 20}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js new file mode 100644 index 000000000000..fc461135937e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js @@ -0,0 +1,647 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 0, + 32 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 1, + 30 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 2, + 14 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "x" + }, + "kind": "get", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "body": [] + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 16, + 29 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ], + "name": "x" + }, + "kind": "set", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 23, + 29 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ], + "name": "v" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 27, + 29 + ], + "body": [] + } + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 2, + 5 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 16, + 19 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "v", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.src.js new file mode 100644 index 000000000000..8b7a70fd3a66 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.src.js @@ -0,0 +1 @@ +({get [x]() {}, set [x](v) {}}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js new file mode 100644 index 000000000000..758277ec25f5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js @@ -0,0 +1,352 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 0, + 29 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 4, + 28 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 8, + 28 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 14, + 26 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 15, + 20 + ], + "value": "hey", + "raw": "\"hey\"" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 23, + 26 + ], + "name": "foo" + }, + "kind": "init" + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "String", + "value": "\"hey\"", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 15, + 20 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 23, + 26 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.src.js new file mode 100644 index 000000000000..d555f8aaa3b9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.src.js @@ -0,0 +1,3 @@ +var x = { + ["hey"]: foo +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js new file mode 100644 index 000000000000..fa5f0d5e35cc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js @@ -0,0 +1,351 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 0, + 27 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 4, + 26 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 8, + 26 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 14, + 24 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 15, + 18 + ], + "name": "bar" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 21, + 24 + ], + "name": "foo" + }, + "kind": "init" + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 21, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.src.js new file mode 100644 index 000000000000..7f41c2c10c4a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.src.js @@ -0,0 +1,3 @@ +var x = { + [bar]: foo +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js new file mode 100644 index 000000000000..e253e4bfaa90 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 20, + "lineNumber": 3, + "column": 1, + "message": "Unexpected token }" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.src.js new file mode 100644 index 000000000000..77380e2ad357 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.src.js @@ -0,0 +1,3 @@ +var x = { + [bar] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js new file mode 100644 index 000000000000..f7180132d444 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Unexpected token }" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js new file mode 100644 index 000000000000..8925311d4766 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js @@ -0,0 +1 @@ +({[x]}); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js new file mode 100644 index 000000000000..750041c1bd0c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js @@ -0,0 +1,370 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 1, + 18 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 2, + 17 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 3, + 12 + ], + "left": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 3, + 6 + ], + "value": "x", + "raw": "\"x\"" + }, + "operator": "+", + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "value": "y", + "raw": "\"y\"" + } + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ], + "value": 10, + "raw": "10" + }, + "kind": "init" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "String", + "value": "\"x\"", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 3, + 6 + ] + }, + { + "type": "Punctuator", + "value": "+", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "String", + "value": "\"y\"", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 15, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.src.js new file mode 100644 index 000000000000..14e5e1dcb0b8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.src.js @@ -0,0 +1 @@ +({["x" + "y"]: 10}); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js new file mode 100644 index 000000000000..52937b519615 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js @@ -0,0 +1,388 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 1, + 21 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 2, + 20 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "x" + }, + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 7, + 20 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 18, + 20 + ], + "body": [] + } + }, + "kind": "init" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 7, + 15 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.src.js new file mode 100644 index 000000000000..eafa2481f503 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.src.js @@ -0,0 +1 @@ +({[x]: function() {}}); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js new file mode 100644 index 000000000000..e970140d196a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js @@ -0,0 +1,296 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 1, + 10 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 2, + 9 + ], + "method": false, + "shorthand": false, + "computed": true, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "x" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ], + "value": 10, + "raw": "10" + }, + "kind": "init" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 7, + 9 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.src.js new file mode 100644 index 000000000000..0d7e62648fe2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.src.js @@ -0,0 +1 @@ +({[x]: 10}); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.result.js new file mode 100644 index 000000000000..976511e12ea8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 62, + "lineNumber": 7, + "column": 2, + "message": "Redefinition of __proto__ property" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.src.js new file mode 100644 index 000000000000..5fc4a41be350 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.src.js @@ -0,0 +1,8 @@ +"use strict"; + +var proto = {}; + +var x = { + __proto__: proto, + __proto__: proto +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.result.js new file mode 100644 index 000000000000..4d43f85c9697 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 64, + "lineNumber": 7, + "column": 2, + "message": "Redefinition of __proto__ property" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.src.js new file mode 100644 index 000000000000..8761b73461ca --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.src.js @@ -0,0 +1,8 @@ +"use strict"; + +var proto = {}; + +var x = { + "__proto__": proto, + "__proto__": proto +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js new file mode 100644 index 000000000000..9747c26c100f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js @@ -0,0 +1,518 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 2 + } + }, + "range": [ + 0, + 53 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "value": "use strict", + "raw": "\"use strict\"" + } + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 2 + } + }, + "range": [ + 15, + 53 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "range": [ + 19, + 52 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 19, + 20 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "range": [ + 23, + 52 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "range": [ + 26, + 36 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 26, + 27 + ], + "name": "y" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "range": [ + 29, + 36 + ], + "value": "first", + "raw": "'first'" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 39, + 50 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 39, + 40 + ], + "name": "y" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 42, + 50 + ], + "value": "second", + "raw": "'second'" + }, + "kind": "init" + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "String", + "value": "'first'", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "range": [ + 29, + 36 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 39, + 40 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "String", + "value": "'second'", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 12 + } + }, + "range": [ + 42, + 50 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + }, + "range": [ + 52, + 53 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js new file mode 100644 index 000000000000..3942db82641a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js @@ -0,0 +1,6 @@ +"use strict"; + +var x = { + y: 'first', + y: 'second' +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js new file mode 100644 index 000000000000..128460a5dbbc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js @@ -0,0 +1,520 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 2 + } + }, + "range": [ + 0, + 57 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "value": "use strict", + "raw": "\"use strict\"" + } + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 2 + } + }, + "range": [ + 15, + 57 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "range": [ + 19, + 56 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 19, + 20 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "range": [ + 23, + 56 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "range": [ + 26, + 38 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "range": [ + 26, + 29 + ], + "value": "y", + "raw": "\"y\"" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "range": [ + 31, + 38 + ], + "value": "first", + "raw": "\"first\"" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 41, + 54 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "range": [ + 41, + 44 + ], + "value": "y", + "raw": "\"y\"" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 46, + 54 + ], + "value": "second", + "raw": "\"second\"" + }, + "kind": "init" + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "String", + "value": "\"y\"", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "range": [ + 26, + 29 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "String", + "value": "\"first\"", + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "range": [ + 31, + 38 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "String", + "value": "\"y\"", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "range": [ + 41, + 44 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 44, + 45 + ] + }, + { + "type": "String", + "value": "\"second\"", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "range": [ + 46, + 54 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + }, + "range": [ + 56, + 57 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js new file mode 100644 index 000000000000..0f2b2710246e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js @@ -0,0 +1,6 @@ +"use strict"; + +var x = { + "y": "first", + "y": "second" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js new file mode 100644 index 000000000000..f8f2ba979254 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 19, + "lineNumber": 2, + "column": 14, + "message": "Unexpected token 42" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.src.js new file mode 100644 index 000000000000..6fd56ea339eb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.src.js @@ -0,0 +1,3 @@ +x = { + method() 42 +};; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js new file mode 100644 index 000000000000..2c0741fde8fb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js @@ -0,0 +1,462 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 50 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 50 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 4, + 49 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 8, + 49 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 14, + 47 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 14, + 17 + ], + "name": "foo" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 17, + 47 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 20, + 47 + ], + "body": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "range": [ + 30, + 41 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 37, + 40 + ], + "name": "bar" + } + } + ] + } + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 14, + 17 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 30, + 36 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 37, + 40 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 46, + 47 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 48, + 49 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 49, + 50 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.src.js new file mode 100644 index 000000000000..5c09849b2e79 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.src.js @@ -0,0 +1,5 @@ +var x = { + foo() { + return bar; + } +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js new file mode 100644 index 000000000000..a9a13bc5234e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js @@ -0,0 +1,387 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 0, + 26 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 0, + 25 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 4, + 25 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 10, + 23 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 10, + 13 + ], + "name": "get" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 13, + 23 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 16, + 23 + ], + "body": [] + } + } + } + ] + } + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 26, + 27 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 10, + 13 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.src.js new file mode 100644 index 000000000000..b7f03cdef933 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.src.js @@ -0,0 +1,4 @@ +x = { + get() { + } +};; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js new file mode 100644 index 000000000000..c82cc704cc9c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js @@ -0,0 +1,387 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 0, + 26 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 0, + 25 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 4, + 25 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 10, + 23 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 10, + 13 + ], + "name": "set" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 13, + 23 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 16, + 23 + ], + "body": [] + } + } + } + ] + } + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 26, + 27 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 10, + 13 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.src.js new file mode 100644 index 000000000000..33ce0e95c298 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.src.js @@ -0,0 +1,4 @@ +x = { + set() { + } +};; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js new file mode 100644 index 000000000000..66f0609d39ee --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js @@ -0,0 +1,424 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 0, + 35 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 34 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 0, + 33 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 4, + 33 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 10, + 31 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 10, + 16 + ], + "name": "method" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 16, + 31 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 17, + 21 + ], + "name": "test" + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 23, + 31 + ], + "body": [] + } + } + } + ] + } + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 34, + 35 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 10, + 16 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "test", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 17, + 21 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 34, + 35 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.src.js new file mode 100644 index 000000000000..db824acd2671 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.src.js @@ -0,0 +1,5 @@ +x = { + method(test) { + + } +};; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js new file mode 100644 index 000000000000..6f61046322f9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js @@ -0,0 +1,388 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 0, + 32 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 0, + 31 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 0, + 30 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 4, + 30 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 10, + 28 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 10, + 18 + ], + "value": "method", + "raw": "\"method\"" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 18, + 28 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 21, + 28 + ], + "body": [] + } + } + } + ] + } + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 31, + 32 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "String", + "value": "\"method\"", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 10, + 18 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 31, + 32 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.src.js new file mode 100644 index 000000000000..345b88844421 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.src.js @@ -0,0 +1,4 @@ +x = { + "method"() { + } +};; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js new file mode 100644 index 000000000000..05d14d69e9af --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js @@ -0,0 +1,387 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 0, + 30 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 0, + 29 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 0, + 28 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "x" + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 4, + 28 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 10, + 26 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 10, + 16 + ], + "name": "method" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 16, + 26 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 19, + 26 + ], + "body": [] + } + } + } + ] + } + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 29, + 30 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "method", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 10, + 16 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 29, + 30 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.src.js new file mode 100644 index 000000000000..0a69310519e1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.src.js @@ -0,0 +1,4 @@ +x = { + method() { + } +};; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js new file mode 100644 index 000000000000..4fdffc8958f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js @@ -0,0 +1,463 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 52 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 52 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 4, + 51 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 8, + 51 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 14, + 49 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 14, + 19 + ], + "value": "foo", + "raw": "\"foo\"" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 19, + 49 + ], + "id": null, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 22, + 49 + ], + "body": [ + { + "type": "ReturnStatement", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "range": [ + 32, + 43 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 39, + 42 + ], + "name": "bar" + } + } + ] + } + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "String", + "value": "\"foo\"", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 14, + 19 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Keyword", + "value": "return", + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "range": [ + 32, + 38 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 39, + 42 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 48, + 49 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 50, + 51 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 51, + 52 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.src.js new file mode 100644 index 000000000000..0c168a31648e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.src.js @@ -0,0 +1,5 @@ +var x = { + "foo"() { + return bar; + } +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js new file mode 100644 index 000000000000..a27872be18e3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js @@ -0,0 +1,719 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 0, + 66 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 0, + 26 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "name": "get" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "name": "set" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 28, + 66 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 32, + 65 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 36, + 65 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "name": "foo" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "name": "foo" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ], + "name": "get" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ], + "name": "get" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 60, + 63 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 60, + 63 + ], + "name": "set" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 60, + 63 + ], + "name": "set" + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 28, + 31 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + }, + "range": [ + 54, + 55 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 60, + 63 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 64, + 65 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 65, + 66 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.src.js new file mode 100644 index 000000000000..1b881004b3c1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.src.js @@ -0,0 +1,9 @@ +var foo, + get, + set; + +var x = { + foo, + get, + set +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js new file mode 100644 index 000000000000..59ae7eea0e5a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Identifier directly after number" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.src.js new file mode 100644 index 000000000000..d0074ff52156 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.src.js @@ -0,0 +1 @@ +0o12z; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js new file mode 100644 index 000000000000..7631534de4c5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js @@ -0,0 +1,94 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "value": 463, + "raw": "0o717" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0o717", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.src.js new file mode 100644 index 000000000000..7655a4ee496e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.src.js @@ -0,0 +1 @@ +0o717; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js new file mode 100644 index 000000000000..49739987e6ac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js @@ -0,0 +1,166 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 0, + 20 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "value": "use strict", + "raw": "\"use strict\"" + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 14, + 20 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 19 + ], + "value": 463, + "raw": "0O717" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"use strict\"", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Numeric", + "value": "0O717", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 14, + 19 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 19, + 20 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.src.js new file mode 100644 index 000000000000..5bf66b1e2072 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.src.js @@ -0,0 +1,2 @@ +"use strict"; +0O717; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js new file mode 100644 index 000000000000..72f01ff29ada --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js @@ -0,0 +1,94 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "value": 463, + "raw": "0O717" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Numeric", + "value": "0O717", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.src.js new file mode 100644 index 000000000000..a5af9801c940 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.src.js @@ -0,0 +1 @@ +0O717; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js new file mode 100644 index 000000000000..f111ee8a1d00 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js @@ -0,0 +1,194 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 0, + 41 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 0, + 41 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 4, + 40 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 8, + 40 + ], + "value": null, + "raw": "/[\\u{0000000000000061}-\\u{7A}]/u", + "regex": { + "pattern": "[\\u{0000000000000061}-\\u{7A}]", + "flags": "u" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "RegularExpression", + "value": "/[\\u{0000000000000061}-\\u{7A}]/u", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 8, + 40 + ], + "regex": { + "flags": "u", + "pattern": "[\\u{0000000000000061}-\\u{7A}]" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.src.js new file mode 100644 index 000000000000..97c9442e5a4e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.src.js @@ -0,0 +1 @@ +var x = /[\u{0000000000000061}-\u{7A}]/u; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js new file mode 100644 index 000000000000..8370cfa6b1c6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 12, + "lineNumber": 1, + "column": 13, + "message": "Code point out of bounds" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.src.js new file mode 100644 index 000000000000..07db7a79d553 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.src.js @@ -0,0 +1 @@ +var x = /\u{110000}/u; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js new file mode 100644 index 000000000000..ba8560d75785 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js @@ -0,0 +1,194 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "value": null, + "raw": "/foo/u", + "regex": { + "pattern": "foo", + "flags": "u" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "RegularExpression", + "value": "/foo/u", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "regex": { + "flags": "u", + "pattern": "foo" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.src.js new file mode 100644 index 000000000000..c31d75552b1e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.src.js @@ -0,0 +1 @@ +var foo = /foo/u; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js new file mode 100644 index 000000000000..e0bf35b6db6a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js @@ -0,0 +1,194 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "value": null, + "raw": "/foo/y", + "regex": { + "pattern": "foo", + "flags": "y" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "RegularExpression", + "value": "/foo/y", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "regex": { + "flags": "y", + "pattern": "foo" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.src.js new file mode 100644 index 000000000000..ab3585070d91 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.src.js @@ -0,0 +1 @@ +var foo = /foo/y; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js new file mode 100644 index 000000000000..9f872275d1ef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js @@ -0,0 +1,347 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 0, + 22 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "f" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "a" + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 14, + 18 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "b" + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 20, + 22 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 14, + 17 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.src.js new file mode 100644 index 000000000000..c7d2b9477c55 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.src.js @@ -0,0 +1 @@ +function f(a, ...b) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js new file mode 100644 index 000000000000..dd0b8fb48e86 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 19, + "lineNumber": 1, + "column": 20, + "message": "Unexpected token =" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.src.js new file mode 100644 index 000000000000..6de42c245a52 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.src.js @@ -0,0 +1 @@ +function f(a, ...b = 0); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js new file mode 100644 index 000000000000..4e7e97af3379 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Unexpected token ," +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.src.js new file mode 100644 index 000000000000..309cc7573260 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.src.js @@ -0,0 +1 @@ +function f(a, ...b, c); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js new file mode 100644 index 000000000000..f56dcac4c132 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js @@ -0,0 +1,404 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 0, + 29 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 4, + 28 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 8, + 28 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "a" + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 20, + 24 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ], + "name": "b" + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 26, + 28 + ], + "body": [] + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 8, + 16 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.src.js new file mode 100644 index 000000000000..68f41d812e6c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.src.js @@ -0,0 +1 @@ +var x = function(a, ...b) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js new file mode 100644 index 000000000000..3a8641eee399 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js @@ -0,0 +1,350 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 4, + 26 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 8, + 26 + ], + "id": null, + "generator": false, + "expression": false, + "params": [ + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 18, + 22 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ], + "name": "a" + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 24, + 26 + ], + "body": [] + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 8, + 16 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 18, + 21 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.src.js new file mode 100644 index 000000000000..a7984c62a640 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.src.js @@ -0,0 +1 @@ +var x = function (...a) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js new file mode 100644 index 000000000000..ea9373dbbadf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 14, + "lineNumber": 1, + "column": 15, + "message": "Unexpected token {" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.src.js new file mode 100644 index 000000000000..49f73ed38546 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.src.js @@ -0,0 +1 @@ +function x(...{ a }){}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js new file mode 100644 index 000000000000..3a79eb27f683 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "f" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 11, + 15 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "b" + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 17, + 19 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.src.js new file mode 100644 index 000000000000..9c90dd499935 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.src.js @@ -0,0 +1 @@ +function f(...b) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js new file mode 100644 index 000000000000..95e30f8bb00c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 6, + "lineNumber": 1, + "column": 7, + "message": "Unexpected token ..." +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.src.js new file mode 100644 index 000000000000..360727b872ef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.src.js @@ -0,0 +1 @@ +if (b,...a, ); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js new file mode 100644 index 000000000000..ef21dc079721 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Unexpected token ..." +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.src.js new file mode 100644 index 000000000000..98458f83d68c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.src.js @@ -0,0 +1 @@ +(b, ...a); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js new file mode 100644 index 000000000000..20380ab57b60 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 0, + 12 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "name": "foo" + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "a" + }, + { + "type": "SpreadElement", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 7, + 11 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "b" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.src.js new file mode 100644 index 000000000000..49237c1f1480 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.src.js @@ -0,0 +1 @@ +foo(a, ...b); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js new file mode 100644 index 000000000000..6830f04256f9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 0, + 4 + ], + "name": "func" + }, + "arguments": [ + { + "type": "SpreadElement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 5, + 9 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "a" + } + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "b" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "func", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 0, + 4 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.src.js new file mode 100644 index 000000000000..7510298b7ca0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.src.js @@ -0,0 +1 @@ +func(...a, b); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js new file mode 100644 index 000000000000..4030fd79916e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js @@ -0,0 +1,219 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "name": "foo" + }, + "arguments": [ + { + "type": "SpreadElement", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 4, + 8 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.src.js new file mode 100644 index 000000000000..1cc736a0c23c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.src.js @@ -0,0 +1 @@ +foo(...a); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js new file mode 100644 index 000000000000..d437f9863c12 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js @@ -0,0 +1,462 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 0, + 45 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 0, + 45 + ], + "expression": { + "type": "TaggedTemplateExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 0, + 44 + ], + "tag": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "name": "raw" + }, + "quasi": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 3, + 44 + ], + "expressions": [ + { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 12, + 42 + ], + "expressions": [ + { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 22, + 35 + ], + "left": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 22, + 30 + ], + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 22, + 30 + ], + "value": { + "raw": "deeply", + "cooked": "deeply" + }, + "tail": true + } + ] + }, + "operator": "+", + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 33, + 35 + ], + "properties": [] + } + } + ], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 12, + 22 + ], + "value": { + "raw": "nested ", + "cooked": "nested " + }, + "tail": false + }, + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 35, + 42 + ], + "value": { + "raw": " blah", + "cooked": " blah" + }, + "tail": true + } + ] + } + ], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 3, + 12 + ], + "value": { + "raw": "hello ", + "cooked": "hello " + }, + "tail": false + }, + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 42, + 44 + ], + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "raw", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Template", + "value": "`hello ${", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 3, + 12 + ] + }, + { + "type": "Template", + "value": "`nested ${", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 12, + 22 + ] + }, + { + "type": "Template", + "value": "`deeply`", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 22, + 30 + ] + }, + { + "type": "Punctuator", + "value": "+", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Template", + "value": "} blah`", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 35, + 42 + ] + }, + { + "type": "Template", + "value": "}`", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "range": [ + 42, + 44 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.src.js new file mode 100644 index 000000000000..4dc0eeb08a34 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.src.js @@ -0,0 +1 @@ +raw`hello ${`nested ${`deeply` + {}} blah`}`; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js new file mode 100644 index 000000000000..451d26cd09c0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js @@ -0,0 +1,209 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 0, + 40 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 0, + 40 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 4, + 39 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 4, + 6 + ], + "name": "ts" + }, + "init": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 9, + 39 + ], + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 9, + 39 + ], + "value": { + "raw": "\\\\n\\\\r\\\\b\\\\v\\\\t\\\\f\\\\\\n\\\\\\r\\n", + "cooked": "\\n\\r\\b\\v\\t\\f\\\n\\\r\n" + }, + "tail": true + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "ts", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 4, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Template", + "value": "`\\\\n\\\\r\\\\b\\\\v\\\\t\\\\f\\\\\\n\\\\\\r\\n`", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 9, + 39 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 39, + 40 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.src.js new file mode 100644 index 000000000000..4163a542c54e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.src.js @@ -0,0 +1 @@ +var ts = `\\n\\r\\b\\v\\t\\f\\\n\\\r\n`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js new file mode 100644 index 000000000000..1061023870a1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js @@ -0,0 +1,671 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "range": [ + 0, + 59 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 4, + 9 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "a" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "value": 5, + "raw": "5" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 11, + 26 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 15, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 15, + 16 + ], + "name": "b" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 19, + 25 + ], + "value": "Fred", + "raw": "'Fred'" + } + } + ], + "kind": "var" + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "range": [ + 28, + 59 + ], + "expression": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 30 + } + }, + "range": [ + 28, + 58 + ], + "expressions": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "range": [ + 37, + 38 + ], + "name": "b" + }, + { + "type": "BinaryExpression", + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "range": [ + 51, + 56 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "range": [ + 51, + 52 + ], + "name": "a" + }, + "operator": "+", + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "range": [ + 55, + 56 + ], + "value": 5, + "raw": "5" + } + } + ], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "range": [ + 28, + 37 + ], + "value": { + "raw": "Hello ", + "cooked": "Hello " + }, + "tail": false + }, + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 23 + } + }, + "range": [ + 38, + 51 + ], + "value": { + "raw": ". a + 5 = ", + "cooked": ". a + 5 = " + }, + "tail": false + }, + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 30 + } + }, + "range": [ + 56, + 58 + ], + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "range": [ + 11, + 14 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "String", + "value": "'Fred'", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 19, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Template", + "value": "`Hello ${", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "range": [ + 28, + 37 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "range": [ + 37, + 38 + ] + }, + { + "type": "Template", + "value": "}. a + 5 = ${", + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 23 + } + }, + "range": [ + 38, + 51 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Punctuator", + "value": "+", + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + }, + "range": [ + 53, + 54 + ] + }, + { + "type": "Numeric", + "value": "5", + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Template", + "value": "}`", + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 30 + } + }, + "range": [ + 56, + 58 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "range": [ + 58, + 59 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.src.js new file mode 100644 index 000000000000..bbe595e9ecfe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.src.js @@ -0,0 +1,4 @@ +var a = 5; +var b = 'Fred'; + +`Hello ${b}. a + 5 = ${a + 5}`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js new file mode 100644 index 000000000000..9787eece8597 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js @@ -0,0 +1,117 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "range": [ + 0, + 111 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "range": [ + 0, + 111 + ], + "expression": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 0, + 110 + ], + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 0, + 110 + ], + "value": { + "raw": "The last man on Earth\n sat alone in a room.\n There was\n a knock\n on the\n door...", + "cooked": "The last man on Earth\n sat alone in a room.\n There was\n a knock\n on the\n door..." + }, + "tail": true + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`The last man on Earth\n sat alone in a room.\n There was\n a knock\n on the\n door...`", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "range": [ + 0, + 110 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "range": [ + 110, + 111 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.src.js new file mode 100644 index 000000000000..4d4d65d91ce5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.src.js @@ -0,0 +1,6 @@ +`The last man on Earth + sat alone in a room. + There was + a knock + on the + door...`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.result.js new file mode 100644 index 000000000000..40993c99c26f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 1, + "lineNumber": 1, + "column": 2, + "message": "Octal literal in strict mode" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.src.js new file mode 100644 index 000000000000..31c66a405763 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.src.js @@ -0,0 +1 @@ +`\07`; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js new file mode 100644 index 000000000000..ea4f6ec12f71 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js @@ -0,0 +1,117 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "expression": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 0, + 4 + ], + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 0, + 4 + ], + "value": { + "raw": "42", + "cooked": "42" + }, + "tail": true + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`42`", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 0, + 4 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.src.js new file mode 100644 index 000000000000..1e6428494f65 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.src.js @@ -0,0 +1 @@ +`42`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js new file mode 100644 index 000000000000..d574fb3dc025 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js @@ -0,0 +1,209 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 4, + 6 + ], + "name": "ts" + }, + "init": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "value": { + "raw": "$", + "cooked": "$" + }, + "tail": true + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "ts", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 4, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Template", + "value": "`$`", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.src.js new file mode 100644 index 000000000000..6788caf51477 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.src.js @@ -0,0 +1 @@ +var ts = `$`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js new file mode 100644 index 000000000000..ee2f2ec36922 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js @@ -0,0 +1,170 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "expression": { + "type": "TaggedTemplateExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ], + "tag": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ], + "name": "foo" + }, + "quasi": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 3, + 8 + ], + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 3, + 8 + ], + "value": { + "raw": "foo", + "cooked": "foo" + }, + "tail": true + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Template", + "value": "`foo`", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 3, + 8 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.src.js new file mode 100644 index 000000000000..02458f045eb3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.src.js @@ -0,0 +1 @@ +foo`foo`; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js new file mode 100644 index 000000000000..fc2d508f361a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js @@ -0,0 +1,722 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 32 + } + }, + "range": [ + 0, + 76 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 0, + 43 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ], + "name": "tag" + }, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 15, + 43 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "range": [ + 18, + 41 + ], + "expression": { + "type": "CallExpression", + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 18, + 40 + ], + "callee": { + "type": "MemberExpression", + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 18, + 29 + ], + "object": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 18, + 25 + ], + "name": "console" + }, + "property": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 26, + 29 + ], + "name": "log" + }, + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 30, + 39 + ], + "name": "arguments" + } + ] + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 32 + } + }, + "range": [ + 44, + 76 + ], + "expression": { + "type": "TaggedTemplateExpression", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "range": [ + 44, + 75 + ], + "tag": { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 44, + 47 + ], + "name": "tag" + }, + "quasi": { + "type": "TemplateLiteral", + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "range": [ + 47, + 75 + ], + "expressions": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 55, + 56 + ], + "name": "a" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "range": [ + 71, + 72 + ], + "name": "b" + } + ], + "quasis": [ + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "range": [ + 47, + 55 + ], + "value": { + "raw": "a is ", + "cooked": "a is " + }, + "tail": false + }, + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "range": [ + 56, + 71 + ], + "value": { + "raw": " while b is ", + "cooked": " while b is " + }, + "tail": false + }, + { + "type": "TemplateElement", + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "range": [ + 72, + 75 + ], + "value": { + "raw": ".", + "cooked": "." + }, + "tail": true + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "tag", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "console", + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 18, + 25 + ] + }, + { + "type": "Punctuator", + "value": ".", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Identifier", + "value": "log", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "range": [ + 26, + 29 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Identifier", + "value": "arguments", + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 30, + 39 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 39, + 40 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "range": [ + 40, + 41 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Identifier", + "value": "tag", + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 3 + } + }, + "range": [ + 44, + 47 + ] + }, + { + "type": "Template", + "value": "`a is ${", + "loc": { + "start": { + "line": 4, + "column": 3 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "range": [ + 47, + 55 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Template", + "value": "} while b is ${", + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "range": [ + 56, + 71 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "range": [ + 71, + 72 + ] + }, + { + "type": "Template", + "value": "}.`", + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "range": [ + 72, + 75 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + }, + "range": [ + 75, + 76 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.src.js new file mode 100644 index 000000000000..61a0bdac2e5f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.src.js @@ -0,0 +1,4 @@ +function tag() { + console.log(arguments); +} +tag`a is ${a} while b is ${b}.`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js new file mode 100644 index 000000000000..e7d4cba5afe2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js @@ -0,0 +1,94 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "value": "煎茶", + "raw": "\"\\u{714E}\\u{8336}\"" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\u{714E}\\u{8336}\"", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.src.js new file mode 100644 index 000000000000..9edb72773067 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.src.js @@ -0,0 +1 @@ +"\u{714E}\u{8336}"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js new file mode 100644 index 000000000000..a83ca4e1bc43 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js @@ -0,0 +1,94 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "expression": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ], + "value": "𠮷􏿿\u0001", + "raw": "\"\\u{20BB7}\\u{10FFFF}\\u{1}\"" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "\"\\u{20BB7}\\u{10FFFF}\\u{1}\"", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 0, + 26 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.src.js new file mode 100644 index 000000000000..ac32b40609c0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.src.js @@ -0,0 +1 @@ +"\u{20BB7}\u{10FFFF}\u{1}"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js new file mode 100644 index 000000000000..7ddaf9353c7a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Bad character escape sequence" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.src.js new file mode 100644 index 000000000000..5d58cb32306b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.src.js @@ -0,0 +1 @@ +"\u{}"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js new file mode 100644 index 000000000000..c8a3a66dfb10 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 4, + "lineNumber": 1, + "column": 5, + "message": "Code point out of bounds" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.src.js new file mode 100644 index 000000000000..30b7cd791f31 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.src.js @@ -0,0 +1 @@ +"\u{FFFFFF}"; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json b/packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json new file mode 100644 index 000000000000..fafe95db8d50 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json @@ -0,0 +1,186 @@ +{ + "type": "Program", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "init": { + "type": "Identifier", + "name": "bar", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 4, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "kind": "let", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "comments": [], + "tokens": [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js new file mode 100644 index 000000000000..3e5f133c6955 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js @@ -0,0 +1,93 @@ +// const foo = bar; +module.exports = [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js new file mode 100644 index 000000000000..1e2cfafc27f1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js @@ -0,0 +1,93 @@ +// let foo = bar; +module.exports = [ + { + "type": "Keyword", + "value": "let", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js new file mode 100644 index 000000000000..96b8e9bb1454 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js @@ -0,0 +1,169 @@ +// (/foo/).test(bar); +module.exports = [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "RegularExpression", + "value": "/foo/", + "range": [ + 1, + 6 + ], + "regex": { + "flags": "", + "pattern": "foo" + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js new file mode 100644 index 000000000000..d56f27eb9b19 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js @@ -0,0 +1,97 @@ +// var foo = /foo/u; +module.exports = [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "RegularExpression", + "value": "/foo/u", + "regex": { + "pattern": "foo", + "flags": "u" + }, + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js new file mode 100644 index 000000000000..9b1d612c0db3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js @@ -0,0 +1,37 @@ +module.exports = [{ + type: 'Keyword', + value: 'var', + range: [0, 3], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + } + }, { + type: 'Identifier', + value: 'x', + range: [4, 5], + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 5 } + } + }, { + type: 'Punctuator', + value: '=', + range: [6, 7], + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + } + }, { + type: 'RegularExpression', + value: '/[\\u{0000000000000061}-\\u{7A}]/u', + regex: { + pattern: '[\\u{0000000000000061}-\\u{7A}]', + flags: 'u' + }, + range: [8, 40], + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 40 } + } + }]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js new file mode 100644 index 000000000000..aae8a5eead1c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js @@ -0,0 +1,97 @@ +// var foo = /foo/y; +module.exports = [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "RegularExpression", + "value": "/foo/y", + "regex": { + "pattern": "foo", + "flags": "y" + }, + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js new file mode 100644 index 000000000000..762b943eaada --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js @@ -0,0 +1,129 @@ +// var foo = `hi${bar}`; +module.exports = [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Template", + "value": "`hi${", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js new file mode 100644 index 000000000000..88768bf3c644 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js @@ -0,0 +1,255 @@ +// var a; console.log(`${a}`, "a"); +module.exports = [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Template", + "value": "`${", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "String", + "value": "\"a\"", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js new file mode 100644 index 000000000000..9532fafaf16f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js @@ -0,0 +1,201 @@ +// var foo = `Hello ${b}. a + 5 = ${a + 5}`; +module.exports = [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Template", + "value": "`Hello ${", + "range": [ + 10, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Template", + "value": "}. a + 5 = ${", + "range": [ + 20, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Numeric", + "value": "5", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 38, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js new file mode 100644 index 000000000000..f2525c747b05 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js @@ -0,0 +1,93 @@ +// var foo = `hi`; +module.exports = [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Template", + "value": "`hi`", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } +]; diff --git a/packages/typescript-eslint-parser/tests/lib/.eslintrc b/packages/typescript-eslint-parser/tests/lib/.eslintrc new file mode 100644 index 000000000000..72b9c8cc7456 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/.eslintrc @@ -0,0 +1,2 @@ +env: + mocha: true diff --git a/packages/typescript-eslint-parser/tests/lib/attach-comments.js b/packages/typescript-eslint-parser/tests/lib/attach-comments.js new file mode 100644 index 000000000000..6d0d9573c71a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/attach-comments.js @@ -0,0 +1,93 @@ +/** + * @fileoverview Tests for parsing and attaching comments. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var assert = require("chai").assert, + leche = require("leche"), + path = require("path"), + espree = require("../../espree"), + shelljs = require("shelljs"); + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +var testFiles = shelljs.find("./tests/fixtures/attach-comments").filter(function(filename) { + return filename.indexOf(".src.js") > -1; +}).map(function(filename) { + return filename.substring(0, filename.length - 7); // strip off ".src.js" +// }).filter(function(filename) { +// return /line-and-block/.test(filename); +}); + +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("attachComment: true", function() { + + leche.withData(testFiles, function(filename) { + it("should produce correct AST when parsed with attachComments", function() { + var output = require(path.resolve(__dirname, "../../", filename + ".result.js")); + var input = shelljs.cat(filename + ".src.js"); + var result; + + if (output.sourceType === "script") { + result = espree.parse(input, { + loc: true, + range: true, + tokens: true, + attachComment: true + }); + } else { + result = espree.parse(input, { + loc: true, + range: true, + tokens: true, + attachComment: true, + ecmaFeatures: { + classes: true, + modules: true + } + }); + } + + assert.deepEqual(getRaw(result), output); + }); + + }); + + +}); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js new file mode 100644 index 000000000000..3084675f8262 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -0,0 +1,190 @@ +/** + * @fileoverview Tests for ECMA feature flags + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var assert = require("chai").assert, + leche = require("leche"), + path = require("path"), + parser = require("../../parser"), + shelljs = require("shelljs"); + +// var parser = require("esprima-fb"); +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +var FIXTURES_DIR = "./tests/fixtures/ecma-features", + FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix"; + +var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { + return filename.indexOf(".src.js") > -1; +}).map(function(filename) { + return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" +}).filter(function(filename) { + return /classes/.test(filename) && filename.indexOf("error-") === -1 && filename.indexOf("invalid-") === -1; +}); + +var moduleTestFiles = testFiles.filter(function(filename) { + return !/jsx|globalReturn|invalid|experimental|generators|not\-strict/.test(filename); +}); + +var mixFiles = shelljs.find(FIXTURES_MIX_DIR).filter(function(filename) { + return filename.indexOf(".src.js") > -1; +}).map(function(filename) { + return filename.substring(FIXTURES_MIX_DIR.length - 1, filename.length - 7); // strip off ".src.js" +// }).filter(function(filename) { +// return /template/.test(filename); +}); + +// console.dir(moduleTestFiles); +// return; + +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("ecmaFeatures", function() { + + var config; + + beforeEach(function() { + config = { + loc: true, + range: true, + tokens: true, + ecmaFeatures: {} + }; + }); + + leche.withData(testFiles, function(filename) { + // Uncomment and fill in filename to focus on a single file + // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; + var feature = path.dirname(filename), + code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); + + it("should parse correctly when " + feature + " is true", function() { + config.ecmaFeatures[feature] = true; + var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); + var result; + + try { + result = parser.parse(code, config); + result = getRaw(result); + } catch (ex) { + + // format of error isn't exactly the same, just check if it's expected + if (expected.message) { + return; + } else { + throw ex; + } + + } + assert.deepEqual(result, expected); + }); + + }); + + // describe("Modules", function() { + + // leche.withData(moduleTestFiles, function(filename) { + + // var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); + + // it("should parse correctly when sourceType is module", function() { + // var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); + // var result; + + // config.sourceType = "module"; + + // // set sourceType of program node to module + // if (expected.type === "Program") { + // expected.sourceType = "module"; + // } + + // try { + // result = getRaw(parser.parse(code, config)); + // } catch (ex) { + + // // if the result is an error, create an error object so deepEqual works + // if (expected.message || expected.description) { + // result = getRaw(ex); + // result.message = ex.message; + // } else { + // throw ex; + // } + + // } + + // assert.deepEqual(result, expected); + // }); + + // }); + // }); + + + + // leche.withData(mixFiles, function(filename) { + + // var features = path.dirname(filename), + // code = shelljs.cat(path.resolve(FIXTURES_MIX_DIR, filename) + ".src.js"); + + // it("should parse correctly when " + features + " are true", function() { + // config.ecmaFeatures = require(path.resolve(__dirname, "../../", FIXTURES_MIX_DIR, filename) + ".config.js"); + + // var expected = require(path.resolve(__dirname, "../../", FIXTURES_MIX_DIR, filename) + ".result.js"); + // var result; + + // try { + // result = parser.parse(code, config); + // result = getRaw(result); + // } catch (ex) { + + // // if the result is an error, create an error object so deepEqual works + // if (expected.message || expected.description) { + // result = getRaw(ex); + // result.message = ex.message; + // } else { + // throw ex; + // } + // } + + // assert.deepEqual(result, expected); + // }); + + // }); + + +}); diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js new file mode 100644 index 000000000000..364c380a97d7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -0,0 +1,80 @@ +/** + * @fileoverview Tests for tokenize(). + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var assert = require("chai").assert, + parser = require("../../parser"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("parse()", function() { + + describe("modules", function() { + + it("should have correct column number when strict mode error occurs", function() { + + try { + parser.parse("function fn(a, a) {\n}", { sourceType: "module" }); + } catch (err) { + assert.equal(err.column, 16); + } + }); + + }); + + describe("general", function() { + it("should output tokens, comments, locs, and ranges when called with those options", function() { + var ast = parser.parse("let foo = bar;", { + ecmaFeatures: { + blockBindings: true + }, + comment: true, + tokens: true, + range: true, + loc: true + }); + + assert.deepEqual(getRaw(ast), require("../fixtures/parse/all-pieces.json")); + }); + + + }); +}); diff --git a/packages/typescript-eslint-parser/tests/lib/tokenize.js b/packages/typescript-eslint-parser/tests/lib/tokenize.js new file mode 100644 index 000000000000..ea740dfd0b8e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/tokenize.js @@ -0,0 +1,162 @@ +/** + * @fileoverview Tests for tokenize(). + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var assert = require("chai").assert, + espree = require("../../espree"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("tokenize()", function() { + + it("should produce tokens when using let", function() { + var tokens = espree.tokenize("let foo = bar;", { + ecmaFeatures: { blockBindings: true }, + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/let-result.tokens.js")); + }); + + it("should produce tokens when using const", function() { + var tokens = espree.tokenize("const foo = bar;", { + ecmaFeatures: { blockBindings: true }, + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/const-result.tokens.js")); + }); + + it("should produce tokens when using regular expression u flag", function() { + var tokens = espree.tokenize("var foo = /foo/u;", { + ecmaFeatures: { regexUFlag: true }, + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/regexp-u-result.tokens.js")); + }); + + it("should produce tokens when using regular expression y flag", function() { + var tokens = espree.tokenize("var foo = /foo/y;", { + ecmaFeatures: { regexYFlag: true }, + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/regexp-y-result.tokens.js")); + }); + + + describe("templateStrings", function() { + it("should produce tokens when tokenizing simple template string", function() { + var tokens = espree.tokenize("var foo = `hi`;", { + ecmaFeatures: { templateStrings: true }, + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-simple-result.tokens.js")); + }); + + it("should produce tokens when tokenizing template string with embedded variable", function() { + var tokens = espree.tokenize("var foo = `hi${bar}`;", { + ecmaFeatures: { templateStrings: true }, + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-embedded-result.tokens.js")); + }); + + it("should produce tokens when tokenizing template string with embedded variable in function call", function() { + var tokens = espree.tokenize("var a; console.log(`${a}`, \"a\");", { + ecmaFeatures: { templateStrings: true }, + loc: true, + range: true + }); + + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-embedded2-result.tokens.js")); + }); + + it("should produce tokens when parsing template string with embedded variable in function call and with tokens options on", function() { + var ast = espree.parse("var a; console.log(`${a}`, \"a\");", { + ecmaFeatures: { templateStrings: true }, + tokens: true, + loc: true, + range: true + }); + + assert.deepEqual(getRaw(ast.tokens), require("../fixtures/tokenize/template-string-embedded2-result.tokens.js")); + }); + + it("should produce tokens when tokenizing template string with embedded expressions", function() { + var tokens = espree.tokenize("var foo = `Hello ${b}. a + 5 = ${a + 5}`;", { + ecmaFeatures: { templateStrings: true }, + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-expressions-result.tokens.js")); + }); + + + }); + + // Make sure we don't introduce the same regex parsing error as Esprima + it("should produce tokens when using regular expression wrapped in parens", function() { + var tokens = espree.tokenize("(/foo/).test(bar);", { + loc: true, + range: true + }); + assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/regex-in-parens-result.tokens.js")); + }); + + it("should produce tokens when using regular expression wrapped in parens using parse()", function() { + var ast = espree.parse("(/foo/).test(bar);", { + loc: true, + range: true, + tokens: true + }); + assert.deepEqual(getRaw(ast.tokens), require("../fixtures/tokenize/regex-in-parens-result.tokens.js")); + }); + + it("should produce tokens when using a single identifier", function() { + var tokens = espree.tokenize("a"); + assert.deepEqual(getRaw(tokens), [ { type: "Identifier", value: "a"}]); + }); + +}); From 9e320b404c04c9501cb5d3f0b3425ed11d8e7529 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 3 Dec 2015 16:05:00 -0800 Subject: [PATCH 002/326] Docs: Update README --- packages/typescript-eslint-parser/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 5fefde1d3054..7b83657caaf3 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -39,3 +39,5 @@ TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. * **Phase 2:** Add JSX support. * **Phase 3:** Add support for top-level TypeScript syntax. * **Phase 4:** Add support for types. + +The high-level goal is to have output that matches Espree v3.x. From 476fc0a5c290d187745db5b16bccd1fb777ab2e1 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 3 Dec 2015 16:05:38 -0800 Subject: [PATCH 003/326] Build: Tag as alpha release --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 6d951ca97278..6016d8808900 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/espree", "main": "parser.js", - "version": "0.0.0", + "version": "0.1.0-alpha-1", "files": [ "lib", "parser.js" From c432cb0f46ca1c4ce97237722cb92c4cec3594b1 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 4 Dec 2015 15:35:28 -0800 Subject: [PATCH 004/326] New: Finished up ES6 features --- .../lib/ast-converter.js | 346 ++++++++++++++++-- packages/typescript-eslint-parser/parser.js | 79 +--- ...sult.js => error-proto-property.result.js} | 0 ...rty.src.js => error-proto-property.src.js} | 0 ... => error-proto-string-property.result.js} | 0 ....js => error-proto-string-property.src.js} | 0 ...esult.js => error-octal-literal.result.js} | 0 ...eral.src.js => error-octal-literal.src.js} | 0 .../tests/lib/ecma-features.js | 2 +- 9 files changed, 316 insertions(+), 111 deletions(-) rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/{proto-property.result.js => error-proto-property.result.js} (100%) rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/{proto-property.src.js => error-proto-property.src.js} (100%) rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/{proto-string-property.result.js => error-proto-string-property.result.js} (100%) rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/{proto-string-property.src.js => error-proto-string-property.src.js} (100%) rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/{octal-literal.result.js => error-octal-literal.result.js} (100%) rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/{octal-literal.src.js => error-octal-literal.src.js} (100%) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index efa8e78fcc2b..f7a8fb34bb48 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -113,6 +113,7 @@ TOKEN_TO_TEXT[SyntaxKind.AmpersandEqualsToken] = "&="; TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|="; TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^="; TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; +TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; function isESTreeClassMember(node) { return node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.SemicolonClassElement; @@ -123,11 +124,11 @@ function isComma(token) { } function isAssignmentOperator(operator) { - return ASSIGNMENT_OPERATORS.indexOf(operator) > -1; + return ASSIGNMENT_OPERATORS.indexOf(operator.kind) > -1; } function isLogicalOperator(operator) { - return LOGICAL_OPERATORS.indexOf(operator) > -1; + return LOGICAL_OPERATORS.indexOf(operator.kind) > -1; } function getBinaryExpressionType(operator) { @@ -174,7 +175,36 @@ function getLoc(nodeOrToken, ast) { // }; } +function fixExports(node, result, ast) { + // check for exports + if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { + var exportKeyword = node.modifiers[0], + nextModifier = node.modifiers[1], + lastModifier = node.modifiers[node.modifiers.length - 1], + declarationIsDefault = nextModifier && (nextModifier.kind === SyntaxKind.DefaultKeyword), + varToken = ts.findNextToken(lastModifier, ast); + + result.range[0] = varToken.getStart(); + result.loc = getLocFor(result.range[0], result.range[1], ast); + + var newResult = { + type: declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration", + declaration: result, + range: [ exportKeyword.getStart(), result.range[1] ], + loc: getLocFor(exportKeyword.getStart(), result.range[1], ast) + }; + + if (!declarationIsDefault) { + newResult.specifiers = []; + newResult.source = null; + } + + return newResult; + + } + return result; +} function convertError(error) { @@ -184,21 +214,41 @@ function convertError(error) { index: error.start, lineNumber: loc.line + 1, column: loc.character, - message: error.message + message: error.message || error.messageText }; } function getTokenType(token) { + // Need two checks for keywords since some are also identifiers if (token.originalKeywordKind) { - return "Keyword"; + + switch (token.originalKeywordKind) { + case SyntaxKind.NullKeyword: + return "Null"; + + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + return "Identifier"; + + default: + return "Keyword" + } } if (token.kind >= 68 && token.kind <= 112) { return "Keyword"; } + if (token.kind >= 15 && token.kind <= 66) { + return "Punctuator"; + } + + if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && token.kind <= SyntaxKind.TemplateTail) { + return "Template"; + } + switch (token.kind) { case SyntaxKind.NumericLiteral: return "Numeric"; @@ -213,22 +263,13 @@ function getTokenType(token) { case SyntaxKind.ConstructorKeyword: case SyntaxKind.GetKeyword: case SyntaxKind.SetKeyword: - return "Identifier" - } - - - if (token.kind >= 15 && token.kind <= 66) { - return "Punctuator"; + // falls through } - if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && token.kind <= SyntaxKind.TemplateTail) { - return "Template"; - } - - return "Unknown"; + return "Identifier"; } function convertToken(token, ast) { @@ -273,7 +314,7 @@ function convertTokens(ast) { // Public //------------------------------------------------------------------------------ -module.exports = function(ast) { +module.exports = function(ast, extra) { if (ast.parseDiagnostics.length) { throw convertError(ast.parseDiagnostics[0]); @@ -306,9 +347,21 @@ module.exports = function(ast) { case SyntaxKind.SourceFile: assign(result, { type: "Program", - body: node.statements.map(convertChild), + body: [], sourceType: node.externalModuleIndicator ? "module": "script" }); + + // filter out unknown nodes for now + node.statements.forEach(function(statement) { + var convertedStatement = convertChild(statement); + if (convertedStatement) { + result.body.push(convertedStatement); + } + }); + + // fix end location + result.range[1] = node.endOfFileToken.pos; + result.loc = getLocFor(node.getStart(), result.range[1], ast); break; case SyntaxKind.Block: @@ -398,6 +451,7 @@ module.exports = function(ast) { case SyntaxKind.TryStatement: assign(result, { type: "TryStatement", + block: convert(node.tryBlock), handler: convertChild(node.catchClause), finalizer: convertChild(node.finallyBlock) }); @@ -461,6 +515,10 @@ module.exports = function(ast) { params: node.parameters.map(convertChild), body: convertChild(node.body) }); + + // check for exports + result = fixExports(node, result, ast); + break; case SyntaxKind.VariableDeclaration: @@ -472,11 +530,24 @@ module.exports = function(ast) { break; case SyntaxKind.VariableStatement: + assign(result, { type: "VariableDeclaration", declarations: node.declarationList.declarations.map(convertChild), kind: (node.declarationList.flags ? (node.declarationList.flags === ts.NodeFlags.Let ? "let" : "const") : "var") }); + + // check for exports + result = fixExports(node, result, ast); + break; + + // mostly for for-of, for-in + case SyntaxKind.VariableDeclarationList: + assign(result, { + type: "VariableDeclaration", + declarations: node.declarations.map(convertChild), + kind: (node.flags ? (node.flags === ts.NodeFlags.Let ? "let" : "const") : "var") + }); break; // Expressions @@ -496,8 +567,19 @@ module.exports = function(ast) { case SyntaxKind.ArrayLiteralExpression: + var arrayAssignNode = ts.getAncestor(node, SyntaxKind.BinaryExpression), + arrayIsInAssignment; + + if (arrayAssignNode) { + if (arrayAssignNode.left === node) { + arrayIsInAssignment = true; + } else { + arrayIsInAssignment = (ts.findChildOfKind(arrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === node); + } + } + // TypeScript uses ArrayLiteralExpression in destructuring assignment, too - if (parent.kind === SyntaxKind.BinaryExpression && node === parent.left) { + if (arrayIsInAssignment) { assign(result, { type: "ArrayPattern", elements: node.elements.map(convertChild) @@ -511,10 +593,30 @@ module.exports = function(ast) { break; case SyntaxKind.ObjectLiteralExpression: - assign(result, { - type: "ObjectExpression", - properties: node.properties.map(convertChild) - }); + + var objectAssignNode = ts.getAncestor(node, SyntaxKind.BinaryExpression), + objectIsInAssignment; + + if (objectAssignNode) { + if (objectAssignNode.left === node) { + objectIsInAssignment = true; + } else { + objectIsInAssignment = (ts.findChildOfKind(objectAssignNode.left, SyntaxKind.ObjectLiteralExpression, ast) === node); + } + } + + // TypeScript uses ObjectLiteralExpression in destructuring assignment, too + if (objectIsInAssignment) { + assign(result, { + type: "ObjectPattern", + properties: node.properties.map(convertChild) + }); + } else { + assign(result, { + type: "ObjectExpression", + properties: node.properties.map(convertChild) + }); + } break; case SyntaxKind.PropertyAssignment: @@ -522,7 +624,7 @@ module.exports = function(ast) { type: "Property", key: convertChild(node.name), value: convertChild(node.initializer), - computed: false, + computed: (node.name.kind === SyntaxKind.ComputedPropertyName), method: false, shorthand: false, kind: "init" @@ -564,6 +666,7 @@ module.exports = function(ast) { // TODO: double-check that these positions are correct var methodLoc = ast.getLineAndCharacterOfPosition(node.name.end + 1), + nodeIsMethod = (node.kind === SyntaxKind.MethodDeclaration), method = { type: "FunctionExpression", id: null, @@ -575,7 +678,7 @@ module.exports = function(ast) { loc: { start: { line: methodLoc.line + 1, - column: methodLoc.character + column: methodLoc.character - 1 }, end: result.loc.end } @@ -586,8 +689,8 @@ module.exports = function(ast) { type: "Property", key: convertChild(node.name), value: method, - computed: false, - method: false, + computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + method: nodeIsMethod, shorthand: false, kind: "init" }); @@ -718,6 +821,56 @@ module.exports = function(ast) { }); break; + // occurs with missing array elements like [,] + case SyntaxKind.OmittedExpression: + return null; + + case SyntaxKind.ObjectBindingPattern: + assign(result, { + type: "ObjectPattern", + properties: node.elements.map(convertChild) + }); + break; + + case SyntaxKind.BindingElement: + + if (parent.kind === SyntaxKind.ArrayBindingPattern) { + var arrayItem = convert(node.name, parent); + if (node.initializer) { + assign(result, { + type: "AssignmentPattern", + left: arrayItem, + right: convertChild(node.initializer) + }); + } else { + return arrayItem; + } + } else { + + assign(result, { + type: "Property", + key: convertChild(node.propertyName || node.name), + value: convertChild(node.name), + computed: false, + method: false, + shorthand: !node.propertyName, + kind: "init" + }); + + if (node.initializer) { + result.value = { + type: "AssignmentPattern", + left: convertChild(node.name), + right: convertChild(node.initializer), + range: [ node.name.getStart(), node.initializer.end ], + loc: getLocFor(node.name.getStart(), node.initializer.end, ast) + }; + } + + } + break; + + case SyntaxKind.ArrowFunction: assign(result, { type: "ArrowFunctionExpression", @@ -852,6 +1005,97 @@ module.exports = function(ast) { result.body.body = filteredMembers.map(convertChild); } + // check for exports + result = fixExports(node, result, ast); + + break; + + // Modules + case SyntaxKind.ImportDeclaration: + assign(result, { + type: "ImportDeclaration", + source: convertChild(node.moduleSpecifier), + specifiers: [] + }); + + if (node.importClause) { + if (node.importClause.name) { + result.specifiers.push(convertChild(node.importClause)); + } + + if (node.importClause.namedBindings) { + if (node.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + result.specifiers.push(convertChild(node.importClause.namedBindings)); + } else { + result.specifiers = result.specifiers.concat(node.importClause.namedBindings.elements.map(convertChild)); + } + } + } + + break; + + case SyntaxKind.NamespaceImport: + assign(result, { + type: "ImportNamespaceSpecifier", + local: convertChild(node.name) + }); + break; + + case SyntaxKind.ImportSpecifier: + assign(result, { + type: "ImportSpecifier", + local: convertChild(node.name), + imported: convertChild(node.propertyName || node.name) + }); + break; + + case SyntaxKind.ImportClause: + assign(result, { + type: "ImportDefaultSpecifier", + local: convertChild(node.name) + }); + + // have to adjust location information due to tree differences + result.range[1] = node.name.end; + result.loc = getLocFor(result.range[0], result.range[1], ast); + break; + + case SyntaxKind.NamedImports: + assign(result, { + type: "ImportDefaultSpecifier", + local: convertChild(node.name) + }); + break; + + case SyntaxKind.ExportDeclaration: + if (node.exportClause) { + assign(result, { + type: "ExportNamedDeclaration", + source: convertChild(node.moduleSpecifier), + specifiers: node.exportClause.elements.map(convertChild), + declaration: null + }); + } else { + assign(result, { + type: "ExportAllDeclaration", + source: convertChild(node.moduleSpecifier) + }); + } + break; + + case SyntaxKind.ExportSpecifier: + assign(result, { + type: "ExportSpecifier", + local: convertChild(node.propertyName || node.name), + exported: convertChild(node.name) + }); + break; + + case SyntaxKind.ExportAssignment: + assign(result, { + type: "ExportDefaultDeclaration", + declaration: convertChild(node.expression) + }); break; // Unary Operations @@ -900,6 +1144,26 @@ module.exports = function(ast) { left: convertChild(node.left), right: convertChild(node.right) }); + + // if the binary expression is in a destructured array, switch it + if (result.type === "AssignmentExpression") { + var upperArrayNode = ts.getAncestor(node, SyntaxKind.ArrayLiteralExpression), + upperArrayAssignNode = upperArrayNode && ts.getAncestor(upperArrayNode, SyntaxKind.BinaryExpression), + upperArrayIsInAssignment; + + if (upperArrayAssignNode) { + if (upperArrayAssignNode.left === upperArrayNode) { + upperArrayIsInAssignment = true; + } else { + upperArrayIsInAssignment = (ts.findChildOfKind(upperArrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === upperArrayNode); + } + } + + if (upperArrayIsInAssignment) { + delete result.operator; + result.type = "AssignmentPattern"; + } + } } break; @@ -939,11 +1203,21 @@ module.exports = function(ast) { break; case SyntaxKind.NewExpression: - assign(result, { - type: "NewExpression", - callee: convertChild(node.expression), - arguments: node.arguments.map(convertChild) - }); + + // new.target + if (node.expression.kind === SyntaxKind.PropertyAccessExpression) { + assign(result, { + type: "MetaProperty", + meta: convertChild(node.expression.name), + property: convertChild(node.expression.propertyName) + }); + } else { + assign(result, { + type: "NewExpression", + callee: convertChild(node.expression), + arguments: node.arguments.map(convertChild) + }); + } break; @@ -1020,7 +1294,15 @@ module.exports = function(ast) { var estree = convert(ast); - estree.tokens = convertTokens(ast); + + if (extra.tokens) { + estree.tokens = convertTokens(ast); + } + + if (extra.comment || extra.attachComment) { + estree.comments = []; + } + return estree; }; diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index da7045905026..404ca03201ab 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -99,59 +99,6 @@ function parse(code, options) { commentAttachment.reset(); } - if (options.sourceType === "module") { - extra.ecmaFeatures = { - arrowFunctions: true, - binaryLiterals: true, - blockBindings: true, - classes: true, - destructuring: true, - forOf: true, - generators: true, - modules: true, - objectLiteralComputedProperties: true, - objectLiteralDuplicateProperties: true, - objectLiteralShorthandMethods: true, - objectLiteralShorthandProperties: true, - octalLiterals: true, - regexUFlag: true, - regexYFlag: true, - restParams: true, - spread: true, - templateStrings: true, - unicodeCodePointEscapes: true, - }; - acornOptions.ecmaVersion = 6; - acornOptions.sourceType = "module"; - } - - // apply parsing flags after sourceType to allow overriding - if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { - - var flags = Object.keys(options.ecmaFeatures); - - // if it's a module, augment the ecmaFeatures - flags.forEach(function(key) { - var value = extra.ecmaFeatures[key] = options.ecmaFeatures[key]; - - if (value) { - switch (key) { - case "globalReturn": - acornOptions.allowReturnOutsideFunction = true; - break; - - case "modules": - acornOptions.sourceType = "module"; - // falls through - - default: - acornOptions.ecmaVersion = 6; - } - } - }); - - } - var FILENAME = "eslint.ts"; var compilerHost = { @@ -205,34 +152,10 @@ function parse(code, options) { }; } - if (extra.range) { - acornOptions.ranges = true; - } - - if (extra.loc) { - acornOptions.locations = true; - } - - if (extra.ecmaFeatures.jsx) { - if (extra.ecmaFeatures.spread !== false) { - extra.ecmaFeatures.spread = true; - } - acornOptions.plugins = { jsx: true }; - } } - - // if (extra.comment || extra.attachComment) { - // ast.comments = extra.comments; - // } - - // if (extra.tokens) { - // ast.tokens = extra.tokens; - // } var convert = require("./lib/ast-converter"); - return convert(ast); - - // return ast; + return convert(ast, extra); } //------------------------------------------------------------------------------ diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.result.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-property.src.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.result.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/proto-string-property.src.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.result.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/octal-literal.src.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.src.js diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 3084675f8262..58fe5bd1ddec 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -49,7 +49,7 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { }).map(function(filename) { return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" }).filter(function(filename) { - return /classes/.test(filename) && filename.indexOf("error-") === -1 && filename.indexOf("invalid-") === -1; + return !(/jsx|error\-|invalid\-|globalReturn|experimental|newTarget/.test(filename)); }); var moduleTestFiles = testFiles.filter(function(filename) { From 78bdeeb7bd64883aff4682735acdec41b4c4ed18 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 4 Dec 2015 15:36:50 -0800 Subject: [PATCH 005/326] Docs: Update README with plans --- packages/typescript-eslint-parser/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 7b83657caaf3..dac3c2d0a0dd 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -36,8 +36,9 @@ TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. ## Development Plan * **Phase 1:** Full ES6 support, stripping out all TypeScript-specific syntax. -* **Phase 2:** Add JSX support. -* **Phase 3:** Add support for top-level TypeScript syntax. -* **Phase 4:** Add support for types. +* **Phase 2:** Add support for attaching comments. +* **Phase 3:** Add JSX support. +* **Phase 4:** Add support for top-level TypeScript syntax. +* **Phase 5:** Add support for types. The high-level goal is to have output that matches Espree v3.x. From 770c422ba878f93f13c396abccfd1a2cb7216342 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 15 Jan 2016 19:53:24 +0000 Subject: [PATCH 006/326] Fix: Removed unused reference to acorn-jsx/inject (fixes #2) --- packages/typescript-eslint-parser/parser.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 404ca03201ab..d2c96c9b832b 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -29,7 +29,6 @@ var astNodeTypes = require("./lib/ast-node-types"), commentAttachment = require("./lib/comment-attachment"), TokenTranslator = require("./lib/token-translator"), - acornJSX = require("acorn-jsx/inject"), ts = require("typescript"); var lookahead, From 5ce05e927e7d9a812aaa75023c9a83dabfc2c03d Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 16 Jan 2016 15:03:00 +0000 Subject: [PATCH 007/326] Fix: Bumped lint script dependencies (fixes #8) --- packages/typescript-eslint-parser/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 6016d8808900..bc52ea499169 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -28,8 +28,8 @@ "devDependencies": { "chai": "^1.10.0", "dateformat": "^1.0.11", - "eslint": "^1.8.0", - "eslint-config-eslint": "^1.0.1", + "eslint": "2.0.0-beta.1", + "eslint-config-eslint": "^2.0.0", "istanbul": "~0.2.6", "leche": "^1.0.1", "mocha": "^2.0.1", From 19d91836bab3159413a11edef377835c8720af06 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 18 Jan 2016 22:01:16 +0000 Subject: [PATCH 008/326] Fix: Fixes linting errors (fixes #10) --- packages/typescript-eslint-parser/Makefile.js | 17 ++- .../lib/ast-converter.js | 130 +++++++++++++++--- packages/typescript-eslint-parser/parser.js | 51 ++++--- .../tests/lib/attach-comments.js | 5 + .../tests/lib/ecma-features.js | 39 +++--- .../tests/lib/parse.js | 5 + .../tests/lib/tokenize.js | 5 + 7 files changed, 190 insertions(+), 62 deletions(-) diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index 713a4378c8be..31bc1719de00 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -2,7 +2,7 @@ * @fileoverview Build file * @author nzakas */ -/*global cat, cp, echo, exec, exit, find, mkdir, mv, rm, target, test*/ +/* global cat, cp, echo, exec, exit, find, mkdir, mv, rm, target, test */ "use strict"; @@ -39,10 +39,10 @@ var NODE_MODULES = "./node_modules/", // Files MAKEFILE = "./Makefile.js", - /*eslint-disable no-use-before-define */ + /* eslint-disable no-use-before-define */ JS_FILES = find("lib/").filter(fileType("js")).join(" ") + " espree.js", TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "); - /*eslint-enable no-use-before-define */ + /* eslint-enable no-use-before-define */ //------------------------------------------------------------------------------ // Helpers @@ -103,6 +103,10 @@ function splitCommandResultToLines(result) { return result.trim().split("\n"); } +/** + * Returns a list of sorted, valid semtantic-verisioning git tags + * @returns {array} The version tags + */ function getVersionTags() { var tags = splitCommandResultToLines(exec("git tag", { silent: true }).output); @@ -230,6 +234,11 @@ target.changelog = function() { target.checkLicenses = function() { + /** + * Returns true if the given dependency's licenses are all permissable for use in OSS + * @param {object} dependency object containing the name and licenses of the given dependency + * @returns {boolean} is permissable dependency + */ function isPermissible(dependency) { var licenses = dependency.licenses; @@ -262,7 +271,7 @@ target.checkLicenses = function() { }); if (impermissible.length) { - impermissible.forEach(function (dependency) { + impermissible.forEach(function(dependency) { console.error("%s license for %s is impermissible.", dependency.licenses, dependency.name diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index f7a8fb34bb48..c54e707e3375 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -37,8 +37,8 @@ var ts = require("typescript"), // Private //------------------------------------------------------------------------------ -var SyntaxKind = ts.SyntaxKind, - TokenClass = ts.TokenClass; +var SyntaxKind = ts.SyntaxKind; +// var TokenClass = ts.TokenClass; var ASSIGNMENT_OPERATORS = [ SyntaxKind.EqualsToken, @@ -115,22 +115,47 @@ TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^="; TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; +/** + * Returns true if the given node is a valid ESTree class member + * @param {object} node AST node + * @returns {boolean} is valid class member + */ function isESTreeClassMember(node) { return node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.SemicolonClassElement; } +/** + * Returns true if the given token is a comma + * @param {object} token the syntax token + * @returns {boolean} is comma + */ function isComma(token) { return token.kind === SyntaxKind.CommaToken; } +/** + * Returns true if the given operator is the assignment operator + * @param {object} operator the operator + * @returns {boolean} is assignment + */ function isAssignmentOperator(operator) { return ASSIGNMENT_OPERATORS.indexOf(operator.kind) > -1; } +/** + * Returns true if the given operator is a logical operator + * @param {object} operator the operator + * @returns {boolean} is a logical operator + */ function isLogicalOperator(operator) { return LOGICAL_OPERATORS.indexOf(operator.kind) > -1; } +/** + * Returns the binary expression type of the given operator + * @param {object} operator the operator + * @returns {string} the binary expression type + */ function getBinaryExpressionType(operator) { if (isAssignmentOperator(operator)) { return "AssignmentExpression"; @@ -141,6 +166,14 @@ function getBinaryExpressionType(operator) { } } +/** + * Returns line and column data for the given start and end positions, + * for the given AST + * @param {object} start start data + * @param {object} end end data + * @param {object} ast the AST object + * @returns {object} the loc data + */ function getLocFor(start, end, ast) { var startLoc = ast.getLineAndCharacterOfPosition(start), endLoc = ast.getLineAndCharacterOfPosition(end); @@ -157,6 +190,13 @@ function getLocFor(start, end, ast) { }; } +/** + * Returns line and column data for the given node or token, + * for the given AST + * @param {object} nodeOrToken the node or token + * @param {object} ast the AST object + * @returns {object} the loc data + */ function getLoc(nodeOrToken, ast) { return getLocFor(nodeOrToken.getStart(), nodeOrToken.end, ast); // var start = nodeOrToken.getStart(), @@ -175,6 +215,13 @@ function getLoc(nodeOrToken, ast) { // }; } +/** + * Fixes the exports of the given node + * @param {object} node the node + * @param {object} result result + * @param {[type]} ast the AST + * @returns {object} the node with fixed exports + */ function fixExports(node, result, ast) { // check for exports if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { @@ -206,6 +253,11 @@ function fixExports(node, result, ast) { return result; } +/** + * Extends and formats a given error object + * @param {object} error the error object + * @returns {object} converted error object + */ function convertError(error) { var loc = error.file.getLineAndCharacterOfPosition(error.start); @@ -218,9 +270,13 @@ function convertError(error) { }; } +/** + * Returns the type of a given token + * @param {object} token the token + * @returns {string} the token type + */ function getTokenType(token) { - // Need two checks for keywords since some are also identifiers if (token.originalKeywordKind) { @@ -233,7 +289,7 @@ function getTokenType(token) { return "Identifier"; default: - return "Keyword" + return "Keyword"; } } @@ -264,19 +320,23 @@ function getTokenType(token) { case SyntaxKind.GetKeyword: case SyntaxKind.SetKeyword: // falls through + default: } - - - return "Identifier"; } +/** + * Extends and formats a given token, for a given AST + * @param {object} token the token + * @param {object} ast the AST object + * @returns {object} the converted token + */ function convertToken(token, ast) { var start = token.getStart(), value = ast.text.slice(start, token.end), - newToken = { + newToken = { type: getTokenType(token), value: value, range: [start, token.end], @@ -293,6 +353,11 @@ function convertToken(token, ast) { return newToken; } +/** + * Converts all tokens for the given AST + * @param {object} ast the AST object + * @returns {array} the converted tokens + */ function convertTokens(ast) { var token = ast.getFirstToken(), converted, @@ -320,6 +385,12 @@ module.exports = function(ast, extra) { throw convertError(ast.parseDiagnostics[0]); } + /** + * Converts node + * @param {object} node the node + * @param {object} parent the parent node + * @returns {object} the converted node + */ function convert(node, parent) { // exit early for null and undefined @@ -333,12 +404,21 @@ module.exports = function(ast, extra) { loc: getLoc(node, ast) }; + /** + * Copies the result object + * @returns {void} + */ function simplyCopy() { assign(result, { type: SyntaxKind[node.kind] }); } + /** + * Converts child node + * @param {object} child the child node + * @returns {object} the converted child node + */ function convertChild(child) { return convert(child, node); } @@ -348,7 +428,7 @@ module.exports = function(ast, extra) { assign(result, { type: "Program", body: [], - sourceType: node.externalModuleIndicator ? "module": "script" + sourceType: node.externalModuleIndicator ? "module" : "script" }); // filter out unknown nodes for now @@ -531,10 +611,18 @@ module.exports = function(ast, extra) { case SyntaxKind.VariableStatement: + var varStatementKind; + + if (node.declarationList.flags) { + varStatementKind = (node.declarationList.flags === ts.NodeFlags.Let) ? "let" : "const"; + } else { + varStatementKind = "var"; + } + assign(result, { type: "VariableDeclaration", declarations: node.declarationList.declarations.map(convertChild), - kind: (node.declarationList.flags ? (node.declarationList.flags === ts.NodeFlags.Let ? "let" : "const") : "var") + kind: varStatementKind }); // check for exports @@ -543,10 +631,19 @@ module.exports = function(ast, extra) { // mostly for for-of, for-in case SyntaxKind.VariableDeclarationList: + + var varDeclarationListKind; + + if (node.flags) { + varDeclarationListKind = (node.flags === ts.NodeFlags.Let) ? "let" : "const"; + } else { + varDeclarationListKind = "var"; + } + assign(result, { type: "VariableDeclaration", declarations: node.declarations.map(convertChild), - kind: (node.flags ? (node.flags === ts.NodeFlags.Let ? "let" : "const") : "var") + kind: varDeclarationListKind }); break; @@ -719,7 +816,7 @@ module.exports = function(ast, extra) { // TypeScript uses this even for static methods named "constructor" case SyntaxKind.Constructor: - var constructorIsStatic = Boolean(node.flags & ts.NodeFlags.Static), + var constructorIsStatic = Boolean(node.flags & ts.NodeFlags.Static), firstConstructorToken = constructorIsStatic ? ts.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), constructorOffset = 11, constructorStartOffset = constructorOffset + firstConstructorToken.getStart() - node.getFirstToken().getStart(), @@ -807,13 +904,6 @@ module.exports = function(ast, extra) { }); break; - case SyntaxKind.SpreadElementExpression: - assign(result, { - type: "SpreadElement", - argument: convertChild(node.expression) - }); - break; - case SyntaxKind.ArrayBindingPattern: assign(result, { type: "ArrayPattern", @@ -997,7 +1087,7 @@ module.exports = function(ast, extra) { range: [ openBrace.getStart(), result.range[1] ], loc: getLocFor(openBrace.getStart(), node.end, ast) }, - superClass: (node.heritageClauses ? convertChild(node.heritageClauses[0].types[0].expression) : null), + superClass: (node.heritageClauses ? convertChild(node.heritageClauses[0].types[0].expression) : null) }); var filteredMembers = node.members.filter(isESTreeClassMember); diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index d2c96c9b832b..637a9eddd7f7 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -22,19 +22,23 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/*eslint no-undefined:0, no-use-before-define: 0*/ +/* eslint no-undefined:0, no-use-before-define: 0 */ "use strict"; var astNodeTypes = require("./lib/ast-node-types"), commentAttachment = require("./lib/comment-attachment"), - TokenTranslator = require("./lib/token-translator"), + // TokenTranslator = require("./lib/token-translator"), ts = require("typescript"); -var lookahead, - extra, - lastToken; +// var lookahead; +var extra; +// var lastToken; +/** + * Resets the extra config object + * @returns {void} + */ function resetExtra() { extra = { tokens: null, @@ -55,15 +59,20 @@ function resetExtra() { // Parser //------------------------------------------------------------------------------ - +/** + * Parses the given source code to produce a valid AST + * @param {mixed} code TypeScript code + * @param {object} options configuration object for the parser + * @returns {object} the AST + */ function parse(code, options) { var program, - toString = String, - translator, - acornOptions = { - ecmaVersion: 5 - }; + toString = String; + // var acornOptions = { + // ecmaVersion: 5 + // }; + // var translator; if (typeof code !== "string" && !(code instanceof String)) { code = toString(code); @@ -132,7 +141,7 @@ function parse(code, options) { } }; - var program = ts.createProgram([FILENAME], { + program = ts.createProgram([FILENAME], { noResolve: true, target: ts.ScriptTarget.Latest, jsx: extra.ecmaFeatures.jsx ? "preserve" : undefined @@ -141,14 +150,14 @@ function parse(code, options) { var ast = program.getSourceFile(FILENAME); if (extra.attachComment || extra.comment) { - acornOptions.onComment = function() { - var comment = convertAcornCommentToEsprimaComment.apply(this, arguments); - extra.comments.push(comment); - - if (extra.attachComment) { - commentAttachment.addComment(comment); - } - }; + // acornOptions.onComment = function() { + // var comment = convertAcornCommentToEsprimaComment.apply(this, arguments); + // extra.comments.push(comment); + // + // if (extra.attachComment) { + // commentAttachment.addComment(comment); + // } + // }; } } @@ -167,7 +176,7 @@ exports.parse = parse; // Deep copy. /* istanbul ignore next */ -exports.Syntax = (function () { +exports.Syntax = (function() { var name, types = {}; if (typeof Object.create === "function") { diff --git a/packages/typescript-eslint-parser/tests/lib/attach-comments.js b/packages/typescript-eslint-parser/tests/lib/attach-comments.js index 6d0d9573c71a..1b74cc20acc2 100644 --- a/packages/typescript-eslint-parser/tests/lib/attach-comments.js +++ b/packages/typescript-eslint-parser/tests/lib/attach-comments.js @@ -48,6 +48,11 @@ var testFiles = shelljs.find("./tests/fixtures/attach-comments").filter(function // return /line-and-block/.test(filename); }); +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ function getRaw(ast) { return JSON.parse(JSON.stringify(ast)); } diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 58fe5bd1ddec..c1e8bdb56a4b 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -41,8 +41,8 @@ var assert = require("chai").assert, // Setup //------------------------------------------------------------------------------ -var FIXTURES_DIR = "./tests/fixtures/ecma-features", - FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix"; +var FIXTURES_DIR = "./tests/fixtures/ecma-features"; +// var FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix"; var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { return filename.indexOf(".src.js") > -1; @@ -52,21 +52,26 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { return !(/jsx|error\-|invalid\-|globalReturn|experimental|newTarget/.test(filename)); }); -var moduleTestFiles = testFiles.filter(function(filename) { - return !/jsx|globalReturn|invalid|experimental|generators|not\-strict/.test(filename); -}); +// var moduleTestFiles = testFiles.filter(function(filename) { +// return !/jsx|globalReturn|invalid|experimental|generators|not\-strict/.test(filename); +// }); -var mixFiles = shelljs.find(FIXTURES_MIX_DIR).filter(function(filename) { - return filename.indexOf(".src.js") > -1; -}).map(function(filename) { - return filename.substring(FIXTURES_MIX_DIR.length - 1, filename.length - 7); // strip off ".src.js" -// }).filter(function(filename) { -// return /template/.test(filename); -}); +// var mixFiles = shelljs.find(FIXTURES_MIX_DIR).filter(function(filename) { +// return filename.indexOf(".src.js") > -1; +// }).map(function(filename) { +// return filename.substring(FIXTURES_MIX_DIR.length - 1, filename.length - 7); // strip off ".src.js" +// // }).filter(function(filename) { +// // return /template/.test(filename); +// }); // console.dir(moduleTestFiles); // return; +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ function getRaw(ast) { return JSON.parse(JSON.stringify(ast)); } @@ -81,11 +86,11 @@ describe("ecmaFeatures", function() { beforeEach(function() { config = { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {} - }; + loc: true, + range: true, + tokens: true, + ecmaFeatures: {} + }; }); leche.withData(testFiles, function(filename) { diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index 364c380a97d7..4c9f793b9df5 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -37,6 +37,11 @@ var assert = require("chai").assert, // Helpers //------------------------------------------------------------------------------ +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ function getRaw(ast) { return JSON.parse(JSON.stringify(ast)); } diff --git a/packages/typescript-eslint-parser/tests/lib/tokenize.js b/packages/typescript-eslint-parser/tests/lib/tokenize.js index ea740dfd0b8e..4e863b61a9e2 100644 --- a/packages/typescript-eslint-parser/tests/lib/tokenize.js +++ b/packages/typescript-eslint-parser/tests/lib/tokenize.js @@ -37,6 +37,11 @@ var assert = require("chai").assert, // Helpers //------------------------------------------------------------------------------ +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ function getRaw(ast) { return JSON.parse(JSON.stringify(ast)); } From 962886b7e28931da7ae98cf35e4ab01bd523caf5 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 19 Jan 2016 21:30:44 +0000 Subject: [PATCH 009/326] Docs: Improved detail and accuracy of JSDoc blocks --- packages/typescript-eslint-parser/Makefile.js | 2 +- .../lib/ast-converter.js | 85 ++++++++++--------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index 31bc1719de00..c089ae4ccb92 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -105,7 +105,7 @@ function splitCommandResultToLines(result) { /** * Returns a list of sorted, valid semtantic-verisioning git tags - * @returns {array} The version tags + * @returns {string[]} The version tags */ function getVersionTags() { var tags = splitCommandResultToLines(exec("git tag", { silent: true }).output); diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index c54e707e3375..61c4157c33b4 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -116,17 +116,17 @@ TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; /** - * Returns true if the given node is a valid ESTree class member - * @param {object} node AST node - * @returns {boolean} is valid class member + * Returns true if the given TSNode is a valid ESTree class member + * @param {TSNode} node TypeScript AST node + * @returns {boolean} is valid ESTree class member */ function isESTreeClassMember(node) { return node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.SemicolonClassElement; } /** - * Returns true if the given token is a comma - * @param {object} token the syntax token + * Returns true if the given TSToken is a comma + * @param {TSToken} token the TypeScript token * @returns {boolean} is comma */ function isComma(token) { @@ -134,8 +134,8 @@ function isComma(token) { } /** - * Returns true if the given operator is the assignment operator - * @param {object} operator the operator + * Returns true if the given TSToken is the assignment operator + * @param {TSToken} operator the operator token * @returns {boolean} is assignment */ function isAssignmentOperator(operator) { @@ -143,8 +143,8 @@ function isAssignmentOperator(operator) { } /** - * Returns true if the given operator is a logical operator - * @param {object} operator the operator + * Returns true if the given TSToken is a logical operator + * @param {TSToken} operator the operator token * @returns {boolean} is a logical operator */ function isLogicalOperator(operator) { @@ -152,8 +152,8 @@ function isLogicalOperator(operator) { } /** - * Returns the binary expression type of the given operator - * @param {object} operator the operator + * Returns the binary expression type of the given TSToken + * @param {TSToken} operator the operator token * @returns {string} the binary expression type */ function getBinaryExpressionType(operator) { @@ -169,10 +169,10 @@ function getBinaryExpressionType(operator) { /** * Returns line and column data for the given start and end positions, * for the given AST - * @param {object} start start data - * @param {object} end end data - * @param {object} ast the AST object - * @returns {object} the loc data + * @param {Object} start start data + * @param {Object} end end data + * @param {Object} ast the AST object + * @returns {Object} the loc data */ function getLocFor(start, end, ast) { var startLoc = ast.getLineAndCharacterOfPosition(start), @@ -191,11 +191,11 @@ function getLocFor(start, end, ast) { } /** - * Returns line and column data for the given node or token, + * Returns line and column data for the given ESTreeNode or ESTreeToken, * for the given AST - * @param {object} nodeOrToken the node or token - * @param {object} ast the AST object - * @returns {object} the loc data + * @param {ESTreeToken|ESTreeNode} nodeOrToken the ESTreeNode or ESTreeToken + * @param {Object} ast the AST object + * @returns {Object} the loc data */ function getLoc(nodeOrToken, ast) { return getLocFor(nodeOrToken.getStart(), nodeOrToken.end, ast); @@ -216,11 +216,11 @@ function getLoc(nodeOrToken, ast) { } /** - * Fixes the exports of the given node - * @param {object} node the node - * @param {object} result result - * @param {[type]} ast the AST - * @returns {object} the node with fixed exports + * Fixes the exports of the given TSNode + * @param {TSNode} node the TSNode + * @param {Object} result result + * @param {Object} ast the AST + * @returns {TSNode} the TSNode with fixed exports */ function fixExports(node, result, ast) { // check for exports @@ -255,8 +255,8 @@ function fixExports(node, result, ast) { /** * Extends and formats a given error object - * @param {object} error the error object - * @returns {object} converted error object + * @param {Object} error the error object + * @returns {Object} converted error object */ function convertError(error) { @@ -271,8 +271,8 @@ function convertError(error) { } /** - * Returns the type of a given token - * @param {object} token the token + * Returns the type of a given ESTreeToken + * @param {ESTreeToken} token the ESTreeToken * @returns {string} the token type */ function getTokenType(token) { @@ -327,10 +327,10 @@ function getTokenType(token) { } /** - * Extends and formats a given token, for a given AST - * @param {object} token the token - * @param {object} ast the AST object - * @returns {object} the converted token + * Extends and formats a given ESTreeToken, for a given AST + * @param {ESTreeToken} token the ESTreeToken + * @param {Object} ast the AST object + * @returns {ESTreeToken} the converted ESTreeToken */ function convertToken(token, ast) { @@ -355,8 +355,8 @@ function convertToken(token, ast) { /** * Converts all tokens for the given AST - * @param {object} ast the AST object - * @returns {array} the converted tokens + * @param {Object} ast the AST object + * @returns {ESTreeToken[]} the converted ESTreeTokens */ function convertTokens(ast) { var token = ast.getFirstToken(), @@ -386,10 +386,10 @@ module.exports = function(ast, extra) { } /** - * Converts node - * @param {object} node the node - * @param {object} parent the parent node - * @returns {object} the converted node + * Converts a TypeScript node into an ESTree node + * @param {TSNode} node the TSNode + * @param {TSNode} parent the parent TSNode + * @returns {ESTreeNode} the converted ESTreeNode */ function convert(node, parent) { @@ -405,7 +405,8 @@ module.exports = function(ast, extra) { }; /** - * Copies the result object + * Copies the result object into an ESTree node with just a type property. + * This is used only for leaf nodes that have no other properties. * @returns {void} */ function simplyCopy() { @@ -415,9 +416,9 @@ module.exports = function(ast, extra) { } /** - * Converts child node - * @param {object} child the child node - * @returns {object} the converted child node + * Converts a TypeScript node into an ESTree node. + * @param {TSNode} child the child TSNode + * @returns {ESTreeNode} the converted ESTree node */ function convertChild(child) { return convert(child, node); From f5c57a1a713b82ed0f57dc1f485d1b4325bf88e0 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 26 Feb 2016 14:05:20 -0800 Subject: [PATCH 010/326] Fix: Make tests actually work (fixes #6) --- .../typescript-eslint-parser/package.json | 4 +- .../tests/lib/attach-comments.js | 98 ---------- .../tests/lib/ecma-features.js | 1 - .../tests/lib/tokenize.js | 167 ------------------ 4 files changed, 2 insertions(+), 268 deletions(-) delete mode 100644 packages/typescript-eslint-parser/tests/lib/attach-comments.js delete mode 100644 packages/typescript-eslint-parser/tests/lib/tokenize.js diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index bc52ea499169..aada5ef65e33 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -28,8 +28,8 @@ "devDependencies": { "chai": "^1.10.0", "dateformat": "^1.0.11", - "eslint": "2.0.0-beta.1", - "eslint-config-eslint": "^2.0.0", + "eslint": "^2.2.0", + "eslint-config-eslint": "^3.0.0", "istanbul": "~0.2.6", "leche": "^1.0.1", "mocha": "^2.0.1", diff --git a/packages/typescript-eslint-parser/tests/lib/attach-comments.js b/packages/typescript-eslint-parser/tests/lib/attach-comments.js deleted file mode 100644 index 1b74cc20acc2..000000000000 --- a/packages/typescript-eslint-parser/tests/lib/attach-comments.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @fileoverview Tests for parsing and attaching comments. - * @author Nicholas C. Zakas - * @copyright 2014 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -var assert = require("chai").assert, - leche = require("leche"), - path = require("path"), - espree = require("../../espree"), - shelljs = require("shelljs"); - -//------------------------------------------------------------------------------ -// Setup -//------------------------------------------------------------------------------ - -var testFiles = shelljs.find("./tests/fixtures/attach-comments").filter(function(filename) { - return filename.indexOf(".src.js") > -1; -}).map(function(filename) { - return filename.substring(0, filename.length - 7); // strip off ".src.js" -// }).filter(function(filename) { -// return /line-and-block/.test(filename); -}); - -/** - * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ - -describe("attachComment: true", function() { - - leche.withData(testFiles, function(filename) { - it("should produce correct AST when parsed with attachComments", function() { - var output = require(path.resolve(__dirname, "../../", filename + ".result.js")); - var input = shelljs.cat(filename + ".src.js"); - var result; - - if (output.sourceType === "script") { - result = espree.parse(input, { - loc: true, - range: true, - tokens: true, - attachComment: true - }); - } else { - result = espree.parse(input, { - loc: true, - range: true, - tokens: true, - attachComment: true, - ecmaFeatures: { - classes: true, - modules: true - } - }); - } - - assert.deepEqual(getRaw(result), output); - }); - - }); - - -}); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index c1e8bdb56a4b..d6fc46c29692 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -36,7 +36,6 @@ var assert = require("chai").assert, parser = require("../../parser"), shelljs = require("shelljs"); -// var parser = require("esprima-fb"); //------------------------------------------------------------------------------ // Setup //------------------------------------------------------------------------------ diff --git a/packages/typescript-eslint-parser/tests/lib/tokenize.js b/packages/typescript-eslint-parser/tests/lib/tokenize.js deleted file mode 100644 index 4e863b61a9e2..000000000000 --- a/packages/typescript-eslint-parser/tests/lib/tokenize.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @fileoverview Tests for tokenize(). - * @author Nicholas C. Zakas - * @copyright 2014 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -var assert = require("chai").assert, - espree = require("../../espree"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ - -describe("tokenize()", function() { - - it("should produce tokens when using let", function() { - var tokens = espree.tokenize("let foo = bar;", { - ecmaFeatures: { blockBindings: true }, - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/let-result.tokens.js")); - }); - - it("should produce tokens when using const", function() { - var tokens = espree.tokenize("const foo = bar;", { - ecmaFeatures: { blockBindings: true }, - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/const-result.tokens.js")); - }); - - it("should produce tokens when using regular expression u flag", function() { - var tokens = espree.tokenize("var foo = /foo/u;", { - ecmaFeatures: { regexUFlag: true }, - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/regexp-u-result.tokens.js")); - }); - - it("should produce tokens when using regular expression y flag", function() { - var tokens = espree.tokenize("var foo = /foo/y;", { - ecmaFeatures: { regexYFlag: true }, - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/regexp-y-result.tokens.js")); - }); - - - describe("templateStrings", function() { - it("should produce tokens when tokenizing simple template string", function() { - var tokens = espree.tokenize("var foo = `hi`;", { - ecmaFeatures: { templateStrings: true }, - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-simple-result.tokens.js")); - }); - - it("should produce tokens when tokenizing template string with embedded variable", function() { - var tokens = espree.tokenize("var foo = `hi${bar}`;", { - ecmaFeatures: { templateStrings: true }, - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-embedded-result.tokens.js")); - }); - - it("should produce tokens when tokenizing template string with embedded variable in function call", function() { - var tokens = espree.tokenize("var a; console.log(`${a}`, \"a\");", { - ecmaFeatures: { templateStrings: true }, - loc: true, - range: true - }); - - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-embedded2-result.tokens.js")); - }); - - it("should produce tokens when parsing template string with embedded variable in function call and with tokens options on", function() { - var ast = espree.parse("var a; console.log(`${a}`, \"a\");", { - ecmaFeatures: { templateStrings: true }, - tokens: true, - loc: true, - range: true - }); - - assert.deepEqual(getRaw(ast.tokens), require("../fixtures/tokenize/template-string-embedded2-result.tokens.js")); - }); - - it("should produce tokens when tokenizing template string with embedded expressions", function() { - var tokens = espree.tokenize("var foo = `Hello ${b}. a + 5 = ${a + 5}`;", { - ecmaFeatures: { templateStrings: true }, - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/template-string-expressions-result.tokens.js")); - }); - - - }); - - // Make sure we don't introduce the same regex parsing error as Esprima - it("should produce tokens when using regular expression wrapped in parens", function() { - var tokens = espree.tokenize("(/foo/).test(bar);", { - loc: true, - range: true - }); - assert.deepEqual(getRaw(tokens), require("../fixtures/tokenize/regex-in-parens-result.tokens.js")); - }); - - it("should produce tokens when using regular expression wrapped in parens using parse()", function() { - var ast = espree.parse("(/foo/).test(bar);", { - loc: true, - range: true, - tokens: true - }); - assert.deepEqual(getRaw(ast.tokens), require("../fixtures/tokenize/regex-in-parens-result.tokens.js")); - }); - - it("should produce tokens when using a single identifier", function() { - var tokens = espree.tokenize("a"); - assert.deepEqual(getRaw(tokens), [ { type: "Identifier", value: "a"}]); - }); - -}); From b5515f2b3b7ef75c6934ddd01bae443868af702e Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 26 Feb 2016 14:08:40 -0800 Subject: [PATCH 011/326] Update: TypeScript to be a peer dependency (fixes #12) --- packages/typescript-eslint-parser/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index aada5ef65e33..81b3a9376e4b 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -55,7 +55,9 @@ "major": "node Makefile.js major" }, "dependencies": { - "object-assign": "^4.0.1", + "object-assign": "^4.0.1" + }, + "peerDependencies": { "typescript": "^1.6.2" } } From bc378bf241acf98977c9579e3ddbde6a4aebd39e Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 26 Feb 2016 14:12:21 -0800 Subject: [PATCH 012/326] Fix: Use YAML file for ESLint config --- packages/typescript-eslint-parser/{.eslintrc => .eslintrc.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/typescript-eslint-parser/{.eslintrc => .eslintrc.yml} (100%) diff --git a/packages/typescript-eslint-parser/.eslintrc b/packages/typescript-eslint-parser/.eslintrc.yml similarity index 100% rename from packages/typescript-eslint-parser/.eslintrc rename to packages/typescript-eslint-parser/.eslintrc.yml From b708c588a52f6700ffe18e75b6ded52ebd61a72d Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 28 Feb 2016 15:16:04 +0000 Subject: [PATCH 013/326] Fix: SyntaxKind code checks, update TS peerDependency ^1.7.3 (fixes #15) --- packages/typescript-eslint-parser/lib/ast-converter.js | 4 ++-- packages/typescript-eslint-parser/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 61c4157c33b4..73e6aaf146d2 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -293,11 +293,11 @@ function getTokenType(token) { } } - if (token.kind >= 68 && token.kind <= 112) { + if (token.kind >= SyntaxKind.FirstKeyword && token.kind <= SyntaxKind.LastFutureReservedWord) { return "Keyword"; } - if (token.kind >= 15 && token.kind <= 66) { + if (token.kind >= SyntaxKind.FirstPunctuation && token.kind <= SyntaxKind.LastBinaryOperator) { return "Punctuator"; } diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 81b3a9376e4b..314c3b54b455 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -58,6 +58,6 @@ "object-assign": "^4.0.1" }, "peerDependencies": { - "typescript": "^1.6.2" + "typescript": "^1.7.3" } } From b25adb38cd2c79e5427eb5ca26b171b75db8483a Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 4 Mar 2016 19:59:23 +0000 Subject: [PATCH 014/326] Fix: Ensure true, false and null values are not stringifed (fixes #1) --- packages/typescript-eslint-parser/lib/ast-converter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 73e6aaf146d2..47bce653179b 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1346,21 +1346,21 @@ module.exports = function(ast, extra) { case SyntaxKind.TrueKeyword: assign(result, { type: "Literal", - value: "true" + value: true }); break; case SyntaxKind.FalseKeyword: assign(result, { type: "Literal", - value: "false" + value: false }); break; case SyntaxKind.NullKeyword: assign(result, { type: "Literal", - value: "null" + value: null }); break; From 8b4d3adf2b876db1de972e7870ebe8e28d33d476 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 4 Mar 2016 12:06:09 -0800 Subject: [PATCH 015/326] Build: Add release tool --- packages/typescript-eslint-parser/package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 314c3b54b455..a534d2b43063 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -30,6 +30,7 @@ "dateformat": "^1.0.11", "eslint": "^2.2.0", "eslint-config-eslint": "^3.0.0", + "eslint-release": "^0.3.0", "istanbul": "~0.2.6", "leche": "^1.0.1", "mocha": "^2.0.1", @@ -50,9 +51,9 @@ "scripts": { "test": "node Makefile.js test", "lint": "node Makefile.js lint", - "patch": "node Makefile.js patch", - "minor": "node Makefile.js minor", - "major": "node Makefile.js major" + "release": "eslint-release", + "alpharelease": "eslint-prerelease alpha", + "betarelease": "eslint-prerelease beta" }, "dependencies": { "object-assign": "^4.0.1" From 7222c0e3d15fe8176f623c32b10a3b30fb2c6226 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 4 Mar 2016 12:09:12 -0800 Subject: [PATCH 016/326] Docs: Autogenerated changelog for 0.1.0-alpha.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index e69de29bb2d1..cfa7457a6503 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -0,0 +1,17 @@ +v0.1.0-alpha.0 - March 4, 2016 + +* c05b5da Build: Add release tool (Nicholas C. Zakas) +* 091973b Fix: SyntaxKind code checks, update TS peerDependency ^1.7.3 (fixes #15) (James Henry) +* e34f6b4 Fix: Use YAML file for ESLint config (Nicholas C. Zakas) +* e19b29d Update: TypeScript to be a peer dependency (fixes #12) (Nicholas C. Zakas) +* bdb1e3a Fix: Make tests actually work (fixes #6) (Nicholas C. Zakas) +* c61cc81 Docs: Improved detail and accuracy of JSDoc blocks (James Henry) +* 918a9cc Fix: Fixes linting errors (fixes #10) (James Henry) +* 1721dde Fix: Bumped lint script dependencies (fixes #8) (James Henry) +* 2f04e92 Fix: Removed unused reference to acorn-jsx/inject (fixes #2) (James Henry) +* 0e9d61e Docs: Update README with plans (Nicholas C. Zakas) +* c88e3ab New: Finished up ES6 features (Nicholas C. Zakas) +* 0ea1e32 Build: Tag as alpha release (Nicholas C. Zakas) +* 08702b8 Docs: Update README (Nicholas C. Zakas) +* c88ba98 New: First commit (Nicholas C. Zakas) + From 39bac011090529b0f4151d989e3e52ec2706a01c Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 4 Mar 2016 12:09:22 -0800 Subject: [PATCH 017/326] 0.1.0-alpha.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index a534d2b43063..1c6e88c520b6 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/espree", "main": "parser.js", - "version": "0.1.0-alpha-1", + "version": "0.1.0-alpha.0", "files": [ "lib", "parser.js" From b8a85115bf8405b1e8fae6e02341a9d14f8f2501 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Sat, 5 Mar 2016 08:19:32 -0800 Subject: [PATCH 018/326] Build: Don't test Node 0.10 --- packages/typescript-eslint-parser/.travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index c943be513d44..89058e6f8ae7 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -1,7 +1,6 @@ language: node_js sudo: false node_js: - - "0.10" - "0.12" - 4 after_success: From da6dbaa73ef4a12203f743051de07a1a6ae52d20 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 11 Mar 2016 10:40:28 -0800 Subject: [PATCH 019/326] Docs: PR validation check --- .../templates/pr-create.md.ejs | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 packages/typescript-eslint-parser/templates/pr-create.md.ejs diff --git a/packages/typescript-eslint-parser/templates/pr-create.md.ejs b/packages/typescript-eslint-parser/templates/pr-create.md.ejs new file mode 100644 index 000000000000..54d8fa7597e5 --- /dev/null +++ b/packages/typescript-eslint-parser/templates/pr-create.md.ejs @@ -0,0 +1,55 @@ +<% + +var FLAG_PATTERN = /^(Fix|Update|New|Breaking|Build|Docs|Upgrade):/, + ISSUE_REF_PATTERN = /\((fixes|refs) #\d+.*?\)$/; + +function isValidCommitFlag(log) { + var result = log.match(FLAG_PATTERN); + return !!result || log.indexOf("Revert \"") === 0; +} + +function needsIssueRef(log) { + var result = log.match(ISSUE_REF_PATTERN); + return !result && log.indexOf("Docs:") !== 0; +} + +var problems = []; + +// Check for one commit per pull request +if (payload.commits > 1) { + problems.push("We require one commit per pull request. Please [squash](https://egghead.io/lessons/javascript-how-to-squash-multiple-git-commits) your commits."); +} else if (meta.commits) { + // get just the first line of the commit message + var log = meta.commits[0].commit.message.split(/\r?\n/g)[0]; + + if (!isValidCommitFlag(log)) { + problems.push("The commit summary needs to begin with a tag (such as `Fix:` or `Update:`). Please check out our [guide](http://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes) for how to properly format your commit summary and [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) it on this pull request.") + } + + if (log.length > 72) { + problems.push("The commit summary must be 72 characters or shorter. Please check out our [guide](http://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes) for how to properly format your commit summary and [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) it on this pull request."); + } + + if (needsIssueRef(log)) { + problems.push("Pull requests with code require an issue to be mentioned at the end of the commit summary, such as `(fixes #1234)`. Please [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) the commit summary with an issue (file a new issue if one doesn't already exist).") + } +} + +// Check for CLA signature +if (!meta.cla) { + problems.push("Please sign our [CLA](http://eslint.org/cla). This is just a way for you to say that you give us permission to use your contribution.") +} + +if (problems.length) { %> +Thanks for the pull request, @<%= payload.sender.login %>! I took a look to make sure it's ready for merging and found some changes are needed: + +<% problems.forEach(function(problem) { %> +* <%- problem %> +<% }); %> + +Can you please update the pull request to address these? + +(More information can be found in our [pull request guide](http://eslint.org/docs/developer-guide/contributing/pull-requests).) +<% } else { %> +LGTM +<% } %> From 0202881339a1724f215257507385b93c67b4f67a Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 5 Mar 2016 15:35:29 +0000 Subject: [PATCH 020/326] New: Implements JSX syntax (fixes #18) --- .../lib/ast-converter.js | 185 +++++++++++++++++- .../typescript-eslint-parser/package.json | 1 + packages/typescript-eslint-parser/parser.js | 9 +- .../tests/lib/ecma-features.js | 14 +- 4 files changed, 203 insertions(+), 6 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 47bce653179b..1ba15b9f50c1 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -31,7 +31,8 @@ //------------------------------------------------------------------------------ var ts = require("typescript"), - assign = require("object-assign"); + assign = require("object-assign"), + unescape = require("lodash.unescape"); //------------------------------------------------------------------------------ // Private @@ -309,7 +310,16 @@ function getTokenType(token) { case SyntaxKind.NumericLiteral: return "Numeric"; + case SyntaxKind.JsxText: + return "JSXText"; + case SyntaxKind.StringLiteral: + // A TypeScript-StringLiteral token with a TypeScript-JsxAttribute or TypeScript-JsxElement parent, + // must actually be an ESTree-JSXText token + if (token.parent && (token.parent.kind === SyntaxKind.JsxAttribute || token.parent.kind === SyntaxKind.JsxElement)) { + return "JSXText"; + } + return "String"; case SyntaxKind.RegularExpressionLiteral: @@ -323,6 +333,23 @@ function getTokenType(token) { default: } + // Some JSX tokens have to be determined based on their parent + if (token.parent) { + if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.FirstNode) { + return "JSXIdentifier"; + } + + if (token.parent.kind >= SyntaxKind.JsxElement && token.parent.kind <= SyntaxKind.JsxAttribute) { + if (token.kind === SyntaxKind.FirstNode) { + return "JSXMemberExpression"; + } + + if (token.kind === SyntaxKind.Identifier) { + return "JSXIdentifier"; + } + } + } + return "Identifier"; } @@ -368,7 +395,6 @@ function convertTokens(ast) { if (converted) { result.push(converted); } - token = ts.findNextToken(token, ast); } @@ -424,6 +450,38 @@ module.exports = function(ast, extra) { return convert(child, node); } + /** + * Converts a TypeScript JSX node.tagName into an ESTree node.name + * @param {Object} tagName the tagName object from a JSX TSNode + * @param {Object} ast the AST object + * @returns {Object} the converted ESTree name object + */ + function convertTypeScriptJSXTagNameToESTreeName(tagName) { + var tagNameToken = convertToken(tagName, ast); + + if (tagNameToken.type === "JSXMemberExpression") { + + var isNestedMemberExpression = (node.tagName.left.kind === SyntaxKind.FirstNode); + + // Convert TSNode left and right objects into ESTreeNode object + // and property objects + tagNameToken.object = convertChild(node.tagName.left); + tagNameToken.property = convertChild(node.tagName.right); + + // Assign the appropriate types + tagNameToken.object.type = (isNestedMemberExpression) ? "JSXMemberExpression" : "JSXIdentifier"; + tagNameToken.property.type = "JSXIdentifier"; + + } else { + + tagNameToken.name = tagNameToken.value; + } + + delete tagNameToken.value; + + return tagNameToken; + } + switch (node.kind) { case SyntaxKind.SourceFile: assign(result, { @@ -1318,7 +1376,7 @@ module.exports = function(ast, extra) { case SyntaxKind.StringLiteral: assign(result, { type: "Literal", - value: node.text, + value: unescape(node.text), raw: ast.text.slice(result.range[0], result.range[1]) }); break; @@ -1369,13 +1427,132 @@ module.exports = function(ast, extra) { simplyCopy(); break; + // JSX + + case SyntaxKind.JsxElement: + assign(result, { + type: "JSXElement", + openingElement: convertChild(node.openingElement), + closingElement: convertChild(node.closingElement), + children: node.children.map(convertChild) + }); + + break; + + case SyntaxKind.JsxSelfClosingElement: + // Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, + // TypeScript does not seem to have the idea of openingElement when tag is self-closing + node.kind = SyntaxKind.JsxOpeningElement; + assign(result, { + type: "JSXElement", + openingElement: convertChild(node), + closingElement: null, + children: [] + }); + + break; + + case SyntaxKind.JsxOpeningElement: + var openingTagName = convertTypeScriptJSXTagNameToESTreeName(node.tagName); + assign(result, { + type: "JSXOpeningElement", + selfClosing: !(node.parent && node.parent.closingElement), + name: openingTagName, + attributes: node.attributes.map(convertChild) + }); + + break; + + case SyntaxKind.JsxClosingElement: + var closingTagName = convertTypeScriptJSXTagNameToESTreeName(node.tagName); + assign(result, { + type: "JSXClosingElement", + name: closingTagName + }); + + break; + + case SyntaxKind.JsxExpression: + var eloc = ast.getLineAndCharacterOfPosition(result.range[0] + 1); + var expression = (node.expression) ? convertChild(node.expression) : { + type: "JSXEmptyExpression", + loc: { + start: { + line: eloc.line + 1, + column: eloc.character + }, + end: { + line: result.loc.end.line, + column: result.loc.end.column - 1 + } + }, + range: [result.range[0] + 1, result.range[1] - 1] + }; + + assign(result, { + type: "JSXExpressionContainer", + expression: expression + }); + + break; + + case SyntaxKind.JsxAttribute: + var attributeName = convertToken(node.name, ast); + attributeName.name = attributeName.value; + delete attributeName.value; + + assign(result, { + type: "JSXAttribute", + name: attributeName, + value: convertChild(node.initializer) + }); + + break; + + case SyntaxKind.JsxText: + assign(result, { + type: "Literal", + value: ast.text.slice(node.pos, node.end), + raw: ast.text.slice(node.pos, node.end) + }); + + result.loc.start.column = node.pos; + result.range[0] = node.pos; + + break; + + case SyntaxKind.JsxSpreadAttribute: + assign(result, { + type: "JSXSpreadAttribute", + argument: convertChild(node.expression) + }); + + break; + + case SyntaxKind.FirstNode: + var jsxMemberExpressionObject = convertChild(node.left); + jsxMemberExpressionObject.type = "JSXIdentifier"; + delete jsxMemberExpressionObject.value; + + var jsxMemberExpressionProperty = convertChild(node.right); + jsxMemberExpressionProperty.type = "JSXIdentifier"; + delete jsxMemberExpressionObject.value; + + assign(result, { + type: "JSXMemberExpression", + object: jsxMemberExpressionObject, + property: jsxMemberExpressionProperty + }); + + break; + // TypeScript specific case SyntaxKind.ParenthesizedExpression: return convert(node.expression, parent); default: - console.log(node.kind); + console.log("unsupported node.kind:", node.kind); result = null; } diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 1c6e88c520b6..05b698fcd9c9 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -56,6 +56,7 @@ "betarelease": "eslint-prerelease beta" }, "dependencies": { + "lodash.unescape": "4.0.0", "object-assign": "^4.0.1" }, "peerDependencies": { diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 637a9eddd7f7..41fd2f4eece6 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -107,7 +107,14 @@ function parse(code, options) { commentAttachment.reset(); } - var FILENAME = "eslint.ts"; + if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { + // pass through jsx option + extra.ecmaFeatures.jsx = options.ecmaFeatures.jsx; + } + + // Even if jsx option is set in typescript compiler, filename still has to + // contain .tsx file extension + var FILENAME = (extra.ecmaFeatures.jsx) ? "eslint.tsx" : "eslint.ts"; var compilerHost = { fileExists: function() { diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index d6fc46c29692..2b57e0a9d924 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -43,12 +43,24 @@ var assert = require("chai").assert, var FIXTURES_DIR = "./tests/fixtures/ecma-features"; // var FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix"; +var filesWithOutsandingTSIssues = [ + "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 + "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 + "jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411 + "jsx/test-content", // https://github.com/Microsoft/TypeScript/issues/7471 + "jsx/multiple-blank-spaces" +]; + var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { return filename.indexOf(".src.js") > -1; +}).filter(function(filename) { + return filesWithOutsandingTSIssues.every(function(fileName) { + return filename.indexOf(fileName) === -1; + }); }).map(function(filename) { return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" }).filter(function(filename) { - return !(/jsx|error\-|invalid\-|globalReturn|experimental|newTarget/.test(filename)); + return !(/error\-|invalid\-|globalReturn|experimental|newTarget/.test(filename)); }); // var moduleTestFiles = testFiles.filter(function(filename) { From b79f7d330b7a06b0271bddeb41cae22511e1cd51 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 18 Mar 2016 10:32:23 -0700 Subject: [PATCH 021/326] Docs: Autogenerated changelog for 0.1.0-alpha.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index cfa7457a6503..21d4baa7e62a 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,10 @@ +v0.1.0-alpha.1 - March 18, 2016 + +* 0eddb71 New: Implements JSX syntax (fixes #18) (James Henry) +* e890743 Docs: PR validation check (Nicholas C. Zakas) +* c314f77 Build: Don't test Node 0.10 (Nicholas C. Zakas) +* bc05e1a Fix: Ensure true, false and null values are not stringifed (fixes #1) (James Henry) + v0.1.0-alpha.0 - March 4, 2016 * c05b5da Build: Add release tool (Nicholas C. Zakas) From 6fd0780495bfa4a20502e31c28b90eb25314b938 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 18 Mar 2016 10:32:25 -0700 Subject: [PATCH 022/326] 0.1.0-alpha.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 05b698fcd9c9..061daefdeecc 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/espree", "main": "parser.js", - "version": "0.1.0-alpha.0", + "version": "0.1.0-alpha.1", "files": [ "lib", "parser.js" From fa10dee3f30a5dab1bcc2c10a7f02a722cebee6a Mon Sep 17 00:00:00 2001 From: "Tom X. Tobin" Date: Mon, 21 Mar 2016 15:48:05 -0400 Subject: [PATCH 023/326] Fix: Remove console logging of node.kind (fixes #29) This was probably left behind during development as per discussion in issue #29. --- packages/typescript-eslint-parser/lib/ast-converter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 1ba15b9f50c1..5b59ff65c6f5 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1552,7 +1552,6 @@ module.exports = function(ast, extra) { return convert(node.expression, parent); default: - console.log("unsupported node.kind:", node.kind); result = null; } From 43f22676f4c643543315ac9f09c55da327774b95 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Tue, 19 Apr 2016 11:24:29 -0700 Subject: [PATCH 024/326] Chore: Add jQuery Foundation copyright --- packages/typescript-eslint-parser/LICENSE | 3 +++ packages/typescript-eslint-parser/Makefile.js | 2 ++ .../lib/ast-converter.js | 23 ++---------------- .../lib/ast-node-types.js | 24 ++----------------- .../lib/comment-attachment.js | 24 ++----------------- .../typescript-eslint-parser/lib/features.js | 24 ++----------------- .../lib/token-translator.js | 23 ++---------------- packages/typescript-eslint-parser/parser.js | 24 +++---------------- .../templates/pr-create.md.ejs | 7 +----- .../tests/lib/ecma-features.js | 23 ++---------------- .../tests/lib/parse.js | 23 ++---------------- 11 files changed, 23 insertions(+), 177 deletions(-) diff --git a/packages/typescript-eslint-parser/LICENSE b/packages/typescript-eslint-parser/LICENSE index 3e580c355a96..c363e906788d 100644 --- a/packages/typescript-eslint-parser/LICENSE +++ b/packages/typescript-eslint-parser/LICENSE @@ -1,3 +1,6 @@ +TypeScript ESLint Parser +Copyright jQuery Foundation and other contributors, https://jquery.org/ + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index c089ae4ccb92..b6cf36d65405 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -1,6 +1,8 @@ /** * @fileoverview Build file * @author nzakas + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ /* global cat, cp, echo, exec, exit, find, mkdir, mv, rm, target, test */ diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 5b59ff65c6f5..ba2b3849a768 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1,27 +1,8 @@ /** * @fileoverview Converts TypeScript AST into ESTree format. * @author Nicholas C. Zakas - * @copyright 2015 Fred K. Schott. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ "use strict"; diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index ec9eaa1fbe37..7832c22a2c4d 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -1,28 +1,8 @@ /** * @fileoverview The AST node types produced by the parser. * @author Nicholas C. Zakas - * @copyright 2014 Nicholas C. Zakas. All rights reserved. - * @copyright 2011-2013 Ariya Hidayat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ "use strict"; diff --git a/packages/typescript-eslint-parser/lib/comment-attachment.js b/packages/typescript-eslint-parser/lib/comment-attachment.js index b0f033dceac1..eebf4883703c 100644 --- a/packages/typescript-eslint-parser/lib/comment-attachment.js +++ b/packages/typescript-eslint-parser/lib/comment-attachment.js @@ -1,28 +1,8 @@ /** * @fileoverview Attaches comments to the AST. * @author Nicholas C. Zakas - * @copyright 2015 Nicholas C. Zakas. All rights reserved. - * @copyright 2011-2013 Ariya Hidayat - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ "use strict"; diff --git a/packages/typescript-eslint-parser/lib/features.js b/packages/typescript-eslint-parser/lib/features.js index 850d675b5398..2a94e13adbe1 100644 --- a/packages/typescript-eslint-parser/lib/features.js +++ b/packages/typescript-eslint-parser/lib/features.js @@ -2,28 +2,8 @@ * @fileoverview The list of feature flags supported by the parser and their default * settings. * @author Nicholas C. Zakas - * @copyright 2015 Fred K. Schott. All rights reserved. - * @copyright 2014 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ "use strict"; diff --git a/packages/typescript-eslint-parser/lib/token-translator.js b/packages/typescript-eslint-parser/lib/token-translator.js index ae7aed153c88..a38d29f32888 100644 --- a/packages/typescript-eslint-parser/lib/token-translator.js +++ b/packages/typescript-eslint-parser/lib/token-translator.js @@ -1,27 +1,8 @@ /** * @fileoverview Translates tokens between Acorn format and Esprima format. * @author Nicholas C. Zakas - * @copyright 2015 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ /* eslint no-underscore-dangle: 0 */ diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 41fd2f4eece6..47907b1a827b 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -1,26 +1,8 @@ /** * @fileoverview Parser that converts TypeScript into ESTree format. - * Copyright 2015 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @author Nicholas C. Zakas + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ /* eslint no-undefined:0, no-use-before-define: 0 */ diff --git a/packages/typescript-eslint-parser/templates/pr-create.md.ejs b/packages/typescript-eslint-parser/templates/pr-create.md.ejs index 54d8fa7597e5..de9295b93f82 100644 --- a/packages/typescript-eslint-parser/templates/pr-create.md.ejs +++ b/packages/typescript-eslint-parser/templates/pr-create.md.ejs @@ -1,6 +1,6 @@ <% -var FLAG_PATTERN = /^(Fix|Update|New|Breaking|Build|Docs|Upgrade):/, +var FLAG_PATTERN = /^(Fix|Update|New|Breaking|Build|Docs|Upgrade|Chore):/, ISSUE_REF_PATTERN = /\((fixes|refs) #\d+.*?\)$/; function isValidCommitFlag(log) { @@ -35,11 +35,6 @@ if (payload.commits > 1) { } } -// Check for CLA signature -if (!meta.cla) { - problems.push("Please sign our [CLA](http://eslint.org/cla). This is just a way for you to say that you give us permission to use your contribution.") -} - if (problems.length) { %> Thanks for the pull request, @<%= payload.sender.login %>! I took a look to make sure it's ready for merging and found some changes are needed: diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 2b57e0a9d924..45ec04d07bcd 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -1,27 +1,8 @@ /** * @fileoverview Tests for ECMA feature flags * @author Nicholas C. Zakas - * @copyright 2014 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ "use strict"; diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index 4c9f793b9df5..faf9c4252141 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -1,27 +1,8 @@ /** * @fileoverview Tests for tokenize(). * @author Nicholas C. Zakas - * @copyright 2014 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ "use strict"; From 0c436abd8d1b5365159c4d4b69c0651785073d66 Mon Sep 17 00:00:00 2001 From: Dean Taub Date: Thu, 28 Apr 2016 12:29:34 -0400 Subject: [PATCH 025/326] Docs: Update README to have the correct phase order. (#35) --- packages/typescript-eslint-parser/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index dac3c2d0a0dd..2c95822d2ff6 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -36,9 +36,9 @@ TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. ## Development Plan * **Phase 1:** Full ES6 support, stripping out all TypeScript-specific syntax. -* **Phase 2:** Add support for attaching comments. -* **Phase 3:** Add JSX support. -* **Phase 4:** Add support for top-level TypeScript syntax. -* **Phase 5:** Add support for types. +* **Phase 2:** Add JSX support. +* **Phase 3:** Add support for attaching comments. +* **Phase 4:** Add support for types. +* **Phase 5:** Add support for top-level TypeScript syntax. The high-level goal is to have output that matches Espree v3.x. From 35a363506c282eecd8c3e1989160dd244bebe9b6 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 7 Jul 2016 19:24:25 -0700 Subject: [PATCH 026/326] New: Automatically generate TS-specific nodes (#40) * New: Automatically generate TS-specific nodes (fixes #41) * Fix no use before define, changed typescript src files to .ts for better development experience (#42) --- packages/typescript-eslint-parser/README.md | 22 +- .../lib/ast-converter.js | 64 ++- .../basics/function-with-types.result.js | 420 ++++++++++++++++++ .../basics/function-with-types.src.ts | 3 + .../typescript/basics/var-with-type.result.js | 257 +++++++++++ .../typescript/basics/var-with-type.src.ts | 1 + .../tests/lib/typescript.js | 88 ++++ 7 files changed, 844 insertions(+), 11 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts create mode 100644 packages/typescript-eslint-parser/tests/lib/typescript.js diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 2c95822d2ff6..7c17dc599992 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -1,6 +1,6 @@ # TypeScript ESLint Parser (Experimental) -An parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint. +A parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint. The goal is to allow TypeScript files to be parsed by ESLint (though not necessarily pass all ESLint rules). **Important:** This parser is still in the very early stages and is considered experimental. There are likely a lot of bugs. You should not rely on this in a production environment yet. @@ -22,23 +22,25 @@ And in your ESLint configuration file: If you're familiar with TypeScript and ESLint, and you'd like to see this project progress, please consider contributing. We need people with a good knowledge of TypeScript to ensure this parser is useful. +## Reporting Bugs + +**Do not** file bugs about ESLint rule failures. This is expected because ESLint doesn't know anything about TypeScript syntax. It's likely that many ESLint rules will have failures as a result. Longer-term, it's likely we'll need to create a custom set of ESLint rules that are TypeScript-specific. + +Bugs should be filed for: + +1. TypeScript syntax that fails to parse. +1. TypeScript syntax that produces an unexpected AST. + ## Contributing Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/typescript-eslint-parser/issues). -TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. - ## Build Commands * `npm test` - run all linting and tests * `npm run lint` - run all linting -## Development Plan +## License -* **Phase 1:** Full ES6 support, stripping out all TypeScript-specific syntax. -* **Phase 2:** Add JSX support. -* **Phase 3:** Add support for attaching comments. -* **Phase 4:** Add support for types. -* **Phase 5:** Add support for top-level TypeScript syntax. +TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. -The high-level goal is to have output that matches Espree v3.x. diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index ba2b3849a768..4d28c68d806b 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -431,6 +431,47 @@ module.exports = function(ast, extra) { return convert(child, node); } + /** + * Converts a child into a type annotation. This creates an intermediary + * TypeAnnotation node to match what Flow does. + * @param {TSNode} child The TypeScript AST node to convert. + * @returns {ESTreeNode} The type annotation node. + */ + function convertTypeAnnotation(child) { + var annotation = convertChild(child); + return { + type: "TypeAnnotation", + loc: annotation.loc, + range: annotation.range, + typeAnnotation: annotation + }; + } + + /** + * For nodes that are copied directly from the TypeScript AST into + * ESTree mostly as-is. The only difference is the addition of a type + * property instead of a kind property. Recursively copies all children. + * @returns {void} + */ + function deeplyCopy() { + result.type = "TS" + SyntaxKind[node.kind]; + Object.keys(node).filter(function(key) { + return !(/^(?:kind|parent|pos|end)$/.test(key)); + }).forEach(function(key) { + if (key === "type") { + result.typeAnnotation = convertTypeAnnotation(node.type); + } else { + if (Array.isArray(node[key])) { + result[key] = node[key].map(convertChild); + } else if (node[key] && typeof node[key] === "object") { + result[key] = convertChild(node[key]); + } else { + result[key] = node[key]; + } + } + }); + } + /** * Converts a TypeScript JSX node.tagName into an ESTree node.name * @param {Object} tagName the tagName object from a JSX TSNode @@ -636,6 +677,10 @@ module.exports = function(ast, extra) { body: convertChild(node.body) }); + if (node.type) { + result.returnType = convertTypeAnnotation(node.type); + } + // check for exports result = fixExports(node, result, ast); @@ -647,6 +692,10 @@ module.exports = function(ast, extra) { id: convertChild(node.name), init: convertChild(node.initializer) }); + + if (node.type) { + result.id.typeAnnotation = convertTypeAnnotation(node.type); + } break; case SyntaxKind.VariableStatement: @@ -821,6 +870,10 @@ module.exports = function(ast, extra) { } }; + if (node.type) { + method.returnType = convertTypeAnnotation(node.type); + } + if (parent.kind === SyntaxKind.ObjectLiteralExpression) { assign(result, { type: "Property", @@ -936,6 +989,10 @@ module.exports = function(ast, extra) { body: convertChild(node.body), expression: false }); + + if (node.type) { + result.returnType = convertTypeAnnotation(node.type); + } break; case SyntaxKind.SuperKeyword: @@ -1010,6 +1067,11 @@ module.exports = function(ast, extra) { body: convertChild(node.body), expression: node.body.kind !== SyntaxKind.Block }); + + if (node.type) { + result.returnType = convertTypeAnnotation(node.type); + } + break; case SyntaxKind.YieldExpression: @@ -1533,7 +1595,7 @@ module.exports = function(ast, extra) { return convert(node.expression, parent); default: - result = null; + deeplyCopy(); } return result; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js new file mode 100644 index 000000000000..93e98ed57f30 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js @@ -0,0 +1,420 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 9, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "name": "message" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "name": "name" + } + ], + "body": { + "type": "BlockStatement", + "range": [ + 37, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 43, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "argument": { + "type": "Identifier", + "range": [ + 50, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "name": "name" + } + } + ] + }, + "returnType": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 30, + 36 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "flags": 0 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 9, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 43, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 50, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.src.ts new file mode 100644 index 000000000000..57eb3a476d15 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.src.ts @@ -0,0 +1,3 @@ +function message(name:string):string { + return name; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js new file mode 100644 index 000000000000..54aad1b90300 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js @@ -0,0 +1,257 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 4, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "name", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 9, + 15 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "flags": 0 + } + } + }, + "init": { + "type": "Literal", + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "value": "Nicholas", + "raw": "\"Nicholas\"" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 4, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 9, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "String", + "value": "\"Nicholas\"", + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts new file mode 100644 index 000000000000..c27e19d3cc07 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts @@ -0,0 +1 @@ +var name:string = "Nicholas"; diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js new file mode 100644 index 000000000000..a98afb226d88 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -0,0 +1,88 @@ +/** + * @fileoverview Tests for ECMA feature flags + * @author Nicholas C. Zakas + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var assert = require("chai").assert, + leche = require("leche"), + path = require("path"), + parser = require("../../parser"), + shelljs = require("shelljs"); + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +var FIXTURES_DIR = "./tests/fixtures/typescript"; + +var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { + return filename.indexOf(".src.ts") > -1; +}).map(function(filename) { + return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.ts" +}); + +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("typescript", function() { + + var config; + + beforeEach(function() { + config = { + loc: true, + range: true, + tokens: true, + ecmaFeatures: {} + }; + }); + + leche.withData(testFiles, function(filename) { + // Uncomment and fill in filename to focus on a single file + // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; + var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.ts"); + + it("should parse correctly", function() { + var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); + var result; + + try { + result = parser.parse(code, config); + result = getRaw(result); + } catch (ex) { + + // format of error isn't exactly the same, just check if it's expected + if (expected.message) { + return; + } else { + throw ex; + } + + } + // console.log(JSON.stringify(result, null, 4)); + assert.deepEqual(result, expected); + + }); + + }); + + +}); From 0ecf2964d94b6543304f2c9ffe9729c9fd03d1fd Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Fri, 8 Jul 2016 11:14:53 -0700 Subject: [PATCH 027/326] Build: Add linting to npm test --- packages/typescript-eslint-parser/Makefile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index b6cf36d65405..bf04bc55044c 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -156,7 +156,7 @@ target.lint = function() { }; target.test = function() { - // target.lint(); + target.lint(); var errors = 0, lastReturn; From 229bc3b12d0bf0428cbec0b1500086ee67a2d581 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Sat, 9 Jul 2016 09:21:32 -0700 Subject: [PATCH 028/326] Fix: Class implements conversion (fixes #39) (#43) --- .../lib/ast-converter.js | 33 ++- .../class-accessor-properties.result.js | 3 +- .../class-computed-static-method.result.js | 3 +- .../classes/class-expression.result.js | 3 +- .../class-method-named-prototype.result.js | 3 +- .../class-method-named-static.result.js | 3 +- .../classes/class-one-method-super.result.js | 3 +- .../classes/class-one-method.result.js | 3 +- ...ss-static-method-named-prototype.result.js | 3 +- ...class-static-method-named-static.result.js | 3 +- .../classes/class-static-method.result.js | 3 +- ...-methods-and-accessor-properties.result.js | 3 +- ...lass-two-computed-static-methods.result.js | 3 +- ...two-methods-computed-constructor.result.js | 3 +- .../classes/class-two-methods-semi.result.js | 3 +- .../class-two-methods-three-semi.result.js | 3 +- .../class-two-methods-two-semi.result.js | 3 +- .../classes/class-two-methods.result.js | 3 +- ...static-methods-named-constructor.result.js | 3 +- .../classes/class-with-constructor.result.js | 3 +- .../derived-class-assign-to-var.result.js | 3 +- .../derived-class-expression.result.js | 3 +- .../classes/empty-class-double-semi.result.js | 3 +- .../classes/empty-class-semi.result.js | 3 +- .../classes/empty-class.result.js | 3 +- .../empty-literal-derived-class.result.js | 3 +- .../classes/named-class-expression.result.js | 3 +- .../named-derived-class-expression.result.js | 3 +- .../basics/class-with-implements.result.js | 221 ++++++++++++++++++ .../basics/class-with-implements.src.ts | 3 + .../basics/function-with-types.result.js | 2 +- .../typescript/basics/var-with-type.result.js | 2 +- .../tools/update-typescript-tests.js | 82 +++++++ 33 files changed, 392 insertions(+), 32 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.src.ts create mode 100644 packages/typescript-eslint-parser/tools/update-typescript-tests.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 4d28c68d806b..758493fc170c 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -447,6 +447,22 @@ module.exports = function(ast, extra) { }; } + /** + * Converts a child into a class implements node. This creates an intermediary + * ClassImplements node to match what Flow does. + * @param {TSNode} child The TypeScript AST node to convert. + * @returns {ESTreeNode} The type annotation node. + */ + function convertClassImplements(child) { + var id = convertChild(child.expression); + return { + type: "ClassImplements", + loc: id.loc, + range: id.range, + id: id + }; + } + /** * For nodes that are copied directly from the TypeScript AST into * ESTree mostly as-is. The only difference is the addition of a type @@ -1171,12 +1187,22 @@ module.exports = function(ast, extra) { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: - var lastClassToken = node.heritageClauses ? node.heritageClauses[node.heritageClauses.length - 1] : node.name; + var heritageClauses = node.heritageClauses || []; + var lastClassToken = heritageClauses.length ? heritageClauses[heritageClauses.length - 1] : node.name; if (!lastClassToken) { // no name lastClassToken = node.getFirstToken(); } - var openBrace = ts.findNextToken(lastClassToken, ast); + var openBrace = ts.findNextToken(lastClassToken, ast), + hasExtends = (heritageClauses.length && node.heritageClauses[0].token === SyntaxKind.ExtendsKeyword), + superClass, + hasImplements = false; + + if (hasExtends) { + superClass = heritageClauses.shift(); + } + + hasImplements = heritageClauses.length > 0; assign(result, { type: SyntaxKind[node.kind], @@ -1189,7 +1215,8 @@ module.exports = function(ast, extra) { range: [ openBrace.getStart(), result.range[1] ], loc: getLocFor(openBrace.getStart(), node.end, ast) }, - superClass: (node.heritageClauses ? convertChild(node.heritageClauses[0].types[0].expression) : null) + superClass: (superClass ? convertChild(superClass.types[0].expression) : null), + implements: hasImplements ? heritageClauses[0].types.map(convertClassImplements) : [] }); var filteredMembers = node.members.filter(isESTreeClassMember); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js index 3898fc4279fe..b607f3b0b80b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -606,4 +607,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js index c5bef576c882..ac3cf9a48253 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -420,4 +421,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js index cd76eedc6f92..d65bb7ba37cc 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js @@ -49,6 +49,7 @@ module.exports = { ], "id": null, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -181,4 +182,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js index b2c670a25bf0..1abfdcb70968 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -348,4 +349,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js index 44dae390a7dc..d0f8e1a17c20 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -366,4 +367,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js index cedacd90f617..245ba91e4ef9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -473,4 +474,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js index 8da6753786e9..12380f6b1b60 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -348,4 +349,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js index 4d12287e78c0..f8d53e4f33f3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -403,4 +404,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js index a3a091f95c18..75491db14174 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -384,4 +385,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js index b632292bdc16..d4bfefd7c6da 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -384,4 +385,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js index 695061fde4d4..e321241b5286 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -809,4 +810,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js index a211ad003f94..51cc0a6b667c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -641,4 +642,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js index 23254af70614..6d5ce4e98dc4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -553,4 +554,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js index 0760b4db2eed..d0a2c12666b1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -533,4 +534,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js index 1015e28f28fa..76e07a56fb76 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -569,4 +570,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js index e41ba85718bf..01735f7633ed 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -551,4 +552,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js index d977942316ea..2ea4519ce572 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -515,4 +516,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js index 3c6cd8060493..ec98ea0fa5c5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -551,4 +552,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js index d07c97385724..6270efa90138 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -348,4 +349,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js index 1d4702683ab0..5b3dc08ecaa0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js @@ -119,6 +119,7 @@ module.exports = { "value": 0, "raw": "0" }, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -326,4 +327,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js index 1a3068b64d44..43e7900754ec 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js @@ -67,6 +67,7 @@ module.exports = { "value": 0, "raw": "0" }, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -235,4 +236,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js index f0bc32e953c4..f50bdd99346e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -180,4 +181,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js index 319c6f97856c..62766a123fab 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -198,4 +199,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js index f0bc32e953c4..f50bdd99346e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js @@ -50,6 +50,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -180,4 +181,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js index 53facc1e96f2..4a181957af4f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js @@ -68,6 +68,7 @@ module.exports = { "value": 0, "raw": "0" }, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -234,4 +235,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js index e12b248af8e4..f9b682bf9462 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js @@ -66,6 +66,7 @@ module.exports = { "name": "A" }, "superClass": null, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -216,4 +217,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js index 5d1d55a04d3f..90666bb273b2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js @@ -84,6 +84,7 @@ module.exports = { "value": 0, "raw": "0" }, + "implements": [], "body": { "type": "ClassBody", "loc": { @@ -270,4 +271,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js new file mode 100644 index 000000000000..576cfc6fa817 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js @@ -0,0 +1,221 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 25, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 21, + 24 + ], + "id": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "Bar" + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "implements", + "range": [ + 10, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.src.ts new file mode 100644 index 000000000000..321a2ea746ae --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.src.ts @@ -0,0 +1,3 @@ +class Foo implements Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js index 93e98ed57f30..44c318f6dc3e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js @@ -417,4 +417,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js index 54aad1b90300..34cb41799609 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js @@ -254,4 +254,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tools/update-typescript-tests.js b/packages/typescript-eslint-parser/tools/update-typescript-tests.js new file mode 100644 index 000000000000..618002a9cf39 --- /dev/null +++ b/packages/typescript-eslint-parser/tools/update-typescript-tests.js @@ -0,0 +1,82 @@ +/** + * @fileoverview A simple script to update existing tests to reflect new + * parser changes. + * @author Nicholas C. Zakas + +"use strict"; + +/* + * Usage: + * node tools/update-typescript-tests.js + * + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var shelljs = require("shelljs"), + parser = require("../parser"), + path = require("path"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + + +function getExpectedResult(code, config) { + try { + return getRaw(parser.parse(code, config)); + } catch (ex) { + var raw = getRaw(ex); + raw.message = ex.message; + return raw; + } +} + +function getTestFilenames(directory) { + return shelljs.find(directory).filter(function(filename) { + return filename.indexOf(".src.ts") > -1; + }).map(function(filename) { + return filename.substring(directory.length - 1, filename.length - 7); // strip off ".src.ts" + }); +} + +function outputResult(result, testResultFilename) { + ("module.exports = " + JSON.stringify(result, null, " ") + ";").to(testResultFilename); +} + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +var FIXTURES_DIR = "./tests/fixtures/typescript"; + +var testFiles = getTestFilenames(FIXTURES_DIR); + + +// update all tests in ecma-features +testFiles.forEach(function(filename) { + + var feature = path.dirname(filename), + code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.ts"), + config = { + loc: true, + range: true, + tokens: true + }; + + var testResultFilename = path.resolve(__dirname, "..", FIXTURES_DIR, filename) + ".result.js"; + var result = getExpectedResult(code, config); + + outputResult(result, testResultFilename); +}); From 713792af584d4992e1b783921947ac8c2295443d Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 28 Jul 2016 16:35:20 +0100 Subject: [PATCH 029/326] New: Attaches comments to the ESTree AST (fixes #31) (#49) --- .../lib/ast-converter.js | 38 +- .../lib/comment-attachment.js | 163 ---- packages/typescript-eslint-parser/parser.js | 103 ++- .../block-trailing-comment.result.js | 22 +- .../comment-within-condition.result.js | 44 +- .../export-default-anonymous-class.result.js | 711 +++++++++--------- .../mix-line-and-block-comments.result.js | 106 +-- .../surrounding-call-comments.result.js | 42 +- .../surrounding-debugger-comments.result.js | 40 - .../surrounding-return-comments.result.js | 42 +- .../surrounding-throw-comments.result.js | 42 +- .../surrounding-while-loop-comments.result.js | 72 +- ...-fallthrough-comment-in-function.result.js | 64 +- .../switch-fallthrough-comment.result.js | 64 +- ...h-no-default-comment-in-function.result.js | 22 +- ...ault-comment-in-nested-functions.result.js | 46 +- .../switch-no-default-comment.result.js | 22 +- .../tests/lib/attach-comments.js | 104 +++ 18 files changed, 577 insertions(+), 1170 deletions(-) delete mode 100644 packages/typescript-eslint-parser/lib/comment-attachment.js create mode 100644 packages/typescript-eslint-parser/tests/lib/attach-comments.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 758493fc170c..eb492daee47f 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -20,7 +20,6 @@ var ts = require("typescript"), //------------------------------------------------------------------------------ var SyntaxKind = ts.SyntaxKind; -// var TokenClass = ts.TokenClass; var ASSIGNMENT_OPERATORS = [ SyntaxKind.EqualsToken, @@ -268,6 +267,8 @@ function getTokenType(token) { case SyntaxKind.GetKeyword: case SyntaxKind.SetKeyword: + case SyntaxKind.TypeKeyword: + case SyntaxKind.ModuleKeyword: return "Identifier"; default: @@ -276,6 +277,10 @@ function getTokenType(token) { } if (token.kind >= SyntaxKind.FirstKeyword && token.kind <= SyntaxKind.LastFutureReservedWord) { + if (token.kind === SyntaxKind.FalseKeyword || token.kind === SyntaxKind.TrueKeyword) { + return "Boolean"; + } + return "Keyword"; } @@ -1189,12 +1194,19 @@ module.exports = function(ast, extra) { case SyntaxKind.ClassExpression: var heritageClauses = node.heritageClauses || []; var lastClassToken = heritageClauses.length ? heritageClauses[heritageClauses.length - 1] : node.name; - if (!lastClassToken) { // no name + /** + * We need check for modifiers, and use the last one, as there + * could be multiple before the open brace + */ + if (node.modifiers && node.modifiers.length) { + var lastModifier = node.modifiers[node.modifiers.length - 1]; + lastClassToken = ts.findNextToken(lastModifier, ast); + } else if (!lastClassToken) { // no name lastClassToken = node.getFirstToken(); } - var openBrace = ts.findNextToken(lastClassToken, ast), - hasExtends = (heritageClauses.length && node.heritageClauses[0].token === SyntaxKind.ExtendsKeyword), + var openBrace = ts.findNextToken(lastClassToken, ast); + var hasExtends = (heritageClauses.length && node.heritageClauses[0].token === SyntaxKind.ExtendsKeyword), superClass, hasImplements = false; @@ -1474,21 +1486,24 @@ module.exports = function(ast, extra) { case SyntaxKind.TrueKeyword: assign(result, { type: "Literal", - value: true + value: true, + raw: "true" }); break; case SyntaxKind.FalseKeyword: assign(result, { type: "Literal", - value: false + value: false, + raw: "false" }); break; case SyntaxKind.NullKeyword: assign(result, { type: "Literal", - value: null + value: null, + raw: "null" }); break; @@ -1628,16 +1643,19 @@ module.exports = function(ast, extra) { return result; } - - var estree = convert(ast); if (extra.tokens) { estree.tokens = convertTokens(ast); } + /** + * Add the comment nodes to the AST (that were parsed separately in parser.js) + * TODO: Track the progress of https://github.com/eslint/eslint/issues/6724 + * regarding ESLint itself becoming responsible for attributing comment nodes + */ if (extra.comment || extra.attachComment) { - estree.comments = []; + estree.comments = extra.comments || []; } return estree; diff --git a/packages/typescript-eslint-parser/lib/comment-attachment.js b/packages/typescript-eslint-parser/lib/comment-attachment.js deleted file mode 100644 index eebf4883703c..000000000000 --- a/packages/typescript-eslint-parser/lib/comment-attachment.js +++ /dev/null @@ -1,163 +0,0 @@ -/** - * @fileoverview Attaches comments to the AST. - * @author Nicholas C. Zakas - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -var astNodeTypes = require("./ast-node-types"); - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -var extra = { - trailingComments: [], - leadingComments: [], - bottomRightStack: [] -}; - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -module.exports = { - - reset: function() { - extra.trailingComments = []; - extra.leadingComments = []; - extra.bottomRightStack = []; - }, - - addComment: function(comment) { - extra.trailingComments.push(comment); - extra.leadingComments.push(comment); - }, - - processComment: function(node) { - var lastChild, - trailingComments, - i; - - if (node.type === astNodeTypes.Program) { - if (node.body.length > 0) { - return; - } - } - - if (extra.trailingComments.length > 0) { - - /* - * If the first comment in trailingComments comes after the - * current node, then we're good - all comments in the array will - * come after the node and so it's safe to add then as official - * trailingComments. - */ - if (extra.trailingComments[0].range[0] >= node.range[1]) { - trailingComments = extra.trailingComments; - extra.trailingComments = []; - } else { - - /* - * Otherwise, if the first comment doesn't come after the - * current node, that means we have a mix of leading and trailing - * comments in the array and that leadingComments contains the - * same items as trailingComments. Reset trailingComments to - * zero items and we'll handle this by evaluating leadingComments - * later. - */ - extra.trailingComments.length = 0; - } - } else { - if (extra.bottomRightStack.length > 0 && - extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments && - extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments[0].range[0] >= node.range[1]) { - trailingComments = extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments; - delete extra.bottomRightStack[extra.bottomRightStack.length - 1].trailingComments; - } - } - - // Eating the stack. - while (extra.bottomRightStack.length > 0 && extra.bottomRightStack[extra.bottomRightStack.length - 1].range[0] >= node.range[0]) { - lastChild = extra.bottomRightStack.pop(); - } - - if (lastChild) { - if (lastChild.leadingComments) { - if (lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) { - node.leadingComments = lastChild.leadingComments; - delete lastChild.leadingComments; - } else { - // A leading comment for an anonymous class had been stolen by its first MethodDefinition, - // so this takes back the leading comment. - // See Also: https://github.com/eslint/espree/issues/158 - for (i = lastChild.leadingComments.length - 2; i >= 0; --i) { - if (lastChild.leadingComments[i].range[1] <= node.range[0]) { - node.leadingComments = lastChild.leadingComments.splice(0, i + 1); - break; - } - } - } - } - } else if (extra.leadingComments.length > 0) { - - if (extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) { - node.leadingComments = extra.leadingComments; - extra.leadingComments = []; - } else { - - // https://github.com/eslint/espree/issues/2 - - /* - * In special cases, such as return (without a value) and - * debugger, all comments will end up as leadingComments and - * will otherwise be eliminated. This extra step runs when the - * bottomRightStack is empty and there are comments left - * in leadingComments. - * - * This loop figures out the stopping point between the actual - * leading and trailing comments by finding the location of the - * first comment that comes after the given node. - */ - for (i = 0; i < extra.leadingComments.length; i++) { - if (extra.leadingComments[i].range[1] > node.range[0]) { - break; - } - } - - /* - * Split the array based on the location of the first comment - * that comes after the node. Keep in mind that this could - * result in an empty array, and if so, the array must be - * deleted. - */ - node.leadingComments = extra.leadingComments.slice(0, i); - if (node.leadingComments.length === 0) { - delete node.leadingComments; - } - - /* - * Similarly, trailing comments are attached later. The variable - * must be reset to null if there are no trailing comments. - */ - trailingComments = extra.leadingComments.slice(i); - if (trailingComments.length === 0) { - trailingComments = null; - } - } - } - - if (trailingComments) { - node.trailingComments = trailingComments; - } - - extra.bottomRightStack.push(node); - } - -}; diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 47907b1a827b..8fc167226e28 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -9,13 +9,9 @@ "use strict"; var astNodeTypes = require("./lib/ast-node-types"), - commentAttachment = require("./lib/comment-attachment"), - // TokenTranslator = require("./lib/token-translator"), ts = require("typescript"); -// var lookahead; var extra; -// var lastToken; /** * Resets the extra config object @@ -35,7 +31,60 @@ function resetExtra() { }; } +/** + * Converts a TypeScript comment to an Esprima comment. + * @param {boolean} block True if it's a block comment, false if not. + * @param {string} text The text of the comment. + * @param {int} start The index at which the comment starts. + * @param {int} end The index at which the comment ends. + * @param {Location} startLoc The location at which the comment starts. + * @param {Location} endLoc The location at which the comment ends. + * @returns {Object} The comment object. + * @private + */ +function convertTypeScriptCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { + var comment = { + type: block ? "Block" : "Line", + value: text + }; + + if (typeof start === "number") { + comment.range = [start, end]; + } + + if (typeof startLoc === "object") { + comment.loc = { + start: startLoc, + end: endLoc + }; + } + + return comment; +} +/** + * Returns line and column data for the given start and end positions, + * for the given AST + * @param {Object} start start data + * @param {Object} end end data + * @param {Object} ast the AST object + * @returns {Object} the loc data + */ +function getLocFor(start, end, ast) { + var startLoc = ast.getLineAndCharacterOfPosition(start), + endLoc = ast.getLineAndCharacterOfPosition(end); + + return { + start: { + line: startLoc.line + 1, + column: startLoc.character + }, + end: { + line: endLoc.line + 1, + column: endLoc.character + } + }; +} //------------------------------------------------------------------------------ // Parser @@ -51,17 +100,12 @@ function parse(code, options) { var program, toString = String; - // var acornOptions = { - // ecmaVersion: 5 - // }; - // var translator; if (typeof code !== "string" && !(code instanceof String)) { code = toString(code); } resetExtra(); - commentAttachment.reset(); if (typeof options !== "undefined") { extra.range = (typeof options.range === "boolean") && options.range; @@ -74,7 +118,6 @@ function parse(code, options) { if (typeof options.tokens === "boolean" && options.tokens) { extra.tokens = []; - // translator = new TokenTranslator(tt, code); } if (typeof options.comment === "boolean" && options.comment) { extra.comment = true; @@ -86,7 +129,6 @@ function parse(code, options) { if (extra.attachComment) { extra.range = true; extra.comments = []; - commentAttachment.reset(); } if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { @@ -139,19 +181,42 @@ function parse(code, options) { var ast = program.getSourceFile(FILENAME); if (extra.attachComment || extra.comment) { - // acornOptions.onComment = function() { - // var comment = convertAcornCommentToEsprimaComment.apply(this, arguments); - // extra.comments.push(comment); - // - // if (extra.attachComment) { - // commentAttachment.addComment(comment); - // } - // }; + /** + * Create a TypeScript Scanner, with skipTrivia set to false so that + * we can parse the comments + */ + var triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); + + var kind = triviaScanner.scan(); + while (kind !== ts.SyntaxKind.EndOfFileToken) { + if (kind !== ts.SyntaxKind.SingleLineCommentTrivia && kind !== ts.SyntaxKind.MultiLineCommentTrivia) { + kind = triviaScanner.scan(); + continue; + } + + var isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + kind: triviaScanner.getToken() + }; + + var comment = code.substring(range.pos, range.end); + var text = comment.replace("//", "").replace("/*", "").replace("*/", ""); + var loc = getLocFor(range.pos, range.end, ast); + + var esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); + extra.comments.push(esprimaComment); + + kind = triviaScanner.scan(); + } + } } var convert = require("./lib/ast-converter"); + return convert(ast, extra); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js index 68b99c7693bc..dd318cf175a7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js @@ -83,27 +83,7 @@ module.exports = { "name": "a" }, "arguments": [] - }, - "trailingComments": [ - { - "type": "Line", - "value": "comment", - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - } - } - ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js index 8e81b74f819d..e4092de3ea36 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js @@ -47,27 +47,7 @@ module.exports = { 25, 26 ], - "name": "a", - "leadingComments": [ - { - "type": "Block", - "value": " bar ", - "range": [ - 14, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - } - } - ] + "name": "a" }, "consequent": { "type": "BlockStatement", @@ -87,27 +67,7 @@ module.exports = { ], "body": [] }, - "alternate": null, - "leadingComments": [ - { - "type": "Block", - "value": " foo ", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ] + "alternate": null } ], "sourceType": "script", diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js index 34b376b6f57f..0e4c7d9469c1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js @@ -1,412 +1,373 @@ module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "method1", - "range": [ - 103, - 110 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 11 - } - } - }, - "value": { - "type": "FunctionExpression", + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", "id": null, - "params": [], + "superClass": null, + "implements": [], "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 9, - "column": 5 + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "method1", + "range": [ + 103, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 112, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 110, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 103, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 9, + "column": 5 + } + }, + "static": false + } + ], + "range": [ + 57, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 10, + "column": 1 + } } - } }, - "generator": false, - "expression": false, "range": [ - 110, - 119 + 51, + 121 ], "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 9, - "column": 5 - } - } - }, - "kind": "method", - "computed": false, - "range": [ - 103, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 9, - "column": 5 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": "*\n * this is method1.\n ", - "range": [ - 63, - 98 - ], - "loc": { "start": { - "line": 5, - "column": 4 + "line": 4, + "column": 15 }, "end": { - "line": 7, - "column": 7 + "line": 10, + "column": 1 } - } } - ], - "static": false - } - ], - "range": [ - 57, - 121 - ], - "loc": { - "start": { - "line": 4, - "column": 21 }, - "end": { - "line": 10, - "column": 1 + "range": [ + 36, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } } - } - }, - "range": [ - 51, - 121 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 10, - "column": 1 - } } - }, - "range": [ + ], + "sourceType": "module", + "range": [ 36, 121 - ], - "loc": { + ], + "loc": { "start": { - "line": 4, - "column": 0 + "line": 4, + "column": 0 }, "end": { - "line": 10, - "column": 1 + "line": 10, + "column": 1 } - }, - "leadingComments": [ + }, + "comments": [ { - "type": "Block", - "value": "*\n * this is anonymous class.\n ", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 + "type": "Block", + "value": "*\n * this is anonymous class.\n ", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } } - } - } - ] - } - ], - "sourceType": "module", - "range": [ - 36, - 121 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, - "comments": [ - { - "type": "Block", - "value": "*\n * this is anonymous class.\n ", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 }, - "end": { - "line": 3, - "column": 3 - } - } - }, - { - "type": "Block", - "value": "*\n * this is method1.\n ", - "range": [ - 63, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 36, - 42 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 + { + "type": "Block", + "value": "*\n * this is method1.\n ", + "range": [ + 63, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + } } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 43, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 7 + ], + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 36, + 42 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } }, - "end": { - "line": 4, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 51, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 15 + { + "type": "Keyword", + "value": "default", + "range": [ + 43, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 21 + { + "type": "Keyword", + "value": "class", + "range": [ + 51, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 20 + } + } }, - "end": { - "line": 4, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "method1", - "range": [ - 103, - 110 - ], - "loc": { - "start": { - "line": 8, - "column": 4 + { + "type": "Punctuator", + "value": "{", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } }, - "end": { - "line": 8, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 8, - "column": 11 + { + "type": "Identifier", + "value": "method1", + "range": [ + 103, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 11 + } + } }, - "end": { - "line": 8, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 111, - 112 - ], - "loc": { - "start": { - "line": 8, - "column": 12 + { + "type": "Punctuator", + "value": "(", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 12 + } + } }, - "end": { - "line": 8, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 112, - 113 - ], - "loc": { - "start": { - "line": 8, - "column": 13 + { + "type": "Punctuator", + "value": ")", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 8, + "column": 12 + }, + "end": { + "line": 8, + "column": 13 + } + } }, - "end": { - "line": 8, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 118, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 4 + { + "type": "Punctuator", + "value": "{", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 14 + } + } }, - "end": { - "line": 9, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 120, - 121 - ], - "loc": { - "start": { - "line": 10, - "column": 0 + { + "type": "Punctuator", + "value": "}", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 5 + } + } }, - "end": { - "line": 10, - "column": 1 + { + "type": "Punctuator", + "value": "}", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } } - } - } - ] + ] }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js index 6024712eb5d8..c31fce20f8e8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js @@ -64,27 +64,7 @@ module.exports = { 10, 13 ], - "name": "zzz", - "trailingComments": [ - { - "type": "Block", - "value": "aaa", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 15 - } - } - } - ] + "name": "zzz" }, "init": { "type": "Literal", @@ -103,89 +83,11 @@ module.exports = { 27 ], "value": 777, - "raw": "777", - "leadingComments": [ - { - "type": "Line", - "value": "foo", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Block", - "value": "aaa", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 15 - } - } - } - ] + "raw": "777" } } ], - "kind": "var", - "leadingComments": [ - { - "type": "Line", - "value": "foo", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "trailingComments": [ - { - "type": "Line", - "value": "bar", - "range": [ - 29, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - } - } - ] + "kind": "var" } ], "sourceType": "script", @@ -337,4 +239,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js index 7b842d5cbaac..4190fdb329ee 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js @@ -118,47 +118,7 @@ module.exports = { "name": "foo" }, "arguments": [] - }, - "leadingComments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "trailingComments": [ - { - "type": "Block", - "value": " after ", - "range": [ - 47, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } - ] + } } ] }, diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js index 7aa523331587..ac5d5bb5610a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js @@ -82,46 +82,6 @@ module.exports = { "range": [ 36, 45 - ], - "leadingComments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "trailingComments": [ - { - "type": "Block", - "value": " after ", - "range": [ - 50, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } ] } ] diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js index c95b5cd54f38..40693bcb4f85 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js @@ -83,47 +83,7 @@ module.exports = { 36, 43 ], - "argument": null, - "leadingComments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "trailingComments": [ - { - "type": "Block", - "value": " after ", - "range": [ - 48, - 59 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } - ] + "argument": null } ] }, diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js index 77d7b49b159b..bdae3d173ba8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js @@ -101,47 +101,7 @@ module.exports = { ], "value": 55, "raw": "55" - }, - "leadingComments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "trailingComments": [ - { - "type": "Block", - "value": " after ", - "range": [ - 50, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } - ] + } } ] }, diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js index fe5017ec788d..58d134228eef 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js @@ -49,6 +49,8 @@ module.exports = { ], "name": "f" }, + "generator": false, + "expression": false, "params": [], "body": { "type": "BlockStatement", @@ -119,47 +121,7 @@ module.exports = { 46 ], "body": [] - }, - "leadingComments": [ - { - "type": "Block", - "value": " infinite ", - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "trailingComments": [ - { - "type": "Block", - "value": " bar ", - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } - } - ] + } }, { "type": "VariableDeclaration", @@ -215,32 +177,10 @@ module.exports = { "init": null } ], - "kind": "var", - "leadingComments": [ - { - "type": "Block", - "value": " bar ", - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } - } - ] + "kind": "var" } ] - }, - "expression": false, - "generator": false + } } ], "sourceType": "script", @@ -554,4 +494,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js index fb00392ee840..e11fe19ebd0b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js @@ -156,47 +156,7 @@ module.exports = { ], "value": 1, "raw": "1" - }, - "leadingComments": [ - { - "type": "Line", - "value": " foo", - "range": [ - 46, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } - } - ], - "trailingComments": [ - { - "type": "Line", - "value": " falls through", - "range": [ - 81, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 28 - } - } - } - ] + } }, { "type": "SwitchCase", @@ -287,27 +247,7 @@ module.exports = { ], "value": 2, "raw": "2" - }, - "leadingComments": [ - { - "type": "Line", - "value": " falls through", - "range": [ - 81, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 28 - } - } - } - ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js index 5441cb4ca32d..91c10191c188 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js @@ -85,47 +85,7 @@ module.exports = { ], "value": 1, "raw": "1" - }, - "leadingComments": [ - { - "type": "Line", - "value": " foo", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - } - ], - "trailingComments": [ - { - "type": "Line", - "value": " falls through", - "range": [ - 45, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - ] + } }, { "type": "SwitchCase", @@ -216,27 +176,7 @@ module.exports = { ], "value": 2, "raw": "2" - }, - "leadingComments": [ - { - "type": "Line", - "value": " falls through", - "range": [ - 45, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js index 416a8a21da7f..c0903c293cad 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js @@ -231,27 +231,7 @@ module.exports = { ], "value": 1, "raw": "1" - }, - "trailingComments": [ - { - "type": "Line", - "value": "no default", - "range": [ - 113, - 125 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 20 - } - } - } - ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js index 53ce0a5f8e36..48969fab6196 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js @@ -587,27 +587,7 @@ module.exports = { ], "value": "SequenceExpression", "raw": "\"SequenceExpression\"" - }, - "trailingComments": [ - { - "type": "Line", - "value": " no default", - "range": [ - 232, - 245 - ], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 25 - } - } - } - ] + } } ] }, @@ -645,27 +625,7 @@ module.exports = { ], "value": false, "raw": "false" - }, - "leadingComments": [ - { - "type": "Line", - "value": " no default", - "range": [ - 232, - 245 - ], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 25 - } - } - } - ] + } } ] }, @@ -1585,4 +1545,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js index 0294fcb3817e..29c1ece8b32d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js @@ -104,27 +104,7 @@ module.exports = { ], "value": 1, "raw": "1" - }, - "trailingComments": [ - { - "type": "Line", - "value": "no default", - "range": [ - 44, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 16 - } - } - } - ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/lib/attach-comments.js b/packages/typescript-eslint-parser/tests/lib/attach-comments.js new file mode 100644 index 000000000000..9350c2f62abc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/attach-comments.js @@ -0,0 +1,104 @@ +/** + * @fileoverview Tests for parsing and attaching comments. + * @author Nicholas C. Zakas + * @copyright 2014 Nicholas C. Zakas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var assert = require("chai").assert, + leche = require("leche"), + path = require("path"), + parser = require("../../parser"), + shelljs = require("shelljs"); + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +var FIXTURES_DIR = "./tests/fixtures/attach-comments"; + +var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { + return filename.indexOf(".src.js") > -1; +}).map(function(filename) { + return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" +}); + +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("attachComment: true", function() { + + var config; + + beforeEach(function() { + config = { + loc: true, + range: true, + tokens: true, + attachComment: true, + ecmaFeatures: {} + }; + }); + + leche.withData(testFiles, function(filename) { + var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); + + it("should produce correct AST when parsed with attachComment", function() { + var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); + var result; + + try { + result = parser.parse(code, config); + result = getRaw(result); + } catch (ex) { + + // format of error isn't exactly the same, just check if it's expected + if (expected.message) { + return; + } else { + throw ex; + } + + } + assert.deepEqual(result, expected); + }); + + }); + + +}); From 24db9252035aec24357798f9c95a53717d569ffe Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 8 Aug 2016 16:56:26 -0700 Subject: [PATCH 030/326] Build: Add CI build scripts --- packages/typescript-eslint-parser/package.json | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 061daefdeecc..eb991df65291 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -2,7 +2,7 @@ "name": "typescript-eslint-parser", "description": "An Esprima-style parser for TypeScript", "author": "Nicholas C. Zakas ", - "homepage": "https://github.com/eslint/espree", + "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", "version": "0.1.0-alpha.1", "files": [ @@ -12,25 +12,17 @@ "engines": { "node": ">=0.10.0" }, - "repository": { - "type": "git", - "url": "https://github.com/eslint/typescript-eslint-parser.git" - }, + "repository": "eslint/typescript-eslint-parser", "bugs": { "url": "https://github.com/eslint/typescript-eslint-parser/issues" }, - "licenses": [ - { - "type": "BSD", - "url": "http://github.com/nzakas/espree/raw/master/LICENSE" - } - ], + "license": "BSD-2-Clause", "devDependencies": { "chai": "^1.10.0", "dateformat": "^1.0.11", "eslint": "^2.2.0", "eslint-config-eslint": "^3.0.0", - "eslint-release": "^0.3.0", + "eslint-release": "^0.9.2", "istanbul": "~0.2.6", "leche": "^1.0.1", "mocha": "^2.0.1", @@ -52,6 +44,8 @@ "test": "node Makefile.js test", "lint": "node Makefile.js lint", "release": "eslint-release", + "ci-release": "eslint-ci-release", + "gh-release": "eslint-gh-release", "alpharelease": "eslint-prerelease alpha", "betarelease": "eslint-prerelease beta" }, From 4485be1ecc339e464ca192bdb4ce79ba516221fe Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 9 Aug 2016 13:45:50 -0400 Subject: [PATCH 031/326] Build: package.json and changelog update for 0.1.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 21d4baa7e62a..05e03bbe9109 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,14 @@ +v0.1.0 - August 9, 2016 + +* d49b5f1 Build: Add CI build scripts (Nicholas C. Zakas) +* 32a46b3 New: Attaches comments to the ESTree AST (fixes #31) (#49) (James Henry) +* f4856f9 Fix: Class implements conversion (fixes #39) (#43) (Nicholas C. Zakas) +* 795a418 Build: Add linting to npm test (Nicholas C. Zakas) +* d26fec4 New: Automatically generate TS-specific nodes (#40) (Nicholas C. Zakas) +* 46b9c87 Docs: Update README to have the correct phase order. (#35) (Dean Taub) +* a8b00fe Chore: Add jQuery Foundation copyright (Nicholas C. Zakas) +* 560bb99 Fix: Remove console logging of node.kind (fixes #29) (Tom X. Tobin) + v0.1.0-alpha.1 - March 18, 2016 * 0eddb71 New: Implements JSX syntax (fixes #18) (James Henry) From 0088fca3670f706c9801301599ab1943f6fd3404 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 9 Aug 2016 13:45:51 -0400 Subject: [PATCH 032/326] 0.1.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index eb991df65291..fc92b2228a7b 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.1.0-alpha.1", + "version": "0.1.0", "files": [ "lib", "parser.js" From 060e28bbe6802a9038c565cb1d27006f8da185cb Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 10 Aug 2016 18:24:49 +0100 Subject: [PATCH 033/326] Fix: Class implements generic syntax (fixes #44) (#53) --- .../lib/ast-converter.js | 42 +- ...with-implements-generic-multiple.result.js | 400 ++++++++++++++++++ ...ss-with-implements-generic-multiple.src.ts | 3 + .../class-with-implements-generic.result.js | 329 ++++++++++++++ .../class-with-implements-generic.src.ts | 3 + 5 files changed, 776 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index eb492daee47f..f40359d96eda 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -452,6 +452,42 @@ module.exports = function(ast, extra) { }; } + /** + * Converts a TSNode's typeArguments array to a flow-like typeParameters node + * @param {Array} typeArguments TSNode typeArguments + * @returns {TypeParameterInstantiation} TypeParameterInstantiation node + */ + function convertTypeArgumentsToTypeParameters(typeArguments) { + var firstTypeArgument = typeArguments[0]; + var lastTypeArgument = typeArguments[typeArguments.length - 1]; + return { + type: "TypeParameterInstantiation", + range: [ + firstTypeArgument.pos - 1, + lastTypeArgument.end + 1 + ], + loc: getLocFor(firstTypeArgument.pos - 1, lastTypeArgument.end + 1, ast), + params: typeArguments.map(function(typeArgument) { + /** + * Have to manually calculate the start of the range, + * because TypeScript includes leading whitespace but Flow does not + */ + var typeArgumentStart = (typeArgument.typeName && typeArgument.typeName.text) + ? typeArgument.end - typeArgument.typeName.text.length + : typeArgument.pos; + return { + type: "GenericTypeAnnotation", + range: [ + typeArgumentStart, + typeArgument.end + ], + loc: getLocFor(typeArgumentStart, typeArgument.end, ast), + id: convertChild(typeArgument.typeName) + }; + }) + }; + } + /** * Converts a child into a class implements node. This creates an intermediary * ClassImplements node to match what Flow does. @@ -460,12 +496,16 @@ module.exports = function(ast, extra) { */ function convertClassImplements(child) { var id = convertChild(child.expression); - return { + var classImplementsNode = { type: "ClassImplements", loc: id.loc, range: id.range, id: id }; + if (child.typeArguments && child.typeArguments.length) { + classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); + } + return classImplementsNode; } /** diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js new file mode 100644 index 000000000000..6dce4c610896 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js @@ -0,0 +1,400 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 31, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 21, + 24 + ], + "id": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "Bar" + }, + "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 24, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "S" + } + }, + { + "type": "GenericTypeAnnotation", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "id": { + "type": "Identifier", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "name": "T" + } + } + ] + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "implements", + "range": [ + 10, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "S", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts new file mode 100644 index 000000000000..0a02bc2081f4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.src.ts @@ -0,0 +1,3 @@ +class Foo implements Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js new file mode 100644 index 000000000000..f28bc5daf844 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js @@ -0,0 +1,329 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [ + { + "type": "ClassImplements", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 21, + 24 + ], + "id": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "Bar" + }, + "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "S" + }, + } + ] + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "implements", + "range": [ + 10, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "S", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.src.ts new file mode 100644 index 000000000000..b18efb98d086 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.src.ts @@ -0,0 +1,3 @@ +class Foo implements Bar { + +} From f724dd1f0ef61fab37f6c80348586ae252050a70 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 10 Aug 2016 13:26:11 -0400 Subject: [PATCH 034/326] Build: package.json and changelog update for 0.1.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 05e03bbe9109..e76ebf3fad8c 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v0.1.1 - August 10, 2016 + +* 62d14b4 Fix: Class implements generic syntax (fixes #44) (#53) (James Henry) + v0.1.0 - August 9, 2016 * d49b5f1 Build: Add CI build scripts (Nicholas C. Zakas) From 8a01711632e978fd5a635c01e114132a94ac5805 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 10 Aug 2016 13:26:12 -0400 Subject: [PATCH 035/326] 0.1.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index fc92b2228a7b..54f5ef7295b5 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.1.0", + "version": "0.1.1", "files": [ "lib", "parser.js" From 0bc64cdb265c32fcdd8aa5932d76ea45d6b74eb9 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 19 Aug 2016 18:56:25 +0100 Subject: [PATCH 036/326] Fix: Add function type parameters (fixes #52) (#56) --- .../lib/ast-converter.js | 58 +- ...ow-function-with-type-parameters.result.js | 511 +++++++++++++++++ ...arrow-function-with-type-parameters.src.ts | 3 + .../function-with-type-parameters.result.js | 529 ++++++++++++++++++ .../function-with-type-parameters.src.ts | 3 + 5 files changed, 1098 insertions(+), 6 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index f40359d96eda..ccddc351e94b 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -454,7 +454,7 @@ module.exports = function(ast, extra) { /** * Converts a TSNode's typeArguments array to a flow-like typeParameters node - * @param {Array} typeArguments TSNode typeArguments + * @param {TSNode[]} typeArguments TSNode typeArguments * @returns {TypeParameterInstantiation} TypeParameterInstantiation node */ function convertTypeArgumentsToTypeParameters(typeArguments) { @@ -488,6 +488,42 @@ module.exports = function(ast, extra) { }; } + /** + * Converts a TSNode's typeParameters array to a flow-like TypeParameterDeclaration node + * @param {TSNode[]} typeParameters TSNode typeParameters + * @returns {TypeParameterDeclaration} TypeParameterDeclaration node + */ + function convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { + var firstTypeParameter = typeParameters[0]; + var lastTypeParameter = typeParameters[typeParameters.length - 1]; + return { + type: "TypeParameterDeclaration", + range: [ + firstTypeParameter.pos - 1, + lastTypeParameter.end + 1 + ], + loc: getLocFor(firstTypeParameter.pos - 1, lastTypeParameter.end + 1, ast), + params: typeParameters.map(function(typeParameter) { + /** + * Have to manually calculate the start of the range, + * because TypeScript includes leading whitespace but Flow does not + */ + var typeParameterStart = (typeParameter.typeName && typeParameter.typeName.text) + ? typeParameter.end - typeParameter.typeName.text.length + : typeParameter.pos; + return { + type: "TypeParameter", + range: [ + typeParameterStart, + typeParameter.end + ], + loc: getLocFor(typeParameterStart, typeParameter.end, ast), + name: typeParameter.name.text + }; + }) + }; + } + /** * Converts a child into a class implements node. This creates an intermediary * ClassImplements node to match what Flow does. @@ -737,11 +773,14 @@ module.exports = function(ast, extra) { params: node.parameters.map(convertChild), body: convertChild(node.body) }); - + // Process returnType if (node.type) { result.returnType = convertTypeAnnotation(node.type); } - + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } // check for exports result = fixExports(node, result, ast); @@ -1050,10 +1089,14 @@ module.exports = function(ast, extra) { body: convertChild(node.body), expression: false }); - + // Process returnType if (node.type) { result.returnType = convertTypeAnnotation(node.type); } + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } break; case SyntaxKind.SuperKeyword: @@ -1128,11 +1171,14 @@ module.exports = function(ast, extra) { body: convertChild(node.body), expression: node.body.kind !== SyntaxKind.Block }); - + // Process returnType if (node.type) { result.returnType = convertTypeAnnotation(node.type); } - + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } break; case SyntaxKind.YieldExpression: diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js new file mode 100644 index 000000000000..e4945cdfa0b8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js @@ -0,0 +1,511 @@ +module.exports = { + "body": [ + { + "expression": { + "body": { + "body": [ + { + "argument": { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "name": "b", + "range": [ + 29, + 30 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 22, + 31 + ], + "type": "ReturnStatement" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "range": [ + 16, + 33 + ], + "type": "BlockStatement" + }, + "expression": false, + "generator": false, + "id": null, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "name": "b", + "range": [ + 4, + 5 + ], + "type": "Identifier" + } + ], + "range": [ + 0, + 33 + ], + "returnType": { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "range": [ + 11, + 12 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "flags": 0, + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "range": [ + 11, + 12 + ], + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "name": "X", + "range": [ + 11, + 12 + ], + "type": "Identifier" + } + } + }, + "type": "ArrowFunctionExpression", + "typeParameters": { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 2, + "line": 1 + }, + "start": { + "column": 1, + "line": 1 + } + }, + "name": "X", + "range": [ + 1, + 2 + ], + "type": "TypeParameter" + } + ], + "range": [ + 0, + 3 + ], + "type": "TypeParameterDeclaration" + } + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 33 + ], + "type": "ExpressionStatement" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 33 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 1, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 1 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 2, + "line": 1 + }, + "start": { + "column": 1, + "line": 1 + } + }, + "range": [ + 1, + 2 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 2, + "line": 1 + } + }, + "range": [ + 2, + 3 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 4, + "line": 1 + }, + "start": { + "column": 3, + "line": 1 + } + }, + "range": [ + 3, + 4 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 5 + ], + "type": "Identifier", + "value": "b" + }, + { + "loc": { + "end": { + "column": 6, + "line": 1 + }, + "start": { + "column": 5, + "line": 1 + } + }, + "range": [ + 5, + 6 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 8, + "line": 1 + }, + "start": { + "column": 7, + "line": 1 + } + }, + "range": [ + 7, + 8 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 9 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "range": [ + 9, + 10 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "range": [ + 11, + 12 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 13, + "line": 1 + } + }, + "range": [ + 13, + 15 + ], + "type": "Punctuator", + "value": "=>" + }, + { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "range": [ + 16, + 17 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 22, + 28 + ], + "type": "Keyword", + "value": "return" + }, + { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "range": [ + 29, + 30 + ], + "type": "Identifier", + "value": "b" + }, + { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 30, + 31 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 32, + 33 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts new file mode 100644 index 000000000000..a50543105d12 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.src.ts @@ -0,0 +1,3 @@ +(b: X): X => { + return b; +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js new file mode 100644 index 000000000000..d60398811f94 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js @@ -0,0 +1,529 @@ +module.exports = { + "body": [ + { + "type": "FunctionDeclaration", + "body": { + "body": [ + { + "argument": { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "name": "b", + "range": [ + 36, + 37 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 29, + 38 + ], + "type": "ReturnStatement" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "range": [ + 23, + 40 + ], + "type": "BlockStatement" + }, + "expression": false, + "generator": false, + "id": { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "name": "a", + "range": [ + 9, + 10 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "name": "b", + "range": [ + 14, + 15 + ], + "type": "Identifier" + } + ], + "range": [ + 0, + 40 + ], + "typeParameters": { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "name": "X", + "range": [ + 11, + 12 + ], + "type": "TypeParameter" + } + ], + "range": [ + 10, + 13 + ], + "type": "TypeParameterDeclaration" + }, + "returnType": { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 22 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "flags": 0, + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 22 + ], + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "name": "X", + "range": [ + 21, + 22 + ], + "type": "Identifier" + } + } + } + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 40 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 8, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 8 + ], + "type": "Keyword", + "value": "function" + }, + { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "range": [ + 9, + 10 + ], + "type": "Identifier", + "value": "a" + }, + { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 11 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "range": [ + 11, + 12 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 12, + "line": 1 + } + }, + "range": [ + 12, + 13 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 13, + "line": 1 + } + }, + "range": [ + 13, + 14 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "range": [ + 14, + 15 + ], + "type": "Identifier", + "value": "b" + }, + { + "loc": { + "end": { + "column": 16, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 16 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 18, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 18 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "range": [ + 18, + 19 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 20, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "range": [ + 19, + 20 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 22 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "range": [ + 23, + 24 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 29, + 35 + ], + "type": "Keyword", + "value": "return" + }, + { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "range": [ + 36, + 37 + ], + "type": "Identifier", + "value": "b" + }, + { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 37, + 38 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 39, + 40 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.src.ts new file mode 100644 index 000000000000..cd0bdc5cc45b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.src.ts @@ -0,0 +1,3 @@ +function a(b: X): X { + return b; +} From 275310ce2218ef3d213158378534e9fb4871f959 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 21 Aug 2016 17:33:02 +0100 Subject: [PATCH 037/326] Fix: UpdateExpression detection and operator format (fixes #58) (#59) * Fix: UpdateExpression detection and operator format (fixes #58) * Added basics in fixtures with update-expression test --- .../lib/ast-converter.js | 5 +- .../basics/update-expression.result.js | 584 ++++++++++++++++++ .../fixtures/basics/update-expression.src.js | 5 + .../tests/lib/basics.js | 88 +++ 4 files changed, 680 insertions(+), 2 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/lib/basics.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index ccddc351e94b..03c1a7307ce1 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1419,10 +1419,11 @@ module.exports = function(ast, extra) { case SyntaxKind.PrefixUnaryExpression: case SyntaxKind.PostfixUnaryExpression: + var operator = TOKEN_TO_TEXT[node.operator]; assign(result, { // ESTree uses UpdateExpression for ++/-- - type: /^(?:\+\+|\-\-)$/.test(TOKEN_TO_TEXT[node.operator.kind]) ? "UpdateExpression" : "UnaryExpression", - operator: SyntaxKind[node.operator], + type: /^(?:\+\+|\-\-)$/.test(operator) ? "UpdateExpression" : "UnaryExpression", + operator: operator, prefix: node.kind === SyntaxKind.PrefixUnaryExpression, argument: convertChild(node.operand) }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js new file mode 100644 index 000000000000..a3f82e5de321 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js @@ -0,0 +1,584 @@ +module.exports = { + "body": [ + { + "declarations": [ + { + "id": { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "name": "i", + "range": [ + 4, + 5 + ], + "type": "Identifier" + }, + "init": { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 9 + ], + "raw": "0", + "type": "Literal", + "value": 0 + }, + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 9 + ], + "type": "VariableDeclarator" + } + ], + "kind": "var", + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 10 + ], + "type": "VariableDeclaration" + }, + { + "body": { + "body": [ + { + "expression": { + "argument": { + "loc": { + "end": { + "column": 3, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "name": "i", + "range": [ + 28, + 29 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "operator": "++", + "prefix": false, + "range": [ + 28, + 31 + ], + "type": "UpdateExpression" + }, + "loc": { + "end": { + "column": 6, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "range": [ + 28, + 32 + ], + "type": "ExpressionStatement" + } + ], + "loc": { + "end": { + "column": 1, + "line": 4 + }, + "start": { + "column": 13, + "line": 2 + } + }, + "range": [ + 24, + 34 + ], + "type": "BlockStatement" + }, + "expression": false, + "generator": false, + "id": { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "name": "f", + "range": [ + 20, + 21 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 1, + "line": 4 + }, + "start": { + "column": 0, + "line": 2 + } + }, + "params": [], + "range": [ + 11, + 34 + ], + "type": "FunctionDeclaration" + }, + { + "expression": { + "arguments": [], + "callee": { + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 5 + } + }, + "name": "f", + "range": [ + 35, + 36 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 3, + "line": 5 + }, + "start": { + "column": 0, + "line": 5 + } + }, + "range": [ + 35, + 38 + ], + "type": "CallExpression" + }, + "loc": { + "end": { + "column": 4, + "line": 5 + }, + "start": { + "column": 0, + "line": 5 + } + }, + "range": [ + 35, + 39 + ], + "type": "ExpressionStatement" + } + ], + "loc": { + "end": { + "column": 4, + "line": 5 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 39 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 3 + ], + "type": "Keyword", + "value": "var" + }, + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 5 + ], + "type": "Identifier", + "value": "i" + }, + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 7 + ], + "type": "Punctuator", + "value": "=" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 9 + ], + "type": "Numeric", + "value": "0" + }, + { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "range": [ + 9, + 10 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 0, + "line": 2 + } + }, + "range": [ + 11, + 19 + ], + "type": "Keyword", + "value": "function" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 20, + 21 + ], + "type": "Identifier", + "value": "f" + }, + { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 10, + "line": 2 + } + }, + "range": [ + 21, + 22 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "range": [ + 22, + 23 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 14, + "line": 2 + }, + "start": { + "column": 13, + "line": 2 + } + }, + "range": [ + 24, + 25 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 3, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "range": [ + 28, + 29 + ], + "type": "Identifier", + "value": "i" + }, + { + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 3, + "line": 3 + } + }, + "range": [ + 29, + 31 + ], + "type": "Punctuator", + "value": "++" + }, + { + "loc": { + "end": { + "column": 6, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + }, + "range": [ + 31, + 32 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 4 + }, + "start": { + "column": 0, + "line": 4 + } + }, + "range": [ + 33, + 34 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 5 + } + }, + "range": [ + 35, + 36 + ], + "type": "Identifier", + "value": "f" + }, + { + "loc": { + "end": { + "column": 2, + "line": 5 + }, + "start": { + "column": 1, + "line": 5 + } + }, + "range": [ + 36, + 37 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 3, + "line": 5 + }, + "start": { + "column": 2, + "line": 5 + } + }, + "range": [ + 37, + 38 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 4, + "line": 5 + }, + "start": { + "column": 3, + "line": 5 + } + }, + "range": [ + 38, + 39 + ], + "type": "Punctuator", + "value": ";" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.src.js new file mode 100644 index 000000000000..1c94b625bd2e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.src.js @@ -0,0 +1,5 @@ +var i = 0; +function f() { + i++; +} +f(); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js new file mode 100644 index 000000000000..0a41ad7b826e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -0,0 +1,88 @@ +/** + * @fileoverview Tests for basic expressions + * @author Nicholas C. Zakas + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +var assert = require("chai").assert, + leche = require("leche"), + path = require("path"), + parser = require("../../parser"), + shelljs = require("shelljs"); + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +var FIXTURES_DIR = "./tests/fixtures/basics"; + +var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { + return filename.indexOf(".src.js") > -1; +}).map(function(filename) { + return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" +}); + +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("basics", function() { + + var config; + + beforeEach(function() { + config = { + loc: true, + range: true, + tokens: true, + ecmaFeatures: {} + }; + }); + + leche.withData(testFiles, function(filename) { + // Uncomment and fill in filename to focus on a single file + // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; + var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); + + it("should parse correctly", function() { + var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); + var result; + + try { + result = parser.parse(code, config); + result = getRaw(result); + } catch (ex) { + + // format of error isn't exactly the same, just check if it's expected + if (expected.message) { + return; + } else { + throw ex; + } + + } + // console.log(JSON.stringify(result, null, 4)); + assert.deepEqual(result, expected); + + }); + + }); + + +}); From df951864167e5fc65da3de694b75bc661b67b67b Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 22 Aug 2016 11:17:35 -0700 Subject: [PATCH 038/326] Docs: Add issue template --- .../.github/ISSUE_TEMPLATE.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md diff --git a/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md b/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000000..efbde91f9eb5 --- /dev/null +++ b/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,18 @@ +**What version of TypeScript are you using?** + + +**What version of `typescript-eslint-parser` are you using?** + + +**What code were you trying to parse?** + +``` + +``` + +**What did you expect to happen?** + + +**What happened?** + + From 7e017853d17afee7cc145cb84792b4a89aee749d Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 22 Aug 2016 21:21:45 +0100 Subject: [PATCH 039/326] Fix: Check for arguments property on NewExpression (fixes #60) (#62) --- .../lib/ast-converter.js | 2 +- .../basics/new-without-parens.result.js | 293 ++++++++++++++++++ .../fixtures/basics/new-without-parens.src.js | 2 + 3 files changed, 296 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 03c1a7307ce1..528b180515ca 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1533,7 +1533,7 @@ module.exports = function(ast, extra) { assign(result, { type: "NewExpression", callee: convertChild(node.expression), - arguments: node.arguments.map(convertChild) + arguments: (node.arguments) ? node.arguments.map(convertChild) : [] }); } break; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js new file mode 100644 index 000000000000..1d7c82de8498 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "X" + }, + "generator": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "body": [] + } + }, + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 17, + 23 + ], + "expression": { + "type": "NewExpression", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 17, + 22 + ], + "callee": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 21, + 22 + ], + "name": "X" + }, + "arguments": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "X", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Keyword", + "value": "new", + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } + }, + "range": [ + 17, + 20 + ] + }, + { + "type": "Identifier", + "value": "X", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.src.js new file mode 100644 index 000000000000..fd30dda06abe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.src.js @@ -0,0 +1,2 @@ +function X () {} +new X; \ No newline at end of file From 48044aac42952cf901e34e464f926026c91c88ad Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 22 Aug 2016 16:39:42 -0700 Subject: [PATCH 040/326] Fix: manually update package.json after build failure --- packages/typescript-eslint-parser/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 54f5ef7295b5..f9229d4b0fa1 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.1.1", + "version": "0.1.2", "files": [ "lib", "parser.js" @@ -22,7 +22,7 @@ "dateformat": "^1.0.11", "eslint": "^2.2.0", "eslint-config-eslint": "^3.0.0", - "eslint-release": "^0.9.2", + "eslint-release": "^0.10.0", "istanbul": "~0.2.6", "leche": "^1.0.1", "mocha": "^2.0.1", From d3311cf1f589c5545f19514b2d13df036bd80eba Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 22 Aug 2016 19:40:53 -0400 Subject: [PATCH 041/326] Build: package.json and changelog update for 0.1.3 --- packages/typescript-eslint-parser/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index e76ebf3fad8c..aed31fabbfb5 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,11 @@ +v0.1.3 - August 22, 2016 + +* da984bf Fix: manually update package.json after build failure (Nicholas C. Zakas) +* 5bfb9bf Fix: Check for arguments property on NewExpression (fixes #60) (#62) (James Henry) +* d323ee7 Docs: Add issue template (Nicholas C. Zakas) +* 8f4964c Fix: UpdateExpression detection and operator format (fixes #58) (#59) (James Henry) +* e09ebb3 Fix: Add function type parameters (fixes #52) (#56) (James Henry) + v0.1.1 - August 10, 2016 * 62d14b4 Fix: Class implements generic syntax (fixes #44) (#53) (James Henry) From 44ccbfec089829550b0e8c93cca0f31f41844669 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 22 Aug 2016 19:40:54 -0400 Subject: [PATCH 042/326] 0.1.3 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index f9229d4b0fa1..613ab3fdeba9 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.1.2", + "version": "0.1.3", "files": [ "lib", "parser.js" From 9d8dce3f048d773ff8d50fa9bfa2620f257642c2 Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 25 Aug 2016 00:25:37 +0100 Subject: [PATCH 043/326] New: Add method decorators to AST (fixes #65) (#64) --- .../lib/ast-converter.js | 5 +- .../export-default-anonymous-class.result.js | 1 + .../class-accessor-properties.result.js | 2 + .../class-computed-static-method.result.js | 1 + .../class-method-named-prototype.result.js | 1 + .../class-method-named-static.result.js | 1 + .../classes/class-one-method-super.result.js | 1 + .../classes/class-one-method.result.js | 1 + ...ss-static-method-named-prototype.result.js | 1 + ...class-static-method-named-static.result.js | 1 + .../classes/class-static-method.result.js | 1 + ...-methods-and-accessor-properties.result.js | 3 + ...lass-two-computed-static-methods.result.js | 2 + ...two-methods-computed-constructor.result.js | 2 + .../classes/class-two-methods-semi.result.js | 2 + .../class-two-methods-three-semi.result.js | 2 + .../class-two-methods-two-semi.result.js | 2 + .../classes/class-two-methods.result.js | 2 + ...ecorator-factory-instance-member.result.js | 465 +++++++++++++++++ ...d-decorator-factory-instance-member.src.ts | 4 + ...-decorator-factory-static-member.result.js | 483 ++++++++++++++++++ ...hod-decorator-factory-static-member.src.ts | 4 + ...method-decorator-instance-member.result.js | 373 ++++++++++++++ .../method-decorator-instance-member.src.ts | 4 + .../method-decorator-static-member.result.js | 391 ++++++++++++++ .../method-decorator-static-member.src.ts | 4 + 26 files changed, 1758 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 528b180515ca..3e664eeca2df 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -993,7 +993,10 @@ module.exports = function(ast, extra) { value: method, computed: methodNameIsComputed, static: Boolean(node.flags & ts.NodeFlags.Static), - kind: "method" + kind: "method", + decorators: (node.decorators) ? node.decorators.map(function(d) { + return convertChild(d.expression); + }) : [] }); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js index 0e4c7d9469c1..035cd83bc5eb 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js @@ -72,6 +72,7 @@ module.exports = { }, "kind": "method", "computed": false, + "decorators": [], "range": [ 103, 119 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js index b607f3b0b80b..f0f7cbcecaf1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js @@ -85,6 +85,7 @@ module.exports = { 18 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -162,6 +163,7 @@ module.exports = { 29 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js index ac3cf9a48253..c26bbfc2c4e8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js @@ -85,6 +85,7 @@ module.exports = { 23 ], "computed": true, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js index 1abfdcb70968..14fb1a3b38e8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js @@ -85,6 +85,7 @@ module.exports = { 22 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js index d0f8e1a17c20..935429af5d41 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js @@ -85,6 +85,7 @@ module.exports = { 19 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js index 245ba91e4ef9..867cd1a1f414 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js @@ -85,6 +85,7 @@ module.exports = { 41 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js index 12380f6b1b60..d328f634ae22 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js @@ -85,6 +85,7 @@ module.exports = { 19 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js index f8d53e4f33f3..520fce142956 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js @@ -85,6 +85,7 @@ module.exports = { 33 ], "computed": true, + "decorators": [], "key": { "type": "Literal", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js index 75491db14174..d208df8dabfc 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js @@ -85,6 +85,7 @@ module.exports = { 26 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js index d4bfefd7c6da..368b27aeb25a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js @@ -85,6 +85,7 @@ module.exports = { 21 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js index e321241b5286..cc4556a3ef08 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js @@ -85,6 +85,7 @@ module.exports = { 21 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -162,6 +163,7 @@ module.exports = { 38 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -239,6 +241,7 @@ module.exports = { 56 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js index 51cc0a6b667c..83c709949117 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js @@ -85,6 +85,7 @@ module.exports = { 22 ], "computed": true, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -162,6 +163,7 @@ module.exports = { 37 ], "computed": true, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js index 6d5ce4e98dc4..9f6309f5ac32 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js @@ -85,6 +85,7 @@ module.exports = { 26 ], "computed": false, + "decorators": [], "key": { "type": "Literal", "loc": { @@ -163,6 +164,7 @@ module.exports = { 46 ], "computed": true, + "decorators": [], "key": { "type": "Literal", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js index d0a2c12666b1..378000320343 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js @@ -85,6 +85,7 @@ module.exports = { 14 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -162,6 +163,7 @@ module.exports = { 20 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js index 76e07a56fb76..72029d9a8110 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js @@ -85,6 +85,7 @@ module.exports = { 15 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -162,6 +163,7 @@ module.exports = { 21 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js index 01735f7633ed..3dd0d8bbeccd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js @@ -85,6 +85,7 @@ module.exports = { 14 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -162,6 +163,7 @@ module.exports = { 20 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js index 2ea4519ce572..c545cd56a12b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js @@ -85,6 +85,7 @@ module.exports = { 14 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { @@ -162,6 +163,7 @@ module.exports = { 19 ], "computed": false, + "decorators": [], "key": { "type": "Identifier", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js new file mode 100644 index 000000000000..2811d90bad16 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js @@ -0,0 +1,465 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "key": { + "type": "Identifier", + "range": [ + 35, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "name": "instanceMethod" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 52, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "body": [] + }, + "range": [ + 49, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "computed": false, + "static": false, + "kind": "method", + "decorators": [ + { + "arguments": [ + { + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 14, + "line": 2 + } + }, + "range": [ + 24, + 29 + ], + "raw": "false", + "type": "Literal", + "value": false + } + ], + "callee": { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "name": "readonly", + "range": [ + 15, + 23 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 20, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "range": [ + 15, + 30 + ], + "type": "CallExpression" + } + ] + } + ], + "range": [ + 8, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 5 + ], + "type": "Keyword", + "value": "class" + }, + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 7 + ], + "type": "Identifier", + "value": "B" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 9 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 5, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 14, + 15 + ], + "type": "Punctuator", + "value": "@" + }, + { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "range": [ + 15, + 23 + ], + "type": "Identifier", + "value": "readonly" + }, + { + "loc": { + "end": { + "column": 14, + "line": 2 + }, + "start": { + "column": 13, + "line": 2 + } + }, + "range": [ + 23, + 24 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 14, + "line": 2 + } + }, + "range": [ + 24, + 29 + ], + "type": "Boolean", + "value": "false" + }, + { + "loc": { + "end": { + "column": 20, + "line": 2 + }, + "start": { + "column": 19, + "line": 2 + } + }, + "range": [ + 29, + 30 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 18, + "line": 3 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "range": [ + 35, + 49 + ], + "type": "Identifier", + "value": "instanceMethod" + }, + { + "loc": { + "end": { + "column": 19, + "line": 3 + }, + "start": { + "column": 18, + "line": 3 + } + }, + "range": [ + 49, + 50 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 20, + "line": 3 + }, + "start": { + "column": 19, + "line": 3 + } + }, + "range": [ + 50, + 51 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 22, + "line": 3 + }, + "start": { + "column": 21, + "line": 3 + } + }, + "range": [ + 52, + 53 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 23, + "line": 3 + }, + "start": { + "column": 22, + "line": 3 + } + }, + "range": [ + 53, + 54 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 1, + "line": 4 + }, + "start": { + "column": 0, + "line": 4 + } + }, + "range": [ + 55, + 56 + ], + "type": "Punctuator", + "value": "}" + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts new file mode 100644 index 000000000000..cb089fb4a9b2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts @@ -0,0 +1,4 @@ +class B { + @readonly(false) + instanceMethod() {} +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js new file mode 100644 index 000000000000..75861aa2e901 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js @@ -0,0 +1,483 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "C" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "key": { + "type": "Identifier", + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "name": "staticMethod" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 52, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "body": [] + }, + "range": [ + 49, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "computed": false, + "static": true, + "kind": "method", + "decorators": [ + { + "arguments": [ + { + "loc": { + "end": { + "column": 14, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 19, + 24 + ], + "raw": "false", + "type": "Literal", + "value": false + } + ], + "callee": { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "name": "Foo", + "range": [ + 15, + 18 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 15, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "range": [ + 15, + 25 + ], + "type": "CallExpression" + } + ] + } + ], + "range": [ + 8, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "loc": { + "end": { + "column": 14, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 19, + 24 + ], + "type": "Boolean", + "value": "false" + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 30, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "staticMethod", + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts new file mode 100644 index 000000000000..735541ffeb71 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts @@ -0,0 +1,4 @@ +class C { + @Foo(false) + static staticMethod() {} +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js new file mode 100644 index 000000000000..b91dd2b35b3c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js @@ -0,0 +1,373 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "key": { + "type": "Identifier", + "range": [ + 28, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "name": "instanceMethod" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 45, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "body": [] + }, + "range": [ + 42, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "computed": false, + "static": false, + "kind": "method", + "decorators": [ + { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "name": "readonly", + "range": [ + 15, + 23 + ], + "type": "Identifier" + } + ] + } + ], + "range": [ + 8, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "readonly", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "instanceMethod", + "range": [ + 28, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts new file mode 100644 index 000000000000..4993bde3f8e4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts @@ -0,0 +1,4 @@ +class A { + @readonly + instanceMethod() {} +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js new file mode 100644 index 000000000000..1b3250ae1c91 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js @@ -0,0 +1,391 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "D" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "key": { + "type": "Identifier", + "range": [ + 30, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "name": "staticMethod" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 45, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "body": [] + }, + "range": [ + 42, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "computed": false, + "static": true, + "kind": "method", + "decorators": [ + { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "name": "Foo", + "range": [ + 15, + 18 + ], + "type": "Identifier" + } + ] + } + ], + "range": [ + 8, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "D", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "staticMethod", + "range": [ + 30, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts new file mode 100644 index 000000000000..59fc47fe0825 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.src.ts @@ -0,0 +1,4 @@ +class D { + @Foo + static staticMethod() {} +} From b8a608f0ba5cd9d7d9c868026775654102ee551f Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 25 Aug 2016 16:27:32 +0100 Subject: [PATCH 044/326] New: Add class decorators to AST (fixes #66) (#67) --- .../lib/ast-converter.js | 5 +- .../export-default-anonymous-class.result.js | 1 + .../classes-and-generators.result.js | 3 +- .../computed-generator.result.js | 1 + .../static-generators.result.js | 3 +- .../class-default-anonymous-extends.result.js | 3 +- .../class-default-anonymous.result.js | 3 +- .../class-default-extends.result.js | 3 +- .../class-default.result.js | 3 +- .../class-extends.result.js | 3 +- .../modules-and-classes/class.result.js | 3 +- .../class-accessor-properties.result.js | 1 + .../class-computed-static-method.result.js | 1 + .../classes/class-expression.result.js | 1 + .../class-method-named-prototype.result.js | 1 + .../class-method-named-static.result.js | 1 + .../classes/class-one-method-super.result.js | 1 + .../classes/class-one-method.result.js | 1 + ...ss-static-method-named-prototype.result.js | 1 + ...class-static-method-named-static.result.js | 1 + .../classes/class-static-method.result.js | 1 + ...-methods-and-accessor-properties.result.js | 1 + ...lass-two-computed-static-methods.result.js | 1 + ...two-methods-computed-constructor.result.js | 1 + .../classes/class-two-methods-semi.result.js | 1 + .../class-two-methods-three-semi.result.js | 1 + .../class-two-methods-two-semi.result.js | 1 + .../classes/class-two-methods.result.js | 1 + ...static-methods-named-constructor.result.js | 1 + .../classes/class-with-constructor.result.js | 1 + .../derived-class-assign-to-var.result.js | 1 + .../derived-class-expression.result.js | 1 + .../classes/empty-class-double-semi.result.js | 1 + .../classes/empty-class-semi.result.js | 1 + .../classes/empty-class.result.js | 1 + .../empty-literal-derived-class.result.js | 1 + .../classes/named-class-expression.result.js | 1 + .../named-derived-class-expression.result.js | 1 + ...with-implements-generic-multiple.result.js | 1 + .../class-with-implements-generic.result.js | 5 +- .../basics/class-with-implements.result.js | 3 +- .../class-decorator-factory.result.js | 445 ++++++++++++++++++ .../class-decorator-factory.src.ts | 4 + .../class-decorator.result.js | 205 ++++++++ .../class-decorators/class-decorator.src.ts | 2 + ...ecorator-factory-instance-member.result.js | 1 + ...-decorator-factory-static-member.result.js | 1 + ...method-decorator-instance-member.result.js | 1 + .../method-decorator-static-member.result.js | 1 + 49 files changed, 715 insertions(+), 12 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 3e664eeca2df..b22d597fc706 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1317,7 +1317,10 @@ module.exports = function(ast, extra) { loc: getLocFor(openBrace.getStart(), node.end, ast) }, superClass: (superClass ? convertChild(superClass.types[0].expression) : null), - implements: hasImplements ? heritageClauses[0].types.map(convertClassImplements) : [] + implements: hasImplements ? heritageClauses[0].types.map(convertClassImplements) : [], + decorators: (node.decorators) ? node.decorators.map(function(d) { + return convertChild(d.expression); + }) : [] }); var filteredMembers = node.members.filter(isESTreeClassMember); diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js index 035cd83bc5eb..d398df2d3fe2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js @@ -5,6 +5,7 @@ module.exports = { "type": "ExportDefaultDeclaration", "declaration": { "type": "ClassDeclaration", + "decorators": [], "id": null, "superClass": null, "implements": [], diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js index 8519dad6bb68..e453dde2f22c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js @@ -3,6 +3,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "id": { "type": "Identifier", "name": "Foo", @@ -331,4 +332,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js index 561edb151345..e06db8d2f17d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js @@ -3,6 +3,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "id": { "type": "Identifier", "name": "Foo", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js index e90ba96dd87b..8b3008dc7cab 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js @@ -3,6 +3,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "id": { "type": "Identifier", "name": "Foo", @@ -349,4 +350,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js index b2579354d258..c9c742eb458b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js @@ -5,6 +5,7 @@ module.exports = { "type": "ExportDefaultDeclaration", "declaration": { "type": "ClassDeclaration", + "decorators": [], "id": null, "superClass": { "type": "Identifier", @@ -251,4 +252,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js index 707bc8108009..3b3618ad5172 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js @@ -5,6 +5,7 @@ module.exports = { "type": "ExportDefaultDeclaration", "declaration": { "type": "ClassDeclaration", + "decorators": [], "id": null, "superClass": null, "body": { @@ -198,4 +199,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js index 659b026d937f..f726afc0c3e6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js @@ -5,6 +5,7 @@ module.exports = { "type": "ExportDefaultDeclaration", "declaration": { "type": "ClassDeclaration", + "decorators": [], "id": { "type": "Identifier", "name": "foo", @@ -286,4 +287,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js index 96465b5e661b..7f61b7cb1022 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js @@ -5,6 +5,7 @@ module.exports = { "type": "ExportDefaultDeclaration", "declaration": { "type": "ClassDeclaration", + "decorators": [], "id": { "type": "Identifier", "name": "foo", @@ -233,4 +234,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js index 0384f1371458..19809e4807a5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js @@ -5,6 +5,7 @@ module.exports = { "type": "ExportNamedDeclaration", "declaration": { "type": "ClassDeclaration", + "decorators": [], "id": { "type": "Identifier", "name": "foo", @@ -270,4 +271,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js index 628a1cc96524..68d44f1b22f2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js @@ -5,6 +5,7 @@ module.exports = { "type": "ExportNamedDeclaration", "declaration": { "type": "ClassDeclaration", + "decorators": [], "id": { "type": "Identifier", "name": "foo", @@ -217,4 +218,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js index f0f7cbcecaf1..556e8b3a71e2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js index c26bbfc2c4e8..1a9bfa6cc5f0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js index d65bb7ba37cc..80b759f81f37 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js @@ -33,6 +33,7 @@ module.exports = { ], "expression": { "type": "ClassExpression", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js index 14fb1a3b38e8..e14f3a83bfca 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js index 935429af5d41..af313d080648 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js index 867cd1a1f414..09ab5eadc091 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js index d328f634ae22..2e2f804759e5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js index 520fce142956..70122340f689 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js index d208df8dabfc..87526a3553ee 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js index 368b27aeb25a..d1239b20a8bf 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js index cc4556a3ef08..618ca0ba1449 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js index 83c709949117..bdd7db2211ef 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js index 9f6309f5ac32..33903c23fab4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js index 378000320343..dbd94acbca3f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js index 72029d9a8110..01cd529de260 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js index 3dd0d8bbeccd..9ca6f8147dfa 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js index c545cd56a12b..57b2dd6f8c2f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js index ec98ea0fa5c5..8f75a8b590db 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js index 6270efa90138..81508709e6e1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js index 5b3dc08ecaa0..f0b4ffd4befd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js @@ -68,6 +68,7 @@ module.exports = { }, "init": { "type": "ClassExpression", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js index 43e7900754ec..621b72c61cff 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js @@ -33,6 +33,7 @@ module.exports = { ], "expression": { "type": "ClassExpression", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js index f50bdd99346e..9060a7e27315 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js index 62766a123fab..4373315c19a7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js index f50bdd99346e..9060a7e27315 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js index 4a181957af4f..3d7aac182e26 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js @@ -17,6 +17,7 @@ module.exports = { "body": [ { "type": "ClassDeclaration", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js index f9b682bf9462..ce2fc38ee726 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js @@ -33,6 +33,7 @@ module.exports = { ], "expression": { "type": "ClassExpression", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js index 90666bb273b2..29ae196c55a0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js @@ -33,6 +33,7 @@ module.exports = { ], "expression": { "type": "ClassExpression", + "decorators": [], "loc": { "start": { "line": 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js index 6dce4c610896..f19424b11a24 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "decorators": [], "id": { "type": "Identifier", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js index f28bc5daf844..a36869618009 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "decorators": [], "id": { "type": "Identifier", "range": [ @@ -153,7 +154,7 @@ module.exports = { } }, "name": "S" - }, + } } ] } @@ -326,4 +327,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js index 576cfc6fa817..83739b6c38ea 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "decorators": [], "id": { "type": "Identifier", "range": [ @@ -218,4 +219,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js new file mode 100644 index 000000000000..e99d4c2b5d76 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js @@ -0,0 +1,445 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "decorators": [ + { + "arguments": [ + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "properties": [ + { + "computed": false, + "key": { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "name": "selector", + "range": [ + 17, + 25 + ], + "type": "Identifier" + }, + "kind": "init", + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "method": false, + "range": [ + 17, + 32 + ], + "shorthand": false, + "type": "Property", + "value": { + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 14, + "line": 2 + } + }, + "range": [ + 27, + 32 + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo" + } + } + ], + "range": [ + 11, + 35 + ], + "type": "ObjectExpression" + } + ], + "callee": { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 1, + "line": 1 + } + }, + "name": "Component", + "range": [ + 1, + 10 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 2, + "line": 3 + }, + "start": { + "column": 1, + "line": 1 + } + }, + "range": [ + 1, + 36 + ], + "type": "CallExpression" + } + ], + "id": { + "type": "Identifier", + "range": [ + 43, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "name": "FooComponent" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 56, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "@", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "Component", + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "selector", + "range": [ + 17, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "String", + "value": "'foo'", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 37, + 42 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "FooComponent", + "range": [ + 43, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts new file mode 100644 index 000000000000..873263376e30 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.src.ts @@ -0,0 +1,4 @@ +@Component({ + selector: 'foo', +}) +class FooComponent {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js new file mode 100644 index 000000000000..5216798cbe4f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js @@ -0,0 +1,205 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "decorators": [ + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 1, + "line": 1 + } + }, + "name": "sealed", + "range": [ + 1, + 7 + ], + "type": "Identifier" + } + ], + "id": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "name": "Qux" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "@", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "sealed", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 8, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Qux", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts new file mode 100644 index 000000000000..a72a8ff5dcb1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.src.ts @@ -0,0 +1,2 @@ +@sealed +class Qux {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js index 2811d90bad16..0d2b909270ff 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "decorators": [], "id": { "type": "Identifier", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js index 75861aa2e901..7467cce4e339 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "decorators": [], "id": { "type": "Identifier", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js index b91dd2b35b3c..b345c0c6719e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "decorators": [], "id": { "type": "Identifier", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js index 1b3250ae1c91..eb6584d67f11 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "decorators": [], "id": { "type": "Identifier", "range": [ From b80fd1036f9fb9dc1e9d98aec9a44ceb466e4f35 Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 25 Aug 2016 21:45:48 +0100 Subject: [PATCH 045/326] New: Add param decorators to the AST (fixes #68) (#69) --- packages/typescript-eslint-parser/.gitignore | 2 +- .../lib/ast-converter.js | 26 +- .../class-accessor-properties.result.js | 3 +- ...-methods-and-accessor-properties.result.js | 3 +- .../parameter-decorator-constructor.result.js | 825 ++++++++++++++++++ .../parameter-decorator-constructor.src.ts | 5 + ...orator-decorator-instance-member.result.js | 540 ++++++++++++ ...decorator-decorator-instance-member.src.ts | 3 + ...ecorator-decorator-static-member.result.js | 558 ++++++++++++ ...r-decorator-decorator-static-member.src.ts | 3 + ...ameter-decorator-instance-member.result.js | 684 +++++++++++++++ ...parameter-decorator-instance-member.src.ts | 5 + ...arameter-decorator-static-member.result.js | 702 +++++++++++++++ .../parameter-decorator-static-member.src.ts | 5 + 14 files changed, 3359 insertions(+), 5 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts diff --git a/packages/typescript-eslint-parser/.gitignore b/packages/typescript-eslint-parser/.gitignore index 4b4cc07f1961..d2ccb92068f3 100644 --- a/packages/typescript-eslint-parser/.gitignore +++ b/packages/typescript-eslint-parser/.gitignore @@ -3,4 +3,4 @@ coverage node_modules npm-debug.log _test.js - +.DS_Store \ No newline at end of file diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index b22d597fc706..a200843877fc 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -956,7 +956,6 @@ module.exports = function(ast, extra) { method = { type: "FunctionExpression", id: null, - params: node.parameters.map(convertChild), generator: false, expression: false, body: convertChild(node.body), @@ -975,6 +974,9 @@ module.exports = function(ast, extra) { } if (parent.kind === SyntaxKind.ObjectLiteralExpression) { + + method.params = node.parameters.map(convertChild); + assign(result, { type: "Property", key: convertChild(node.name), @@ -986,7 +988,20 @@ module.exports = function(ast, extra) { }); } else { // class + + /** + * Unlinke in object literal methods, class method params can have decorators + */ + method.params = node.parameters.map(function(param) { + var convertedParam = convertChild(param); + convertedParam.decorators = (param.decorators) ? param.decorators.map(function(d) { + return convertChild(d.expression); + }) : []; + return convertedParam; + }); + var methodNameIsComputed = (node.name.kind === SyntaxKind.ComputedPropertyName); + assign(result, { type: "MethodDefinition", key: convertChild(node.name), @@ -998,6 +1013,7 @@ module.exports = function(ast, extra) { return convertChild(d.expression); }) : [] }); + } if (node.kind === SyntaxKind.GetAccessor) { @@ -1020,7 +1036,13 @@ module.exports = function(ast, extra) { constructor = { type: "FunctionExpression", id: null, - params: node.parameters.map(convertChild), + params: node.parameters.map(function(param) { + var convertedParam = convertChild(param); + convertedParam.decorators = (param.decorators) ? param.decorators.map(function(d) { + return convertChild(d.expression); + }) : []; + return convertedParam; + }), generator: false, expression: false, body: convertChild(node.body), diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js index 556e8b3a71e2..d00777a47a72 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js @@ -221,7 +221,8 @@ module.exports = { 25, 26 ], - "name": "c" + "name": "c", + "decorators": [] } ], "body": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js index 618ca0ba1449..0d737f26f8cb 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js @@ -299,7 +299,8 @@ module.exports = { 52, 53 ], - "name": "b" + "name": "b", + "decorators": [] } ], "body": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js new file mode 100644 index 000000000000..3c8e9a912d4d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js @@ -0,0 +1,825 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 115 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "decorators": [], + "range": [ + 0, + 115 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Service" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 20, + 113 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "range": [ + 52, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "name": "config", + "decorators": [ + { + "arguments": [ + { + "loc": { + "end": { + "column": 34, + "line": 2 + }, + "start": { + "column": 24, + "line": 2 + } + }, + "name": "APP_CONFIG", + "range": [ + 40, + 50 + ], + "type": "Identifier" + } + ], + "callee": { + "loc": { + "end": { + "column": 23, + "line": 2 + }, + "start": { + "column": 17, + "line": 2 + } + }, + "name": "Inject", + "range": [ + 33, + 39 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 35, + "line": 2 + }, + "start": { + "column": 17, + "line": 2 + } + }, + "range": [ + 33, + 51 + ], + "type": "CallExpression" + } + ] + } + ], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 71, + 113 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 81, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "expression": { + "type": "AssignmentExpression", + "range": [ + 81, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "range": [ + 81, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "object": { + "type": "ThisExpression", + "range": [ + 81, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "name": "title" + }, + "computed": false + }, + "right": { + "type": "MemberExpression", + "range": [ + 94, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "range": [ + 94, + 100 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 27 + } + }, + "name": "config" + }, + "property": { + "type": "Identifier", + "range": [ + 101, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "name": "title" + }, + "computed": false + } + } + } + ] + }, + "range": [ + 31, + 113 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "computed": false, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 14, + 115 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Service", + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "Inject", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "APP_CONFIG", + "range": [ + 40, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "config", + "range": [ + 52, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + { + "type": "Identifier", + "value": "AppConfig", + "range": [ + 60, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 81, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "title", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "config", + "range": [ + 94, + 100 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "title", + "range": [ + 101, + 106 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts new file mode 100644 index 000000000000..066334bf8743 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts @@ -0,0 +1,5 @@ +class Service { + constructor(@Inject(APP_CONFIG) config: AppConfig) { + this.title = config.title; + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js new file mode 100644 index 000000000000..6e007c55ea65 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js @@ -0,0 +1,540 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "decorators": [], + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 16, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "key": { + "type": "Identifier", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "bar" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "name": "baz", + "decorators": [ + { + "arguments": [ + { + "loc": { + "end": { + "column": 21, + "line": 2 + }, + "start": { + "column": 17, + "line": 2 + } + }, + "range": [ + 29, + 33 + ], + "raw": "true", + "type": "Literal", + "value": true + } + ], + "callee": { + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "name": "special", + "range": [ + 21, + 28 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 22, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 21, + 34 + ], + "type": "CallExpression" + } + ] + } + ], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 48, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "body": [] + }, + "range": [ + 19, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "computed": false, + "static": false, + "kind": "method", + "decorators": [] + } + ], + "range": [ + 10, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "special", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts new file mode 100644 index 000000000000..9b8c50c51fe5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts @@ -0,0 +1,3 @@ +class Foo { + bar(@special(true) baz: number) {} +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js new file mode 100644 index 000000000000..c0c3934551ca --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js @@ -0,0 +1,558 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "decorators": [], + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "name": "StaticFoo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 22, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "key": { + "type": "Identifier", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "bar" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "range": [ + 48, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "name": "baz", + "decorators": [ + { + "arguments": [ + { + "loc": { + "end": { + "column": 28, + "line": 2 + }, + "start": { + "column": 24, + "line": 2 + } + }, + "range": [ + 42, + 46 + ], + "raw": "true", + "type": "Literal", + "value": true + } + ], + "callee": { + "loc": { + "end": { + "column": 23, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "name": "special", + "range": [ + 34, + 41 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 29, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "range": [ + 34, + 47 + ], + "type": "CallExpression" + } + ] + } + ], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 61, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "body": [] + }, + "range": [ + 32, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "computed": false, + "static": true, + "kind": "method", + "decorators": [] + } + ], + "range": [ + 16, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "StaticFoo", + "range": [ + 6, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "special", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 48, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts new file mode 100644 index 000000000000..26013fa26279 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts @@ -0,0 +1,3 @@ +class StaticFoo { + static bar(@special(true) baz: number) {} +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js new file mode 100644 index 000000000000..7a14d2775994 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js @@ -0,0 +1,684 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "decorators": [], + "range": [ + 0, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Greeter" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 20, + 95 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "name": "greet" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "range": [ + 36, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "name": "name", + "decorators": [ + { + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "name": "required", + "range": [ + 27, + 35 + ], + "type": "Identifier" + } + ] + } + ], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 50, + 95 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 60, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "argument": { + "type": "BinaryExpression", + "range": [ + 67, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "operator": "+", + "left": { + "type": "BinaryExpression", + "range": [ + 67, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "operator": "+", + "left": { + "type": "Literal", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "value": "Hello ", + "raw": "\"Hello \"" + }, + "right": { + "type": "Identifier", + "range": [ + 78, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "name": "name" + } + }, + "right": { + "type": "Literal", + "range": [ + 85, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "value": "!", + "raw": "\"!\"" + } + } + } + ] + }, + "range": [ + 25, + 95 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "computed": false, + "static": false, + "kind": "method", + "decorators": [] + } + ], + "range": [ + 14, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Greeter", + "range": [ + 6, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "greet", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "required", + "range": [ + 27, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 36, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "String", + "value": "\"Hello \"", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 78, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "String", + "value": "\"!\"", + "range": [ + 85, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts new file mode 100644 index 000000000000..fa5f4902a309 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts @@ -0,0 +1,5 @@ +class Greeter { + greet(@required name: string) { + return "Hello " + name + "!"; + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js new file mode 100644 index 000000000000..99c154b1555e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js @@ -0,0 +1,702 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 110 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "decorators": [], + "range": [ + 0, + 110 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "name": "StaticGreeter" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 26, + 108 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "name": "greet" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "name": "name", + "decorators": [ + { + "loc": { + "end": { + "column": 26, + "line": 2 + }, + "start": { + "column": 18, + "line": 2 + } + }, + "name": "required", + "range": [ + 40, + 48 + ], + "type": "Identifier" + } + ] + } + ], + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 63, + 108 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 73, + 102 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "argument": { + "type": "BinaryExpression", + "range": [ + 80, + 101 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "operator": "+", + "left": { + "type": "BinaryExpression", + "range": [ + 80, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "operator": "+", + "left": { + "type": "Literal", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "value": "Hello ", + "raw": "\"Hello \"" + }, + "right": { + "type": "Identifier", + "range": [ + 91, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "name": "name" + } + }, + "right": { + "type": "Literal", + "range": [ + 98, + 101 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "value": "!", + "raw": "\"!\"" + } + } + } + ] + }, + "range": [ + 38, + 108 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "computed": false, + "static": true, + "kind": "method", + "decorators": [] + } + ], + "range": [ + 20, + 110 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "StaticGreeter", + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "greet", + "range": [ + 33, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "required", + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 73, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "String", + "value": "\"Hello \"", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 91, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "String", + "value": "\"!\"", + "range": [ + 98, + 101 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 3, + "column": 36 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts new file mode 100644 index 000000000000..ad512a2c2640 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts @@ -0,0 +1,5 @@ +class StaticGreeter { + static greet(@required name: string) { + return "Hello " + name + "!"; + } +} From 96697a22cd839d974cf86639738380f35b97a7d1 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 26 Aug 2016 20:07:36 +0100 Subject: [PATCH 046/326] New: Add property decorators to AST (fixes #71) (#72) --- .../lib/ast-converter.js | 15 +- ...ecorator-factory-instance-member.result.js | 644 ++++++++++++++++++ ...y-decorator-factory-instance-member.src.ts | 5 + ...-decorator-factory-static-member.result.js | 631 +++++++++++++++++ ...rty-decorator-factory-static-member.src.ts | 6 + ...operty-decorator-instance-member.result.js | 411 +++++++++++ .../property-decorator-instance-member.src.ts | 5 + ...property-decorator-static-member.result.js | 447 ++++++++++++ .../property-decorator-static-member.src.ts | 5 + 9 files changed, 2168 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index a200843877fc..72f8caa0e46a 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -102,7 +102,7 @@ TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; * @returns {boolean} is valid ESTree class member */ function isESTreeClassMember(node) { - return node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.SemicolonClassElement; + return node.kind !== SyntaxKind.SemicolonClassElement; } /** @@ -946,6 +946,19 @@ module.exports = function(ast, extra) { } break; + case SyntaxKind.PropertyDeclaration: + assign(result, { + type: "ClassProperty", + key: convertChild(node.name), + value: convertChild(node.initializer), + computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + static: Boolean(node.flags & ts.NodeFlags.Static), + decorators: (node.decorators) ? node.decorators.map(function(d) { + return convertChild(d.expression); + }) : [] + }); + break; + case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.MethodDeclaration: diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js new file mode 100644 index 000000000000..481d09fd8f04 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js @@ -0,0 +1,644 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 88 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 88 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "name": "SomeComponent" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "computed": false, + "decorators": [ + { + "arguments": [], + "callee": { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "name": "Input", + "range": [ + 27, + 32 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "range": [ + 27, + 34 + ], + "type": "CallExpression" + } + ], + "key": { + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 13, + "line": 2 + } + }, + "name": "data", + "range": [ + 35, + 39 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 18, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 26, + 40 + ], + "static": false, + "type": "ClassProperty", + "value": null + }, + { + "computed": false, + "decorators": [ + { + "arguments": [], + "callee": { + "loc": { + "end": { + "column": 11, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + }, + "name": "Output", + "range": [ + 46, + 52 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 13, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + }, + "range": [ + 46, + 54 + ], + "type": "CallExpression" + } + ], + "key": { + "loc": { + "end": { + "column": 9, + "line": 4 + }, + "start": { + "column": 4, + "line": 4 + } + }, + "name": "click", + "range": [ + 59, + 64 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 31, + "line": 4 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "range": [ + 45, + 86 + ], + "static": false, + "type": "ClassProperty", + "value": { + "arguments": [], + "callee": { + "loc": { + "end": { + "column": 28, + "line": 4 + }, + "start": { + "column": 16, + "line": 4 + } + }, + "name": "EventEmitter", + "range": [ + 71, + 83 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 30, + "line": 4 + }, + "start": { + "column": 12, + "line": 4 + } + }, + "range": [ + 67, + 85 + ], + "type": "NewExpression" + } + } + ], + "range": [ + 20, + 88 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "SomeComponent", + "range": [ + 6, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Input", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "data", + "range": [ + 35, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Output", + "range": [ + 46, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "click", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 67, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "EventEmitter", + "range": [ + 71, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts new file mode 100644 index 000000000000..4e618d12dc37 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts @@ -0,0 +1,5 @@ +class SomeComponent { + @Input() data; + @Output() + click = new EventEmitter(); +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js new file mode 100644 index 000000000000..7cea7de243cc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js @@ -0,0 +1,631 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 93 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 93 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "ClassProperty", + "range": [ + 14, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "key": { + "type": "Identifier", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "name": "prop1" + }, + "value": null, + "computed": false, + "static": true, + "decorators": [ + { + "type": "CallExpression", + "range": [ + 15, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "configurable" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "value": true, + "raw": "true" + } + ] + } + ] + }, + { + "type": "ClassProperty", + "range": [ + 53, + 91 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 5, + "column": 17 + } + }, + "key": { + "type": "Identifier", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + }, + "name": "prop2" + }, + "value": null, + "computed": false, + "static": true, + "decorators": [ + { + "type": "CallExpression", + "range": [ + 54, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 54, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "name": "configurable" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 67, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + }, + "value": false, + "raw": "false" + } + ] + } + ] + } + ], + "range": [ + 8, + 93 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "configurable", + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 34, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "prop1", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "configurable", + "range": [ + 54, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 67, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 78, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "prop2", + "range": [ + 85, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts new file mode 100644 index 000000000000..c49b797bf305 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts @@ -0,0 +1,6 @@ +class A { + @configurable(true) static prop1; + + @configurable(false) + static prop2; +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js new file mode 100644 index 000000000000..cf4a2513ccde --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js @@ -0,0 +1,411 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "B" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "ClassProperty", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "key": { + "type": "Identifier", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "name": "x" + }, + "value": null, + "computed": false, + "static": false, + "decorators": [ + { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "foo" + } + ] + }, + { + "type": "ClassProperty", + "range": [ + 26, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 4, + "column": 6 + } + }, + "key": { + "type": "Identifier", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "name": "y" + }, + "value": null, + "computed": false, + "static": false, + "decorators": [ + { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "name": "bar" + } + ] + } + ], + "range": [ + 8, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts new file mode 100644 index 000000000000..8b13a2f4c09b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts @@ -0,0 +1,5 @@ +class B { + @foo x; + @bar + y; +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js new file mode 100644 index 000000000000..f0d009cca81d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js @@ -0,0 +1,447 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "C" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "ClassProperty", + "range": [ + 14, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "key": { + "type": "Identifier", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "a" + }, + "value": null, + "computed": false, + "static": true, + "decorators": [ + { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "baz" + } + ] + }, + { + "type": "ClassProperty", + "range": [ + 33, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "key": { + "type": "Identifier", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "name": "b" + }, + "value": null, + "computed": false, + "static": true, + "decorators": [ + { + "type": "Identifier", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "name": "qux" + } + ] + } + ], + "range": [ + 8, + 53 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 19, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "qux", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts new file mode 100644 index 000000000000..df529500e508 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.src.ts @@ -0,0 +1,5 @@ +class C { + @baz static a; + @qux + static b; +} From f4648c04f7630eccaf9d60853122bcaf3cbdb4ec Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 29 Aug 2016 20:11:27 +0100 Subject: [PATCH 047/326] New: Add accessor decorators to AST (fixes #63) (#73) --- ...ecorator-factory-instance-member.result.js | 645 ++++++++++++++ ...r-decorator-factory-instance-member.src.ts | 4 + ...-decorator-factory-static-member.result.js | 793 ++++++++++++++++++ ...sor-decorator-factory-static-member.src.ts | 4 + ...cessor-decorator-instance-member.result.js | 553 ++++++++++++ .../accessor-decorator-instance-member.src.ts | 4 + ...accessor-decorator-static-member.result.js | 663 +++++++++++++++ .../accessor-decorator-static-member.src.ts | 6 + 8 files changed, 2672 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js new file mode 100644 index 000000000000..59c6570fc671 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js @@ -0,0 +1,645 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "Point" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 18, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "key": { + "type": "Identifier", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "name": "x" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 51, + 70 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 53, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "argument": { + "type": "MemberExpression", + "range": [ + 60, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "object": { + "type": "ThisExpression", + "range": [ + 60, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "range": [ + 65, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "name": "_x" + }, + "computed": false + } + } + ] + }, + "range": [ + 48, + 70 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "get", + "decorators": [ + { + "type": "CallExpression", + "range": [ + 19, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "configurable" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "value": false, + "raw": "false" + } + ] + } + ] + } + ], + "range": [ + 12, + 72 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Point", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "configurable", + "range": [ + 19, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Boolean", + "value": "false", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 60, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "_x", + "range": [ + 65, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts new file mode 100644 index 000000000000..24f2b53691d1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts @@ -0,0 +1,4 @@ +class Point { + @configurable(false) + get x() { return this._x; } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js new file mode 100644 index 000000000000..410be525f634 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js @@ -0,0 +1,793 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 82 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 82 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "Other" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 18, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 42 + } + }, + "key": { + "type": "Identifier", + "range": [ + 53, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "name": "bar" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 59, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 42 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 61, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "argument": { + "type": "MemberExpression", + "range": [ + 68, + 77 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "object": { + "type": "ThisExpression", + "range": [ + 68, + 72 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "range": [ + 73, + 77 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 39 + } + }, + "name": "_bar" + }, + "computed": false + } + } + ] + }, + "range": [ + 56, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 42 + } + }, + "params": [] + }, + "computed": false, + "static": true, + "kind": "get", + "decorators": [ + { + "type": "CallExpression", + "range": [ + 19, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "foo" + }, + "arguments": [ + { + "type": "ObjectExpression", + "range": [ + 23, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "properties": [ + { + "type": "Property", + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "key": { + "type": "Identifier", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "baz" + }, + "value": { + "type": "Literal", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "value": true, + "raw": "true" + }, + "computed": false, + "method": false, + "shorthand": false, + "kind": "init" + } + ] + } + ] + } + ] + } + ], + "range": [ + 12, + 82 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Other", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Boolean", + "value": "true", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 49, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 53, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 61, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 68, + 72 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "_bar", + "range": [ + 73, + 77 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 39 + }, + "end": { + "line": 3, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 41 + }, + "end": { + "line": 3, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts new file mode 100644 index 000000000000..f48e71052ebe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts @@ -0,0 +1,4 @@ +class Other { + @foo({ baz: true }) + static get bar() { return this._bar; } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js new file mode 100644 index 000000000000..ef73cf19c489 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js @@ -0,0 +1,553 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "P" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "key": { + "type": "Identifier", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "name": "z" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 34, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 36, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "argument": { + "type": "MemberExpression", + "range": [ + 43, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "object": { + "type": "ThisExpression", + "range": [ + 43, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "range": [ + 48, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "name": "_z" + }, + "computed": false + } + } + ] + }, + "range": [ + 31, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "get", + "decorators": [ + { + "type": "Identifier", + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "name": "hidden" + } + ] + } + ], + "range": [ + 8, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "P", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "hidden", + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "get", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "z", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 36, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 43, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "_z", + "range": [ + 48, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts new file mode 100644 index 000000000000..4cea72889f61 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts @@ -0,0 +1,4 @@ +class P { + @hidden + get z() { return this._z; } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js new file mode 100644 index 000000000000..1bf4490a1e19 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js @@ -0,0 +1,663 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 78 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 78 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "User" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 17, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "name": "y" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 48, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 58, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "expression": { + "type": "AssignmentExpression", + "range": [ + 58, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "range": [ + 58, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "object": { + "type": "ThisExpression", + "range": [ + 58, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "range": [ + 63, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "name": "_y" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "name": "a" + } + } + } + ] + }, + "range": [ + 44, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "name": "a", + "decorators": [] + } + ] + }, + "computed": false, + "static": true, + "kind": "set", + "decorators": [ + { + "type": "Identifier", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "adminonly" + } + ] + } + ], + "range": [ + 11, + 78 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "User", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "adminonly", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "set", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "y", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 58, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "_y", + "range": [ + 63, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts new file mode 100644 index 000000000000..f9b2964c0f70 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts @@ -0,0 +1,6 @@ +class User { + @adminonly + static set y(a) { + this._y = a; + } +} \ No newline at end of file From 9f6320e6e77a35840b1f1b98fe7391db6bb538fa Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 29 Aug 2016 15:13:33 -0400 Subject: [PATCH 048/326] Build: package.json and changelog update for 0.2.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index aed31fabbfb5..768795fff0e8 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,11 @@ +v0.2.0 - August 29, 2016 + +* 138495f New: Add accessor decorators to AST (fixes #63) (#73) (James Henry) +* f6a8e71 New: Add property decorators to AST (fixes #71) (#72) (James Henry) +* 328259f New: Add param decorators to the AST (fixes #68) (#69) (James Henry) +* 8b97fe7 New: Add class decorators to AST (fixes #66) (#67) (James Henry) +* 7364cb9 New: Add method decorators to AST (fixes #65) (#64) (James Henry) + v0.1.3 - August 22, 2016 * da984bf Fix: manually update package.json after build failure (Nicholas C. Zakas) From abb508d23039020c6a6aa4022d88747316f2f615 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 29 Aug 2016 15:13:34 -0400 Subject: [PATCH 049/326] 0.2.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 613ab3fdeba9..48cb9dadf908 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.1.3", + "version": "0.2.0", "files": [ "lib", "parser.js" From 7a9930431c89acc4e95f828909a329b5e7c4adad Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 7 Sep 2016 21:07:50 +0100 Subject: [PATCH 050/326] Fix: Distinguish between DeclareFunction and FunctionDeclaration (#79) Refs #78 --- .../lib/ast-converter.js | 16 +- .../basics/declare-function.result.js | 313 ++++++++++++++++++ .../typescript/basics/declare-function.src.ts | 1 + 3 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 72f8caa0e46a..b63aa324216c 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -765,22 +765,36 @@ module.exports = function(ast, extra) { // Declarations case SyntaxKind.FunctionDeclaration: + + var functionDeclarationType = "FunctionDeclaration"; + if (node.modifiers && node.modifiers.length) { + var isDeclareFunction = node.modifiers.some(function(modifier) { + return modifier.kind === ts.SyntaxKind.DeclareKeyword; + }); + if (isDeclareFunction) { + functionDeclarationType = "DeclareFunction"; + } + } + assign(result, { - type: "FunctionDeclaration", + type: functionDeclarationType, id: convertChild(node.name), generator: !!node.asteriskToken, expression: false, params: node.parameters.map(convertChild), body: convertChild(node.body) }); + // Process returnType if (node.type) { result.returnType = convertTypeAnnotation(node.type); } + // Process typeParameters if (node.typeParameters && node.typeParameters.length) { result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); } + // check for exports result = fixExports(node, result, ast); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js new file mode 100644 index 000000000000..8531c5b6a66d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js @@ -0,0 +1,313 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "body": [ + { + "type": "DeclareFunction", + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "Identifier", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": "foo" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "bar" + } + ], + "body": null, + "returnType": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 35, + 41 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "flags": 0 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "declare", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.src.ts new file mode 100644 index 000000000000..4f4d10709f56 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.src.ts @@ -0,0 +1 @@ +declare function foo(bar: string): string; \ No newline at end of file From a5c61880d1ac290b4de0a0950632127e6d269f9d Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 12 Sep 2016 19:00:19 +0100 Subject: [PATCH 051/326] Fix: Convert TSTypeOfExpression to UnaryExpression (fixes #85) (#86) --- .../lib/ast-converter.js | 9 ++ .../basics/typeof-expression.result.js | 113 ++++++++++++++++++ .../fixtures/basics/typeof-expression.src.js | 1 + 3 files changed, 123 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index b63aa324216c..23a05c6ceb7e 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1484,6 +1484,15 @@ module.exports = function(ast, extra) { }); break; + case SyntaxKind.TypeOfExpression: + assign(result, { + type: "UnaryExpression", + operator: "typeof", + prefix: true, + argument: convertChild(node.expression) + }); + break; + // Binary Operations case SyntaxKind.BinaryExpression: diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js new file mode 100644 index 000000000000..f2bc9338b4db --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js @@ -0,0 +1,113 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "expression": { + "type": "UnaryExpression", + "operator": "typeof", + "prefix": true, + "range": [ + 0, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "argument": { + "type": "Literal", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "str", + "raw": "'str'" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "typeof", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "String", + "value": "'str'", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.src.js new file mode 100644 index 000000000000..43d0ea77840c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.src.js @@ -0,0 +1 @@ +typeof 'str' From fb55bb2cab6be9b6e63de27569e79f61dd972d6d Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 12 Sep 2016 19:05:22 +0100 Subject: [PATCH 052/326] New: Convert type alias into variable declaration (refs #77) (#83) --- .../lib/ast-converter.js | 13 + .../basics/type-alias-declaration.result.js | 461 ++++++++++++++++++ .../basics/type-alias-declaration.src.ts | 1 + 3 files changed, 475 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 23a05c6ceb7e..2c81255085e8 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1787,6 +1787,19 @@ module.exports = function(ast, extra) { case SyntaxKind.ParenthesizedExpression: return convert(node.expression, parent); + /** + * Convert TypeAliasDeclaration node into VariableDeclaration + * to allow core rules such as "semi" to work automatically + */ + case SyntaxKind.TypeAliasDeclaration: + deeplyCopy(); + assign(result, { + type: "VariableDeclaration", + kind: "type", + declarations: [] + }); + break; + default: deeplyCopy(); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js new file mode 100644 index 000000000000..af8e9a7dc04c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -0,0 +1,461 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "type", + "declarations": [], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "flags": 0, + "name": { + "type": "Identifier", + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "Result" + }, + "typeParameters": [ + { + "type": "TSTypeParameter", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "flags": 0, + "name": { + "type": "Identifier", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "T" + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 17, + 37 + ], + "typeAnnotation": { + "type": "TSUnionType", + "range": [ + 17, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "flags": 0, + "types": [ + { + "type": "TSTypeReference", + "range": [ + 17, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "flags": 0, + "typeName": { + "type": "Identifier", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "Success" + }, + "typeArguments": [ + { + "type": "TSTypeReference", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "flags": 0, + "typeName": { + "type": "Identifier", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "T" + } + } + ] + }, + { + "type": "TSTypeReference", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "flags": 0, + "typeName": { + "type": "Identifier", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "name": "Failure" + } + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "type", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "Result", + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "Success", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "|", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "Failure", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.src.ts new file mode 100644 index 000000000000..c2067d850774 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.src.ts @@ -0,0 +1 @@ +type Result = Success | Failure \ No newline at end of file From 9d030cd36276c4543b9a217541ce66bd0dac4e0d Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 13 Sep 2016 14:16:10 -0400 Subject: [PATCH 053/326] Build: package.json and changelog update for 0.3.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 768795fff0e8..6434161d49a4 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,9 @@ +v0.3.0 - September 13, 2016 + +* e76f3b9 New: Convert type alias into variable declaration (refs #77) (#83) (James Henry) +* 5c47ad5 Fix: Convert TSTypeOfExpression to UnaryExpression (fixes #85) (#86) (James Henry) +* 799fd63 Fix: Distinguish between DeclareFunction and FunctionDeclaration (#79) (James Henry) + v0.2.0 - August 29, 2016 * 138495f New: Add accessor decorators to AST (fixes #63) (#73) (James Henry) From 4803b1731c2c616b810c6d4e60b124ce9727503c Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 13 Sep 2016 14:16:11 -0400 Subject: [PATCH 054/326] 0.3.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 48cb9dadf908..990bb179f1c6 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.2.0", + "version": "0.3.0", "files": [ "lib", "parser.js" From 5878c2aaabb77d90cbb39d0db254873447f152dc Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 16 Sep 2016 12:14:12 +0100 Subject: [PATCH 055/326] Fix: Support abstract classes and methods (fixes #80) (#81) --- .../lib/ast-converter.js | 46 +- ...tract-class-with-abstract-method.result.js | 520 ++++++++++++++++++ ...abstract-class-with-abstract-method.src.ts | 3 + 3 files changed, 561 insertions(+), 8 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 2c81255085e8..b234495a78a0 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1027,13 +1027,26 @@ module.exports = function(ast, extra) { return convertedParam; }); - var methodNameIsComputed = (node.name.kind === SyntaxKind.ComputedPropertyName); + var isMethodNameComputed = (node.name.kind === SyntaxKind.ComputedPropertyName); + + /** + * TypeScript class methods can be defined as "abstract" + */ + var methodDefinitionType = "MethodDefinition"; + if (node.modifiers && node.modifiers.length) { + var isAbstractMethod = node.modifiers.some(function(modifier) { + return modifier.kind === ts.SyntaxKind.AbstractKeyword; + }); + if (isAbstractMethod) { + methodDefinitionType = "TSAbstractMethodDefinition"; + } + } assign(result, { - type: "MethodDefinition", + type: methodDefinitionType, key: convertChild(node.name), value: method, - computed: methodNameIsComputed, + computed: isMethodNameComputed, static: Boolean(node.flags & ts.NodeFlags.Static), kind: "method", decorators: (node.decorators) ? node.decorators.map(function(d) { @@ -1330,15 +1343,32 @@ module.exports = function(ast, extra) { case SyntaxKind.ClassDeclaration: case SyntaxKind.ClassExpression: + var heritageClauses = node.heritageClauses || []; var lastClassToken = heritageClauses.length ? heritageClauses[heritageClauses.length - 1] : node.name; - /** - * We need check for modifiers, and use the last one, as there - * could be multiple before the open brace - */ + var classNodeType = SyntaxKind[node.kind]; + if (node.modifiers && node.modifiers.length) { + + /** + * TypeScript class declarations can be defined as "abstract" + */ + if (node.kind === SyntaxKind.ClassDeclaration) { + var isAbstractClass = node.modifiers.some(function(modifier) { + return modifier.kind === ts.SyntaxKind.AbstractKeyword; + }); + if (isAbstractClass) { + classNodeType = "TSAbstract" + classNodeType; + } + } + + /** + * We need check for modifiers, and use the last one, as there + * could be multiple before the open brace + */ var lastModifier = node.modifiers[node.modifiers.length - 1]; lastClassToken = ts.findNextToken(lastModifier, ast); + } else if (!lastClassToken) { // no name lastClassToken = node.getFirstToken(); } @@ -1355,7 +1385,7 @@ module.exports = function(ast, extra) { hasImplements = heritageClauses.length > 0; assign(result, { - type: SyntaxKind[node.kind], + type: classNodeType, id: convertChild(node.name), body: { type: "ClassBody", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js new file mode 100644 index 000000000000..607b55a69a44 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js @@ -0,0 +1,520 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 86 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "TSAbstractClassDeclaration", + "range": [ + 16, + 86 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "name": "AbstractSocket" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "TSAbstractMethodDefinition", + "range": [ + 43, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "key": { + "type": "Identifier", + "range": [ + 52, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "name": "createSocket" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "generator": false, + "expression": false, + "body": null, + "range": [ + 64, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "returnType": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "range": [ + 68, + 83 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 68, + 83 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 44 + } + }, + "flags": 0, + "typeName": { + "type": "Identifier", + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "name": "Promise" + }, + "typeArguments": [ + { + "type": "TSStringKeyword", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 43 + } + }, + "flags": 0 + } + ] + } + } + }, + "computed": false, + "static": false, + "kind": "method", + "decorators": [] + } + ], + "range": [ + 22, + 86 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 86 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "AbstractSocket", + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 43, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "createSocket", + "range": [ + 52, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "Promise", + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts new file mode 100644 index 000000000000..537036b92f84 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.src.ts @@ -0,0 +1,3 @@ +export abstract class AbstractSocket { + abstract createSocket(): Promise; +} \ No newline at end of file From f90527541985c350eef4def7c6cd63e360bcf65d Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 16 Sep 2016 18:05:47 +0100 Subject: [PATCH 056/326] Fix: Prefix function declarations in TS namespaces (fixes #78) (#82) * Fix: Prefix function declarations in TS namespaces (fixes #78) * Improve the new type namespaces --- .../lib/ast-converter.js | 19 +- ...namespace-with-exported-function.result.js | 590 ++++++++++++++++++ ...re-namespace-with-exported-function.src.ts | 3 + 3 files changed, 611 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index b234495a78a0..dabdb6006187 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -215,8 +215,18 @@ function fixExports(node, result, ast) { result.range[0] = varToken.getStart(); result.loc = getLocFor(result.range[0], result.range[1], ast); + var declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration"; + + /** + * Prefix exports from TypeScript namespaces with "TS" to distinguish + * them from ES2015 exports + */ + if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { + declarationType = "TSNamespaceExportDeclaration"; + } + var newResult = { - type: declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration", + type: declarationType, declaration: result, range: [ exportKeyword.getStart(), result.range[1] ], loc: getLocFor(exportKeyword.getStart(), result.range[1], ast) @@ -776,6 +786,13 @@ module.exports = function(ast, extra) { } } + /** + * Prefix FunctionDeclarations within TypeScript namespaces with "TS" + */ + if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { + functionDeclarationType = "TSNamespaceFunctionDeclaration"; + } + assign(result, { type: functionDeclarationType, id: convertChild(node.name), diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js new file mode 100644 index 000000000000..86d12568221d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js @@ -0,0 +1,590 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSModuleDeclaration", + "range": [ + 0, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "flags": 65540, + "modifiers": [ + { + "type": "TSDeclareKeyword", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "flags": 0 + } + ], + "name": { + "type": "Identifier", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": "d3" + }, + "body": { + "type": "TSModuleBlock", + "range": [ + 21, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "flags": 0, + "statements": [ + { + "type": "TSNamespaceExportDeclaration", + "declaration": { + "type": "TSNamespaceFunctionDeclaration", + "range": [ + 32, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 59 + } + }, + "id": { + "type": "Identifier", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "name": "select" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "name": "selector" + } + ], + "body": null, + "returnType": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 58 + } + }, + "range": [ + 67, + 81 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 67, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 58 + } + }, + "flags": 0, + "typeName": { + "type": "Identifier", + "range": [ + 67, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "name": "Selection" + }, + "typeArguments": [ + { + "type": "TSAnyKeyword", + "range": [ + 77, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 54 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "flags": 0 + } + ] + } + } + }, + "range": [ + 25, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 59 + } + }, + "specifiers": [], + "source": null + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "declare", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "namespace", + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "d3", + "range": [ + 18, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 32, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "select", + "range": [ + 41, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "selector", + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 42 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + { + "type": "Identifier", + "value": "Selection", + "range": [ + 67, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + { + "type": "Identifier", + "value": "any", + "range": [ + 77, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 54 + }, + "end": { + "line": 2, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 57 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.src.ts new file mode 100644 index 000000000000..403557868e70 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.src.ts @@ -0,0 +1,3 @@ +declare namespace d3 { + export function select(selector: string): Selection; +} \ No newline at end of file From 057fbf56c48460e15164a540d773ca545a7eed05 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 20 Sep 2016 21:32:08 +0100 Subject: [PATCH 057/326] Fix: Convert TypeAliasDeclaration into VariableDeclarator (fixes #89) (#91) --- .../lib/ast-converter.js | 12 +- .../basics/type-alias-declaration.result.js | 347 +++++++++--------- 2 files changed, 176 insertions(+), 183 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index dabdb6006187..4b559fb41930 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1839,11 +1839,19 @@ module.exports = function(ast, extra) { * to allow core rules such as "semi" to work automatically */ case SyntaxKind.TypeAliasDeclaration: - deeplyCopy(); + var typeAliasDeclarator = { + type: "VariableDeclarator", + id: convertChild(node.name), + init: convertChild(node.type) + }; + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + typeAliasDeclarator.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } assign(result, { type: "VariableDeclaration", kind: "type", - declarations: [] + declarations: [typeAliasDeclarator] }); break; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js index af8e9a7dc04c..ad813291579e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -18,223 +18,208 @@ module.exports = { { "type": "VariableDeclaration", "kind": "type", - "declarations": [], - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "flags": 0, - "name": { - "type": "Identifier", - "range": [ - 5, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "Result" - }, - "typeParameters": [ + "declarations": [ { - "type": "TSTypeParameter", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "flags": 0, - "name": { + "type": "VariableDeclarator", + "id": { "type": "Identifier", "range": [ - 12, - 13 + 5, + 11 ], "loc": { "start": { "line": 1, - "column": 12 + "column": 5 }, "end": { "line": 1, - "column": 13 + "column": 11 } }, - "name": "T" - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 17 + "name": "Result" }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 17, - 37 - ], - "typeAnnotation": { - "type": "TSUnionType", - "range": [ - 17, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 17 + "typeParameters": { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } }, - "end": { - "line": 1, - "column": 37 - } - }, - "flags": 0, - "types": [ - { - "type": "TSTypeReference", - "range": [ - 17, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 17 + "params": [ + { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 12, + "line": 1 + } }, - "end": { - "line": 1, - "column": 27 - } - }, - "flags": 0, - "typeName": { - "type": "Identifier", + "name": "T", "range": [ - 17, - 24 + 12, + 13 ], + "type": "TypeParameter" + } + ], + "range": [ + 11, + 14 + ], + "type": "TypeParameterDeclaration" + }, + "init": { + "flags": 0, + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 37 + ], + "type": "TSUnionType", + "types": [ + { + "flags": 0, "loc": { - "start": { - "line": 1, - "column": 17 - }, "end": { - "line": 1, - "column": 24 + "column": 27, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 } }, - "name": "Success" - }, - "typeArguments": [ - { - "type": "TSTypeReference", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 + "range": [ + 17, + 27 + ], + "type": "TSTypeReference", + "typeArguments": [ + { + "flags": 0, + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } }, - "end": { - "line": 1, - "column": 26 - } - }, - "flags": 0, - "typeName": { - "type": "Identifier", "range": [ 25, 26 ], - "loc": { - "start": { - "line": 1, - "column": 25 + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "T" + "name": "T", + "range": [ + 25, + 26 + ], + "type": "Identifier" + } } - } - ] - }, - { - "type": "TSTypeReference", - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 + ], + "typeName": { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "name": "Success", + "range": [ + 17, + 24 + ], + "type": "Identifier" } }, - "flags": 0, - "typeName": { - "type": "Identifier", + { + "flags": 0, + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 30, + "line": 1 + } + }, "range": [ 30, 37 ], - "loc": { - "start": { - "line": 1, - "column": 30 + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 30, + "line": 1 + } }, - "end": { - "line": 1, - "column": 37 - } - }, - "name": "Failure" + "name": "Failure", + "range": [ + 30, + 37 + ], + "type": "Identifier" + } } - } - ] + ] + } + } + ], + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 } } } From 631a3368e7eb514bfb8d7cc8531ba1a144e3d0be Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 20 Sep 2016 16:47:00 -0400 Subject: [PATCH 058/326] Build: package.json and changelog update for 0.3.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 6434161d49a4..d1c080642bd7 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,9 @@ +v0.3.1 - September 20, 2016 + +* e36d800 Fix: Convert TypeAliasDeclaration into VariableDeclarator (fixes #89) (#91) (James Henry) +* ac0c95d Fix: Prefix function declarations in TS namespaces (fixes #78) (#82) (James Henry) +* 7cc865e Fix: Support abstract classes and methods (fixes #80) (#81) (James Henry) + v0.3.0 - September 13, 2016 * e76f3b9 New: Convert type alias into variable declaration (refs #77) (#83) (James Henry) From 6ed504395f540673d1d626cf1d847f996459b160 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 20 Sep 2016 16:47:02 -0400 Subject: [PATCH 059/326] 0.3.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 990bb179f1c6..d2a1c5b12af8 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.3.0", + "version": "0.3.1", "files": [ "lib", "parser.js" From fe99217067b2d0c34ae902e0b2453a0e99325371 Mon Sep 17 00:00:00 2001 From: Danny Fritz Date: Tue, 20 Sep 2016 20:52:00 -0600 Subject: [PATCH 060/326] Fix: Tests break with Windows line-endings (fixes #93) (#97) --- packages/typescript-eslint-parser/.gitattributes | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 packages/typescript-eslint-parser/.gitattributes diff --git a/packages/typescript-eslint-parser/.gitattributes b/packages/typescript-eslint-parser/.gitattributes new file mode 100644 index 000000000000..240a8c3f4800 --- /dev/null +++ b/packages/typescript-eslint-parser/.gitattributes @@ -0,0 +1,3 @@ +* text=auto +*.js eol=lf +*.ts eol=lf From eb41427c9e2c939b0b1075027e3ca896a8dbe33d Mon Sep 17 00:00:00 2001 From: Danny Fritz Date: Wed, 21 Sep 2016 02:09:57 -0600 Subject: [PATCH 061/326] New: Accessibility Modifiers (fixes #87) (#88) --- .../lib/ast-converter.js | 29 + .../export-default-anonymous-class.result.js | 1 + .../class-accessor-properties.result.js | 418 +++--- .../class-computed-static-method.result.js | 281 ++-- .../class-method-named-prototype.result.js | 241 ++-- .../class-method-named-static.result.js | 251 ++-- .../classes/class-one-method-super.result.js | 307 ++-- .../classes/class-one-method.result.js | 241 ++-- ...ss-static-method-named-prototype.result.js | 271 ++-- ...class-static-method-named-static.result.js | 261 ++-- .../classes/class-static-method.result.js | 261 ++-- ...-methods-and-accessor-properties.result.js | 555 ++++---- ...lass-two-computed-static-methods.result.js | 428 +++--- ...two-methods-computed-constructor.result.js | 378 ++--- .../classes/class-two-methods-semi.result.js | 368 ++--- .../class-two-methods-three-semi.result.js | 388 ++--- .../class-two-methods-two-semi.result.js | 378 ++--- .../classes/class-two-methods.result.js | 358 ++--- ...static-methods-named-constructor.result.js | 2 + .../classes/class-with-constructor.result.js | 1 + ...tract-class-with-abstract-method.result.js | 7 +- ...ass-with-accessibility-modifiers.result.js | 1253 +++++++++++++++++ .../class-with-accessibility-modifiers.src.ts | 10 + ...ecorator-factory-instance-member.result.js | 3 +- ...-decorator-factory-static-member.result.js | 3 +- ...cessor-decorator-instance-member.result.js | 3 +- ...accessor-decorator-static-member.result.js | 3 +- ...ecorator-factory-instance-member.result.js | 413 +++--- ...-decorator-factory-static-member.result.js | 127 +- ...method-decorator-instance-member.result.js | 35 +- .../method-decorator-static-member.result.js | 35 +- .../parameter-decorator-constructor.result.js | 1 + ...orator-decorator-instance-member.result.js | 165 +-- ...ecorator-decorator-static-member.result.js | 165 +-- ...ameter-decorator-instance-member.result.js | 89 +- ...arameter-decorator-static-member.result.js | 89 +- ...ecorator-factory-instance-member.result.js | 304 ++-- ...-decorator-factory-static-member.result.js | 4 +- ...operty-decorator-instance-member.result.js | 4 +- ...property-decorator-static-member.result.js | 4 +- 40 files changed, 4739 insertions(+), 3396 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 4b559fb41930..3baa3340b067 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -498,6 +498,32 @@ module.exports = function(ast, extra) { }; } + /** + * Gets a TSNode's accessibility level + * @param {TSNode} tsNode The TSNode + * @returns {string | null} accessibility "public", "protected", "private", or null + */ + function getTSNodeAccessibility(tsNode) { + var modifiers = tsNode.modifiers; + if (!modifiers) { + return null; + } + for (var i = 0; i < modifiers.length; i++) { + var modifier = modifiers[i]; + switch (modifier.kind) { + case SyntaxKind.PublicKeyword: + return "public"; + case SyntaxKind.ProtectedKeyword: + return "protected"; + case SyntaxKind.PrivateKeyword: + return "private"; + default: + continue; + } + } + return null; + } + /** * Converts a TSNode's typeParameters array to a flow-like TypeParameterDeclaration node * @param {TSNode[]} typeParameters TSNode typeParameters @@ -984,6 +1010,7 @@ module.exports = function(ast, extra) { value: convertChild(node.initializer), computed: (node.name.kind === SyntaxKind.ComputedPropertyName), static: Boolean(node.flags & ts.NodeFlags.Static), + accessibility: getTSNodeAccessibility(node), decorators: (node.decorators) ? node.decorators.map(function(d) { return convertChild(d.expression); }) : [] @@ -1066,6 +1093,7 @@ module.exports = function(ast, extra) { computed: isMethodNameComputed, static: Boolean(node.flags & ts.NodeFlags.Static), kind: "method", + accessibility: getTSNodeAccessibility(node), decorators: (node.decorators) ? node.decorators.map(function(d) { return convertChild(d.expression); }) : [] @@ -1157,6 +1185,7 @@ module.exports = function(ast, extra) { key: constructorKey, value: constructor, computed: constructorIsComputed, + accessibility: getTSNodeAccessibility(node), static: constructorIsStatic, kind: (constructorIsStatic || constructorIsComputed) ? "method" : "constructor" }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js index d398df2d3fe2..3c28224e503c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js @@ -73,6 +73,7 @@ module.exports = { }, "kind": "method", "computed": false, + "accessibility": null, "decorators": [], "range": [ 103, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js index d00777a47a72..0a8e99030fed 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 32 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 32 } }, - "range": [ - 0, - 32 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 31 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 31 } }, - "range": [ - 0, - 31 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 8, - 31 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 18 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 18 } }, - "range": [ - 9, - 18 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 13, + 14 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 14 } }, - "range": [ - 13, - 14 - ], "name": "a" }, - "static": false, - "kind": "get", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 14, - 18 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 16, + 18 + ], "loc": { "start": { "line": 1, @@ -139,16 +107,36 @@ module.exports = { "column": 18 } }, - "range": [ - 16, - 18 - ], "body": [] - } - } + }, + "range": [ + 14, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "get", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 19, + 29 + ], "loc": { "start": { "line": 1, @@ -159,14 +147,12 @@ module.exports = { "column": 29 } }, - "range": [ - 19, - 29 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -177,16 +163,35 @@ module.exports = { "column": 24 } }, - "range": [ - 23, - 24 - ], "name": "b" }, - "static": false, - "kind": "set", "value": { "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 27, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "body": [] + }, + "range": [ + 24, + 29 + ], "loc": { "start": { "line": 1, @@ -197,16 +202,13 @@ module.exports = { "column": 29 } }, - "range": [ - 24, - 29 - ], - "id": null, - "generator": false, - "expression": false, "params": [ { "type": "Identifier", + "range": [ + 25, + 26 + ], "loc": { "start": { "line": 1, @@ -217,39 +219,43 @@ module.exports = { "column": 26 } }, - "range": [ - 25, - 26 - ], "name": "c", "decorators": [] } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 27, - 29 - ], - "body": [] - } - } + ] + }, + "computed": false, + "static": false, + "kind": "set", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 31, + 32 + ], "loc": { "start": { "line": 1, @@ -259,11 +265,7 @@ module.exports = { "line": 1, "column": 32 } - }, - "range": [ - 31, - 32 - ] + } } ], "sourceType": "script", @@ -271,6 +273,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -280,15 +286,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -298,15 +304,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -316,15 +322,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Identifier", "value": "get", + "range": [ + 9, + 12 + ], "loc": { "start": { "line": 1, @@ -334,15 +340,15 @@ module.exports = { "line": 1, "column": 12 } - }, - "range": [ - 9, - 12 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 13, + 14 + ], "loc": { "start": { "line": 1, @@ -352,15 +358,15 @@ module.exports = { "line": 1, "column": 14 } - }, - "range": [ - 13, - 14 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 1, @@ -370,15 +376,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 14, - 15 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -388,15 +394,15 @@ module.exports = { "line": 1, "column": 16 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -406,15 +412,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -424,15 +430,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Identifier", "value": "set", + "range": [ + 19, + 22 + ], "loc": { "start": { "line": 1, @@ -442,15 +448,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 19, - 22 - ] + } }, { "type": "Identifier", "value": "b", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -460,15 +466,15 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 24, + 25 + ], "loc": { "start": { "line": 1, @@ -478,15 +484,15 @@ module.exports = { "line": 1, "column": 25 } - }, - "range": [ - 24, - 25 - ] + } }, { "type": "Identifier", "value": "c", + "range": [ + 25, + 26 + ], "loc": { "start": { "line": 1, @@ -496,15 +502,15 @@ module.exports = { "line": 1, "column": 26 } - }, - "range": [ - 25, - 26 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 26, + 27 + ], "loc": { "start": { "line": 1, @@ -514,15 +520,15 @@ module.exports = { "line": 1, "column": 27 } - }, - "range": [ - 26, - 27 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 27, + 28 + ], "loc": { "start": { "line": 1, @@ -532,15 +538,15 @@ module.exports = { "line": 1, "column": 28 } - }, - "range": [ - 27, - 28 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 28, + 29 + ], "loc": { "start": { "line": 1, @@ -550,15 +556,15 @@ module.exports = { "line": 1, "column": 29 } - }, - "range": [ - 28, - 29 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 29, + 30 + ], "loc": { "start": { "line": 1, @@ -568,15 +574,15 @@ module.exports = { "line": 1, "column": 30 } - }, - "range": [ - 29, - 30 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 30, + 31 + ], "loc": { "start": { "line": 1, @@ -586,15 +592,15 @@ module.exports = { "line": 1, "column": 31 } - }, - "range": [ - 30, - 31 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 31, + 32 + ], "loc": { "start": { "line": 1, @@ -604,11 +610,7 @@ module.exports = { "line": 1, "column": 32 } - }, - "range": [ - 31, - 32 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js index 1a9bfa6cc5f0..e99cd9825028 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 26 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 26 } }, - "range": [ - 0, - 26 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 25 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 25 } }, - "range": [ - 0, - 25 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 8, - 25 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 23 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 23 } }, - "range": [ - 9, - 23 - ], - "computed": true, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 18 } }, - "range": [ - 17, - 18 - ], "name": "a" }, - "static": true, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 19, - 23 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 21, + 23 + ], "loc": { "start": { "line": 1, @@ -139,19 +107,56 @@ module.exports = { "column": 23 } }, - "range": [ - 21, - 23 - ], "body": [] - } - } + }, + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "params": [] + }, + "computed": true, + "static": true, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 25, + 26 + ], "loc": { "start": { "line": 1, @@ -161,11 +166,7 @@ module.exports = { "line": 1, "column": 26 } - }, - "range": [ - 25, - 26 - ] + } } ], "sourceType": "script", @@ -173,6 +174,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -182,15 +187,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -200,15 +205,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -218,15 +223,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -236,15 +241,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 9, - 15 - ] + } }, { "type": "Punctuator", "value": "[", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -254,15 +259,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -272,15 +277,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": "]", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -290,15 +295,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -308,15 +313,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -326,15 +331,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -344,15 +349,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -362,15 +367,15 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -380,15 +385,15 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 24, + 25 + ], "loc": { "start": { "line": 1, @@ -398,15 +403,15 @@ module.exports = { "line": 1, "column": 25 } - }, - "range": [ - 24, - 25 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 25, + 26 + ], "loc": { "start": { "line": 1, @@ -416,11 +421,7 @@ module.exports = { "line": 1, "column": 26 } - }, - "range": [ - 25, - 26 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js index e14f3a83bfca..05873693e971 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 24 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 24 } }, - "range": [ - 0, - 24 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 23 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 23 } }, - "range": [ - 0, - 23 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 8, - 23 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 22 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 22 } }, - "range": [ - 9, - 22 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 9, + 18 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 18 } }, - "range": [ - 9, - 18 - ], "name": "prototype" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 18, - 22 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 20, + 22 + ], "loc": { "start": { "line": 1, @@ -139,19 +107,56 @@ module.exports = { "column": 22 } }, - "range": [ - 20, - 22 - ], "body": [] - } - } + }, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -161,11 +166,7 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } } ], "sourceType": "script", @@ -173,6 +174,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -182,15 +187,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -200,15 +205,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -218,15 +223,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Identifier", "value": "prototype", + "range": [ + 9, + 18 + ], "loc": { "start": { "line": 1, @@ -236,15 +241,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 9, - 18 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -254,15 +259,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -272,15 +277,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -290,15 +295,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -308,15 +313,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -326,15 +331,15 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -344,11 +349,7 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js index af313d080648..fe5b51227d64 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 22 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 22 } }, - "range": [ - 0, - 22 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 21 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 21 } }, - "range": [ - 0, - 21 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 8, - 21 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 19 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 19 } }, - "range": [ - 9, - 19 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 15 } }, - "range": [ - 9, - 15 - ], "name": "static" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 15, - 19 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 17, + 19 + ], "loc": { "start": { "line": 1, @@ -139,19 +107,56 @@ module.exports = { "column": 19 } }, - "range": [ - 17, - 19 - ], "body": [] - } - } + }, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -161,11 +166,7 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } } ], "sourceType": "script", @@ -173,6 +174,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -182,15 +187,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -200,15 +205,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -218,15 +223,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -236,15 +241,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 9, - 15 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -254,15 +259,15 @@ module.exports = { "line": 1, "column": 16 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -272,15 +277,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -290,15 +295,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -308,15 +313,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -326,15 +331,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -344,15 +349,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -362,11 +367,7 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js index 09ab5eadc091..c785e39f134a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 44 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 2 } }, - "range": [ - 0, - 44 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 43 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 1 } }, - "range": [ - 0, - 43 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 8, - 43 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 14, + 41 + ], "loc": { "start": { "line": 2, @@ -81,14 +68,12 @@ module.exports = { "column": 5 } }, - "range": [ - 14, - 41 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 2, @@ -99,36 +84,19 @@ module.exports = { "column": 5 } }, - "range": [ - 14, - 15 - ], "name": "a" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 15, - 41 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 17, + 41 + ], "loc": { "start": { "line": 2, @@ -139,13 +107,13 @@ module.exports = { "column": 5 } }, - "range": [ - 17, - 41 - ], "body": [ { "type": "ExpressionStatement", + "range": [ + 27, + 35 + ], "loc": { "start": { "line": 3, @@ -156,12 +124,12 @@ module.exports = { "column": 16 } }, - "range": [ - 27, - 35 - ], "expression": { "type": "CallExpression", + "range": [ + 27, + 34 + ], "loc": { "start": { "line": 3, @@ -172,12 +140,12 @@ module.exports = { "column": 15 } }, - "range": [ - 27, - 34 - ], "callee": { "type": "Super", + "range": [ + 27, + 32 + ], "loc": { "start": { "line": 3, @@ -187,24 +155,61 @@ module.exports = { "line": 3, "column": 13 } - }, - "range": [ - 27, - 32 - ] + } }, "arguments": [] } } ] - } - } + }, + "range": [ + 15, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 43, + 44 + ], "loc": { "start": { "line": 5, @@ -214,11 +219,7 @@ module.exports = { "line": 5, "column": 2 } - }, - "range": [ - 43, - 44 - ] + } } ], "sourceType": "script", @@ -226,6 +227,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -235,15 +240,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -253,15 +258,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -271,15 +276,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 2, @@ -289,15 +294,15 @@ module.exports = { "line": 2, "column": 5 } - }, - "range": [ - 14, - 15 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 2, @@ -307,15 +312,15 @@ module.exports = { "line": 2, "column": 6 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 2, @@ -325,15 +330,15 @@ module.exports = { "line": 2, "column": 7 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 2, @@ -343,15 +348,15 @@ module.exports = { "line": 2, "column": 8 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Keyword", "value": "super", + "range": [ + 27, + 32 + ], "loc": { "start": { "line": 3, @@ -361,15 +366,15 @@ module.exports = { "line": 3, "column": 13 } - }, - "range": [ - 27, - 32 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 32, + 33 + ], "loc": { "start": { "line": 3, @@ -379,15 +384,15 @@ module.exports = { "line": 3, "column": 14 } - }, - "range": [ - 32, - 33 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 33, + 34 + ], "loc": { "start": { "line": 3, @@ -397,15 +402,15 @@ module.exports = { "line": 3, "column": 15 } - }, - "range": [ - 33, - 34 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 34, + 35 + ], "loc": { "start": { "line": 3, @@ -415,15 +420,15 @@ module.exports = { "line": 3, "column": 16 } - }, - "range": [ - 34, - 35 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 40, + 41 + ], "loc": { "start": { "line": 4, @@ -433,15 +438,15 @@ module.exports = { "line": 4, "column": 5 } - }, - "range": [ - 40, - 41 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 42, + 43 + ], "loc": { "start": { "line": 5, @@ -451,15 +456,15 @@ module.exports = { "line": 5, "column": 1 } - }, - "range": [ - 42, - 43 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 43, + 44 + ], "loc": { "start": { "line": 5, @@ -469,11 +474,7 @@ module.exports = { "line": 5, "column": 2 } - }, - "range": [ - 43, - 44 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js index 2e2f804759e5..2467802f67a8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 22 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 2 } }, - "range": [ - 0, - 22 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 21 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 1 } }, - "range": [ - 0, - 21 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 8, - 21 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 14, + 19 + ], "loc": { "start": { "line": 2, @@ -81,14 +68,12 @@ module.exports = { "column": 9 } }, - "range": [ - 14, - 19 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 2, @@ -99,36 +84,19 @@ module.exports = { "column": 5 } }, - "range": [ - 14, - 15 - ], "name": "a" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 15, - 19 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 17, + 19 + ], "loc": { "start": { "line": 2, @@ -139,19 +107,56 @@ module.exports = { "column": 9 } }, - "range": [ - 17, - 19 - ], "body": [] - } - } + }, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 3, @@ -161,11 +166,7 @@ module.exports = { "line": 3, "column": 2 } - }, - "range": [ - 21, - 22 - ] + } } ], "sourceType": "script", @@ -173,6 +174,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -182,15 +187,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -200,15 +205,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -218,15 +223,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 2, @@ -236,15 +241,15 @@ module.exports = { "line": 2, "column": 5 } - }, - "range": [ - 14, - 15 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 2, @@ -254,15 +259,15 @@ module.exports = { "line": 2, "column": 6 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 2, @@ -272,15 +277,15 @@ module.exports = { "line": 2, "column": 7 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 2, @@ -290,15 +295,15 @@ module.exports = { "line": 2, "column": 8 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 2, @@ -308,15 +313,15 @@ module.exports = { "line": 2, "column": 9 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 3, @@ -326,15 +331,15 @@ module.exports = { "line": 3, "column": 1 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 3, @@ -344,11 +349,7 @@ module.exports = { "line": 3, "column": 2 } - }, - "range": [ - 21, - 22 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js index 70122340f689..09f4f077b83f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 35 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 35 } }, - "range": [ - 0, - 35 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 34 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 34 } }, - "range": [ - 0, - 34 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 8, - 34 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 33 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 33 } }, - "range": [ - 9, - 33 - ], - "computed": true, - "decorators": [], "key": { "type": "Literal", + "range": [ + 17, + 28 + ], "loc": { "start": { "line": 1, @@ -99,37 +84,20 @@ module.exports = { "column": 28 } }, - "range": [ - 17, - 28 - ], "value": "prototype", "raw": "\"prototype\"" }, - "static": true, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 29, - 33 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 31, + 33 + ], "loc": { "start": { "line": 1, @@ -140,19 +108,56 @@ module.exports = { "column": 33 } }, - "range": [ - 31, - 33 - ], "body": [] - } - } + }, + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "params": [] + }, + "computed": true, + "static": true, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 34, + 35 + ], "loc": { "start": { "line": 1, @@ -162,11 +167,7 @@ module.exports = { "line": 1, "column": 35 } - }, - "range": [ - 34, - 35 - ] + } } ], "sourceType": "script", @@ -174,6 +175,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -183,15 +188,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -201,15 +206,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -219,15 +224,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -237,15 +242,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 9, - 15 - ] + } }, { "type": "Punctuator", "value": "[", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -255,15 +260,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "String", "value": "\"prototype\"", + "range": [ + 17, + 28 + ], "loc": { "start": { "line": 1, @@ -273,15 +278,15 @@ module.exports = { "line": 1, "column": 28 } - }, - "range": [ - 17, - 28 - ] + } }, { "type": "Punctuator", "value": "]", + "range": [ + 28, + 29 + ], "loc": { "start": { "line": 1, @@ -291,15 +296,15 @@ module.exports = { "line": 1, "column": 29 } - }, - "range": [ - 28, - 29 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 29, + 30 + ], "loc": { "start": { "line": 1, @@ -309,15 +314,15 @@ module.exports = { "line": 1, "column": 30 } - }, - "range": [ - 29, - 30 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 30, + 31 + ], "loc": { "start": { "line": 1, @@ -327,15 +332,15 @@ module.exports = { "line": 1, "column": 31 } - }, - "range": [ - 30, - 31 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 31, + 32 + ], "loc": { "start": { "line": 1, @@ -345,15 +350,15 @@ module.exports = { "line": 1, "column": 32 } - }, - "range": [ - 31, - 32 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 32, + 33 + ], "loc": { "start": { "line": 1, @@ -363,15 +368,15 @@ module.exports = { "line": 1, "column": 33 } - }, - "range": [ - 32, - 33 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 33, + 34 + ], "loc": { "start": { "line": 1, @@ -381,15 +386,15 @@ module.exports = { "line": 1, "column": 34 } - }, - "range": [ - 33, - 34 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 34, + 35 + ], "loc": { "start": { "line": 1, @@ -399,11 +404,7 @@ module.exports = { "line": 1, "column": 35 } - }, - "range": [ - 34, - 35 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js index 87526a3553ee..23684f536a4d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 29 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 29 } }, - "range": [ - 0, - 29 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 28 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 28 } }, - "range": [ - 0, - 28 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 8, - 28 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 26 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 26 } }, - "range": [ - 9, - 26 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 16, + 22 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 22 } }, - "range": [ - 16, - 22 - ], "name": "static" }, - "static": true, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 22, - 26 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 24, + 26 + ], "loc": { "start": { "line": 1, @@ -139,19 +107,56 @@ module.exports = { "column": 26 } }, - "range": [ - 24, - 26 - ], "body": [] - } - } + }, + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "params": [] + }, + "computed": false, + "static": true, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 28, + 29 + ], "loc": { "start": { "line": 1, @@ -161,11 +166,7 @@ module.exports = { "line": 1, "column": 29 } - }, - "range": [ - 28, - 29 - ] + } } ], "sourceType": "script", @@ -173,6 +174,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -182,15 +187,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -200,15 +205,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -218,15 +223,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -236,15 +241,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 9, - 15 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 16, + 22 + ], "loc": { "start": { "line": 1, @@ -254,15 +259,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 16, - 22 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -272,15 +277,15 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -290,15 +295,15 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 24, + 25 + ], "loc": { "start": { "line": 1, @@ -308,15 +313,15 @@ module.exports = { "line": 1, "column": 25 } - }, - "range": [ - 24, - 25 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 25, + 26 + ], "loc": { "start": { "line": 1, @@ -326,15 +331,15 @@ module.exports = { "line": 1, "column": 26 } - }, - "range": [ - 25, - 26 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 26, + 27 + ], "loc": { "start": { "line": 1, @@ -344,15 +349,15 @@ module.exports = { "line": 1, "column": 27 } - }, - "range": [ - 26, - 27 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 27, + 28 + ], "loc": { "start": { "line": 1, @@ -362,15 +367,15 @@ module.exports = { "line": 1, "column": 28 } - }, - "range": [ - 27, - 28 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 28, + 29 + ], "loc": { "start": { "line": 1, @@ -380,11 +385,7 @@ module.exports = { "line": 1, "column": 29 } - }, - "range": [ - 28, - 29 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js index d1239b20a8bf..cc8bd151162c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 24 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 24 } }, - "range": [ - 0, - 24 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 23 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 23 } }, - "range": [ - 0, - 23 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 8, - 23 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 21 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 21 } }, - "range": [ - 9, - 21 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 17 } }, - "range": [ - 16, - 17 - ], "name": "a" }, - "static": true, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 17, - 21 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 19, + 21 + ], "loc": { "start": { "line": 1, @@ -139,19 +107,56 @@ module.exports = { "column": 21 } }, - "range": [ - 19, - 21 - ], "body": [] - } - } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "params": [] + }, + "computed": false, + "static": true, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -161,11 +166,7 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } } ], "sourceType": "script", @@ -173,6 +174,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -182,15 +187,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -200,15 +205,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -218,15 +223,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -236,15 +241,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 9, - 15 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -254,15 +259,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -272,15 +277,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -290,15 +295,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -308,15 +313,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -326,15 +331,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -344,15 +349,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -362,15 +367,15 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -380,11 +385,7 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js index 0d737f26f8cb..fb23622d6505 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 59 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 59 } }, - "range": [ - 0, - 59 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 58 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 58 } }, - "range": [ - 0, - 58 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 58 - } - }, - "range": [ - 8, - 58 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 21 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 21 } }, - "range": [ - 9, - 21 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 17 } }, - "range": [ - 16, - 17 - ], "name": "a" }, - "static": true, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 17, - 21 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 19, + 21 + ], "loc": { "start": { "line": 1, @@ -139,16 +107,36 @@ module.exports = { "column": 21 } }, - "range": [ - 19, - 21 - ], "body": [] - } - } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "params": [] + }, + "computed": false, + "static": true, + "kind": "method", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 22, + 38 + ], "loc": { "start": { "line": 1, @@ -159,14 +147,12 @@ module.exports = { "column": 38 } }, - "range": [ - 22, - 38 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 33, + 34 + ], "loc": { "start": { "line": 1, @@ -177,36 +163,19 @@ module.exports = { "column": 34 } }, - "range": [ - 33, - 34 - ], "name": "a" }, - "static": true, - "kind": "get", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 34, - 38 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 36, + 38 + ], "loc": { "start": { "line": 1, @@ -217,16 +186,36 @@ module.exports = { "column": 38 } }, - "range": [ - 36, - 38 - ], "body": [] - } - } + }, + "range": [ + 34, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "params": [] + }, + "computed": false, + "static": true, + "kind": "get", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 39, + 56 + ], "loc": { "start": { "line": 1, @@ -237,14 +226,12 @@ module.exports = { "column": 56 } }, - "range": [ - 39, - 56 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 50, + 51 + ], "loc": { "start": { "line": 1, @@ -255,16 +242,35 @@ module.exports = { "column": 51 } }, - "range": [ - 50, - 51 - ], "name": "a" }, - "static": true, - "kind": "set", "value": { "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 54, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 54 + }, + "end": { + "line": 1, + "column": 56 + } + }, + "body": [] + }, + "range": [ + 51, + 56 + ], "loc": { "start": { "line": 1, @@ -275,16 +281,13 @@ module.exports = { "column": 56 } }, - "range": [ - 51, - 56 - ], - "id": null, - "generator": false, - "expression": false, "params": [ { "type": "Identifier", + "range": [ + 52, + 53 + ], "loc": { "start": { "line": 1, @@ -295,39 +298,43 @@ module.exports = { "column": 53 } }, - "range": [ - 52, - 53 - ], "name": "b", "decorators": [] } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "range": [ - 54, - 56 - ], - "body": [] - } - } + ] + }, + "computed": false, + "static": true, + "kind": "set", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 58 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 58 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 58, + 59 + ], "loc": { "start": { "line": 1, @@ -337,11 +344,7 @@ module.exports = { "line": 1, "column": 59 } - }, - "range": [ - 58, - 59 - ] + } } ], "sourceType": "script", @@ -349,6 +352,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -358,15 +365,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -376,15 +383,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -394,15 +401,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -412,15 +419,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 9, - 15 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -430,15 +437,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -448,15 +455,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -466,15 +473,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -484,15 +491,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -502,15 +509,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 22, + 28 + ], "loc": { "start": { "line": 1, @@ -520,15 +527,15 @@ module.exports = { "line": 1, "column": 28 } - }, - "range": [ - 22, - 28 - ] + } }, { "type": "Identifier", "value": "get", + "range": [ + 29, + 32 + ], "loc": { "start": { "line": 1, @@ -538,15 +545,15 @@ module.exports = { "line": 1, "column": 32 } - }, - "range": [ - 29, - 32 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 33, + 34 + ], "loc": { "start": { "line": 1, @@ -556,15 +563,15 @@ module.exports = { "line": 1, "column": 34 } - }, - "range": [ - 33, - 34 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 34, + 35 + ], "loc": { "start": { "line": 1, @@ -574,15 +581,15 @@ module.exports = { "line": 1, "column": 35 } - }, - "range": [ - 34, - 35 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 35, + 36 + ], "loc": { "start": { "line": 1, @@ -592,15 +599,15 @@ module.exports = { "line": 1, "column": 36 } - }, - "range": [ - 35, - 36 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 36, + 37 + ], "loc": { "start": { "line": 1, @@ -610,15 +617,15 @@ module.exports = { "line": 1, "column": 37 } - }, - "range": [ - 36, - 37 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 37, + 38 + ], "loc": { "start": { "line": 1, @@ -628,15 +635,15 @@ module.exports = { "line": 1, "column": 38 } - }, - "range": [ - 37, - 38 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 39, + 45 + ], "loc": { "start": { "line": 1, @@ -646,15 +653,15 @@ module.exports = { "line": 1, "column": 45 } - }, - "range": [ - 39, - 45 - ] + } }, { "type": "Identifier", "value": "set", + "range": [ + 46, + 49 + ], "loc": { "start": { "line": 1, @@ -664,15 +671,15 @@ module.exports = { "line": 1, "column": 49 } - }, - "range": [ - 46, - 49 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 50, + 51 + ], "loc": { "start": { "line": 1, @@ -682,15 +689,15 @@ module.exports = { "line": 1, "column": 51 } - }, - "range": [ - 50, - 51 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 51, + 52 + ], "loc": { "start": { "line": 1, @@ -700,15 +707,15 @@ module.exports = { "line": 1, "column": 52 } - }, - "range": [ - 51, - 52 - ] + } }, { "type": "Identifier", "value": "b", + "range": [ + 52, + 53 + ], "loc": { "start": { "line": 1, @@ -718,15 +725,15 @@ module.exports = { "line": 1, "column": 53 } - }, - "range": [ - 52, - 53 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 53, + 54 + ], "loc": { "start": { "line": 1, @@ -736,15 +743,15 @@ module.exports = { "line": 1, "column": 54 } - }, - "range": [ - 53, - 54 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 54, + 55 + ], "loc": { "start": { "line": 1, @@ -754,15 +761,15 @@ module.exports = { "line": 1, "column": 55 } - }, - "range": [ - 54, - 55 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 55, + 56 + ], "loc": { "start": { "line": 1, @@ -772,15 +779,15 @@ module.exports = { "line": 1, "column": 56 } - }, - "range": [ - 55, - 56 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 57, + 58 + ], "loc": { "start": { "line": 1, @@ -790,15 +797,15 @@ module.exports = { "line": 1, "column": 58 } - }, - "range": [ - 57, - 58 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 58, + 59 + ], "loc": { "start": { "line": 1, @@ -808,11 +815,7 @@ module.exports = { "line": 1, "column": 59 } - }, - "range": [ - 58, - 59 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js index bdd7db2211ef..ef416cc36e47 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 39 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 39 } }, - "range": [ - 0, - 39 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 38 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 38 } }, - "range": [ - 0, - 38 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 8, - 38 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 22 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 22 } }, - "range": [ - 9, - 22 - ], - "computed": true, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 17 } }, - "range": [ - 16, - 17 - ], "name": "a" }, - "static": true, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 18, - 22 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 20, + 22 + ], "loc": { "start": { "line": 1, @@ -139,16 +107,36 @@ module.exports = { "column": 22 } }, - "range": [ - 20, - 22 - ], "body": [] - } - } + }, + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "params": [] + }, + "computed": true, + "static": true, + "kind": "method", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 24, + 37 + ], "loc": { "start": { "line": 1, @@ -159,14 +147,12 @@ module.exports = { "column": 37 } }, - "range": [ - 24, - 37 - ], - "computed": true, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 31, + 32 + ], "loc": { "start": { "line": 1, @@ -177,36 +163,19 @@ module.exports = { "column": 32 } }, - "range": [ - 31, - 32 - ], "name": "b" }, - "static": true, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 33, - 37 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 35, + 37 + ], "loc": { "start": { "line": 1, @@ -217,19 +186,56 @@ module.exports = { "column": 37 } }, - "range": [ - 35, - 37 - ], "body": [] - } - } + }, + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "params": [] + }, + "computed": true, + "static": true, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 38, + 39 + ], "loc": { "start": { "line": 1, @@ -239,11 +245,7 @@ module.exports = { "line": 1, "column": 39 } - }, - "range": [ - 38, - 39 - ] + } } ], "sourceType": "script", @@ -251,6 +253,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -260,15 +266,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -278,15 +284,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -296,15 +302,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 9, + 15 + ], "loc": { "start": { "line": 1, @@ -314,15 +320,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 9, - 15 - ] + } }, { "type": "Punctuator", "value": "[", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -332,15 +338,15 @@ module.exports = { "line": 1, "column": 16 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -350,15 +356,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "]", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -368,15 +374,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -386,15 +392,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -404,15 +410,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -422,15 +428,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -440,15 +446,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -458,15 +464,15 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } }, { "type": "Keyword", "value": "static", + "range": [ + 24, + 30 + ], "loc": { "start": { "line": 1, @@ -476,15 +482,15 @@ module.exports = { "line": 1, "column": 30 } - }, - "range": [ - 24, - 30 - ] + } }, { "type": "Punctuator", "value": "[", + "range": [ + 30, + 31 + ], "loc": { "start": { "line": 1, @@ -494,15 +500,15 @@ module.exports = { "line": 1, "column": 31 } - }, - "range": [ - 30, - 31 - ] + } }, { "type": "Identifier", "value": "b", + "range": [ + 31, + 32 + ], "loc": { "start": { "line": 1, @@ -512,15 +518,15 @@ module.exports = { "line": 1, "column": 32 } - }, - "range": [ - 31, - 32 - ] + } }, { "type": "Punctuator", "value": "]", + "range": [ + 32, + 33 + ], "loc": { "start": { "line": 1, @@ -530,15 +536,15 @@ module.exports = { "line": 1, "column": 33 } - }, - "range": [ - 32, - 33 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 33, + 34 + ], "loc": { "start": { "line": 1, @@ -548,15 +554,15 @@ module.exports = { "line": 1, "column": 34 } - }, - "range": [ - 33, - 34 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 34, + 35 + ], "loc": { "start": { "line": 1, @@ -566,15 +572,15 @@ module.exports = { "line": 1, "column": 35 } - }, - "range": [ - 34, - 35 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 35, + 36 + ], "loc": { "start": { "line": 1, @@ -584,15 +590,15 @@ module.exports = { "line": 1, "column": 36 } - }, - "range": [ - 35, - 36 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 36, + 37 + ], "loc": { "start": { "line": 1, @@ -602,15 +608,15 @@ module.exports = { "line": 1, "column": 37 } - }, - "range": [ - 36, - 37 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 37, + 38 + ], "loc": { "start": { "line": 1, @@ -620,15 +626,15 @@ module.exports = { "line": 1, "column": 38 } - }, - "range": [ - 37, - 38 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 38, + 39 + ], "loc": { "start": { "line": 1, @@ -638,11 +644,7 @@ module.exports = { "line": 1, "column": 39 } - }, - "range": [ - 38, - 39 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js index 33903c23fab4..2f2f5176297d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 48 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 48 } }, - "range": [ - 0, - 48 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 47 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 47 } }, - "range": [ - 0, - 47 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 8, - 47 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 26 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 26 } }, - "range": [ - 9, - 26 - ], - "computed": false, - "decorators": [], "key": { "type": "Literal", + "range": [ + 9, + 22 + ], "loc": { "start": { "line": 1, @@ -99,37 +84,20 @@ module.exports = { "column": 22 } }, - "range": [ - 9, - 22 - ], "value": "constructor", "raw": "\"constructor\"" }, - "static": false, - "kind": "constructor", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 22, - 26 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 24, + 26 + ], "loc": { "start": { "line": 1, @@ -140,16 +108,36 @@ module.exports = { "column": 26 } }, - "range": [ - 24, - 26 - ], "body": [] - } - } + }, + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "constructor", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 27, + 46 + ], "loc": { "start": { "line": 1, @@ -160,14 +148,12 @@ module.exports = { "column": 46 } }, - "range": [ - 27, - 46 - ], - "computed": true, - "decorators": [], "key": { "type": "Literal", + "range": [ + 28, + 41 + ], "loc": { "start": { "line": 1, @@ -178,37 +164,20 @@ module.exports = { "column": 41 } }, - "range": [ - 28, - 41 - ], "value": "constructor", "raw": "\"constructor\"" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 42, - 46 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 44, + 46 + ], "loc": { "start": { "line": 1, @@ -219,19 +188,56 @@ module.exports = { "column": 46 } }, - "range": [ - 44, - 46 - ], "body": [] - } - } + }, + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "params": [] + }, + "computed": true, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 47, + 48 + ], "loc": { "start": { "line": 1, @@ -241,11 +247,7 @@ module.exports = { "line": 1, "column": 48 } - }, - "range": [ - 47, - 48 - ] + } } ], "sourceType": "script", @@ -253,6 +255,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -262,15 +268,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -280,15 +286,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -298,15 +304,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "String", "value": "\"constructor\"", + "range": [ + 9, + 22 + ], "loc": { "start": { "line": 1, @@ -316,15 +322,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 9, - 22 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -334,15 +340,15 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -352,15 +358,15 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 24, + 25 + ], "loc": { "start": { "line": 1, @@ -370,15 +376,15 @@ module.exports = { "line": 1, "column": 25 } - }, - "range": [ - 24, - 25 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 25, + 26 + ], "loc": { "start": { "line": 1, @@ -388,15 +394,15 @@ module.exports = { "line": 1, "column": 26 } - }, - "range": [ - 25, - 26 - ] + } }, { "type": "Punctuator", "value": "[", + "range": [ + 27, + 28 + ], "loc": { "start": { "line": 1, @@ -406,15 +412,15 @@ module.exports = { "line": 1, "column": 28 } - }, - "range": [ - 27, - 28 - ] + } }, { "type": "String", "value": "\"constructor\"", + "range": [ + 28, + 41 + ], "loc": { "start": { "line": 1, @@ -424,15 +430,15 @@ module.exports = { "line": 1, "column": 41 } - }, - "range": [ - 28, - 41 - ] + } }, { "type": "Punctuator", "value": "]", + "range": [ + 41, + 42 + ], "loc": { "start": { "line": 1, @@ -442,15 +448,15 @@ module.exports = { "line": 1, "column": 42 } - }, - "range": [ - 41, - 42 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 42, + 43 + ], "loc": { "start": { "line": 1, @@ -460,15 +466,15 @@ module.exports = { "line": 1, "column": 43 } - }, - "range": [ - 42, - 43 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 43, + 44 + ], "loc": { "start": { "line": 1, @@ -478,15 +484,15 @@ module.exports = { "line": 1, "column": 44 } - }, - "range": [ - 43, - 44 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 44, + 45 + ], "loc": { "start": { "line": 1, @@ -496,15 +502,15 @@ module.exports = { "line": 1, "column": 45 } - }, - "range": [ - 44, - 45 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 45, + 46 + ], "loc": { "start": { "line": 1, @@ -514,15 +520,15 @@ module.exports = { "line": 1, "column": 46 } - }, - "range": [ - 45, - 46 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 46, + 47 + ], "loc": { "start": { "line": 1, @@ -532,15 +538,15 @@ module.exports = { "line": 1, "column": 47 } - }, - "range": [ - 46, - 47 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 47, + 48 + ], "loc": { "start": { "line": 1, @@ -550,11 +556,7 @@ module.exports = { "line": 1, "column": 48 } - }, - "range": [ - 47, - 48 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js index dbd94acbca3f..91a8ef97fcfd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 22 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 22 } }, - "range": [ - 0, - 22 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 21 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 21 } }, - "range": [ - 0, - 21 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 8, - 21 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 14 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 14 } }, - "range": [ - 9, - 14 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 9, + 10 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 10 } }, - "range": [ - 9, - 10 - ], "name": "a" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 10, - 14 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 12, + 14 + ], "loc": { "start": { "line": 1, @@ -139,16 +107,36 @@ module.exports = { "column": 14 } }, - "range": [ - 12, - 14 - ], "body": [] - } - } + }, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 15, + 20 + ], "loc": { "start": { "line": 1, @@ -159,14 +147,12 @@ module.exports = { "column": 20 } }, - "range": [ - 15, - 20 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -177,36 +163,19 @@ module.exports = { "column": 16 } }, - "range": [ - 15, - 16 - ], "name": "b" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 16, - 20 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 18, + 20 + ], "loc": { "start": { "line": 1, @@ -217,19 +186,56 @@ module.exports = { "column": 20 } }, - "range": [ - 18, - 20 - ], "body": [] - } - } + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -239,11 +245,7 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } } ], "sourceType": "script", @@ -251,6 +253,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -260,15 +266,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -278,15 +284,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -296,15 +302,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 9, + 10 + ], "loc": { "start": { "line": 1, @@ -314,15 +320,15 @@ module.exports = { "line": 1, "column": 10 } - }, - "range": [ - 9, - 10 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 10, + 11 + ], "loc": { "start": { "line": 1, @@ -332,15 +338,15 @@ module.exports = { "line": 1, "column": 11 } - }, - "range": [ - 10, - 11 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 11, + 12 + ], "loc": { "start": { "line": 1, @@ -350,15 +356,15 @@ module.exports = { "line": 1, "column": 12 } - }, - "range": [ - 11, - 12 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 12, + 13 + ], "loc": { "start": { "line": 1, @@ -368,15 +374,15 @@ module.exports = { "line": 1, "column": 13 } - }, - "range": [ - 12, - 13 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 13, + 14 + ], "loc": { "start": { "line": 1, @@ -386,15 +392,15 @@ module.exports = { "line": 1, "column": 14 } - }, - "range": [ - 13, - 14 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 1, @@ -404,15 +410,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 14, - 15 - ] + } }, { "type": "Identifier", "value": "b", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -422,15 +428,15 @@ module.exports = { "line": 1, "column": 16 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -440,15 +446,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -458,15 +464,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -476,15 +482,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -494,15 +500,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -512,15 +518,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -530,11 +536,7 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js index 01cd529de260..2093dba34364 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 24 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 24 } }, - "range": [ - 0, - 24 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 23 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 23 } }, - "range": [ - 0, - 23 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 8, - 23 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 10, + 15 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 15 } }, - "range": [ - 10, - 15 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 10, + 11 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 11 } }, - "range": [ - 10, - 11 - ], "name": "a" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 11, - 15 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 13, + 15 + ], "loc": { "start": { "line": 1, @@ -139,16 +107,36 @@ module.exports = { "column": 15 } }, - "range": [ - 13, - 15 - ], "body": [] - } - } + }, + "range": [ + 11, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 16, + 21 + ], "loc": { "start": { "line": 1, @@ -159,14 +147,12 @@ module.exports = { "column": 21 } }, - "range": [ - 16, - 21 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -177,36 +163,19 @@ module.exports = { "column": 17 } }, - "range": [ - 16, - 17 - ], "name": "b" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 17, - 21 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 19, + 21 + ], "loc": { "start": { "line": 1, @@ -217,19 +186,56 @@ module.exports = { "column": 21 } }, - "range": [ - 19, - 21 - ], "body": [] - } - } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -239,11 +245,7 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } } ], "sourceType": "script", @@ -251,6 +253,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -260,15 +266,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -278,15 +284,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -296,15 +302,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 9, + 10 + ], "loc": { "start": { "line": 1, @@ -314,15 +320,15 @@ module.exports = { "line": 1, "column": 10 } - }, - "range": [ - 9, - 10 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 10, + 11 + ], "loc": { "start": { "line": 1, @@ -332,15 +338,15 @@ module.exports = { "line": 1, "column": 11 } - }, - "range": [ - 10, - 11 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 11, + 12 + ], "loc": { "start": { "line": 1, @@ -350,15 +356,15 @@ module.exports = { "line": 1, "column": 12 } - }, - "range": [ - 11, - 12 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 12, + 13 + ], "loc": { "start": { "line": 1, @@ -368,15 +374,15 @@ module.exports = { "line": 1, "column": 13 } - }, - "range": [ - 12, - 13 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 13, + 14 + ], "loc": { "start": { "line": 1, @@ -386,15 +392,15 @@ module.exports = { "line": 1, "column": 14 } - }, - "range": [ - 13, - 14 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 1, @@ -404,15 +410,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 14, - 15 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -422,15 +428,15 @@ module.exports = { "line": 1, "column": 16 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Identifier", "value": "b", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -440,15 +446,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -458,15 +464,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -476,15 +482,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -494,15 +500,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -512,15 +518,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -530,15 +536,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -548,15 +554,15 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 23, + 24 + ], "loc": { "start": { "line": 1, @@ -566,11 +572,7 @@ module.exports = { "line": 1, "column": 24 } - }, - "range": [ - 23, - 24 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js index 9ca6f8147dfa..7a8ff70944e2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 23 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 23 } }, - "range": [ - 0, - 23 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 22 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 22 } }, - "range": [ - 0, - 22 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 8, - 22 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 14 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 14 } }, - "range": [ - 9, - 14 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 9, + 10 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 10 } }, - "range": [ - 9, - 10 - ], "name": "a" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 10, - 14 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 12, + 14 + ], "loc": { "start": { "line": 1, @@ -139,16 +107,36 @@ module.exports = { "column": 14 } }, - "range": [ - 12, - 14 - ], "body": [] - } - } + }, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 15, + 20 + ], "loc": { "start": { "line": 1, @@ -159,14 +147,12 @@ module.exports = { "column": 20 } }, - "range": [ - 15, - 20 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -177,36 +163,19 @@ module.exports = { "column": 16 } }, - "range": [ - 15, - 16 - ], "name": "b" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 16, - 20 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 18, + 20 + ], "loc": { "start": { "line": 1, @@ -217,19 +186,56 @@ module.exports = { "column": 20 } }, - "range": [ - 18, - 20 - ], "body": [] - } - } + }, + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -239,11 +245,7 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } } ], "sourceType": "script", @@ -251,6 +253,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -260,15 +266,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -278,15 +284,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -296,15 +302,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 9, + 10 + ], "loc": { "start": { "line": 1, @@ -314,15 +320,15 @@ module.exports = { "line": 1, "column": 10 } - }, - "range": [ - 9, - 10 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 10, + 11 + ], "loc": { "start": { "line": 1, @@ -332,15 +338,15 @@ module.exports = { "line": 1, "column": 11 } - }, - "range": [ - 10, - 11 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 11, + 12 + ], "loc": { "start": { "line": 1, @@ -350,15 +356,15 @@ module.exports = { "line": 1, "column": 12 } - }, - "range": [ - 11, - 12 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 12, + 13 + ], "loc": { "start": { "line": 1, @@ -368,15 +374,15 @@ module.exports = { "line": 1, "column": 13 } - }, - "range": [ - 12, - 13 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 13, + 14 + ], "loc": { "start": { "line": 1, @@ -386,15 +392,15 @@ module.exports = { "line": 1, "column": 14 } - }, - "range": [ - 13, - 14 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 1, @@ -404,15 +410,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 14, - 15 - ] + } }, { "type": "Identifier", "value": "b", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -422,15 +428,15 @@ module.exports = { "line": 1, "column": 16 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -440,15 +446,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -458,15 +464,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -476,15 +482,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -494,15 +500,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -512,15 +518,15 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 21, + 22 + ], "loc": { "start": { "line": 1, @@ -530,15 +536,15 @@ module.exports = { "line": 1, "column": 22 } - }, - "range": [ - 21, - 22 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 22, + 23 + ], "loc": { "start": { "line": 1, @@ -548,11 +554,7 @@ module.exports = { "line": 1, "column": 23 } - }, - "range": [ - 22, - 23 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js index 57b2dd6f8c2f..d89363049e99 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js @@ -1,5 +1,9 @@ module.exports = { "type": "Program", + "range": [ + 0, + 21 + ], "loc": { "start": { "line": 1, @@ -10,14 +14,13 @@ module.exports = { "column": 21 } }, - "range": [ - 0, - 21 - ], "body": [ { "type": "ClassDeclaration", - "decorators": [], + "range": [ + 0, + 20 + ], "loc": { "start": { "line": 1, @@ -28,12 +31,12 @@ module.exports = { "column": 20 } }, - "range": [ - 0, - 20 - ], "id": { "type": "Identifier", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -44,33 +47,17 @@ module.exports = { "column": 7 } }, - "range": [ - 6, - 7 - ], "name": "A" }, - "superClass": null, - "implements": [], "body": { "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 8, - 20 - ], "body": [ { "type": "MethodDefinition", + "range": [ + 9, + 14 + ], "loc": { "start": { "line": 1, @@ -81,14 +68,12 @@ module.exports = { "column": 14 } }, - "range": [ - 9, - 14 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 9, + 10 + ], "loc": { "start": { "line": 1, @@ -99,36 +84,19 @@ module.exports = { "column": 10 } }, - "range": [ - 9, - 10 - ], "name": "a" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 10, - 14 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 12, + 14 + ], "loc": { "start": { "line": 1, @@ -139,16 +107,36 @@ module.exports = { "column": 14 } }, - "range": [ - 12, - 14 - ], "body": [] - } - } + }, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] }, { "type": "MethodDefinition", + "range": [ + 14, + 19 + ], "loc": { "start": { "line": 1, @@ -159,14 +147,12 @@ module.exports = { "column": 19 } }, - "range": [ - 14, - 19 - ], - "computed": false, - "decorators": [], "key": { "type": "Identifier", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 1, @@ -177,36 +163,19 @@ module.exports = { "column": 15 } }, - "range": [ - 14, - 15 - ], "name": "b" }, - "static": false, - "kind": "method", "value": { "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 15, - 19 - ], "id": null, "generator": false, "expression": false, - "params": [], "body": { "type": "BlockStatement", + "range": [ + 17, + 19 + ], "loc": { "start": { "line": 1, @@ -217,19 +186,56 @@ module.exports = { "column": 19 } }, - "range": [ - 17, - 19 - ], "body": [] - } - } + }, + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } - ] - } + ], + "range": [ + 8, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] }, { "type": "EmptyStatement", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -239,11 +245,7 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } } ], "sourceType": "script", @@ -251,6 +253,10 @@ module.exports = { { "type": "Keyword", "value": "class", + "range": [ + 0, + 5 + ], "loc": { "start": { "line": 1, @@ -260,15 +266,15 @@ module.exports = { "line": 1, "column": 5 } - }, - "range": [ - 0, - 5 - ] + } }, { "type": "Identifier", "value": "A", + "range": [ + 6, + 7 + ], "loc": { "start": { "line": 1, @@ -278,15 +284,15 @@ module.exports = { "line": 1, "column": 7 } - }, - "range": [ - 6, - 7 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 8, + 9 + ], "loc": { "start": { "line": 1, @@ -296,15 +302,15 @@ module.exports = { "line": 1, "column": 9 } - }, - "range": [ - 8, - 9 - ] + } }, { "type": "Identifier", "value": "a", + "range": [ + 9, + 10 + ], "loc": { "start": { "line": 1, @@ -314,15 +320,15 @@ module.exports = { "line": 1, "column": 10 } - }, - "range": [ - 9, - 10 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 10, + 11 + ], "loc": { "start": { "line": 1, @@ -332,15 +338,15 @@ module.exports = { "line": 1, "column": 11 } - }, - "range": [ - 10, - 11 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 11, + 12 + ], "loc": { "start": { "line": 1, @@ -350,15 +356,15 @@ module.exports = { "line": 1, "column": 12 } - }, - "range": [ - 11, - 12 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 12, + 13 + ], "loc": { "start": { "line": 1, @@ -368,15 +374,15 @@ module.exports = { "line": 1, "column": 13 } - }, - "range": [ - 12, - 13 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 13, + 14 + ], "loc": { "start": { "line": 1, @@ -386,15 +392,15 @@ module.exports = { "line": 1, "column": 14 } - }, - "range": [ - 13, - 14 - ] + } }, { "type": "Identifier", "value": "b", + "range": [ + 14, + 15 + ], "loc": { "start": { "line": 1, @@ -404,15 +410,15 @@ module.exports = { "line": 1, "column": 15 } - }, - "range": [ - 14, - 15 - ] + } }, { "type": "Punctuator", "value": "(", + "range": [ + 15, + 16 + ], "loc": { "start": { "line": 1, @@ -422,15 +428,15 @@ module.exports = { "line": 1, "column": 16 } - }, - "range": [ - 15, - 16 - ] + } }, { "type": "Punctuator", "value": ")", + "range": [ + 16, + 17 + ], "loc": { "start": { "line": 1, @@ -440,15 +446,15 @@ module.exports = { "line": 1, "column": 17 } - }, - "range": [ - 16, - 17 - ] + } }, { "type": "Punctuator", "value": "{", + "range": [ + 17, + 18 + ], "loc": { "start": { "line": 1, @@ -458,15 +464,15 @@ module.exports = { "line": 1, "column": 18 } - }, - "range": [ - 17, - 18 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 18, + 19 + ], "loc": { "start": { "line": 1, @@ -476,15 +482,15 @@ module.exports = { "line": 1, "column": 19 } - }, - "range": [ - 18, - 19 - ] + } }, { "type": "Punctuator", "value": "}", + "range": [ + 19, + 20 + ], "loc": { "start": { "line": 1, @@ -494,15 +500,15 @@ module.exports = { "line": 1, "column": 20 } - }, - "range": [ - 19, - 20 - ] + } }, { "type": "Punctuator", "value": ";", + "range": [ + 20, + 21 + ], "loc": { "start": { "line": 1, @@ -512,11 +518,7 @@ module.exports = { "line": 1, "column": 21 } - }, - "range": [ - 20, - 21 - ] + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js index 8f75a8b590db..3fbfccd9586e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js @@ -105,6 +105,7 @@ module.exports = { "name": "constructor" }, "static": true, + "accessibility": null, "kind": "method", "value": { "type": "FunctionExpression", @@ -181,6 +182,7 @@ module.exports = { ], "name": "constructor" }, + "accessibility": null, "static": true, "kind": "method", "value": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js index 81508709e6e1..e082cb6f7494 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js @@ -104,6 +104,7 @@ module.exports = { ], "name": "constructor" }, + "accessibility": null, "static": false, "kind": "constructor", "value": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js index 607b55a69a44..88db264679f0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js @@ -91,7 +91,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [], "generator": false, "expression": false, "body": null, @@ -181,11 +180,13 @@ module.exports = { } ] } - } + }, + "params": [] }, "computed": false, "static": false, "kind": "method", + "accessibility": null, "decorators": [] } ], @@ -517,4 +518,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js new file mode 100644 index 000000000000..354e018cb5fe --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js @@ -0,0 +1,1253 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 173 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 173 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "ClassProperty", + "range": [ + 14, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "key": { + "type": "Identifier", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "name": "bar" + }, + "value": null, + "computed": false, + "static": false, + "accessibility": "private", + "decorators": [] + }, + { + "type": "ClassProperty", + "range": [ + 38, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "key": { + "type": "Identifier", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "name": "baz" + }, + "value": null, + "computed": false, + "static": true, + "accessibility": "public", + "decorators": [] + }, + { + "type": "MethodDefinition", + "range": [ + 68, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "key": { + "type": "Identifier", + "range": [ + 75, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "name": "getBar" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 85, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 91, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 20 + } + }, + "argument": { + "type": "MemberExpression", + "range": [ + 98, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "object": { + "type": "ThisExpression", + "range": [ + 98, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "range": [ + 103, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "name": "bar" + }, + "computed": false + } + } + ] + }, + "range": [ + 81, + 111 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 6, + "column": 3 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": "public", + "decorators": [] + }, + { + "type": "MethodDefinition", + "range": [ + 114, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + }, + "key": { + "type": "Identifier", + "range": [ + 124, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 18 + } + }, + "name": "setBar" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 146, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 34 + }, + "end": { + "line": 9, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 152, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "range": [ + 152, + 166 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "range": [ + 152, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "object": { + "type": "ThisExpression", + "range": [ + 152, + 156 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "range": [ + 157, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 12 + } + }, + "name": "bar" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "range": [ + 163, + 166 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 18 + } + }, + "name": "bar" + } + } + } + ] + }, + "range": [ + 130, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 9, + "column": 3 + } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 132, + 135 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + }, + "name": "bar", + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": "protected", + "decorators": [] + } + ], + "range": [ + 10, + 173 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 10, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "private", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 28, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "public", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 45, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "public", + "range": [ + 68, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "getBar", + "range": [ + 75, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 98, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 103, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "Keyword", + "value": "protected", + "range": [ + 114, + 123 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "setBar", + "range": [ + 124, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 132, + 135 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 138, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 7, + "column": 32 + }, + "end": { + "line": 7, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 7, + "column": 34 + }, + "end": { + "line": 7, + "column": 35 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 152, + 156 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 157, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 163, + 166 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts new file mode 100644 index 000000000000..14b2f8e38750 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.src.ts @@ -0,0 +1,10 @@ +class Foo { + private bar : string; + public static baz : number; + public getBar () { + return this.bar; + } + protected setBar (bar : string) { + this.bar = bar; + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js index 59c6570fc671..2e63f45a7baa 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js @@ -199,6 +199,7 @@ module.exports = { "computed": false, "static": false, "kind": "get", + "accessibility": null, "decorators": [ { "type": "CallExpression", @@ -642,4 +643,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js index 410be525f634..03b6881a976e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js @@ -199,6 +199,7 @@ module.exports = { "computed": false, "static": true, "kind": "get", + "accessibility": null, "decorators": [ { "type": "CallExpression", @@ -790,4 +791,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js index ef73cf19c489..ee29e083e91e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js @@ -199,6 +199,7 @@ module.exports = { "computed": false, "static": false, "kind": "get", + "accessibility": null, "decorators": [ { "type": "Identifier", @@ -550,4 +551,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js index 1bf4490a1e19..a1368f97c19c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js @@ -255,6 +255,7 @@ module.exports = { "computed": false, "static": true, "kind": "set", + "accessibility": null, "decorators": [ { "type": "Identifier", @@ -660,4 +661,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js index 0d2b909270ff..1de1e06f5ba0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "decorators": [], "id": { "type": "Identifier", "range": [ @@ -90,7 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [], "generator": false, "expression": false, "body": { @@ -124,67 +122,69 @@ module.exports = { "line": 3, "column": 23 } - } + }, + "params": [] }, "computed": false, "static": false, "kind": "method", + "accessibility": null, "decorators": [ { - "arguments": [ - { - "loc": { - "end": { - "column": 19, - "line": 2 - }, - "start": { - "column": 14, - "line": 2 - } - }, - "range": [ - 24, - 29 - ], - "raw": "false", - "type": "Literal", - "value": false - } + "type": "CallExpression", + "range": [ + 15, + 30 ], - "callee": { - "loc": { - "end": { - "column": 13, - "line": 2 - }, - "start": { - "column": 5, - "line": 2 - } + "loc": { + "start": { + "line": 2, + "column": 5 }, - "name": "readonly", + "end": { + "line": 2, + "column": 20 + } + }, + "callee": { + "type": "Identifier", "range": [ 15, 23 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 20, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 13 + } }, - "start": { - "column": 5, - "line": 2 - } + "name": "readonly" }, - "range": [ - 15, - 30 - ], - "type": "CallExpression" + "arguments": [ + { + "type": "Literal", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "value": false, + "raw": "false" + } + ] } ] } @@ -205,262 +205,263 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "class", "range": [ 0, 5 ], - "type": "Keyword", - "value": "class" - }, - { "loc": { - "end": { - "column": 7, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, + } + }, + { + "type": "Identifier", + "value": "B", "range": [ 6, 7 ], - "type": "Identifier", - "value": "B" - }, - { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 8, - "line": 1 + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 8, 9 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 5, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Punctuator", + "value": "@", "range": [ 14, 15 ], - "type": "Punctuator", - "value": "@" - }, - { "loc": { - "end": { - "column": 13, - "line": 2 - }, "start": { - "column": 5, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 } - }, + } + }, + { + "type": "Identifier", + "value": "readonly", "range": [ 15, 23 ], - "type": "Identifier", - "value": "readonly" - }, - { "loc": { - "end": { - "column": 14, - "line": 2 - }, "start": { - "column": 13, - "line": 2 + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 23, 24 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 19, - "line": 2 - }, "start": { - "column": 14, - "line": 2 + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 } - }, + } + }, + { + "type": "Boolean", + "value": "false", "range": [ 24, 29 ], - "type": "Boolean", - "value": "false" - }, - { "loc": { - "end": { - "column": 20, - "line": 2 - }, "start": { - "column": 19, - "line": 2 + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 29, 30 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 18, - "line": 3 - }, "start": { - "column": 4, - "line": 3 + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 } - }, + } + }, + { + "type": "Identifier", + "value": "instanceMethod", "range": [ 35, 49 ], - "type": "Identifier", - "value": "instanceMethod" - }, - { "loc": { - "end": { - "column": 19, - "line": 3 - }, "start": { - "column": 18, - "line": 3 + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 18 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 49, 50 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 20, - "line": 3 - }, "start": { - "column": 19, - "line": 3 + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 50, 51 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 22, - "line": 3 - }, "start": { - "column": 21, - "line": 3 + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 52, 53 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 23, - "line": 3 - }, "start": { - "column": 22, - "line": 3 + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 53, 54 ], - "type": "Punctuator", - "value": "}" - }, - { "loc": { - "end": { - "column": 1, - "line": 4 - }, "start": { - "column": 0, - "line": 4 + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 55, 56 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js index 7467cce4e339..f43fb5f28bfa 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "decorators": [], "id": { "type": "Identifier", "range": [ @@ -90,7 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [], "generator": false, "expression": false, "body": { @@ -124,67 +122,69 @@ module.exports = { "line": 3, "column": 28 } - } + }, + "params": [] }, "computed": false, "static": true, "kind": "method", + "accessibility": null, "decorators": [ { - "arguments": [ - { - "loc": { - "end": { - "column": 14, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } - }, - "range": [ - 19, - 24 - ], - "raw": "false", - "type": "Literal", - "value": false - } + "type": "CallExpression", + "range": [ + 15, + 25 ], - "callee": { - "loc": { - "end": { - "column": 8, - "line": 2 - }, - "start": { - "column": 5, - "line": 2 - } + "loc": { + "start": { + "line": 2, + "column": 5 }, - "name": "Foo", + "end": { + "line": 2, + "column": 15 + } + }, + "callee": { + "type": "Identifier", "range": [ 15, 18 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 15, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } }, - "start": { - "column": 5, - "line": 2 - } + "name": "Foo" }, - "range": [ - 15, - 25 - ], - "type": "CallExpression" + "arguments": [ + { + "type": "Literal", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": false, + "raw": "false" + } + ] } ] } @@ -205,7 +205,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -319,22 +320,22 @@ module.exports = { } }, { - "loc": { - "end": { - "column": 14, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } - }, + "type": "Boolean", + "value": "false", "range": [ 19, 24 ], - "type": "Boolean", - "value": "false" + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } }, { "type": "Punctuator", @@ -481,4 +482,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js index b345c0c6719e..e3aa21db6dee 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "decorators": [], "id": { "type": "Identifier", "range": [ @@ -90,7 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [], "generator": false, "expression": false, "body": { @@ -124,29 +122,31 @@ module.exports = { "line": 3, "column": 23 } - } + }, + "params": [] }, "computed": false, "static": false, "kind": "method", + "accessibility": null, "decorators": [ { - "loc": { - "end": { - "column": 13, - "line": 2 - }, - "start": { - "column": 5, - "line": 2 - } - }, - "name": "readonly", + "type": "Identifier", "range": [ 15, 23 ], - "type": "Identifier" + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "name": "readonly" } ] } @@ -167,7 +167,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -371,4 +372,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js index eb6584d67f11..b710d115bfe3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "decorators": [], "id": { "type": "Identifier", "range": [ @@ -90,7 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [], "generator": false, "expression": false, "body": { @@ -124,29 +122,31 @@ module.exports = { "line": 3, "column": 28 } - } + }, + "params": [] }, "computed": false, "static": true, "kind": "method", + "accessibility": null, "decorators": [ { - "loc": { - "end": { - "column": 8, - "line": 2 - }, - "start": { - "column": 5, - "line": 2 - } - }, - "name": "Foo", + "type": "Identifier", "range": [ 15, 18 ], - "type": "Identifier" + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "Foo" } ] } @@ -167,7 +167,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -389,4 +390,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js index 3c8e9a912d4d..868671a79005 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js @@ -345,6 +345,7 @@ module.exports = { } } }, + "accessibility": null, "computed": false, "static": false, "kind": "constructor" diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js index 6e007c55ea65..7bd76baa1021 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js @@ -17,7 +17,6 @@ module.exports = { "body": [ { "type": "ClassDeclaration", - "decorators": [], "range": [ 0, 52 @@ -90,84 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [ - { - "type": "Identifier", - "range": [ - 35, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "name": "baz", - "decorators": [ - { - "arguments": [ - { - "loc": { - "end": { - "column": 21, - "line": 2 - }, - "start": { - "column": 17, - "line": 2 - } - }, - "range": [ - 29, - 33 - ], - "raw": "true", - "type": "Literal", - "value": true - } - ], - "callee": { - "loc": { - "end": { - "column": 16, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } - }, - "name": "special", - "range": [ - 21, - 28 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 22, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } - }, - "range": [ - 21, - 34 - ], - "type": "CallExpression" - } - ] - } - ], "generator": false, "expression": false, "body": { @@ -201,11 +122,90 @@ module.exports = { "line": 2, "column": 38 } - } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "name": "baz", + "decorators": [ + { + "type": "CallExpression", + "range": [ + 21, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "name": "special" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": true, + "raw": "true" + } + ] + } + ] + } + ] }, "computed": false, "static": false, "kind": "method", + "accessibility": null, "decorators": [] } ], @@ -225,7 +225,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -537,4 +538,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js index c0c3934551ca..133ff68ff387 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js @@ -17,7 +17,6 @@ module.exports = { "body": [ { "type": "ClassDeclaration", - "decorators": [], "range": [ 0, 65 @@ -90,84 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [ - { - "type": "Identifier", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "name": "baz", - "decorators": [ - { - "arguments": [ - { - "loc": { - "end": { - "column": 28, - "line": 2 - }, - "start": { - "column": 24, - "line": 2 - } - }, - "range": [ - 42, - 46 - ], - "raw": "true", - "type": "Literal", - "value": true - } - ], - "callee": { - "loc": { - "end": { - "column": 23, - "line": 2 - }, - "start": { - "column": 16, - "line": 2 - } - }, - "name": "special", - "range": [ - 34, - 41 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 29, - "line": 2 - }, - "start": { - "column": 16, - "line": 2 - } - }, - "range": [ - 34, - 47 - ], - "type": "CallExpression" - } - ] - } - ], "generator": false, "expression": false, "body": { @@ -201,11 +122,90 @@ module.exports = { "line": 2, "column": 45 } - } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 48, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "name": "baz", + "decorators": [ + { + "type": "CallExpression", + "range": [ + 34, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "name": "special" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "value": true, + "raw": "true" + } + ] + } + ] + } + ] }, "computed": false, "static": true, "kind": "method", + "accessibility": null, "decorators": [] } ], @@ -225,7 +225,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -555,4 +556,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js index 7a14d2775994..fe8711c9e92e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js @@ -17,7 +17,6 @@ module.exports = { "body": [ { "type": "ClassDeclaration", - "decorators": [], "range": [ 0, 97 @@ -90,46 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [ - { - "type": "Identifier", - "range": [ - 36, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "name": "name", - "decorators": [ - { - "loc": { - "end": { - "column": 19, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 - } - }, - "name": "required", - "range": [ - 27, - 35 - ], - "type": "Identifier" - } - ] - } - ], "generator": false, "expression": false, "body": { @@ -273,11 +232,52 @@ module.exports = { "line": 4, "column": 5 } - } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 36, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "name": "name", + "decorators": [ + { + "type": "Identifier", + "range": [ + 27, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "required" + } + ] + } + ] }, "computed": false, "static": false, "kind": "method", + "accessibility": null, "decorators": [] } ], @@ -297,7 +297,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -681,4 +682,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js index 99c154b1555e..980489547ed6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js @@ -17,7 +17,6 @@ module.exports = { "body": [ { "type": "ClassDeclaration", - "decorators": [], "range": [ 0, 110 @@ -90,46 +89,6 @@ module.exports = { "value": { "type": "FunctionExpression", "id": null, - "params": [ - { - "type": "Identifier", - "range": [ - 49, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 31 - } - }, - "name": "name", - "decorators": [ - { - "loc": { - "end": { - "column": 26, - "line": 2 - }, - "start": { - "column": 18, - "line": 2 - } - }, - "name": "required", - "range": [ - 40, - 48 - ], - "type": "Identifier" - } - ] - } - ], "generator": false, "expression": false, "body": { @@ -273,11 +232,52 @@ module.exports = { "line": 4, "column": 5 } - } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "name": "name", + "decorators": [ + { + "type": "Identifier", + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "name": "required" + } + ] + } + ] }, "computed": false, "static": true, "kind": "method", + "accessibility": null, "decorators": [] } ], @@ -297,7 +297,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -699,4 +700,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js index 481d09fd8f04..13d258bf263e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js @@ -53,191 +53,193 @@ module.exports = { "type": "ClassBody", "body": [ { - "computed": false, - "decorators": [ - { - "arguments": [], - "callee": { - "loc": { - "end": { - "column": 10, - "line": 2 - }, - "start": { - "column": 5, - "line": 2 - } - }, - "name": "Input", - "range": [ - 27, - 32 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 12, - "line": 2 - }, - "start": { - "column": 5, - "line": 2 - } - }, - "range": [ - 27, - 34 - ], - "type": "CallExpression" - } + "type": "ClassProperty", + "range": [ + 26, + 40 ], - "key": { - "loc": { - "end": { - "column": 17, - "line": 2 - }, - "start": { - "column": 13, - "line": 2 - } + "loc": { + "start": { + "line": 2, + "column": 4 }, - "name": "data", + "end": { + "line": 2, + "column": 18 + } + }, + "key": { + "type": "Identifier", "range": [ 35, 39 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 18, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } }, - "start": { - "column": 4, - "line": 2 - } + "name": "data" }, - "range": [ - 26, - 40 - ], - "static": false, - "type": "ClassProperty", - "value": null - }, - { + "value": null, "computed": false, + "static": false, + "accessibility": null, "decorators": [ { - "arguments": [], + "type": "CallExpression", + "range": [ + 27, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 12 + } + }, "callee": { + "type": "Identifier", + "range": [ + 27, + 32 + ], "loc": { - "end": { - "column": 11, - "line": 3 - }, "start": { - "column": 5, - "line": 3 + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 } }, - "name": "Output", - "range": [ - 46, - 52 - ], - "type": "Identifier" + "name": "Input" }, - "loc": { - "end": { - "column": 13, - "line": 3 - }, - "start": { - "column": 5, - "line": 3 - } - }, - "range": [ - 46, - 54 - ], - "type": "CallExpression" + "arguments": [] } + ] + }, + { + "type": "ClassProperty", + "range": [ + 45, + 86 ], - "key": { - "loc": { - "end": { - "column": 9, - "line": 4 - }, - "start": { - "column": 4, - "line": 4 - } + "loc": { + "start": { + "line": 3, + "column": 4 }, - "name": "click", + "end": { + "line": 4, + "column": 31 + } + }, + "key": { + "type": "Identifier", "range": [ 59, 64 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 31, - "line": 4 + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 9 + } }, - "start": { - "column": 4, - "line": 3 - } + "name": "click" }, - "range": [ - 45, - 86 - ], - "static": false, - "type": "ClassProperty", "value": { - "arguments": [], + "type": "NewExpression", + "range": [ + 67, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 30 + } + }, "callee": { + "type": "Identifier", + "range": [ + 71, + 83 + ], "loc": { - "end": { - "column": 28, - "line": 4 - }, "start": { - "column": 16, - "line": 4 + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 28 } }, - "name": "EventEmitter", + "name": "EventEmitter" + }, + "arguments": [] + }, + "computed": false, + "static": false, + "accessibility": null, + "decorators": [ + { + "type": "CallExpression", "range": [ - 71, - 83 + 46, + 54 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 30, - "line": 4 + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 13 + } }, - "start": { - "column": 12, - "line": 4 - } - }, - "range": [ - 67, - 85 - ], - "type": "NewExpression" - } + "callee": { + "type": "Identifier", + "range": [ + 46, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "name": "Output" + }, + "arguments": [] + } + ] } ], "range": [ @@ -641,4 +643,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js index 7cea7de243cc..4fa4ec4a5fa9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js @@ -89,6 +89,7 @@ module.exports = { "value": null, "computed": false, "static": true, + "accessibility": null, "decorators": [ { "type": "CallExpression", @@ -185,6 +186,7 @@ module.exports = { "value": null, "computed": false, "static": true, + "accessibility": null, "decorators": [ { "type": "CallExpression", @@ -628,4 +630,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js index cf4a2513ccde..fbce854ed9f2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js @@ -89,6 +89,7 @@ module.exports = { "value": null, "computed": false, "static": false, + "accessibility": null, "decorators": [ { "type": "Identifier", @@ -147,6 +148,7 @@ module.exports = { "value": null, "computed": false, "static": false, + "accessibility": null, "decorators": [ { "type": "Identifier", @@ -408,4 +410,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js index f0d009cca81d..46bfead2b630 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js @@ -89,6 +89,7 @@ module.exports = { "value": null, "computed": false, "static": true, + "accessibility": null, "decorators": [ { "type": "Identifier", @@ -147,6 +148,7 @@ module.exports = { "value": null, "computed": false, "static": true, + "accessibility": null, "decorators": [ { "type": "Identifier", @@ -444,4 +446,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file From 4dd6a9001e8c29b5cf34268fe7e3d27c7d3c187f Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 23 Sep 2016 19:25:57 +0100 Subject: [PATCH 062/326] Fix: Add loc and range data to generated VariableDeclarator node (#100) --- .../typescript-eslint-parser/lib/ast-converter.js | 4 +++- .../basics/type-alias-declaration.result.js | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 3baa3340b067..2aaccde31499 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1871,8 +1871,10 @@ module.exports = function(ast, extra) { var typeAliasDeclarator = { type: "VariableDeclarator", id: convertChild(node.name), - init: convertChild(node.type) + init: convertChild(node.type), + range: [node.name.getStart(), node.end] }; + typeAliasDeclarator.loc = getLocFor(typeAliasDeclarator.range[0], typeAliasDeclarator.range[1], ast); // Process typeParameters if (node.typeParameters && node.typeParameters.length) { typeAliasDeclarator.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js index ad813291579e..3f7d479ce1bd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -20,6 +20,20 @@ module.exports = { "kind": "type", "declarations": [ { + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 5, + "line": 1 + } + }, + "range": [ + 5, + 37 + ], "type": "VariableDeclarator", "id": { "type": "Identifier", From a3ab50695ac4892405735652ce2b31d7b44e47b0 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 23 Sep 2016 14:27:08 -0400 Subject: [PATCH 063/326] Build: package.json and changelog update for 0.4.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index d1c080642bd7..b6b3443a807a 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,9 @@ +v0.4.0 - September 23, 2016 + +* eb1ad9b Fix: Add loc and range data to generated VariableDeclarator node (#100) (James Henry) +* 5dae849 New: Accessibility Modifiers (fixes #87) (#88) (Danny Fritz) +* 68992eb Fix: Tests break with Windows line-endings (fixes #93) (#97) (Danny Fritz) + v0.3.1 - September 20, 2016 * e36d800 Fix: Convert TypeAliasDeclaration into VariableDeclarator (fixes #89) (#91) (James Henry) From 2e23c416249cafbe2cec3f4b4a82e5265d3b1de3 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 23 Sep 2016 14:27:08 -0400 Subject: [PATCH 064/326] 0.4.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index d2a1c5b12af8..f14c32f1d6ee 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.3.1", + "version": "0.4.0", "files": [ "lib", "parser.js" From 1ac40b69a386487ddfcad27adfcc0ff73d5bd76b Mon Sep 17 00:00:00 2001 From: Danny Fritz Date: Thu, 29 Sep 2016 15:22:25 -0600 Subject: [PATCH 065/326] Build: Add Node 6.x to Travis (fixes #99) (#98) --- packages/typescript-eslint-parser/.travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index 89058e6f8ae7..5dec3ad5df96 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -3,5 +3,9 @@ sudo: false node_js: - "0.12" - 4 + - 6 +before_script: + - npm install -g npm-install-peers + - npm-install-peers after_success: - npm run coveralls From c42484b2432f0f1a905ccec42e170c490a27975c Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 15 Oct 2016 20:20:18 +0100 Subject: [PATCH 066/326] Fix: Added missing yml lf gitattribute (#104) --- packages/typescript-eslint-parser/.gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typescript-eslint-parser/.gitattributes b/packages/typescript-eslint-parser/.gitattributes index 240a8c3f4800..b9aad4d12c4d 100644 --- a/packages/typescript-eslint-parser/.gitattributes +++ b/packages/typescript-eslint-parser/.gitattributes @@ -1,3 +1,4 @@ * text=auto *.js eol=lf *.ts eol=lf +*.yml eol=lf From a77f220c54eb1d43f739aaf8481b782103fafd95 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 22 Oct 2016 15:43:22 +0100 Subject: [PATCH 067/326] Fix: Rename decorator example to avoid issue in TS 2.x (refs #105) (#106) --- .../method-decorator-factory-instance-member.result.js | 4 ++-- .../method-decorator-factory-instance-member.src.ts | 2 +- .../method-decorator-instance-member.result.js | 4 ++-- .../method-decorators/method-decorator-instance-member.src.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js index 1de1e06f5ba0..50dac49ea01c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js @@ -162,7 +162,7 @@ module.exports = { "column": 13 } }, - "name": "readonly" + "name": "onlyRead" }, "arguments": [ { @@ -285,7 +285,7 @@ module.exports = { }, { "type": "Identifier", - "value": "readonly", + "value": "onlyRead", "range": [ 15, 23 diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts index cb089fb4a9b2..12898791abbd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts @@ -1,4 +1,4 @@ class B { - @readonly(false) + @onlyRead(false) instanceMethod() {} } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js index e3aa21db6dee..d7b78841be4c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js @@ -146,7 +146,7 @@ module.exports = { "column": 13 } }, - "name": "readonly" + "name": "onlyRead" } ] } @@ -247,7 +247,7 @@ module.exports = { }, { "type": "Identifier", - "value": "readonly", + "value": "onlyRead", "range": [ 15, 23 diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts index 4993bde3f8e4..a0e5e11a6190 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts @@ -1,4 +1,4 @@ class A { - @readonly + @onlyRead instanceMethod() {} } From 77b34ce7d9f18ed65343c5730b99827af3127569 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 29 Oct 2016 22:33:39 +0100 Subject: [PATCH 068/326] Fix: Exclude TSNode.flags when deeplyCopy fallback is used (refs #105) (#107) --- packages/typescript-eslint-parser/lib/ast-converter.js | 2 +- .../basics/abstract-class-with-abstract-method.result.js | 4 +--- .../basics/arrow-function-with-type-parameters.result.js | 1 - .../typescript/basics/declare-function.result.js | 3 +-- .../declare-namespace-with-exported-function.result.js | 9 ++------- .../basics/function-with-type-parameters.result.js | 1 - .../typescript/basics/function-with-types.result.js | 3 +-- .../typescript/basics/type-alias-declaration.result.js | 4 ---- .../fixtures/typescript/basics/var-with-type.result.js | 3 +-- 9 files changed, 7 insertions(+), 23 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 2aaccde31499..437f0ec46039 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -589,7 +589,7 @@ module.exports = function(ast, extra) { function deeplyCopy() { result.type = "TS" + SyntaxKind[node.kind]; Object.keys(node).filter(function(key) { - return !(/^(?:kind|parent|pos|end)$/.test(key)); + return !(/^(?:kind|parent|pos|end|flags)$/.test(key)); }).forEach(function(key) { if (key === "type") { result.typeAnnotation = convertTypeAnnotation(node.type); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js index 88db264679f0..082ed354be58 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js @@ -140,7 +140,6 @@ module.exports = { "column": 44 } }, - "flags": 0, "typeName": { "type": "Identifier", "range": [ @@ -175,8 +174,7 @@ module.exports = { "line": 2, "column": 43 } - }, - "flags": 0 + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js index e4945cdfa0b8..e1363c71b330 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js @@ -110,7 +110,6 @@ module.exports = { ], "type": "TypeAnnotation", "typeAnnotation": { - "flags": 0, "loc": { "end": { "column": 12, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js index 8531c5b6a66d..26777383f1e4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js @@ -103,8 +103,7 @@ module.exports = { "line": 1, "column": 41 } - }, - "flags": 0 + } } } } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js index 86d12568221d..c8de4ab60c75 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "flags": 65540, "modifiers": [ { "type": "TSDeclareKeyword", @@ -48,8 +47,7 @@ module.exports = { "line": 1, "column": 7 } - }, - "flags": 0 + } } ], "name": { @@ -86,7 +84,6 @@ module.exports = { "column": 1 } }, - "flags": 0, "statements": [ { "type": "TSNamespaceExportDeclaration", @@ -179,7 +176,6 @@ module.exports = { "column": 58 } }, - "flags": 0, "typeName": { "type": "Identifier", "range": [ @@ -214,8 +210,7 @@ module.exports = { "line": 2, "column": 57 } - }, - "flags": 0 + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js index d60398811f94..4d3ae3e49737 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js @@ -164,7 +164,6 @@ module.exports = { ], "type": "TypeAnnotation", "typeAnnotation": { - "flags": 0, "loc": { "end": { "column": 22, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js index 44c318f6dc3e..013a16a58eb9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js @@ -156,8 +156,7 @@ module.exports = { "line": 1, "column": 36 } - }, - "flags": 0 + } } } } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js index 3f7d479ce1bd..a3e1830e8504 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -91,7 +91,6 @@ module.exports = { "type": "TypeParameterDeclaration" }, "init": { - "flags": 0, "loc": { "end": { "column": 37, @@ -109,7 +108,6 @@ module.exports = { "type": "TSUnionType", "types": [ { - "flags": 0, "loc": { "end": { "column": 27, @@ -127,7 +125,6 @@ module.exports = { "type": "TSTypeReference", "typeArguments": [ { - "flags": 0, "loc": { "end": { "column": 26, @@ -183,7 +180,6 @@ module.exports = { } }, { - "flags": 0, "loc": { "end": { "column": 37, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js index 34cb41799609..5c3b66e19638 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js @@ -96,8 +96,7 @@ module.exports = { "line": 1, "column": 15 } - }, - "flags": 0 + } } } }, From 3b1b37362ddb510f73f77a5fbf3258a1d7c00f35 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Mon, 31 Oct 2016 13:12:56 -0700 Subject: [PATCH 069/326] Docs: Update license copyright --- packages/typescript-eslint-parser/LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/LICENSE b/packages/typescript-eslint-parser/LICENSE index c363e906788d..a2d896685ac9 100644 --- a/packages/typescript-eslint-parser/LICENSE +++ b/packages/typescript-eslint-parser/LICENSE @@ -1,5 +1,5 @@ TypeScript ESLint Parser -Copyright jQuery Foundation and other contributors, https://jquery.org/ +Copyright JS Foundation and other contributors, https://js.foundation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: From 9e56f75e80cb123e0d44fa9001c417b073e52696 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 8 Nov 2016 18:41:22 +0000 Subject: [PATCH 070/326] Breaking: Updated to TypeScript 2.x (fixes #105) (#112) * Breaking: Updated TypeScript peerDependency to ^2.0.3 (refs #105) * Chore: Added test for shorthand-ambient-module-declaration (refs #105) (#109) * Chore: Added test for non-null assertion operator (refs #105) (#110) * Breaking: Update JSX tagName conversion for TS 2 (refs #105) (#108) * Chore: Added test for typed this parameter (fixes #105) * Fix: Add parameter type annotations to the AST (refs #105) (#111) --- .../lib/ast-converter.js | 72 +- .../typescript-eslint-parser/package.json | 2 +- ...ow-function-with-type-parameters.result.js | 734 +++++++++-------- ...ass-with-accessibility-modifiers.result.js | 34 + ...with-implements-generic-multiple.result.js | 6 +- .../class-with-implements-generic.result.js | 6 +- .../basics/class-with-implements.result.js | 6 +- .../basics/declare-function.result.js | 38 +- .../function-with-type-parameters.result.js | 752 +++++++++-------- .../basics/function-with-types.result.js | 36 +- .../non-null-assertion-operator.result.js | 762 ++++++++++++++++++ .../basics/non-null-assertion-operator.src.ts | 4 + .../basics/type-alias-declaration.result.js | 304 +++---- .../typescript/basics/typed-this.result.js | 754 +++++++++++++++++ .../typescript/basics/typed-this.src.ts | 3 + .../class-decorator-factory.result.js | 236 +++--- .../class-decorator.result.js | 44 +- .../parameter-decorator-constructor.result.js | 148 ++-- ...orator-decorator-instance-member.result.js | 34 + ...ecorator-decorator-static-member.result.js | 34 + ...ameter-decorator-instance-member.result.js | 34 + ...arameter-decorator-static-member.result.js | 34 + ...namespace-with-exported-function.result.js | 38 +- ...re-namespace-with-exported-function.src.ts | 0 ...thand-ambient-module-declaration.result.js | 149 ++++ ...horthand-ambient-module-declaration.src.ts | 1 + 26 files changed, 3205 insertions(+), 1060 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.src.ts rename packages/typescript-eslint-parser/tests/fixtures/typescript/{basics => namespaces-and-modules}/declare-namespace-with-exported-function.result.js (89%) rename packages/typescript-eslint-parser/tests/fixtures/typescript/{basics => namespaces-and-modules}/declare-namespace-with-exported-function.src.ts (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 437f0ec46039..f0ded24d50c0 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -244,6 +244,34 @@ function fixExports(node, result, ast) { return result; } +/** + * Returns true if a given TSNode is a JSX token + * @param {TSNode} node TSNode to be checked + * @returns {boolean} is a JSX token + */ +function isJSXToken(node) { + return ( + node.kind >= SyntaxKind.JsxElement + && node.kind <= SyntaxKind.JsxAttribute + ); +} + +/** + * Returns true if a given TSNode has a JSX token within its hierarchy + * @param {TSNode} node TSNode to be checked + * @returns {boolean} has JSX ancestor + */ +function hasJSXAncestor(node) { + while (node) { + if (isJSXToken(node)) { + return true; + } + node = node.parent; + } + return false; +} + + /** * Extends and formats a given error object * @param {Object} error the error object @@ -331,12 +359,12 @@ function getTokenType(token) { // Some JSX tokens have to be determined based on their parent if (token.parent) { - if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.FirstNode) { + if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.PropertyAccessExpression && hasJSXAncestor(token)) { return "JSXIdentifier"; } - if (token.parent.kind >= SyntaxKind.JsxElement && token.parent.kind <= SyntaxKind.JsxAttribute) { - if (token.kind === SyntaxKind.FirstNode) { + if (isJSXToken(token.parent)) { + if (token.kind === SyntaxKind.PropertyAccessExpression) { return "JSXMemberExpression"; } @@ -616,12 +644,12 @@ module.exports = function(ast, extra) { if (tagNameToken.type === "JSXMemberExpression") { - var isNestedMemberExpression = (node.tagName.left.kind === SyntaxKind.FirstNode); + var isNestedMemberExpression = (node.tagName.expression.kind === SyntaxKind.PropertyAccessExpression); // Convert TSNode left and right objects into ESTreeNode object // and property objects - tagNameToken.object = convertChild(node.tagName.left); - tagNameToken.property = convertChild(node.tagName.right); + tagNameToken.object = convertChild(node.tagName.expression); + tagNameToken.property = convertChild(node.tagName.name); // Assign the appropriate types tagNameToken.object.type = (isNestedMemberExpression) ? "JSXMemberExpression" : "JSXIdentifier"; @@ -1061,7 +1089,7 @@ module.exports = function(ast, extra) { } else { // class /** - * Unlinke in object literal methods, class method params can have decorators + * Unlike in object literal methods, class method params can have decorators */ method.params = node.parameters.map(function(param) { var convertedParam = convertChild(param); @@ -1380,7 +1408,11 @@ module.exports = function(ast, extra) { right: convertChild(node.initializer) }); } else { - return convert(node.name, parent); + var convertedParameter = convert(node.name, parent); + if (node.type) { + convertedParameter.typeAnnotation = convertTypeAnnotation(node.type); + } + return convertedParameter; } break; @@ -1626,12 +1658,24 @@ module.exports = function(ast, extra) { break; case SyntaxKind.PropertyAccessExpression: - assign(result, { - type: "MemberExpression", - object: convertChild(node.expression), - property: convertChild(node.name), - computed: false - }); + if (isJSXToken(parent)) { + var jsxMemberExpression = { + type: "MemberExpression", + object: convertChild(node.expression), + property: convertChild(node.name) + }; + var isNestedMemberExpression = (node.expression.kind === SyntaxKind.PropertyAccessExpression); + jsxMemberExpression.object.type = (isNestedMemberExpression) ? "MemberExpression" : "JSXIdentifier"; + jsxMemberExpression.property.type = "JSXIdentifier"; + assign(result, jsxMemberExpression); + } else { + assign(result, { + type: "MemberExpression", + object: convertChild(node.expression), + property: convertChild(node.name), + computed: false + }); + } break; case SyntaxKind.ElementAccessExpression: diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index f14c32f1d6ee..018ac6b61b8c 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -54,6 +54,6 @@ "object-assign": "^4.0.1" }, "peerDependencies": { - "typescript": "^1.7.3" + "typescript": "^2.0.3" } } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js index e1363c71b330..c481ca863148 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js @@ -1,510 +1,562 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { + "type": "ExpressionStatement", + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "expression": { - "body": { - "body": [ - { - "argument": { - "loc": { - "end": { - "column": 12, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 - } - }, - "name": "b", - "range": [ - 29, - 30 - ], - "type": "Identifier" + "type": "ArrowFunctionExpression", + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 }, + "end": { + "line": 1, + "column": 5 + } + }, + "name": "b", + "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 13, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 } }, "range": [ - 22, - 31 + 7, + 8 ], - "type": "ReturnStatement" - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 16, - "line": 1 + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "X" + } + } } - }, + } + ], + "body": { + "type": "BlockStatement", "range": [ 16, 33 ], - "type": "BlockStatement" - }, - "expression": false, - "generator": false, - "id": null, - "loc": { - "end": { - "column": 1, - "line": 3 + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } }, - "start": { - "column": 0, - "line": 1 - } - }, - "params": [ - { - "loc": { - "end": { - "column": 5, - "line": 1 + "body": [ + { + "type": "ReturnStatement", + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 13 + } }, - "start": { - "column": 4, - "line": 1 + "argument": { + "type": "Identifier", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "b" } - }, - "name": "b", - "range": [ - 4, - 5 - ], - "type": "Identifier" - } - ], - "range": [ - 0, - 33 - ], + } + ] + }, + "expression": false, "returnType": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 12, - "line": 1 - }, "start": { - "column": 11, - "line": 1 + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 } }, "range": [ 11, 12 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 12, - "line": 1 - }, - "start": { - "column": 11, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 11, 12 ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 12, - "line": 1 - }, - "start": { - "column": 11, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 11 }, - "name": "X", + "end": { + "line": 1, + "column": 12 + } + }, + "typeName": { + "type": "Identifier", "range": [ 11, 12 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "name": "X" } } }, - "type": "ArrowFunctionExpression", "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 0, + 3 + ], "loc": { - "end": { - "column": 3, - "line": 1 - }, "start": { - "column": 0, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 } }, "params": [ { - "loc": { - "end": { - "column": 2, - "line": 1 - }, - "start": { - "column": 1, - "line": 1 - } - }, - "name": "X", + "type": "TypeParameter", "range": [ 1, 2 ], - "type": "TypeParameter" + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "name": "X" } - ], - "range": [ - 0, - 3 - ], - "type": "TypeParameterDeclaration" + ] } - }, - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 33 - ], - "type": "ExpressionStatement" + } } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 33 - ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 1, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Punctuator", + "value": "<", "range": [ 0, 1 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 2, - "line": 1 - }, "start": { - "column": 1, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 1, 2 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 3, - "line": 1 - }, "start": { - "column": 2, - "line": 1 + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 2, 3 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 4, - "line": 1 - }, "start": { - "column": 3, - "line": 1 + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 3, 4 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 5, - "line": 1 - }, "start": { - "column": 4, - "line": 1 + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 } - }, + } + }, + { + "type": "Identifier", + "value": "b", "range": [ 4, 5 ], - "type": "Identifier", - "value": "b" - }, - { "loc": { - "end": { - "column": 6, - "line": 1 - }, "start": { - "column": 5, - "line": 1 + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 5, 6 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 8, - "line": 1 - }, "start": { - "column": 7, - "line": 1 + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 7, 8 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 8, - "line": 1 + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 8, 9 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 10, - "line": 1 - }, "start": { - "column": 9, - "line": 1 + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 9, 10 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 12, - "line": 1 - }, "start": { - "column": 11, - "line": 1 + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 11, 12 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 13, - "line": 1 + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": "=>", "range": [ 13, 15 ], - "type": "Punctuator", - "value": "=>" - }, - { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 16, - "line": 1 + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 16, 17 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 10, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 } - }, + } + }, + { + "type": "Keyword", + "value": "return", "range": [ 22, 28 ], - "type": "Keyword", - "value": "return" - }, - { "loc": { - "end": { - "column": 12, - "line": 2 - }, "start": { - "column": 11, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 } - }, + } + }, + { + "type": "Identifier", + "value": "b", "range": [ 29, 30 ], - "type": "Identifier", - "value": "b" - }, - { "loc": { - "end": { - "column": 13, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 30, 31 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 32, 33 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js index 354e018cb5fe..b79e78f08271 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js @@ -478,6 +478,40 @@ module.exports = { } }, "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 32 + } + }, + "range": [ + 138, + 144 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 138, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 32 + } + } + } + }, "decorators": [] } ] diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js index f19424b11a24..8669c88384a3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "decorators": [], "id": { "type": "Identifier", "range": [ @@ -194,7 +193,8 @@ module.exports = { ] } } - ] + ], + "decorators": [] } ], "sourceType": "script", @@ -398,4 +398,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js index a36869618009..69b3e69893f8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "decorators": [], "id": { "type": "Identifier", "range": [ @@ -159,7 +158,8 @@ module.exports = { ] } } - ] + ], + "decorators": [] } ], "sourceType": "script", @@ -327,4 +327,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js index 83739b6c38ea..5388d10ba5ec 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js @@ -31,7 +31,6 @@ module.exports = { "column": 1 } }, - "decorators": [], "id": { "type": "Identifier", "range": [ @@ -105,7 +104,8 @@ module.exports = { "name": "Bar" } } - ] + ], + "decorators": [] } ], "sourceType": "script", @@ -219,4 +219,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js index 26777383f1e4..9add7484aeb9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js @@ -68,7 +68,41 @@ module.exports = { "column": 24 } }, - "name": "bar" + "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 26, + 32 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + } } ], "body": null, @@ -309,4 +343,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js index 4d3ae3e49737..30d7d28e5709 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js @@ -1,528 +1,580 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { "type": "FunctionDeclaration", - "body": { - "body": [ - { - "argument": { - "loc": { - "end": { - "column": 12, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 - } - }, - "name": "b", - "range": [ - 36, - 37 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 13, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "range": [ - 29, - 38 - ], - "type": "ReturnStatement" - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 23, - "line": 1 - } + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - "range": [ - 23, - 40 - ], - "type": "BlockStatement" + "end": { + "line": 3, + "column": 1 + } }, - "expression": false, - "generator": false, "id": { - "loc": { - "end": { - "column": 10, - "line": 1 - }, - "start": { - "column": 9, - "line": 1 - } - }, - "name": "a", + "type": "Identifier", "range": [ 9, 10 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 1, - "line": 3 + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } }, - "start": { - "column": 0, - "line": 1 - } + "name": "a" }, + "generator": false, + "expression": false, "params": [ { + "type": "Identifier", + "range": [ + 14, + 15 + ], "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 } }, "name": "b", - "range": [ - 14, - 15 - ], - "type": "Identifier" + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "X" + } + } + } } ], - "range": [ - 0, - 40 - ], - "typeParameters": { + "body": { + "type": "BlockStatement", + "range": [ + 23, + 40 + ], "loc": { - "end": { - "column": 13, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 23 + }, + "end": { + "line": 3, + "column": 1 } }, - "params": [ + "body": [ { + "type": "ReturnStatement", + "range": [ + 29, + 38 + ], "loc": { - "end": { - "column": 12, - "line": 1 - }, "start": { - "column": 11, - "line": 1 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 13 } }, - "name": "X", - "range": [ - 11, - 12 - ], - "type": "TypeParameter" + "argument": { + "type": "Identifier", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "b" + } } - ], - "range": [ - 10, - 13 - ], - "type": "TypeParameterDeclaration" + ] }, "returnType": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 } }, "range": [ 21, 22 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 22, - "line": 1 - }, - "start": { - "column": 21, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 21, 22 ], - "type": "TSTypeReference", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, "typeName": { + "type": "Identifier", + "range": [ + 21, + 22 + ], "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 } }, - "name": "X", + "name": "X" + } + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "params": [ + { + "type": "TypeParameter", "range": [ - 21, - 22 + 11, + 12 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "name": "X" } - } + ] } } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 40 - ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 8, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "function", "range": [ 0, 8 ], - "type": "Keyword", - "value": "function" - }, - { "loc": { - "end": { - "column": 10, - "line": 1 - }, "start": { - "column": 9, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 } - }, + } + }, + { + "type": "Identifier", + "value": "a", "range": [ 9, 10 ], - "type": "Identifier", - "value": "a" - }, - { "loc": { - "end": { - "column": 11, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 10, 11 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 12, - "line": 1 - }, "start": { - "column": 11, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 11, 12 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 13, - "line": 1 - }, "start": { - "column": 12, - "line": 1 + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 12, 13 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 13, - "line": 1 + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 13, 14 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 } - }, + } + }, + { + "type": "Identifier", + "value": "b", "range": [ 14, 15 ], - "type": "Identifier", - "value": "b" - }, - { "loc": { - "end": { - "column": 16, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 15, 16 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 18, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 17, 18 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 19, - "line": 1 - }, "start": { - "column": 18, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 18, 19 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 20, - "line": 1 - }, "start": { - "column": 19, - "line": 1 + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 19, 20 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 21, 22 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 23, - "line": 1 + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 23, 24 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 10, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 } - }, + } + }, + { + "type": "Keyword", + "value": "return", "range": [ 29, 35 ], - "type": "Keyword", - "value": "return" - }, - { "loc": { - "end": { - "column": 12, - "line": 2 - }, "start": { - "column": 11, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 } - }, + } + }, + { + "type": "Identifier", + "value": "b", "range": [ 36, 37 ], - "type": "Identifier", - "value": "b" - }, - { "loc": { - "end": { - "column": 13, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 37, 38 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 39, 40 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js index 013a16a58eb9..ed358254a2b9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js @@ -68,7 +68,41 @@ module.exports = { "column": 21 } }, - "name": "name" + "name": "name", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 22, + 28 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + } } ], "body": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js new file mode 100644 index 000000000000..fba26ae9181d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js @@ -0,0 +1,762 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 82 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 82 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "name": "processEntity" + }, + "generator": false, + "expression": false, + "params": [ + { + "type": "Identifier", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "e", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 27, + 33 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "name": "Entity" + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "range": [ + 35, + 82 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 41, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "range": [ + 41, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "name": "validateEntity" + }, + "arguments": [ + { + "type": "Identifier", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "name": "e" + } + ] + } + }, + { + "type": "VariableDeclaration", + "range": [ + 64, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 68, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + }, + "name": "s" + }, + "init": { + "type": "MemberExpression", + "range": [ + 72, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "object": { + "type": "TSNonNullExpression", + "range": [ + 72, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "expression": { + "type": "Identifier", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "name": "e" + } + }, + "property": { + "type": "Identifier", + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "name": "name" + }, + "computed": false + } + } + ], + "kind": "let" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "processEntity", + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "Entity", + "range": [ + 27, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "validateEntity", + "range": [ + 41, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 64, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "s", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "!", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.src.ts new file mode 100644 index 000000000000..18e73855fd2e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.src.ts @@ -0,0 +1,4 @@ +function processEntity(e?: Entity) { + validateEntity(e); + let s = e!.name; +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js index a3e1830e8504..6e2b01e67d88 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -17,23 +17,23 @@ module.exports = { "body": [ { "type": "VariableDeclaration", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, "kind": "type", "declarations": [ { - "loc": { - "end": { - "column": 37, - "line": 1 - }, - "start": { - "column": 5, - "line": 1 - } - }, - "range": [ - 5, - 37 - ], "type": "VariableDeclarator", "id": { "type": "Identifier", @@ -53,185 +53,185 @@ module.exports = { }, "name": "Result" }, - "typeParameters": { - "loc": { - "end": { - "column": 14, - "line": 1 - }, - "start": { - "column": 11, - "line": 1 - } - }, - "params": [ - { - "loc": { - "end": { - "column": 13, - "line": 1 - }, - "start": { - "column": 12, - "line": 1 - } - }, - "name": "T", - "range": [ - 12, - 13 - ], - "type": "TypeParameter" - } - ], + "init": { + "type": "TSUnionType", "range": [ - 11, - 14 + 17, + 37 ], - "type": "TypeParameterDeclaration" - }, - "init": { "loc": { - "end": { - "column": 37, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 37 } }, - "range": [ - 17, - 37 - ], - "type": "TSUnionType", "types": [ { - "loc": { - "end": { - "column": 27, - "line": 1 - }, - "start": { - "column": 17, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 17, 27 ], - "type": "TSTypeReference", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "Success" + }, "typeArguments": [ { - "loc": { - "end": { - "column": 26, - "line": 1 - }, - "start": { - "column": 25, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 25, 26 ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 26, - "line": 1 - }, - "start": { - "column": 25, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 25 }, - "name": "T", + "end": { + "line": 1, + "column": 26 + } + }, + "typeName": { + "type": "Identifier", "range": [ 25, 26 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "T" } } + ] + }, + { + "type": "TSTypeReference", + "range": [ + 30, + 37 ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 + } + }, "typeName": { + "type": "Identifier", + "range": [ + 30, + 37 + ], "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 37 } }, - "name": "Success", - "range": [ - 17, - 24 - ], - "type": "Identifier" + "name": "Failure" } + } + ] + }, + "range": [ + 5, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 }, + "end": { + "line": 1, + "column": 14 + } + }, + "params": [ { + "type": "TypeParameter", + "range": [ + 12, + 13 + ], "loc": { - "end": { - "column": 37, - "line": 1 - }, "start": { - "column": 30, - "line": 1 + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 } }, - "range": [ - 30, - 37 - ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 37, - "line": 1 - }, - "start": { - "column": 30, - "line": 1 - } - }, - "name": "Failure", - "range": [ - 30, - 37 - ], - "type": "Identifier" - } + "name": "T" } ] } } - ], - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - } + ] } ], "sourceType": "script", @@ -453,4 +453,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js new file mode 100644 index 000000000000..3414d4ce021a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js @@ -0,0 +1,754 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 89 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 89 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "name": { + "type": "Identifier", + "range": [ + 10, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "name": "UIElement" + }, + "members": [ + { + "type": "TSMethodSignature", + "range": [ + 23, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 65 + } + }, + "name": { + "type": "Identifier", + "range": [ + 23, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "addClickListener" + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 40, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "name": "onclick", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "range": [ + 49, + 79 + ], + "typeAnnotation": { + "type": "TSFunctionType", + "range": [ + 49, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 50, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "name": "this", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "range": [ + 56, + 60 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 56, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + } + }, + { + "type": "Identifier", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "name": "e", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 48 + } + }, + "range": [ + 65, + 70 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 48 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 48 + } + }, + "name": "Event" + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 57 + } + }, + "range": [ + 75, + 79 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 57 + } + } + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 60 + }, + "end": { + "line": 2, + "column": 64 + } + }, + "range": [ + 82, + 86 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 82, + 86 + ], + "loc": { + "start": { + "line": 2, + "column": 60 + }, + "end": { + "line": 2, + "column": 64 + } + } + } + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "UIElement", + "range": [ + 10, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "addClickListener", + "range": [ + 23, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "onclick", + "range": [ + 40, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 50, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 56, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 40 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + { + "type": "Identifier", + "value": "Event", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 72, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 50 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 57 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 57 + }, + "end": { + "line": 2, + "column": 58 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 82, + 86 + ], + "loc": { + "start": { + "line": 2, + "column": 60 + }, + "end": { + "line": 2, + "column": 64 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 2, + "column": 64 + }, + "end": { + "line": 2, + "column": 65 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.src.ts new file mode 100644 index 000000000000..398775778522 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.src.ts @@ -0,0 +1,3 @@ +interface UIElement { + addClickListener(onclick: (this: void, e: Event) => void): void; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js index e99d4c2b5d76..af4fb3681d54 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js @@ -31,122 +31,6 @@ module.exports = { "column": 21 } }, - "decorators": [ - { - "arguments": [ - { - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 11, - "line": 1 - } - }, - "properties": [ - { - "computed": false, - "key": { - "loc": { - "end": { - "column": 12, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "name": "selector", - "range": [ - 17, - 25 - ], - "type": "Identifier" - }, - "kind": "init", - "loc": { - "end": { - "column": 19, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "method": false, - "range": [ - 17, - 32 - ], - "shorthand": false, - "type": "Property", - "value": { - "loc": { - "end": { - "column": 19, - "line": 2 - }, - "start": { - "column": 14, - "line": 2 - } - }, - "range": [ - 27, - 32 - ], - "raw": "'foo'", - "type": "Literal", - "value": "foo" - } - } - ], - "range": [ - 11, - 35 - ], - "type": "ObjectExpression" - } - ], - "callee": { - "loc": { - "end": { - "column": 10, - "line": 1 - }, - "start": { - "column": 1, - "line": 1 - } - }, - "name": "Component", - "range": [ - 1, - 10 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 2, - "line": 3 - }, - "start": { - "column": 1, - "line": 1 - } - }, - "range": [ - 1, - 36 - ], - "type": "CallExpression" - } - ], "id": { "type": "Identifier", "range": [ @@ -184,7 +68,123 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [ + { + "type": "CallExpression", + "range": [ + 1, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "Component" + }, + "arguments": [ + { + "type": "ObjectExpression", + "range": [ + 11, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "Property", + "range": [ + 17, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "key": { + "type": "Identifier", + "range": [ + 17, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "selector" + }, + "value": { + "type": "Literal", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "value": "foo", + "raw": "'foo'" + }, + "computed": false, + "method": false, + "shorthand": false, + "kind": "init" + } + ] + } + ] + } + ] } ], "sourceType": "script", @@ -442,4 +442,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js index 5216798cbe4f..c05b767eb651 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js @@ -31,26 +31,6 @@ module.exports = { "column": 12 } }, - "decorators": [ - { - "loc": { - "end": { - "column": 7, - "line": 1 - }, - "start": { - "column": 1, - "line": 1 - } - }, - "name": "sealed", - "range": [ - 1, - 7 - ], - "type": "Identifier" - } - ], "id": { "type": "Identifier", "range": [ @@ -88,7 +68,27 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [ + { + "type": "Identifier", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "sealed" + } + ] } ], "sourceType": "script", @@ -202,4 +202,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js index 868671a79005..8ce99fe4342c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js @@ -17,7 +17,6 @@ module.exports = { "body": [ { "type": "ClassDeclaration", - "decorators": [], "range": [ 0, 115 @@ -108,61 +107,113 @@ module.exports = { } }, "name": "config", - "decorators": [ - { - "arguments": [ - { - "loc": { - "end": { - "column": 34, - "line": 2 - }, - "start": { - "column": 24, - "line": 2 - } - }, - "name": "APP_CONFIG", - "range": [ - 40, - 50 - ], - "type": "Identifier" - } + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "range": [ + 60, + 69 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 60, + 69 ], - "callee": { + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 53 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 60, + 69 + ], "loc": { - "end": { - "column": 23, - "line": 2 - }, "start": { - "column": 17, - "line": 2 + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 53 } }, - "name": "Inject", + "name": "AppConfig" + } + } + }, + "decorators": [ + { + "type": "CallExpression", + "range": [ + 33, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "callee": { + "type": "Identifier", "range": [ 33, 39 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 35, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 23 + } }, - "start": { - "column": 17, - "line": 2 - } + "name": "Inject" }, - "range": [ - 33, - 51 - ], - "type": "CallExpression" + "arguments": [ + { + "type": "Identifier", + "range": [ + 40, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "name": "APP_CONFIG" + } + ] } ] } @@ -345,8 +396,8 @@ module.exports = { } } }, - "accessibility": null, "computed": false, + "accessibility": null, "static": false, "kind": "constructor" } @@ -367,7 +418,8 @@ module.exports = { } }, "superClass": null, - "implements": [] + "implements": [], + "decorators": [] } ], "sourceType": "script", @@ -823,4 +875,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js index 7bd76baa1021..1195e1b9decd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js @@ -141,6 +141,40 @@ module.exports = { } }, "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "range": [ + 40, + 46 + ], + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 40, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 34 + } + } + } + }, "decorators": [ { "type": "CallExpression", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js index 133ff68ff387..052a238fee83 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js @@ -141,6 +141,40 @@ module.exports = { } }, "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "range": [ + 53, + 59 + ], + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + }, "decorators": [ { "type": "CallExpression", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js index fe8711c9e92e..4737dab9f0ff 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js @@ -251,6 +251,40 @@ module.exports = { } }, "name": "name", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "range": [ + 42, + 48 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 42, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + } + } + }, "decorators": [ { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js index 980489547ed6..552b0c1426e4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js @@ -251,6 +251,40 @@ module.exports = { } }, "name": "name", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + }, + "range": [ + 55, + 61 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 55, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 39 + } + } + } + }, "decorators": [ { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js similarity index 89% rename from packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js rename to packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js index c8de4ab60c75..9768931fca71 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js @@ -140,7 +140,41 @@ module.exports = { "column": 33 } }, - "name": "selector" + "name": "selector", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "range": [ + 58, + 64 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 41 + } + } + } + } } ], "body": null, @@ -582,4 +616,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-namespace-with-exported-function.src.ts rename to packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js new file mode 100644 index 000000000000..13218657800f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js @@ -0,0 +1,149 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [ + { + "type": "TSModuleDeclaration", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "modifiers": [ + { + "type": "TSDeclareKeyword", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "name": { + "type": "Literal", + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "value": "hot-new-module", + "raw": "\"hot-new-module\"" + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "declare", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "module", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "String", + "value": "\"hot-new-module\"", + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts new file mode 100644 index 000000000000..b8df95b7de58 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts @@ -0,0 +1 @@ +declare module "hot-new-module"; From 7c29ea16d355c5c4c1b3fcc4c86d9c7fa9100bde Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 10 Nov 2016 20:44:29 +0000 Subject: [PATCH 071/326] Chore: Normalize .yml line endings (fixes #113) (#115) From a65ee72c5d2cff8c020907c4a636605abdcb79dd Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 11 Nov 2016 15:07:48 -0500 Subject: [PATCH 072/326] Build: package.json and changelog update for 1.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index b6b3443a807a..e71906c20b8b 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,13 @@ +v1.0.0 - November 11, 2016 + +* c60f216 Chore: Normalize .yml line endings (fixes #113) (#115) (James Henry) +* 9521396 Breaking: Updated to TypeScript 2.x (fixes #105) (#112) (James Henry) +* a7320df Docs: Update license copyright (Nicholas C. Zakas) +* 51ec64d Fix: Exclude TSNode.flags when deeplyCopy fallback is used (refs #105) (#107) (James Henry) +* 7ebf4d5 Fix: Rename decorator example to avoid issue in TS 2.x (refs #105) (#106) (James Henry) +* 45b9874 Fix: Added missing yml lf gitattribute (#104) (James Henry) +* 4dd3439 Build: Add Node 6.x to Travis (fixes #99) (#98) (Danny Fritz) + v0.4.0 - September 23, 2016 * eb1ad9b Fix: Add loc and range data to generated VariableDeclarator node (#100) (James Henry) From d0690294edb0735fd278ecfe9ec3143f97cb4293 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 11 Nov 2016 15:07:49 -0500 Subject: [PATCH 073/326] 1.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 018ac6b61b8c..5e36e0c06813 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "0.4.0", + "version": "1.0.0", "files": [ "lib", "parser.js" From 83ac45c0c45e8226c403a8cee636757a63a0179d Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 1 Jan 2017 15:58:08 +0000 Subject: [PATCH 074/326] Build: Add TS as dev-dep, only support minor range (#131) --- packages/typescript-eslint-parser/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 5e36e0c06813..9ba20db95dc0 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -29,7 +29,8 @@ "npm-license": "^0.2.3", "semver": "^4.1.1", "shelljs": "^0.3.0", - "shelljs-nodecli": "^0.1.1" + "shelljs-nodecli": "^0.1.1", + "typescript": "~2.0.3" }, "keywords": [ "ast", @@ -54,6 +55,6 @@ "object-assign": "^4.0.1" }, "peerDependencies": { - "typescript": "^2.0.3" + "typescript": "~2.0.3" } } From fad4b67a4949601087f0bc785025eeadb1aeed9c Mon Sep 17 00:00:00 2001 From: Amila Welihinda Date: Mon, 2 Jan 2017 04:37:59 -0800 Subject: [PATCH 075/326] Docs: Changed --save to --save-dev in readme (#132) --- packages/typescript-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 7c17dc599992..0b319ae4ac53 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -9,7 +9,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est Install: ``` -npm i typescript-eslint-parser --save +npm i typescript-eslint-parser --save-dev ``` And in your ESLint configuration file: From 21f2c9752d70a50d54841abefe127ad519903dbc Mon Sep 17 00:00:00 2001 From: Philipp A Date: Mon, 2 Jan 2017 13:40:40 +0100 Subject: [PATCH 076/326] Fix: Allow running without options (fixes #121) (#120) --- packages/typescript-eslint-parser/parser.js | 139 +++++++++--------- .../tests/lib/{.eslintrc => .eslintrc.yml} | 0 .../tests/lib/parse.js | 15 +- 3 files changed, 82 insertions(+), 72 deletions(-) rename packages/typescript-eslint-parser/tests/lib/{.eslintrc => .eslintrc.yml} (100%) diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 8fc167226e28..34e5edef885b 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -135,82 +135,81 @@ function parse(code, options) { // pass through jsx option extra.ecmaFeatures.jsx = options.ecmaFeatures.jsx; } + } - // Even if jsx option is set in typescript compiler, filename still has to - // contain .tsx file extension - var FILENAME = (extra.ecmaFeatures.jsx) ? "eslint.tsx" : "eslint.ts"; - - var compilerHost = { - fileExists: function() { - return true; - }, - getCanonicalFileName: function() { - return FILENAME; - }, - getCurrentDirectory: function() { - return ""; - }, - getDefaultLibFileName: function() { - return "lib.d.ts"; - }, - - // TODO: Support Windows CRLF - getNewLine: function() { - return "\n"; - }, - getSourceFile: function(filename) { - return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); - }, - readFile: function() { - return null; - }, - useCaseSensitiveFileNames: function() { - return true; - }, - writeFile: function() { - return null; - } - }; + // Even if jsx option is set in typescript compiler, filename still has to + // contain .tsx file extension + var FILENAME = (extra.ecmaFeatures.jsx) ? "eslint.tsx" : "eslint.ts"; + + var compilerHost = { + fileExists: function() { + return true; + }, + getCanonicalFileName: function() { + return FILENAME; + }, + getCurrentDirectory: function() { + return ""; + }, + getDefaultLibFileName: function() { + return "lib.d.ts"; + }, + + // TODO: Support Windows CRLF + getNewLine: function() { + return "\n"; + }, + getSourceFile: function(filename) { + return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); + }, + readFile: function() { + return null; + }, + useCaseSensitiveFileNames: function() { + return true; + }, + writeFile: function() { + return null; + } + }; - program = ts.createProgram([FILENAME], { - noResolve: true, - target: ts.ScriptTarget.Latest, - jsx: extra.ecmaFeatures.jsx ? "preserve" : undefined - }, compilerHost); - - var ast = program.getSourceFile(FILENAME); - - if (extra.attachComment || extra.comment) { - /** - * Create a TypeScript Scanner, with skipTrivia set to false so that - * we can parse the comments - */ - var triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); - - var kind = triviaScanner.scan(); - while (kind !== ts.SyntaxKind.EndOfFileToken) { - if (kind !== ts.SyntaxKind.SingleLineCommentTrivia && kind !== ts.SyntaxKind.MultiLineCommentTrivia) { - kind = triviaScanner.scan(); - continue; - } - - var isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); - var range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos(), - kind: triviaScanner.getToken() - }; - - var comment = code.substring(range.pos, range.end); - var text = comment.replace("//", "").replace("/*", "").replace("*/", ""); - var loc = getLocFor(range.pos, range.end, ast); - - var esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); - extra.comments.push(esprimaComment); + program = ts.createProgram([FILENAME], { + noResolve: true, + target: ts.ScriptTarget.Latest, + jsx: extra.ecmaFeatures.jsx ? "preserve" : undefined + }, compilerHost); + var ast = program.getSourceFile(FILENAME); + + if (extra.attachComment || extra.comment) { + /** + * Create a TypeScript Scanner, with skipTrivia set to false so that + * we can parse the comments + */ + var triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); + + var kind = triviaScanner.scan(); + while (kind !== ts.SyntaxKind.EndOfFileToken) { + if (kind !== ts.SyntaxKind.SingleLineCommentTrivia && kind !== ts.SyntaxKind.MultiLineCommentTrivia) { kind = triviaScanner.scan(); + continue; } + var isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); + var range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + kind: triviaScanner.getToken() + }; + + var comment = code.substring(range.pos, range.end); + var text = comment.replace("//", "").replace("/*", "").replace("*/", ""); + var loc = getLocFor(range.pos, range.end, ast); + + var esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); + extra.comments.push(esprimaComment); + + kind = triviaScanner.scan(); } } diff --git a/packages/typescript-eslint-parser/tests/lib/.eslintrc b/packages/typescript-eslint-parser/tests/lib/.eslintrc.yml similarity index 100% rename from packages/typescript-eslint-parser/tests/lib/.eslintrc rename to packages/typescript-eslint-parser/tests/lib/.eslintrc.yml diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index faf9c4252141..00ad3167c1cb 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -33,10 +33,19 @@ function getRaw(ast) { describe("parse()", function() { + + describe("basic functionality", function() { + + it("should parse an empty string", function() { + assert.deepEqual(parser.parse("").body, []); + assert.deepEqual(parser.parse("", {}).body, []); + }); + + }); + describe("modules", function() { it("should have correct column number when strict mode error occurs", function() { - try { parser.parse("function fn(a, a) {\n}", { sourceType: "module" }); } catch (err) { @@ -47,6 +56,7 @@ describe("parse()", function() { }); describe("general", function() { + it("should output tokens, comments, locs, and ranges when called with those options", function() { var ast = parser.parse("let foo = bar;", { ecmaFeatures: { @@ -61,6 +71,7 @@ describe("parse()", function() { assert.deepEqual(getRaw(ast), require("../fixtures/parse/all-pieces.json")); }); - }); + + }); From 5f04bb5d6d4e5f3bacecbfb7e7e42fe54e081500 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Wed, 4 Jan 2017 16:35:47 -0600 Subject: [PATCH 077/326] Fix: Exception thrown when space occurs after function name (fixes #123) (#124) --- .../lib/ast-converter.js | 2 +- .../class-method-named-with-space.result.js | 320 ++++++++++++++++++ .../class-method-named-with-space.src.js | 1 + ...ass-with-accessibility-modifiers.result.js | 6 +- 4 files changed, 325 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index f0ded24d50c0..db471164cabc 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1058,7 +1058,7 @@ module.exports = function(ast, extra) { generator: false, expression: false, body: convertChild(node.body), - range: [ node.name.end, result.range[1]], + range: [ node.parameters.pos - 1, result.range[1]], loc: { start: { line: methodLoc.line + 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js new file mode 100644 index 000000000000..9082d93e5662 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js @@ -0,0 +1,320 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 9, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "key": { + "type": "Identifier", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "withSpace" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "body": { + "type": "BlockStatement", + "range": [ + 22, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "body": [] + }, + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "withSpace", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.src.js new file mode 100644 index 000000000000..3e1360594e06 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.src.js @@ -0,0 +1 @@ +class A {withSpace () {}} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js index b79e78f08271..3ff4c0d12597 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js @@ -261,7 +261,7 @@ module.exports = { ] }, "range": [ - 81, + 82, 111 ], "loc": { @@ -447,7 +447,7 @@ module.exports = { ] }, "range": [ - 130, + 131, 171 ], "loc": { @@ -1284,4 +1284,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From 39de41bfe2c5681cd97e8bc9932d67671fb0bc29 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Wed, 4 Jan 2017 23:43:54 +0100 Subject: [PATCH 078/326] Fix: Handle async/await (fixes #119) (#129) --- .../lib/ast-converter.js | 23 ++ .../lib/ast-node-types.js | 1 + .../export-default-anonymous-class.result.js | 1 + .../surrounding-call-comments.result.js | 1 + .../surrounding-debugger-comments.result.js | 1 + .../surrounding-return-comments.result.js | 1 + .../surrounding-throw-comments.result.js | 1 + .../surrounding-while-loop-comments.result.js | 1 + ...-fallthrough-comment-in-function.result.js | 1 + ...h-no-default-comment-in-function.result.js | 1 + ...ault-comment-in-nested-functions.result.js | 2 + .../basics/new-without-parens.result.js | 1 + .../basics/update-expression.result.js | 3 +- .../classes-and-generators.result.js | 1 + .../computed-generator.result.js | 1 + .../static-generators.result.js | 1 + .../default-param-arrow.result.js | 2 + .../default-param.result.js | 1 + .../local-eval-multi.result.js | 3 +- .../local-eval.result.js | 3 +- .../yield-default-param.result.js | 4 +- .../arrow-param-array.result.js | 3 +- .../arrow-param-nested-array.result.js | 3 +- .../arrow-param-nested-object-named.result.js | 3 +- .../arrow-param-nested-object.result.js | 3 +- .../arrow-param-object.result.js | 3 +- .../param-defaults-array.result.js | 1 + .../param-defaults-object-nested.result.js | 1 + .../param-defaults-object.result.js | 1 + .../param-array.result.js | 3 +- .../param-object-short.result.js | 3 +- .../param-object-wrapped.result.js | 1 + .../param-object.result.js | 3 +- .../destructuring-param.result.js | 1 + .../default-params.result.js | 5 +- .../array-destructuring.result.js | 3 +- .../generator-object-literal-method.result.js | 1 + .../computed-method-property.result.js | 3 +- .../arrow-rest-multi.result.js | 3 +- .../arrow-rest.result.js | 3 +- .../destructured-arrow-array.result.js | 3 +- .../destructured-arrow-multi.result.js | 3 +- .../destructured-arrow-object.result.js | 3 +- .../template-strings-in-jsx-complex.result.js | 3 +- .../as-param-with-params.result.js | 3 +- .../arrowFunctions/as-param.result.js | 3 +- .../arrowFunctions/basic.result.js | 3 +- .../block-body-not-object.result.js | 3 +- .../arrowFunctions/block-body.result.js | 3 +- .../arrowFunctions/expression.result.js | 3 +- .../arrowFunctions/iife.result.js | 3 +- .../arrowFunctions/multiple-params.result.js | 3 +- .../arrowFunctions/no-auto-return.result.js | 3 +- .../not-strict-arguments.result.js | 3 +- .../not-strict-eval-params.result.js | 3 +- .../arrowFunctions/not-strict-eval.result.js | 3 +- .../arrowFunctions/not-strict-octal.result.js | 3 +- .../return-arrow-function.result.js | 4 +- .../arrowFunctions/return-sequence.result.js | 4 +- .../single-param-parens.result.js | 3 +- .../single-param-return-identifier.result.js | 3 +- .../arrowFunctions/single-param.result.js | 3 +- .../class-accessor-properties.result.js | 4 +- .../class-computed-static-method.result.js | 3 +- .../class-method-named-prototype.result.js | 3 +- .../class-method-named-static.result.js | 3 +- .../classes/class-one-method-super.result.js | 3 +- .../classes/class-one-method.result.js | 3 +- ...ss-static-method-named-prototype.result.js | 3 +- ...class-static-method-named-static.result.js | 3 +- .../classes/class-static-method.result.js | 3 +- ...-methods-and-accessor-properties.result.js | 5 +- ...lass-two-computed-static-methods.result.js | 4 +- ...two-methods-computed-constructor.result.js | 4 +- .../classes/class-two-methods-semi.result.js | 4 +- .../class-two-methods-three-semi.result.js | 4 +- .../class-two-methods-two-semi.result.js | 4 +- .../classes/class-two-methods.result.js | 4 +- ...static-methods-named-constructor.result.js | 2 + .../classes/class-with-constructor.result.js | 1 + .../defaultParams/declaration.result.js | 1 + .../defaultParams/expression.result.js | 1 + .../defaultParams/method.result.js | 1 + .../defaultParams/not-all-params.result.js | 3 +- .../destructured-array-catch.result.js | 3 +- .../destructured-object-catch.result.js | 3 +- .../param-defaults-array.result.js | 1 + .../param-defaults-object-nested.result.js | 3 +- .../param-defaults-object.result.js | 1 + .../params-array-wrapped.result.js | 3 +- .../destructuring/params-array.result.js | 3 +- .../params-multi-object.result.js | 3 +- .../params-nested-array.result.js | 3 +- .../params-nested-object.result.js | 3 +- .../params-object-wrapped.result.js | 3 +- .../destructuring/params-object.result.js | 3 +- ...for-of-with-function-initializer.result.js | 3 +- .../generators/anonymous-generator.result.js | 3 +- .../generators/double-yield.result.js | 3 +- .../empty-generator-declaration.result.js | 3 +- .../generator-declaration.result.js | 3 +- .../generators/yield-delegation.result.js | 3 +- .../yield-without-value-in-call.result.js | 3 +- .../yield-without-value-no-semi.result.js | 3 +- .../generators/yield-without-value.result.js | 1 + .../modules/export-default-function.result.js | 1 + .../export-default-named-function.result.js | 1 + .../modules/export-function.result.js | 1 + .../export-var-anonymous-function.result.js | 3 +- .../newTarget/simple-new-target.result.js | 1 + .../computed-getter-and-setter.result.js | 4 +- ...tandalone-expression-with-method.result.js | 3 +- .../method-property.result.js | 3 +- .../simple-method-named-get.result.js | 3 +- .../simple-method-named-set.result.js | 3 +- .../simple-method-with-argument.result.js | 3 +- .../simple-method-with-string-name.result.js | 3 +- .../simple-method.result.js | 3 +- .../string-name-method-property.result.js | 3 +- .../restParams/basic-rest.result.js | 3 +- .../func-expression-multi.result.js | 3 +- .../restParams/func-expression.result.js | 3 +- .../restParams/single-rest.result.js | 3 +- .../tagged-template-string.result.js | 3 +- ...tract-class-with-abstract-method.result.js | 1 + ...ow-function-with-type-parameters.result.js | 3 +- ...ass-with-accessibility-modifiers.result.js | 2 + .../basics/declare-function.result.js | 1 + .../basics/function-with-await.result.js | 349 ++++++++++++++++++ .../basics/function-with-await.src.ts | 3 + .../function-with-type-parameters.result.js | 1 + .../basics/function-with-types.result.js | 1 + .../non-null-assertion-operator.result.js | 1 + ...ecorator-factory-instance-member.result.js | 3 +- ...-decorator-factory-static-member.result.js | 1 + ...cessor-decorator-instance-member.result.js | 3 +- ...accessor-decorator-static-member.result.js | 1 + ...ecorator-factory-instance-member.result.js | 3 +- ...-decorator-factory-static-member.result.js | 1 + ...method-decorator-instance-member.result.js | 3 +- .../method-decorator-static-member.result.js | 1 + .../parameter-decorator-constructor.result.js | 1 + ...orator-decorator-instance-member.result.js | 3 +- ...ecorator-decorator-static-member.result.js | 1 + ...ameter-decorator-instance-member.result.js | 3 +- ...arameter-decorator-static-member.result.js | 1 + ...namespace-with-exported-function.result.js | 1 + 147 files changed, 634 insertions(+), 96 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index db471164cabc..926229e5f599 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -105,6 +105,17 @@ function isESTreeClassMember(node) { return node.kind !== SyntaxKind.SemicolonClassElement; } +/** + * Returns true if the given node is an async function + * @param {TSNode} node TypeScript AST node + * @returns {boolean} is an async function + */ +function isAsyncFunction(node) { + return !!node.modifiers && !!node.modifiers.length && node.modifiers.some(function(modifier) { + return modifier.kind === SyntaxKind.AsyncKeyword; + }); +} + /** * Returns true if the given TSToken is a comma * @param {TSToken} token the TypeScript token @@ -852,6 +863,7 @@ module.exports = function(ast, extra) { id: convertChild(node.name), generator: !!node.asteriskToken, expression: false, + async: isAsyncFunction(node), params: node.parameters.map(convertChild), body: convertChild(node.body) }); @@ -1057,6 +1069,7 @@ module.exports = function(ast, extra) { id: null, generator: false, expression: false, + async: isAsyncFunction(node), body: convertChild(node.body), range: [ node.parameters.pos - 1, result.range[1]], loc: { @@ -1158,6 +1171,7 @@ module.exports = function(ast, extra) { }), generator: false, expression: false, + async: false, body: convertChild(node.body), range: [ result.range[0] + constructorStartOffset, result.range[1]], loc: { @@ -1226,6 +1240,7 @@ module.exports = function(ast, extra) { generator: !!node.asteriskToken, params: node.parameters.map(convertChild), body: convertChild(node.body), + async: isAsyncFunction(node), expression: false }); // Process returnType @@ -1308,6 +1323,7 @@ module.exports = function(ast, extra) { id: null, params: node.parameters.map(convertChild), body: convertChild(node.body), + async: isAsyncFunction(node), expression: node.body.kind !== SyntaxKind.Block }); // Process returnType @@ -1328,6 +1344,13 @@ module.exports = function(ast, extra) { }); break; + case SyntaxKind.AwaitExpression: + assign(result, { + type: "AwaitExpression", + expression: convertChild(node.expression) + }); + break; + // Template Literals case SyntaxKind.NoSubstitutionTemplateLiteral: diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 7832c22a2c4d..32657125a160 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -23,6 +23,7 @@ module.exports = { ArrayExpression: "ArrayExpression", ArrayPattern: "ArrayPattern", ArrowFunctionExpression: "ArrowFunctionExpression", + AwaitExpression: "AwaitExpression", BlockStatement: "BlockStatement", BinaryExpression: "BinaryExpression", BreakStatement: "BreakStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js index 3c28224e503c..978a65a2ba45 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js @@ -56,6 +56,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 110, 119 diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js index 4190fdb329ee..fd5615fff2d5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js @@ -123,6 +123,7 @@ module.exports = { ] }, "expression": false, + "async": false, "generator": false } ], diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js index ac5d5bb5610a..1e55dce7ee78 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js @@ -87,6 +87,7 @@ module.exports = { ] }, "expression": false, + "async": false, "generator": false } ], diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js index 40693bcb4f85..aa103fee4b8e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js @@ -88,6 +88,7 @@ module.exports = { ] }, "expression": false, + "async": false, "generator": false } ], diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js index bdae3d173ba8..bcb53e19d8f8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js @@ -106,6 +106,7 @@ module.exports = { ] }, "expression": false, + "async": false, "generator": false } ], diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js index 58d134228eef..ec4e87bb9e35 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js index e11fe19ebd0b..210b717f7399 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js @@ -254,6 +254,7 @@ module.exports = { ] }, "expression": false, + "async": false, "generator": false } ], diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js index c0903c293cad..473225db87f5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js @@ -238,6 +238,7 @@ module.exports = { ] }, "expression": false, + "async": false, "generator": false } ], diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js index 48969fab6196..aa9dd9a6940d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js @@ -630,11 +630,13 @@ module.exports = { ] }, "expression": false, + "async": false, "generator": false } ] }, "expression": false, + "async": false, "generator": false } } diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js index 1d7c82de8498..46b5482a36ab 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js index a3f82e5de321..119a5fb037f6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js @@ -148,8 +148,9 @@ module.exports = { ], "type": "BlockStatement" }, - "expression": false, "generator": false, + "expression": false, + "async": false, "id": { "loc": { "end": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js index e453dde2f22c..c0a881fdfbb8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js @@ -70,6 +70,7 @@ module.exports = { }, "generator": true, "expression": false, + "async": false, "range": [ 17, 24 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js index e06db8d2f17d..e8987ca66cf1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js @@ -106,6 +106,7 @@ module.exports = { }, "generator": true, "expression": false, + "async": false, "range": [ 31, 38 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js index 8b3008dc7cab..ea238e92e1d5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js @@ -70,6 +70,7 @@ module.exports = { }, "generator": true, "expression": false, + "async": false, "range": [ 24, 31 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js index b243043867ab..dc6700eba07e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js @@ -88,6 +88,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 6, 13 @@ -139,6 +140,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 20 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js index 87788d2e861c..ffc3bd84ab9a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js @@ -118,6 +118,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 14 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js index 95e002336273..f976d1830ec5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js @@ -101,6 +101,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 20 @@ -329,4 +330,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js index 03b1de5e43b1..8b79b305f9dd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js @@ -83,6 +83,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 17 @@ -275,4 +276,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js index bf1cc87d4495..be049431ec01 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js @@ -105,6 +105,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 16, 33 @@ -153,6 +154,7 @@ module.exports = { }, "generator": true, "expression": false, + "async": false, "range": [ 0, 35 @@ -456,4 +458,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js index bb2224135c4f..4f67f926ea38 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js @@ -65,6 +65,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 10 @@ -257,4 +258,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js index ffa6bf69f3f4..a10038071724 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js @@ -102,6 +102,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 15 @@ -366,4 +367,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js index b12cd6a926ca..5d844af1d52a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js @@ -219,6 +219,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 27 @@ -591,4 +592,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js index 549b2f507105..88daa074deca 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js @@ -219,6 +219,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 17 @@ -519,4 +520,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js index e9bd579742a3..c8298834bc40 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js @@ -104,6 +104,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 10 @@ -296,4 +297,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js index f82d26850135..e98e28d7e112 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js @@ -101,6 +101,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 15 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js index 90dec70c4f6e..413473aa5844 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js @@ -328,6 +328,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 35 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js index 4115ffae6036..7dc67fdcfeae 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js @@ -140,6 +140,7 @@ module.exports = { }, "generator": false, "expression": true, + "async": false, "range": [ 0, 15 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js index c8c278a56b90..ce25b86d218c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js @@ -135,6 +135,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 24 @@ -437,4 +438,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js index 1a1299bb6ea5..730eacb51de0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js @@ -221,6 +221,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 3, 21 @@ -646,4 +647,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js index ee4ffedaca35..2b7ccdbb5823 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js @@ -108,6 +108,7 @@ module.exports = { rest: null, generator: false, expression: false, + async: false, range: [5, 31], loc: { start: { line: 1, column: 5 }, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js index eff80734859b..6f3c7ef0d156 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js @@ -219,6 +219,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 4, 30 @@ -588,4 +589,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js index 25c29996c2f2..4920e70453ad 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js @@ -152,6 +152,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 30 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js index 7796c83e4ecc..d5346e2739ec 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js @@ -162,6 +162,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 29, 40 @@ -313,6 +314,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 46, 60 @@ -482,6 +484,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 68, 85 @@ -1302,4 +1305,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js index bfcd7212c112..fb8ac4366730 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js @@ -106,6 +106,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 4, 16 @@ -459,4 +460,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js index a2685d85aa9d..6caea87446c3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js @@ -125,6 +125,7 @@ module.exports = { }, "generator": true, "expression": false, + "async": false, "range": [ 16, 31 diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js index 5ec21b4d14de..bf0710da0caf 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js @@ -107,6 +107,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 19, 49 @@ -495,4 +496,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js index 3371536ef20c..87c65263781a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js @@ -81,6 +81,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 15 @@ -309,4 +310,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js index a0a52817347f..2fbab660aea1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js @@ -63,6 +63,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 12 @@ -255,4 +256,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js index 59a035190b09..056fe91c2535 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js @@ -139,6 +139,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 19 @@ -403,4 +404,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js index 355dc59d2efe..fbd27ec7eae3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js @@ -251,6 +251,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 33 @@ -695,4 +696,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js index 78d2d2bde7d5..7007fb941980 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js @@ -176,6 +176,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 0, 27 @@ -548,4 +549,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js index ea75734a95c6..8158d2ffa1d5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js @@ -931,6 +931,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "range": [ 86, 257 @@ -2522,4 +2523,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js index 84bb130698eb..347fc610a280 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js @@ -85,6 +85,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -365,4 +366,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js index 2221e208724e..d15557475888 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js @@ -85,6 +85,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -274,4 +275,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js index 2ccbb7643d66..70ee8b395b28 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [], "body": { "type": "Literal", @@ -166,4 +167,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js index cdb182883b05..902c6754b3f8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -310,4 +311,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js index ccbffc2b8484..7848b1acbb67 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -257,4 +258,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js index 51eeaeaf3d12..8014aabbf5e1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -202,4 +203,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js index 4f81cb16fb32..0cdd0ed3813b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -333,4 +334,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js index 936fcec2c748..788bb5d7334e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -257,4 +258,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js index c0effed7c807..e67c7e4b1285 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -347,4 +348,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js index 56728311cf35..4e51fd377d09 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -167,4 +168,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js index b09455900db3..78deb4f50ff7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -257,4 +258,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js index 9c396d94531a..7060aeafefe5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -167,4 +168,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js index 335364d0c93b..3a8c648439a6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -203,4 +204,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js index fc4798d0b251..7353434d0cff 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -89,6 +90,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -243,4 +245,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js index 48a3212fa534..ff147bd482c5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -89,6 +90,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -567,4 +569,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js index 888b7f32c466..2b3ebf0d83e5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -203,4 +204,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js index e8811ef079f7..202b779f3699 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -202,4 +203,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js index a6964f0f8241..390c79528fda 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": true, + "async": false, "params": [ { "type": "Identifier", @@ -167,4 +168,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js index 0a8e99030fed..9e2247dd45b7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -170,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -613,4 +615,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js index e99cd9825028..300d28a4698f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -424,4 +425,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js index 05873693e971..28b55cea2f29 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -352,4 +353,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js index fe5b51227d64..b0aa183ad181 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -370,4 +371,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js index c785e39f134a..19c9b6ff4f8b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -477,4 +478,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js index 2467802f67a8..92dd95517e3d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -352,4 +353,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js index 09f4f077b83f..71c48ae7072c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js @@ -92,6 +92,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -407,4 +408,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js index 23684f536a4d..612ea03fe358 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -388,4 +389,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js index cc8bd151162c..12ce22f9c7ce 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -388,4 +389,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js index fb23622d6505..28b4cffa4176 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -170,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -249,6 +251,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -818,4 +821,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js index ef416cc36e47..c3a057915370 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -170,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -647,4 +649,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js index 2f2f5176297d..498a86398f88 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js @@ -92,6 +92,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -172,6 +173,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -559,4 +561,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js index 91a8ef97fcfd..a0ceb3a28ec3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -170,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -539,4 +541,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js index 2093dba34364..396912856134 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -170,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -575,4 +577,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js index 7a8ff70944e2..c5209f80a3c9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -170,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -557,4 +559,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js index d89363049e99..a02df3609e84 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -170,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -521,4 +523,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js index 3fbfccd9586e..e96932563363 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js @@ -126,6 +126,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -204,6 +205,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js index e082cb6f7494..42a2a8ad14ab 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js @@ -126,6 +126,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js index 12c025f7fe75..fbd99e074ee4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "AssignmentPattern", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js index 9ca8637fceb1..f6ab67a40885 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js @@ -85,6 +85,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "AssignmentPattern", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js index 91261a8cb2d1..c138b609103b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js @@ -139,6 +139,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "AssignmentPattern", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js index 0c15e55781a2..f7885b211aec 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js @@ -85,6 +85,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -492,4 +493,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js index d77c2cc04aeb..502726529d9a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ObjectPattern", @@ -914,4 +915,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js index 6d4aaa5eeffa..73a185eb11cc 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ObjectPattern", @@ -953,4 +954,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js index 906c058a588f..a5cb3a81ab39 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ArrayPattern", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js index 6e811298622c..dd8a72d66526 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ObjectPattern", @@ -716,4 +717,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js index 2b2644572bd2..73ade897e53e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ObjectPattern", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js index c4fda76dea27..7af6c21169d6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js @@ -67,6 +67,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ArrayPattern", @@ -400,4 +401,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js index e8c902877dcd..442ff1a57ef3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ArrayPattern", @@ -364,4 +365,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js index b2a460de33f3..bdccf3486812 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -403,4 +404,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js index 980e0c19e0e1..390ce67b6357 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ArrayPattern", @@ -457,4 +458,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js index c6f7786a6eaf..c795570ae22b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ObjectPattern", @@ -644,4 +645,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js index fac97e31ac6c..54b73e8d9cc4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js @@ -67,6 +67,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ObjectPattern", @@ -478,4 +479,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js index 0acce76590ba..4b14534b0994 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "ObjectPattern", @@ -442,4 +443,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js index 344e65bf91c2..b82caacbaedd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js @@ -101,6 +101,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -707,4 +708,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js index d08884d29395..c7963c6f93a4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -327,4 +328,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js index 343c7241bfac..3bf284be609f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -364,4 +365,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js index 7e864c55e8ff..e79bfbff537e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -236,4 +237,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js index b3a22b030dae..7f0e5cfdb0c6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -344,4 +345,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js index d34a0d8f581e..96c36879ee71 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -345,4 +346,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js index b721c0ef7d64..9e7af391f163 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -401,4 +402,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js index fd5821464be0..a367eecb575d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -292,4 +293,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js index 96b2eb7021b6..08032f399e0d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": true, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js index 383afa4210b9..4cd2c26bfa9e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js @@ -50,6 +50,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js index 9fbc71a5e615..8e5b36233cd3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js @@ -67,6 +67,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js index b59434772fb2..92e3721d06b5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js @@ -67,6 +67,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js index bfc762dd8c21..a29d30917135 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js @@ -101,6 +101,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -312,4 +313,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js index 50b45bf23871..3c6ea66d9678 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js index fc461135937e..1d335d907484 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js @@ -105,6 +105,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -183,6 +184,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -644,4 +646,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js index 52937b519615..fa34bcf6dcb7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js @@ -104,6 +104,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -385,4 +386,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js index 2c0741fde8fb..467de21ae9c1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js @@ -140,6 +140,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -459,4 +460,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js index a9a13bc5234e..f5175f8102b3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js @@ -140,6 +140,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -384,4 +385,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js index c82cc704cc9c..996338a39c9e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js @@ -140,6 +140,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -384,4 +385,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js index 66f0609d39ee..03e0de7b3c85 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js @@ -140,6 +140,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -421,4 +422,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js index 6f61046322f9..7f6591f4f304 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js @@ -141,6 +141,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -385,4 +386,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js index 05d14d69e9af..b21677ae955a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js @@ -140,6 +140,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -384,4 +385,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js index 4fdffc8958f2..20df529cdd99 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js @@ -141,6 +141,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -460,4 +461,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js index 9f872275d1ef..144b07404179 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -344,4 +345,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js index f56dcac4c132..f3c1b5059652 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js @@ -85,6 +85,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", @@ -401,4 +402,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js index 3a8641eee399..0fe11596943c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js @@ -85,6 +85,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "params": [ { "type": "RestElement", @@ -347,4 +348,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js index 3a79eb27f683..93bd3ca7d4a2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "RestElement", @@ -290,4 +291,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js index fc2d508f361a..63037b1d5c66 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [], "body": { "type": "BlockStatement", @@ -719,4 +720,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js index 082ed354be58..5d253fe85f0e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js @@ -93,6 +93,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": null, "range": [ 64, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js index c481ca863148..7b6c530d0e0a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js @@ -176,6 +176,7 @@ module.exports = { ] }, "expression": false, + "async": false, "returnType": { "type": "TypeAnnotation", "loc": { @@ -559,4 +560,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js index 3ff4c0d12597..f9d174fdf140 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js @@ -171,6 +171,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -321,6 +322,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js index 9add7484aeb9..efe5741818a1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js new file mode 100644 index 000000000000..cc03d87d41f9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js @@ -0,0 +1,349 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "FunctionDeclaration", + "expression": false, + "generator": false, + "async": true, + "id": { + "type": "Identifier", + "name": "hope", + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 19 + ] + }, + "params": [ + { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 20, + "line": 1 + } + }, + "name": "future", + "range": [ + 20, + 26 + ], + "type": "Identifier" + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AwaitExpression", + "expression": { + "type": "Identifier", + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 10, + "line": 2 + } + }, + "name": "future", + "range": [ + 40, + 46 + ] + }, + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 34, + 46 + ] + }, + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 34, + 47 + ] + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 49 + ] + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 49 + ] + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 49 + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "async", + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 14 + ] + }, + { + "type": "Identifier", + "value": "hope", + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 19 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "end": { + "column": 20, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Identifier", + "value": "future", + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 20, + "line": 1 + } + }, + "range": [ + 20, + 26 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "end": { + "column": 27, + "line": 1 + }, + "start": { + "column": 26, + "line": 1 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Identifier", + "value": "await", + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 34, + 39 + ] + }, + { + "type": "Identifier", + "value": "future", + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 10, + "line": 2 + } + }, + "range": [ + 40, + 46 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "range": [ + 46, + 47 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 48, + 49 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.src.ts new file mode 100644 index 000000000000..e867dc45d20a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.src.ts @@ -0,0 +1,3 @@ +async function hope(future) { + await future; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js index 30d7d28e5709..79b15d25dadb 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js index ed358254a2b9..bccbe7bef3fb 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js index fba26ae9181d..9fa6cc769251 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js @@ -51,6 +51,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js index 2e63f45a7baa..990e66da1691 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -643,4 +644,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js index 03b6881a976e..6449044f6bf7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js index ee29e083e91e..8f15e94a377e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -551,4 +552,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js index a1368f97c19c..301e980d011f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js index 50dac49ea01c..6bf94dfc9873 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -464,4 +465,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js index f43fb5f28bfa..00df8ea774ad 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js index d7b78841be4c..1e5ad094c0c1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -372,4 +373,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js index b710d115bfe3..9e52d52bf89f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js index 8ce99fe4342c..768e3620409f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js @@ -220,6 +220,7 @@ module.exports = { ], "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js index 1195e1b9decd..7f7a5158b8a8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -572,4 +573,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js index 052a238fee83..6d44940d33bb 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js index 4737dab9f0ff..a723cb8722fd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ @@ -716,4 +717,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js index 552b0c1426e4..661c38f63fe9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js index 9768931fca71..47242ab8d303 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js @@ -123,6 +123,7 @@ module.exports = { }, "generator": false, "expression": false, + "async": false, "params": [ { "type": "Identifier", From 5e0999e2840c511c5bb950aad821012be5077451 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 4 Jan 2017 23:08:24 +0000 Subject: [PATCH 079/326] Fix: Add missing async property (#133) --- .../classes/class-method-named-with-space.result.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js index 9082d93e5662..ff88f1a62248 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js @@ -91,6 +91,7 @@ module.exports = { "id": null, "generator": false, "expression": false, + "async": false, "body": { "type": "BlockStatement", "range": [ From 43ddc1a584f662bf2d221041580ffde444e07bfa Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 4 Jan 2017 18:40:44 -0500 Subject: [PATCH 080/326] Build: package.json and changelog update for 1.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index e71906c20b8b..d925301a7ffa 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,12 @@ +v1.0.1 - January 4, 2017 + +* 9882a8e Fix: Add missing async property (#133) (James Henry) +* 60843ad Fix: Handle async/await (fixes #119) (#129) (Philipp A) +* 0ff19dd Fix: Exception thrown when space occurs after function name (fixes #123) (#124) (Reyad Attiyat) +* ff283aa Fix: Allow running without options (fixes #121) (#120) (Philipp A) +* dd03b2f Docs: Changed --save to --save-dev in readme (#132) (Amila Welihinda) +* 41ccef5 Build: Add TS as dev-dep, only support minor range (#131) (James Henry) + v1.0.0 - November 11, 2016 * c60f216 Chore: Normalize .yml line endings (fixes #113) (#115) (James Henry) From 2316bf310e24e32b5dccb5427209238c6022dddd Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 4 Jan 2017 18:40:45 -0500 Subject: [PATCH 081/326] 1.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 9ba20db95dc0..f19138150735 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "1.0.0", + "version": "1.0.1", "files": [ "lib", "parser.js" From 98e4365c53fcf5743f729e3e837e458e6a6cd945 Mon Sep 17 00:00:00 2001 From: patricio trevino Date: Tue, 10 Jan 2017 04:31:01 -0600 Subject: [PATCH 082/326] Fix: export type alias ExportNamedDeclaration node generation (fixes #134) (#135) --- .../lib/ast-converter.js | 7 + .../export-type-alias-declaration.result.js | 293 ++++++++++++ .../export-type-alias-declaration.src.ts | 1 + .../export-type-class-declaration.result.js | 364 +++++++++++++++ .../export-type-class-declaration.src.ts | 3 + ...export-type-function-declaration.result.js | 417 ++++++++++++++++++ .../export-type-function-declaration.src.ts | 1 + 7 files changed, 1086 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 926229e5f599..268ada7282eb 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1941,16 +1941,23 @@ module.exports = function(ast, extra) { init: convertChild(node.type), range: [node.name.getStart(), node.end] }; + typeAliasDeclarator.loc = getLocFor(typeAliasDeclarator.range[0], typeAliasDeclarator.range[1], ast); + // Process typeParameters if (node.typeParameters && node.typeParameters.length) { typeAliasDeclarator.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); } + assign(result, { type: "VariableDeclaration", kind: "type", declarations: [typeAliasDeclarator] }); + + // check for exports + result = fixExports(node, result, ast); + break; default: diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js new file mode 100644 index 000000000000..272c62c2cf0e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js @@ -0,0 +1,293 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "range": [ + 0, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "declaration": { + "type": "VariableDeclaration", + "range": [ + 7, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 7 + } + }, + "kind": "type", + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 12, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "range": [ + 12, + 21 + ], + "loc": { + "end": { + "line": 1, + "column": 21 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "name": "TestAlias" + }, + "init": { + "type": "TSUnionType", + "loc": { + "end": { + "line": 1, + "column": 39 + }, + "start": { + "line": 1, + "column": 24 + } + }, + "range": [ + 24, + 39 + ], + "types": [ + { + "type": "TSStringKeyword", + "range": [ + 24, + 30 + ], + "loc": { + "end": { + "line": 1, + "column": 30 + }, + "start": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "TSNumberKeyword", + "range": [ + 33, + 39 + ], + "loc": { + "end": { + "line": 1, + "column": 39 + }, + "start": { + "line": 1, + "column": 33 + } + } + } + ] + } + } + ] + }, + "source": null, + "specifiers": [] + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 6 + ], + "loc": { + "end": { + "line": 1, + "column": 6 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "export" + }, + { + "type": "Identifier", + "range": [ + 7, + 11 + ], + "loc": { + "end": { + "line": 1, + "column": 11 + }, + "start": { + "line": 1, + "column": 7 + } + }, + "value": "type" + }, + { + "type": "Identifier", + "range": [ + 12, + 21 + ], + "loc": { + "end": { + "line": 1, + "column": 21 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "value": "TestAlias" + }, + { + "type": "Punctuator", + "range": [ + 22, + 23 + ], + "loc": { + "end": { + "line": 1, + "column": 23 + }, + "start": { + "line": 1, + "column": 22 + } + }, + "value": "=" + }, + { + "type": "Identifier", + "range": [ + 24, + 30 + ], + "loc": { + "end": { + "line": 1, + "column": 30 + }, + "start": { + "line": 1, + "column": 24 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 31, + 32 + ], + "loc": { + "end": { + "line": 1, + "column": 32 + }, + "start": { + "line": 1, + "column": 31 + } + }, + "value": "|" + }, + { + "type": "Identifier", + "range": [ + 33, + 39 + ], + "loc": { + "end": { + "line": 1, + "column": 39 + }, + "start": { + "line": 1, + "column": 33 + } + }, + "value": "number" + }, + { + "type": "Punctuator", + "range": [ + 39, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 39 + } + }, + "value": ";" + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.src.ts new file mode 100644 index 000000000000..d166857d8a5e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.src.ts @@ -0,0 +1 @@ +export type TestAlias = string | number; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js new file mode 100644 index 000000000000..dc93d1d3874a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js @@ -0,0 +1,364 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 51 + ], + "loc": { + "end": { + "line": 3, + "column": 2 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "range": [ + 0, + 51 + ], + "loc": { + "end": { + "line": 3, + "column": 2 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "declaration": { + "type": "VariableDeclaration", + "range": [ + 7, + 51 + ], + "loc": { + "end": { + "line": 3, + "column": 2 + }, + "start": { + "line": 1, + "column": 7 + } + }, + "kind": "type", + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 12, + 51 + ], + "loc": { + "end": { + "line": 3, + "column": 2 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "range": [ + 12, + 26 + ], + "loc": { + "end": { + "line": 1, + "column": 26 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "name": "TestClassProps" + }, + "init": { + "type": "TSTypeLiteral", + "range": [ + 29, + 50 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 1, + "column": 29 + } + }, + "members": [ + { + "type": "TSPropertySignature", + "range": [ + 35, + 48 + ], + "loc": { + "end": { + "line": 2, + "column": 17 + }, + "start": { + "line": 2, + "column": 4 + } + }, + "name": { + "type": "Identifier", + "range": [ + 35, + 40 + ], + "loc": { + "end": { + "line": 2, + "column": 9 + }, + "start": { + "line": 2, + "column": 4 + } + }, + "name": "count" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 42, + 48 + ], + "loc": { + "end": { + "line": 2, + "column": 17 + }, + "start": { + "line": 2, + "column": 11 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 42, + 48 + ], + "loc": { + "end": { + "line": 2, + "column": 17 + }, + "start": { + "line": 2, + "column": 11 + } + } + } + } + } + ] + } + } + ] + }, + "source": null, + "specifiers": [] + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 6 + ], + "loc": { + "end": { + "line": 1, + "column": 6 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "export" + }, + { + "type": "Identifier", + "range": [ + 7, + 11 + ], + "loc": { + "end": { + "line": 1, + "column": 11 + }, + "start": { + "line": 1, + "column": 7 + } + }, + "value": "type" + }, + { + "type": "Identifier", + "range": [ + 12, + 26 + ], + "loc": { + "end": { + "line": 1, + "column": 26 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "value": "TestClassProps" + }, + { + "type": "Punctuator", + "range": [ + 27, + 28 + ], + "loc": { + "end": { + "line": 1, + "column": 28 + }, + "start": { + "line": 1, + "column": 27 + } + }, + "value": "=" + }, + { + "type": "Punctuator", + "range": [ + 29, + 30 + ], + "loc": { + "end": { + "line": 1, + "column": 30 + }, + "start": { + "line": 1, + "column": 29 + } + }, + "value": "{" + }, + { + "type": "Identifier", + "range": [ + 35, + 40 + ], + "loc": { + "end": { + "line": 2, + "column": 9 + }, + "start": { + "line": 2, + "column": 4 + } + }, + "value": "count" + }, + { + "type": "Punctuator", + "range": [ + 40, + 41 + ], + "loc": { + "end": { + "line": 2, + "column": 10 + }, + "start": { + "line": 2, + "column": 9 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 42, + 48 + ], + "loc": { + "end": { + "line": 2, + "column": 17 + }, + "start": { + "line": 2, + "column": 11 + } + }, + "value": "number" + }, + { + "type": "Punctuator", + "range": [ + 49, + 50 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 3, + "column": 0 + } + }, + "value": "}" + }, + { + "type": "Punctuator", + "range": [ + 50, + 51 + ], + "loc": { + "end": { + "line": 3, + "column": 2 + }, + "start": { + "line": 3, + "column": 1 + } + }, + "value": ";" + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.src.ts new file mode 100644 index 000000000000..a7999bbcaa15 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.src.ts @@ -0,0 +1,3 @@ +export type TestClassProps = { + count: number +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js new file mode 100644 index 000000000000..1ed404aa592d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js @@ -0,0 +1,417 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 47 + ], + "loc": { + "end": { + "line": 1, + "column": 47 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "range": [ + 0, + 47 + ], + "loc": { + "end": { + "line": 1, + "column": 47 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "declaration": { + "type": "VariableDeclaration", + "range": [ + 7, + 47 + ], + "loc": { + "end": { + "line": 1, + "column": 47 + }, + "start": { + "line": 1, + "column": 7 + } + }, + "kind": "type", + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 12, + 47 + ], + "loc": { + "end": { + "line": 1, + "column": 47 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "range": [ + 12, + 24 + ], + "loc": { + "end": { + "line": 1, + "column": 24 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "name": "TestCallback" + }, + "init": { + "type": "TSFunctionType", + "range": [ + 27, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 27 + } + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 28, + 29 + ], + "loc": { + "end": { + "line": 1, + "column": 29 + }, + "start": { + "line": 1, + "column": 28 + } + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 31, + 37 + ], + "loc": { + "end": { + "line": 1, + "column": 37 + }, + "start": { + "line": 1, + "column": 31 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 31, + 37 + ], + "loc": { + "end": { + "line": 1, + "column": 37 + }, + "start": { + "line": 1, + "column": 31 + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 42, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 42 + } + }, + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 42, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 42 + } + } + } + } + } + } + ] + }, + "source": null, + "specifiers": [] + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 6 + ], + "loc": { + "end": { + "line": 1, + "column": 6 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "export" + }, + { + "type": "Identifier", + "range": [ + 7, + 11 + ], + "loc": { + "end": { + "line": 1, + "column": 11 + }, + "start": { + "line": 1, + "column": 7 + } + }, + "value": "type" + }, + { + "type": "Identifier", + "range": [ + 12, + 24 + ], + "loc": { + "end": { + "line": 1, + "column": 24 + }, + "start": { + "line": 1, + "column": 12 + } + }, + "value": "TestCallback" + }, + { + "type": "Punctuator", + "range": [ + 25, + 26 + ], + "loc": { + "end": { + "line": 1, + "column": 26 + }, + "start": { + "line": 1, + "column": 25 + } + }, + "value": "=" + }, + { + "type": "Punctuator", + "range": [ + 27, + 28 + ], + "loc": { + "end": { + "line": 1, + "column": 28 + }, + "start": { + "line": 1, + "column": 27 + } + }, + "value": "(" + }, + { + "type": "Identifier", + "range": [ + 28, + 29 + ], + "loc": { + "end": { + "line": 1, + "column": 29 + }, + "start": { + "line": 1, + "column": 28 + } + }, + "value": "a" + }, + { + "type": "Punctuator", + "range": [ + 29, + 30 + ], + "loc": { + "end": { + "line": 1, + "column": 30 + }, + "start": { + "line": 1, + "column": 29 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 31, + 37 + ], + "loc": { + "end": { + "line": 1, + "column": 37 + }, + "start": { + "line": 1, + "column": 31 + } + }, + "value": "number" + }, + { + "type": "Punctuator", + "range": [ + 37, + 38 + ], + "loc": { + "end": { + "line": 1, + "column": 38 + }, + "start": { + "line": 1, + "column": 37 + } + }, + "value": ")" + }, + { + "type": "Punctuator", + "range": [ + 39, + 41 + ], + "loc": { + "end": { + "line": 1, + "column": 41 + }, + "start": { + "line": 1, + "column": 39 + } + }, + "value": "=>" + }, + { + "type": "Keyword", + "range": [ + 42, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 42 + } + }, + "value": "void" + }, + { + "type": "Punctuator", + "range": [ + 46, + 47 + ], + "loc": { + "end": { + "line": 1, + "column": 47 + }, + "start": { + "line": 1, + "column": 46 + } + }, + "value": ";" + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.src.ts new file mode 100644 index 000000000000..1948b43ead29 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.src.ts @@ -0,0 +1 @@ +export type TestCallback = (a: number) => void; \ No newline at end of file From e46f5707ac20773ce027515382df3fbe2a15aa40 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Tue, 10 Jan 2017 09:41:23 -0600 Subject: [PATCH 083/326] Fix: Use ts utilities determine variable declaration type (fixes #136) (#138) --- .../lib/ast-converter.js | 52 +- ...nc-function-with-var-declaration.result.js | 698 ++++++++++++++++++ ...async-function-with-var-declaration.src.ts | 5 + 3 files changed, 734 insertions(+), 21 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 268ada7282eb..7064f264db21 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -563,6 +563,34 @@ module.exports = function(ast, extra) { return null; } + /** + * Returns the declaration kind of the given TSNode + * @param {TSNode} tsNode TypeScript AST node + * @returns {string} declaration kind + */ + function getDeclarationKind(tsNode) { + var varDeclarationKind; + + switch (tsNode.kind) { + case SyntaxKind.TypeAliasDeclaration: + varDeclarationKind = "type"; + break; + case SyntaxKind.VariableDeclarationList: + if (ts.isLet(tsNode)) { + varDeclarationKind = "let"; + } else if (ts.isConst(tsNode)) { + varDeclarationKind = "const"; + } else { + varDeclarationKind = "var"; + } + break; + default: + throw "Unable to determine declaration kind."; + } + + return varDeclarationKind; + } + /** * Converts a TSNode's typeParameters array to a flow-like TypeParameterDeclaration node * @param {TSNode[]} typeParameters TSNode typeParameters @@ -896,19 +924,10 @@ module.exports = function(ast, extra) { break; case SyntaxKind.VariableStatement: - - var varStatementKind; - - if (node.declarationList.flags) { - varStatementKind = (node.declarationList.flags === ts.NodeFlags.Let) ? "let" : "const"; - } else { - varStatementKind = "var"; - } - assign(result, { type: "VariableDeclaration", declarations: node.declarationList.declarations.map(convertChild), - kind: varStatementKind + kind: getDeclarationKind(node.declarationList) }); // check for exports @@ -917,19 +936,10 @@ module.exports = function(ast, extra) { // mostly for for-of, for-in case SyntaxKind.VariableDeclarationList: - - var varDeclarationListKind; - - if (node.flags) { - varDeclarationListKind = (node.flags === ts.NodeFlags.Let) ? "let" : "const"; - } else { - varDeclarationListKind = "var"; - } - assign(result, { type: "VariableDeclaration", declarations: node.declarations.map(convertChild), - kind: varDeclarationListKind + kind: getDeclarationKind(node) }); break; @@ -1951,7 +1961,7 @@ module.exports = function(ast, extra) { assign(result, { type: "VariableDeclaration", - kind: "type", + kind: getDeclarationKind(node), declarations: [typeAliasDeclarator] }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js new file mode 100644 index 000000000000..65bee37c8907 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js @@ -0,0 +1,698 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 96 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 96 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "name": "test" + }, + "generator": false, + "expression": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 22, + 96 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 28, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 32, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "name": "foo" + }, + "init": { + "type": "Literal", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "value": "foo", + "raw": "'foo'" + } + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "range": [ + 49, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 53, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "range": [ + 53, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "name": "bar" + }, + "init": { + "type": "Literal", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "value": "bar", + "raw": "'bar'" + } + } + ], + "kind": "let" + }, + { + "type": "VariableDeclaration", + "range": [ + 70, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 76, + 93 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "id": { + "type": "Identifier", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "name": "fooBar" + }, + "init": { + "type": "Literal", + "range": [ + 85, + 93 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "value": "fooBar", + "raw": "'fooBar'" + } + } + ], + "kind": "const" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "async", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "var", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "String", + "value": "'foo'", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 49, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 53, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "String", + "value": "'bar'", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 70, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "fooBar", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "String", + "value": "'fooBar'", + "range": [ + 85, + 93 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.src.ts new file mode 100644 index 000000000000..e691825b8056 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.src.ts @@ -0,0 +1,5 @@ +async function test() { + var foo = 'foo'; + let bar = 'bar'; + const fooBar = 'fooBar'; +} From 1e64712a9983846a0a6d53bd01c936f60b8ea0fc Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 12 Jan 2017 10:01:25 -0500 Subject: [PATCH 084/326] Build: package.json and changelog update for 1.0.2 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index d925301a7ffa..d508e957f7b9 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v1.0.2 - January 12, 2017 + +* d53f1f8 Fix: Use ts utilities determine variable declaration type (fixes #136) (#138) (Reyad Attiyat) +* 918190d Fix: export type alias ExportNamedDeclaration node generation (fixes #134) (#135) (patricio trevino) + v1.0.1 - January 4, 2017 * 9882a8e Fix: Add missing async property (#133) (James Henry) From b36d2f6856041f1564ace0c44e73cdadc13c799a Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 12 Jan 2017 10:01:26 -0500 Subject: [PATCH 085/326] 1.0.2 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index f19138150735..99cb5daabe8e 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "1.0.1", + "version": "1.0.2", "files": [ "lib", "parser.js" From bf0736679f8ff8e28927e61fa2af788a1e8d55b6 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 14 Jan 2017 10:33:56 -0600 Subject: [PATCH 086/326] Fix: Calculate constructor range using node.parameters.pos (fixes #139) (#140) --- .../lib/ast-converter.js | 6 +- ...lass-with-constructor-with-space.result.js | 355 ++++++++++++++++++ .../class-with-constructor-with-space.src.js | 1 + 3 files changed, 358 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 7064f264db21..865023e21792 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1166,9 +1166,7 @@ module.exports = function(ast, extra) { var constructorIsStatic = Boolean(node.flags & ts.NodeFlags.Static), firstConstructorToken = constructorIsStatic ? ts.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), - constructorOffset = 11, - constructorStartOffset = constructorOffset + firstConstructorToken.getStart() - node.getFirstToken().getStart(), - constructorLoc = ast.getLineAndCharacterOfPosition(result.range[0] + constructorStartOffset), + constructorLoc = ast.getLineAndCharacterOfPosition(node.parameters.pos - 1), constructor = { type: "FunctionExpression", id: null, @@ -1183,7 +1181,7 @@ module.exports = function(ast, extra) { expression: false, async: false, body: convertChild(node.body), - range: [ result.range[0] + constructorStartOffset, result.range[1]], + range: [ node.parameters.pos - 1, result.range[1]], loc: { start: { line: constructorLoc.line + 1, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js new file mode 100644 index 000000000000..1a392513161a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js @@ -0,0 +1,355 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 9, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 23, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [] + }, + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 8, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + { + "type": "EmptyStatement", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.src.js new file mode 100644 index 000000000000..af3f316ec017 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.src.js @@ -0,0 +1 @@ +class A {constructor (){}}; From 7307e038ee9fca0cdf291e2932ab8af6ccbd2fb9 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 5 Feb 2017 11:49:25 -0600 Subject: [PATCH 087/326] Fix: Calculate range correctly when class is exported (fixes #152) (#153) The range of a class body should be from the opening brace to the closing brace. To find the opening brace the ast converter parses over modifiers of the class declaration and assumes it is the last token after the last node modifier. This assumption is not always true when the class is exported. This commit ensures we only skip over modifiers which are after the class name or heritage clause. --- .../lib/ast-converter.js | 4 +- .../modules/export-default-class.result.js | 168 +++++++++++++++ .../modules/export-default-class.src.js | 3 + .../export-default-named-class.result.js | 203 ++++++++++++++++++ .../modules/export-default-named-class.src.js | 3 + .../modules/export-named-class.result.js | 188 ++++++++++++++++ .../modules/export-named-class.src.js | 3 + ...tract-class-with-abstract-method.result.js | 6 +- 8 files changed, 574 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 865023e21792..4078ed369165 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1476,7 +1476,9 @@ module.exports = function(ast, extra) { * could be multiple before the open brace */ var lastModifier = node.modifiers[node.modifiers.length - 1]; - lastClassToken = ts.findNextToken(lastModifier, ast); + if (!lastClassToken || lastModifier.pos > lastClassToken.pos) { + lastClassToken = ts.findNextToken(lastModifier, ast); + } } else if (!lastClassToken) { // no name lastClassToken = node.getFirstToken(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js new file mode 100644 index 000000000000..68d9008a7cdc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js @@ -0,0 +1,168 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 15, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.src.js new file mode 100644 index 000000000000..3509c96a752f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.src.js @@ -0,0 +1,3 @@ +export default class { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js new file mode 100644 index 000000000000..fa48618b6657 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js @@ -0,0 +1,203 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 15, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "name": "Test" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "Test", + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.src.js new file mode 100644 index 000000000000..b2ded7d41d9d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.src.js @@ -0,0 +1,3 @@ +export default class Test { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js new file mode 100644 index 000000000000..b265290529a7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js @@ -0,0 +1,188 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 7, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "Test" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "Test", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; + diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.src.js new file mode 100644 index 000000000000..3cb35e97ee95 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.src.js @@ -0,0 +1,3 @@ +export class Test { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js index 5d253fe85f0e..c476c036844b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js @@ -190,13 +190,13 @@ module.exports = { } ], "range": [ - 22, + 37, 86 ], "loc": { "start": { "line": 1, - "column": 22 + "column": 37 }, "end": { "line": 3, @@ -517,4 +517,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From 40637889a0364a7c1ffe90f5294e2ad127fe3cce Mon Sep 17 00:00:00 2001 From: patricio trevino Date: Sun, 5 Feb 2017 11:53:02 -0600 Subject: [PATCH 088/326] Fix: Parameter with assignation provide type annotations (fixes #146) (#147) * Fix: Parameter with assignation provide type annotations (fixes #146) * Adding support for rest arguments --- .../lib/ast-converter.js | 14 +- .../function-with-types-assignation.result.js | 899 ++++++++++++++++++ .../function-with-types-assignation.src.ts | 3 + 3 files changed, 913 insertions(+), 3 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 4078ed369165..3240e669526e 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1426,16 +1426,18 @@ module.exports = function(ast, extra) { break; case SyntaxKind.Parameter: - + var parameter; if (node.dotDotDotToken) { + parameter = convertChild(node.name); assign(result, { type: "RestElement", - argument: convertChild(node.name) + argument: parameter }); } else if (node.initializer) { + parameter = convertChild(node.name); assign(result, { type: "AssignmentPattern", - left: convertChild(node.name), + left: parameter, right: convertChild(node.initializer) }); } else { @@ -1446,6 +1448,12 @@ module.exports = function(ast, extra) { return convertedParameter; } + if (node.type) { + assign(parameter, { + typeAnnotation: convertTypeAnnotation(node.type) + }); + } + break; // Classes diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js new file mode 100644 index 000000000000..4ca5b486aeba --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js @@ -0,0 +1,899 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "async": false, + "body": { + "body": [ + { + "argument": { + "type": "Identifier", + "range": [ + 89, + 93 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 9 + } + }, + "name": "name" + }, + "type": "ReturnStatement", + "range": [ + 82, + 94 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 2 + } + } + } + ], + "type": "BlockStatement", + "range": [ + 78, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 1, + "column": 78 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "range": [ + 9, + 16 + ], + "loc": { + "end": { + "line": 1, + "column": 16 + }, + "start": { + "line": 1, + "column": 9 + } + }, + "name": "message" + }, + "type": "FunctionDeclaration", + "range": [ + 0, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "params": [ + { + "loc": { + "end": { + "line": 1, + "column": 21 + }, + "start": { + "line": 1, + "column": 17 + } + }, + "name": "name", + "range": [ + 17, + 21 + ], + "type": "Identifier", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 22, + 28 + ], + "loc": { + "end": { + "line": 1, + "column": 28 + }, + "start": { + "line": 1, + "column": 22 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 22, + 28 + ], + "loc": { + "end": { + "line": 1, + "column": 28 + }, + "start": { + "line": 1, + "column": 22 + } + } + } + } + }, + { + "type": "AssignmentPattern", + "range": [ + 30, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "range": [ + 30, + 33 + ], + "loc": { + "end": { + "line": 1, + "column": 33 + }, + "start": { + "line": 1, + "column": 30 + } + }, + "name": "age", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 34, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 34 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 34, + 40 + ],"loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 34 + } + } + } + } + }, + "right": { + "type": "Literal", + "range": [ + 43, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 43 + } + }, + "raw": "100", + "value": 100 + } + }, + { + "argument": { + "loc": { + "end": { + "line": 1, + "column": 55 + }, + "start": { + "line": 1, + "column": 51 + } + }, + "name": "args", + "range": [ + 51, + 55 + ], + "type": "Identifier", + "typeAnnotation": { + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "range": [ + 56, + 69 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "range": [ + 56, + 69 + ], + "type": "TSTypeReference", + "typeArguments": [ + { + "loc": { + "end": { + "line": 1, + "column": 68 + }, + "start": { + "line": 1, + "column": 62 + } + }, + "range": [ + 62, + 68 + ], + "type": "TSStringKeyword" + } + ], + "typeName": { + "loc": { + "end": { + "line": 1, + "column": 61 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "name": "Array", + "range": [ + 56, + 61 + ], + "type": "Identifier" + } + } + } + }, + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 48 + } + }, + "range": [ + 48, + 69 + ], + "type": "RestElement" + } + ], + "returnType": { + "type": "TypeAnnotation", + "range": [ + 71, + 77 + ], + "loc": { + "end": { + "line": 1, + "column": 77 + }, + "start": { + "line": 1, + "column": 71 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 71, + 77 + ], + "loc": { + "end": { + "line": 1, + "column": 77 + }, + "start": { + "line": 1, + "column": 71 + } + } + } + }, + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 8 + ], + "loc": { + "end": { + "line": 1, + "column": 8 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "function" + }, + { + "type": "Identifier", + "range": [ + 9, + 16 + ], + "loc": { + "end": { + "line": 1, + "column": 16 + }, + "start": { + "line": 1, + "column": 9 + } + }, + "value": "message" + }, + { + "type": "Punctuator", + "range": [ + 16, + 17 + ], + "loc": { + "end": { + "line": 1, + "column": 17 + }, + "start": { + "line": 1, + "column": 16 + } + }, + "value": "(" + }, + { + "type": "Identifier", + "range": [ + 17, + 21 + ], + "loc": { + "end": { + "line": 1, + "column": 21 + }, + "start": { + "line": 1, + "column": 17 + } + }, + "value": "name" + }, + { + "type": "Punctuator", + "range": [ + 21, + 22 + ], + "loc": { + "end": { + "line": 1, + "column": 22 + }, + "start": { + "line": 1, + "column": 21 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 22, + 28 + ], + "loc": { + "end": { + "line": 1, + "column": 28 + }, + "start": { + "line": 1, + "column": 22 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 28, + 29 + ], + "loc": { + "end": { + "line": 1, + "column": 29 + }, + "start": { + "line": 1, + "column": 28 + } + }, + "value": "," + }, + { + "type": "Identifier", + "range": [ + 30, + 33 + ], + "loc": { + "end": { + "line": 1, + "column": 33 + }, + "start": { + "line": 1, + "column": 30 + } + }, + "value": "age" + }, + { + "type": "Punctuator", + "range": [ + 33, + 34 + ], + "loc": { + "end": { + "line": 1, + "column": 34 + }, + "start": { + "line": 1, + "column": 33 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 34, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 34 + } + }, + "value": "number" + }, + { + "type": "Punctuator", + "range": [ + 41, + 42 + ], + "loc": { + "end": { + "line": 1, + "column": 42 + }, + "start": { + "line": 1, + "column": 41 + } + }, + "value": "=" + }, + { + "type": "Numeric", + "range": [ + 43, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 43 + } + }, + "value": "100" + }, + { + "type": "Punctuator", + "range": [ + 46, + 47 + ], + "loc": { + "end": { + "line": 1, + "column": 47 + }, + "start": { + "line": 1, + "column": 46 + } + }, + "value": "," + }, + { + "type": "Punctuator", + "range": [ + 48, + 51 + ], + "loc": { + "end": { + "line": 1, + "column": 51 + }, + "start": { + "line": 1, + "column": 48 + } + }, + "value": "..." + }, + { + "type": "Identifier", + "range": [ + 51, + 55 + ], + "loc": { + "end": { + "line": 1, + "column": 55 + }, + "start": { + "line": 1, + "column": 51 + } + }, + "value": "args" + }, + { + "type": "Punctuator", + "range": [ + 55, + 56 + ], + "loc": { + "end": { + "line": 1, + "column": 56 + }, + "start": { + "line": 1, + "column": 55 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 56, + 61 + ], + "loc": { + "end": { + "line": 1, + "column": 61 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "value": "Array" + }, + { + "type": "Punctuator", + "range": [ + 61, + 62 + ], + "loc": { + "end": { + "line": 1, + "column": 62 + }, + "start": { + "line": 1, + "column": 61 + } + }, + "value": "<" + }, + { + "type": "Identifier", + "range": [ + 62, + 68 + ], + "loc": { + "end": { + "line": 1, + "column": 68 + }, + "start": { + "line": 1, + "column": 62 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 68, + 69 + ], + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 68 + } + }, + "value": ">" + }, + { + "type": "Punctuator", + "range": [ + 69, + 70 + ], + "loc": { + "end": { + "line": 1, + "column": 70 + }, + "start": { + "line": 1, + "column": 69 + } + }, + "value": ")" + }, + { + "type": "Punctuator", + "range": [ + 70, + 71 + ], + "loc": { + "end": { + "line": 1, + "column": 71 + }, + "start": { + "line": 1, + "column": 70 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 71, + 77 + ], + "loc": { + "end": { + "line": 1, + "column": 77 + }, + "start": { + "line": 1, + "column": 71 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 78, + 79 + ], + "loc": { + "end": { + "line": 1, + "column": 79 + }, + "start": { + "line": 1, + "column": 78 + } + }, + "value": "{" + }, + { + "type": "Keyword", + "range": [ + 82, + 88 + ], + "loc": { + "end": { + "line": 2, + "column": 8 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "value": "return" + }, + { + "type": "Identifier", + "range": [ + 89, + 93 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 9 + } + }, + "value": "name" + }, + { + "type": "Punctuator", + "range": [ + 93, + 94 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "value": ";" + }, + { + "type": "Punctuator", + "range": [ + 95, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 3, + "column": 0 + } + }, + "value": "}" + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.src.ts new file mode 100644 index 000000000000..b6d3f08924a0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.src.ts @@ -0,0 +1,3 @@ +function message(name:string, age:number = 100, ...args:Array):string { + return name; +} From 8915626a8f7cf67f64367755d1fa105e955353ea Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 5 Feb 2017 11:53:14 -0600 Subject: [PATCH 089/326] Fix: Handle object types without annotations (fixes #148) (#154) Typescript allows object/interface type definitions without type annotations. This commit will replace missing type annotations with null instead of trying to convert them. --- .../lib/ast-converter.js | 2 +- ...h-object-type-without-annotation.result.js | 696 ++++++++++++++++++ ...with-object-type-without-annotation.src.ts | 3 + ...nterface-without-type-annotation.result.js | 203 +++++ .../interface-without-type-annotation.src.ts | 3 + ...-alias-object-without-annotation.result.js | 399 ++++++++++ ...ype-alias-object-without-annotation.src.ts | 1 + 7 files changed, 1306 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 3240e669526e..2af0cfdb54c7 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -659,7 +659,7 @@ module.exports = function(ast, extra) { return !(/^(?:kind|parent|pos|end|flags)$/.test(key)); }).forEach(function(key) { if (key === "type") { - result.typeAnnotation = convertTypeAnnotation(node.type); + result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; } else { if (Array.isArray(node[key])) { result[key] = node[key].map(convertChild); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js new file mode 100644 index 000000000000..1cd0e17ad61c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js @@ -0,0 +1,696 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "name": "foo" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "range": [ + 13, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "properties": [ + { + "type": "Property", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "bar" + }, + "value": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "bar" + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + }, + { + "type": "Property", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "key": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "name": "baz" + }, + "value": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "name": "baz" + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 25, + 43 + ], + "typeAnnotation": { + "type": "TSTypeLiteral", + "range": [ + 25, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "members": [ + { + "type": "TSPropertySignature", + "range": [ + 26, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 38 + } + }, + "name": { + "type": "Identifier", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "name": "bar" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 31, + 37 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 31, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + } + }, + { + "type": "TSPropertySignature", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "name": { + "type": "Identifier", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "name": "baz" + }, + "typeAnnotation": null + } + ] + } + } + } + ], + "body": { + "type": "BlockStatement", + "range": [ + 45, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 31, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts new file mode 100644 index 000000000000..bd3604de9f7f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.src.ts @@ -0,0 +1,3 @@ +function foo({bar, baz}: {bar: string, baz}) { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js new file mode 100644 index 000000000000..40c8fbc31ca7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js @@ -0,0 +1,203 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "name": { + "type": "Identifier", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "test" + }, + "members": [ + { + "type": "TSPropertySignature", + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "typeAnnotation": null + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.src.ts new file mode 100644 index 000000000000..31f184e8e67a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.src.ts @@ -0,0 +1,3 @@ +interface test { + foo; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js new file mode 100644 index 000000000000..d3ab28505c34 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js @@ -0,0 +1,399 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "kind": "type", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "foo" + }, + "init": { + "type": "TSTypeLiteral", + "range": [ + 11, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "members": [ + { + "type": "TSPropertySignature", + "range": [ + 12, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": { + "type": "Identifier", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "name": "bar" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 17, + 23 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + }, + { + "type": "TSPropertySignature", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "name": { + "type": "Identifier", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "name": "baz" + }, + "typeAnnotation": null + } + ] + }, + "range": [ + 5, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "type", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts new file mode 100644 index 000000000000..5c542c940ace --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.src.ts @@ -0,0 +1 @@ +type foo = {bar: string, baz}; From aa8c49996ed691ff66cd6fd4fb474f01592cd721 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Fri, 10 Feb 2017 11:27:22 -0600 Subject: [PATCH 090/326] Fix: Calculate range correctly for exported generic class (fixes #152) (#155) --- .../lib/ast-converter.js | 7 + ...xport-default-class-with-generic.result.js | 222 ++++++++++++++ .../export-default-class-with-generic.src.ts | 3 + ...ult-class-with-multiple-generics.result.js | 258 ++++++++++++++++ ...efault-class-with-multiple-generics.src.ts | 3 + .../export-named-class-with-generic.result.js | 241 +++++++++++++++ .../export-named-class-with-generic.src.ts | 3 + ...med-class-with-multiple-generics.result.js | 277 ++++++++++++++++++ ...-named-class-with-multiple-generics.src.ts | 3 + 9 files changed, 1017 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 2af0cfdb54c7..eed6498ded85 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1465,6 +1465,13 @@ module.exports = function(ast, extra) { var lastClassToken = heritageClauses.length ? heritageClauses[heritageClauses.length - 1] : node.name; var classNodeType = SyntaxKind[node.kind]; + if (node.typeParameters && node.typeParameters.length) { + var lastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; + if (!lastClassToken || lastTypeParameter.pos > lastClassToken.pos) { + lastClassToken = ts.findNextToken(lastTypeParameter, ast); + } + } + if (node.modifiers && node.modifiers.length) { /** diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js new file mode 100644 index 000000000000..870644fa3baf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js @@ -0,0 +1,222 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 15, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 24, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.src.ts new file mode 100644 index 000000000000..8b0d9acbf807 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.src.ts @@ -0,0 +1,3 @@ +export default class { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js new file mode 100644 index 000000000000..582090a74769 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js @@ -0,0 +1,258 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 27, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts new file mode 100644 index 000000000000..7eb59ca4e0c7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.src.ts @@ -0,0 +1,3 @@ +export default class { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js new file mode 100644 index 000000000000..510f54d0f74b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js @@ -0,0 +1,241 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 7, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 20, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.src.ts new file mode 100644 index 000000000000..ad37e87c5551 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.src.ts @@ -0,0 +1,3 @@ +export class Foo { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js new file mode 100644 index 000000000000..653ba524af0e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js @@ -0,0 +1,277 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 7, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "U", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts new file mode 100644 index 000000000000..9abd7bb1623e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.src.ts @@ -0,0 +1,3 @@ +export class Foo { + +} From 68393bca6e52a8745ff5d5a204594d07c082c0cd Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 10 Feb 2017 18:26:32 +0000 Subject: [PATCH 091/326] Docs: Show currently supported TypeScript version (#157) --- packages/typescript-eslint-parser/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 0b319ae4ac53..11cfae6e797e 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -4,6 +4,12 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est **Important:** This parser is still in the very early stages and is considered experimental. There are likely a lot of bugs. You should not rely on this in a production environment yet. +## Supported TypeScript Version + +The version of TypeScript supported by this parser is `2.0.x`. Please ensure that you are using this version before submitting any issues. + +Due to a bug in the TypeScript Compiler it was not possible to officially support TypeScript `2.1.x`, please see this issue for more details on using `2.1.x`: https://github.com/eslint/typescript-eslint-parser/issues/149 + ## Usage Install: From 3799d16b4d4cf34e92894ef32cb9290208b2f029 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 10 Feb 2017 14:32:20 -0500 Subject: [PATCH 092/326] Build: package.json and changelog update for 1.0.3 --- packages/typescript-eslint-parser/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index d508e957f7b9..d406a24146b8 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,12 @@ +v1.0.3 - February 10, 2017 + +* 19e7f15 Docs: Show currently supported TypeScript version (#157) (James Henry) +* e96ba1f Fix: Calculate range correctly for exported generic class (fixes #152) (#155) (Reyad Attiyat) +* 11d5a7d Fix: Handle object types without annotations (fixes #148) (#154) (Reyad Attiyat) +* fc1e6bb Fix: Parameter with assignation provide type annotations (fixes #146) (#147) (patricio trevino) +* e5f378f Fix: Calculate range correctly when class is exported (fixes #152) (#153) (Reyad Attiyat) +* 6312383 Fix: Calculate constructor range using node.parameters.pos (fixes #139) (#140) (Reyad Attiyat) + v1.0.2 - January 12, 2017 * d53f1f8 Fix: Use ts utilities determine variable declaration type (fixes #136) (#138) (Reyad Attiyat) From 58bbd02eb207bbceb838a8de440a66e94b8fe7d5 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 10 Feb 2017 14:32:21 -0500 Subject: [PATCH 093/326] 1.0.3 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 99cb5daabe8e..887fef718227 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "1.0.2", + "version": "1.0.3", "files": [ "lib", "parser.js" From 4b60c7faafddb0136586d644750283f5522d2efe Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Tue, 14 Feb 2017 15:08:14 -0600 Subject: [PATCH 094/326] Fix: Unescape identifiers typescript may prepend underscore (fixes #145) (#159) --- .../lib/ast-converter.js | 2 +- .../identifiers-double-underscore.result.js | 479 ++++++++++++++++++ .../identifiers-double-underscore.src.js | 9 + 3 files changed, 489 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index eed6498ded85..d80df39e82c0 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -735,7 +735,7 @@ module.exports = function(ast, extra) { case SyntaxKind.Identifier: assign(result, { type: "Identifier", - name: node.text + name: ts.unescapeIdentifier(node.text) }); break; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js new file mode 100644 index 000000000000..74fe3d4c5fa5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js @@ -0,0 +1,479 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 4, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "__test" + }, + "init": { + "type": "Literal", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "value": "ff", + "raw": "'ff'" + } + } + ], + "kind": "var" + }, + { + "type": "ClassDeclaration", + "range": [ + 20, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "name": "__Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 32, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + { + "type": "FunctionDeclaration", + "range": [ + 38, + 59 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + }, + "name": "__Bar" + }, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 55, + 59 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "__test", + "range": [ + 4, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "String", + "value": "'ff'", + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "__Foo", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 38, + 46 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "__Bar", + "range": [ + 47, + 52 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.src.js new file mode 100644 index 000000000000..b765d562e143 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.src.js @@ -0,0 +1,9 @@ +var __test = 'ff'; + +class __Foo { + +} + +function __Bar() { + +} From d9aa28d27a6737371cd49206acc6f1df9b09f0e4 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 18 Feb 2017 07:38:14 -0600 Subject: [PATCH 095/326] Fix: Await node should have argument property (fixes #160) (#161) --- packages/typescript-eslint-parser/lib/ast-converter.js | 2 +- .../fixtures/typescript/basics/function-with-await.result.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index d80df39e82c0..b978b909f750 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1355,7 +1355,7 @@ module.exports = function(ast, extra) { case SyntaxKind.AwaitExpression: assign(result, { type: "AwaitExpression", - expression: convertChild(node.expression) + argument: convertChild(node.expression) }); break; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js index cc03d87d41f9..f9e54eaffee9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js @@ -51,7 +51,7 @@ module.exports = { "type": "ExpressionStatement", "expression": { "type": "AwaitExpression", - "expression": { + "argument": { "type": "Identifier", "loc": { "end": { From 5b87d973619e5138ba1001bc7ed311b2650f1934 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 22 Feb 2017 19:37:17 +0000 Subject: [PATCH 096/326] Fix: Optimize convertTokens, treat JsxText as token (fixes #70) (#158) --- .../lib/ast-converter.js | 44 ++++++++++++++----- .../tests/lib/ecma-features.js | 1 - 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index b978b909f750..bedc2053cede 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -255,6 +255,26 @@ function fixExports(node, result, ast) { return result; } +/** + * Returns true if a given TSNode is a token + * @param {TSNode} node the TSNode + * @returns {boolean} is a token + */ +function isToken(node) { + /** + * Note: We treat JsxText like a token (TypeScript doesn't classify it as one), + * to prevent traversing into it and creating unintended addiontal tokens from + * its contents. + * + * It looks like this has been addressed in the master branch of TypeScript, so we can + * look to remove this extra check as part of the 2.2.x support + */ + if (node.kind === ts.SyntaxKind.JsxText) { + return true; + } + return node.kind >= ts.SyntaxKind.FirstToken && node.kind <= ts.SyntaxKind.LastToken; +} + /** * Returns true if a given TSNode is a JSX token * @param {TSNode} node TSNode to be checked @@ -421,18 +441,22 @@ function convertToken(token, ast) { * @returns {ESTreeToken[]} the converted ESTreeTokens */ function convertTokens(ast) { - var token = ast.getFirstToken(), - converted, - result = []; - - while (token) { - converted = convertToken(token, ast); - if (converted) { - result.push(converted); + var result = []; + /** + * @param {TSNode} node the TSNode + * @returns {undefined} + */ + function walk(node) { + if (isToken(node) && node.kind !== ts.SyntaxKind.EndOfFileToken) { + var converted = convertToken(node, ast); + if (converted) { + result.push(converted); + } + } else { + node.getChildren().forEach(walk); } - token = ts.findNextToken(token, ast); } - + walk(ast); return result; } diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 45ec04d07bcd..a52e1243b6bc 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -28,7 +28,6 @@ var filesWithOutsandingTSIssues = [ "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 "jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411 - "jsx/test-content", // https://github.com/Microsoft/TypeScript/issues/7471 "jsx/multiple-blank-spaces" ]; From 5e9ba5347f6996a0da5a05d4e838d29ac6f94078 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 24 Feb 2017 14:39:54 +0000 Subject: [PATCH 097/326] Breaking: Updated supported TypeScript version to ~2.2.1 (fixes #149) (#169) --- packages/typescript-eslint-parser/README.md | 4 ++-- .../lib/ast-converter.js | 23 +++++-------------- .../typescript-eslint-parser/package.json | 4 ++-- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 11cfae6e797e..91e3cd3a01d3 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -6,9 +6,9 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est ## Supported TypeScript Version -The version of TypeScript supported by this parser is `2.0.x`. Please ensure that you are using this version before submitting any issues. +The version of TypeScript supported by this parser is `~2.2.1`. This is reflected in the `peerDependency` requirement within the package.json file. -Due to a bug in the TypeScript Compiler it was not possible to officially support TypeScript `2.1.x`, please see this issue for more details on using `2.1.x`: https://github.com/eslint/typescript-eslint-parser/issues/149 +**Please ensure that you are using this version before submitting any issues.** ## Usage diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index bedc2053cede..d80831bd12c0 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -261,17 +261,6 @@ function fixExports(node, result, ast) { * @returns {boolean} is a token */ function isToken(node) { - /** - * Note: We treat JsxText like a token (TypeScript doesn't classify it as one), - * to prevent traversing into it and creating unintended addiontal tokens from - * its contents. - * - * It looks like this has been addressed in the master branch of TypeScript, so we can - * look to remove this extra check as part of the 2.2.x support - */ - if (node.kind === ts.SyntaxKind.JsxText) { - return true; - } return node.kind >= ts.SyntaxKind.FirstToken && node.kind <= ts.SyntaxKind.LastToken; } @@ -680,7 +669,7 @@ module.exports = function(ast, extra) { function deeplyCopy() { result.type = "TS" + SyntaxKind[node.kind]; Object.keys(node).filter(function(key) { - return !(/^(?:kind|parent|pos|end|flags)$/.test(key)); + return !(/^(?:kind|parent|pos|end|flags|modifierFlagsCache)$/.test(key)); }).forEach(function(key) { if (key === "type") { result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; @@ -1083,7 +1072,7 @@ module.exports = function(ast, extra) { key: convertChild(node.name), value: convertChild(node.initializer), computed: (node.name.kind === SyntaxKind.ComputedPropertyName), - static: Boolean(node.flags & ts.NodeFlags.Static), + static: Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static), accessibility: getTSNodeAccessibility(node), decorators: (node.decorators) ? node.decorators.map(function(d) { return convertChild(d.expression); @@ -1166,7 +1155,7 @@ module.exports = function(ast, extra) { key: convertChild(node.name), value: method, computed: isMethodNameComputed, - static: Boolean(node.flags & ts.NodeFlags.Static), + static: Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static), kind: "method", accessibility: getTSNodeAccessibility(node), decorators: (node.decorators) ? node.decorators.map(function(d) { @@ -1188,7 +1177,7 @@ module.exports = function(ast, extra) { // TypeScript uses this even for static methods named "constructor" case SyntaxKind.Constructor: - var constructorIsStatic = Boolean(node.flags & ts.NodeFlags.Static), + var constructorIsStatic = Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static), firstConstructorToken = constructorIsStatic ? ts.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), constructorLoc = ast.getLineAndCharacterOfPosition(node.parameters.pos - 1), constructor = { @@ -1441,8 +1430,8 @@ module.exports = function(ast, extra) { // Patterns - // Note: TypeScript uses this for both spread and rest expressions - case SyntaxKind.SpreadElementExpression: + case SyntaxKind.SpreadElement: + case SyntaxKind.SpreadAssignment: assign(result, { type: "SpreadElement", argument: convertChild(node.expression) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 887fef718227..251944ae9d94 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -30,7 +30,7 @@ "semver": "^4.1.1", "shelljs": "^0.3.0", "shelljs-nodecli": "^0.1.1", - "typescript": "~2.0.3" + "typescript": "~2.2.1" }, "keywords": [ "ast", @@ -55,6 +55,6 @@ "object-assign": "^4.0.1" }, "peerDependencies": { - "typescript": "~2.0.3" + "typescript": "~2.2.1" } } From b87cd4ca0f1caa53d1558ff829c12f47b5c4c977 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 24 Feb 2017 09:41:21 -0500 Subject: [PATCH 098/326] Build: package.json and changelog update for 2.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index d406a24146b8..40193d5eecf6 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,10 @@ +v2.0.0 - February 24, 2017 + +* 38aef53 Breaking: Updated supported TypeScript version to ~2.2.1 (fixes #149) (#169) (James Henry) +* 25207e0 Fix: Optimize convertTokens, treat JsxText as token (fixes #70) (#158) (James Henry) +* 76c33f8 Fix: Await node should have argument property (fixes #160) (#161) (Reyad Attiyat) +* 2f86bef Fix: Unescape identifiers typescript may prepend underscore (fixes #145) (#159) (Reyad Attiyat) + v1.0.3 - February 10, 2017 * 19e7f15 Docs: Show currently supported TypeScript version (#157) (James Henry) From 401f8f017b47f7e041453e925090f9a5906719ed Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 24 Feb 2017 09:41:22 -0500 Subject: [PATCH 099/326] 2.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 251944ae9d94..8347ae058c81 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "1.0.3", + "version": "2.0.0", "files": [ "lib", "parser.js" From 3520a3b7cc2c07312f8351c9fed88a8f514a0084 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 26 Feb 2017 11:29:54 -0600 Subject: [PATCH 100/326] Fix: Convert Void and Delete expressions to UnaryExpression (fixes #171) (#174) --- .../lib/ast-converter.js | 18 ++ .../basics/delete-expression.result.js | 202 +++++++++++++ .../fixtures/basics/delete-expression.src.js | 1 + .../fixtures/basics/void-expression.result.js | 276 ++++++++++++++++++ .../fixtures/basics/void-expression.src.js | 2 + 5 files changed, 499 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index d80831bd12c0..05fe9785b163 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1653,6 +1653,24 @@ module.exports = function(ast, extra) { }); break; + case SyntaxKind.DeleteExpression: + assign(result, { + type: "UnaryExpression", + operator: "delete", + prefix: true, + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.VoidExpression: + assign(result, { + type: "UnaryExpression", + operator: "void", + prefix: true, + argument: convertChild(node.expression) + }); + break; + case SyntaxKind.TypeOfExpression: assign(result, { type: "UnaryExpression", diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js new file mode 100644 index 000000000000..590085bedb3d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js @@ -0,0 +1,202 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "expression": { + "type": "UnaryExpression", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "delete", + "prefix": true, + "argument": { + "type": "MemberExpression", + "range": [ + 7, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "foo" + }, + "property": { + "type": "Identifier", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "bar" + }, + "computed": false + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "delete", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.src.js new file mode 100644 index 000000000000..23cb06466d66 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.src.js @@ -0,0 +1 @@ +delete foo.bar; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js new file mode 100644 index 000000000000..12437f1d8976 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js @@ -0,0 +1,276 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "expression": { + "type": "UnaryExpression", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "operator": "void", + "prefix": true, + "argument": { + "type": "Literal", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "value": 4, + "raw": "4" + } + } + }, + { + "type": "ExpressionStatement", + "range": [ + 8, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "expression": { + "type": "UnaryExpression", + "range": [ + 8, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "operator": "void", + "prefix": true, + "argument": { + "type": "Literal", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "value": 3, + "raw": "3" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "void", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.src.js new file mode 100644 index 000000000000..7da947c9a451 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.src.js @@ -0,0 +1,2 @@ +void 4; +void(3); From 29fdc1a57ac6ed352abb2e9e6292051c4b61adcc Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 26 Feb 2017 11:47:44 -0600 Subject: [PATCH 101/326] Fix: Set name to type JSXIdentifier and fix selfClosing (fixes #172) (#175) --- .../lib/ast-converter.js | 7 +- .../ecma-features/jsx/attributes.result.js | 740 ++++++++++++++++++ .../ecma-features/jsx/attributes.src.js | 1 + .../jsx/self-closing-tag-inside-tag.result.js | 458 +++++++++++ .../jsx/self-closing-tag-inside-tag.src.js | 3 + 5 files changed, 1207 insertions(+), 2 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 05fe9785b163..e6e8c7898a36 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1878,9 +1878,11 @@ module.exports = function(ast, extra) { // Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, // TypeScript does not seem to have the idea of openingElement when tag is self-closing node.kind = SyntaxKind.JsxOpeningElement; + var openingElement = convertChild(node); + openingElement.selfClosing = true; assign(result, { type: "JSXElement", - openingElement: convertChild(node), + openingElement: openingElement, closingElement: null, children: [] }); @@ -1891,7 +1893,7 @@ module.exports = function(ast, extra) { var openingTagName = convertTypeScriptJSXTagNameToESTreeName(node.tagName); assign(result, { type: "JSXOpeningElement", - selfClosing: !(node.parent && node.parent.closingElement), + selfClosing: false, name: openingTagName, attributes: node.attributes.map(convertChild) }); @@ -1933,6 +1935,7 @@ module.exports = function(ast, extra) { case SyntaxKind.JsxAttribute: var attributeName = convertToken(node.name, ast); + attributeName.type = "JSXIdentifier"; attributeName.name = attributeName.value; delete attributeName.value; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.result.js new file mode 100644 index 000000000000..aa44d4fe490b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.result.js @@ -0,0 +1,740 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "expression": { + "type": "JSXElement", + "range": [ + 0, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 0, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "selfClosing": false, + "name": { + "type": "JSXIdentifier", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "foo" + }, + "attributes": [ + { + "type": "JSXAttribute", + "range": [ + 5, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "bar" + }, + "value": { + "type": "Literal", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": "baz", + "raw": "\"baz\"" + } + }, + { + "type": "JSXAttribute", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "qux" + }, + "value": { + "type": "JSXExpressionContainer", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "expression": { + "type": "Identifier", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "name": "quz" + } + } + }, + { + "type": "JSXAttribute", + "range": [ + 25, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "name": "spread" + }, + "value": { + "type": "JSXExpressionContainer", + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "expression": { + "type": "Identifier", + "range": [ + 36, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "name": "rest" + } + } + } + ] + }, + "closingElement": { + "type": "JSXClosingElement", + "range": [ + 46, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 48, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "name": "foo" + } + }, + "children": [ + { + "type": "Literal", + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + } + }, + "value": "test", + "raw": "test" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "foo", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "JSXIdentifier", + "value": "bar", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "JSXText", + "value": "\"baz\"", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "JSXIdentifier", + "value": "qux", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "quz", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "JSXIdentifier", + "value": "spread", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 33, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "rest", + "range": [ + 36, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "JSXText", + "value": "test", + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "JSXIdentifier", + "value": "foo", + "range": [ + 48, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.src.js new file mode 100644 index 000000000000..c70e86b54566 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.src.js @@ -0,0 +1 @@ +test diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js new file mode 100644 index 000000000000..450dcb77e11c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js @@ -0,0 +1,458 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "expression": { + "type": "JSXElement", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "selfClosing": false, + "name": { + "type": "JSXIdentifier", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "div" + }, + "attributes": [] + }, + "closingElement": { + "type": "JSXClosingElement", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "name": "div" + } + }, + "children": [ + { + "type": "Literal", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n ", + "raw": "\n " + }, + { + "type": "JSXElement", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "selfClosing": true, + "name": { + "type": "JSXIdentifier", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "foo" + }, + "attributes": [] + }, + "closingElement": null, + "children": [] + }, + { + "type": "Literal", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 0 + } + }, + "value": "\n", + "raw": "\n" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "JSXText", + "value": "", + "range": [ + 10, + 10 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "JSXIdentifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "JSXText", + "value": "", + "range": [ + 18, + 18 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.src.js new file mode 100644 index 000000000000..b1b254055e2e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.src.js @@ -0,0 +1,3 @@ +
+ +
From f3dd68c58e9a1fba1afb156ebe80cb100f1250b9 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 26 Feb 2017 11:56:09 -0600 Subject: [PATCH 102/326] Fix: Remove jsdoc node property from ts nodes (fixes #164) (#177) --- .../lib/ast-converter.js | 2 +- .../basics/interface-with-jsdoc.result.js | 654 ++++++++++++++++++ .../basics/interface-with-jsdoc.src.ts | 7 + 3 files changed, 662 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index e6e8c7898a36..8ddb8ed508cd 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -669,7 +669,7 @@ module.exports = function(ast, extra) { function deeplyCopy() { result.type = "TS" + SyntaxKind[node.kind]; Object.keys(node).filter(function(key) { - return !(/^(?:kind|parent|pos|end|flags|modifierFlagsCache)$/.test(key)); + return !(/^(?:kind|parent|pos|end|flags|modifierFlagsCache|jsDoc)$/.test(key)); }).forEach(function(key) { if (key === "type") { result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js new file mode 100644 index 000000000000..fc134d46f0cc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js @@ -0,0 +1,654 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 87 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 87 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "name": { + "type": "Identifier", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "Test" + }, + "members": [ + { + "type": "TSMethodSignature", + "range": [ + 76, + 85 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 13 + } + }, + "name": { + "type": "Identifier", + "range": [ + 76, + 79 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "name": "foo" + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 80, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "name": "bar" + } + ] + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Test", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 76, + 22 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 30, + 25 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 0 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 30, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 32, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "Comment", + "range": [ + 32, + 39 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 40, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "Line", + "range": [ + 40, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 45, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "1", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 52, + 47 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 0 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 52, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "", + "range": [ + 54, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "@", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 55, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 59, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 76, + 79 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 80, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.src.ts new file mode 100644 index 000000000000..698a393860f3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.src.ts @@ -0,0 +1,7 @@ +interface Test { + /** + * Comment Line 1 + * @baz bar + */ + foo(bar); +} From 275895cd3c376b676b7e438ea0471face695edc8 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 26 Feb 2017 12:00:52 -0600 Subject: [PATCH 103/326] Fix: Add start and end property to tokens (fixes #172) (#176) --- .../lib/ast-converter.js | 2 ++ .../tests/lib/attach-comments.js | 14 ++------- .../tests/lib/basics.js | 14 ++------- .../tests/lib/ecma-features.js | 14 ++------- .../tests/lib/parse.js | 18 ++--------- .../tests/lib/tester.js | 31 +++++++++++++++++++ .../tests/lib/typescript.js | 14 ++------- 7 files changed, 48 insertions(+), 59 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/lib/tester.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 8ddb8ed508cd..fd8b72f4fa9c 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -410,6 +410,8 @@ function convertToken(token, ast) { newToken = { type: getTokenType(token), value: value, + start: start, + end: token.end, range: [start, token.end], loc: getLoc(token, ast) }; diff --git a/packages/typescript-eslint-parser/tests/lib/attach-comments.js b/packages/typescript-eslint-parser/tests/lib/attach-comments.js index 9350c2f62abc..b135969da793 100644 --- a/packages/typescript-eslint-parser/tests/lib/attach-comments.js +++ b/packages/typescript-eslint-parser/tests/lib/attach-comments.js @@ -34,7 +34,8 @@ var assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), - shelljs = require("shelljs"); + shelljs = require("shelljs"), + tester = require("./tester"); //------------------------------------------------------------------------------ // Setup @@ -48,15 +49,6 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" }); -/** - * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} - //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ @@ -84,7 +76,7 @@ describe("attachComment: true", function() { try { result = parser.parse(code, config); - result = getRaw(result); + result = tester.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index 0a41ad7b826e..db0719a67634 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -15,7 +15,8 @@ var assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), - shelljs = require("shelljs"); + shelljs = require("shelljs"), + tester = require("./tester"); //------------------------------------------------------------------------------ // Setup @@ -29,15 +30,6 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" }); -/** - * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} - //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ @@ -66,7 +58,7 @@ describe("basics", function() { try { result = parser.parse(code, config); - result = getRaw(result); + result = tester.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index a52e1243b6bc..9433406f947d 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -15,7 +15,8 @@ var assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), - shelljs = require("shelljs"); + shelljs = require("shelljs"), + tester = require("./tester"); //------------------------------------------------------------------------------ // Setup @@ -58,15 +59,6 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { // console.dir(moduleTestFiles); // return; -/** - * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} - //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ @@ -97,7 +89,7 @@ describe("ecmaFeatures", function() { try { result = parser.parse(code, config); - result = getRaw(result); + result = tester.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index 00ad3167c1cb..76310b89e530 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -12,20 +12,8 @@ //------------------------------------------------------------------------------ var assert = require("chai").assert, - parser = require("../../parser"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} + parser = require("../../parser"), + tester = require("./tester"); //------------------------------------------------------------------------------ // Tests @@ -68,7 +56,7 @@ describe("parse()", function() { loc: true }); - assert.deepEqual(getRaw(ast), require("../fixtures/parse/all-pieces.json")); + assert.deepEqual(tester.getRaw(ast), require("../fixtures/parse/all-pieces.json")); }); }); diff --git a/packages/typescript-eslint-parser/tests/lib/tester.js b/packages/typescript-eslint-parser/tests/lib/tester.js new file mode 100644 index 000000000000..d20003a6efd5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/tester.js @@ -0,0 +1,31 @@ +/** + * @fileoverview Tools for running test cases + * @author Nicholas C. Zakas + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Private +//-------------------------------------------------------------------------------- + +/** + * Returns a raw copy of the given AST + * @param {object} ast the AST object + * @returns {object} copy of the AST object + */ +function getRaw(ast) { + return JSON.parse(JSON.stringify(ast, function(key, value) { + if ((key === "start" || key === "end") && typeof value === "number") { + return undefined; // eslint-disable-line no-undefined + } + + return value; + })); +} + +module.exports = { + getRaw: getRaw +}; diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index a98afb226d88..691985edf468 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -15,7 +15,8 @@ var assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), - shelljs = require("shelljs"); + shelljs = require("shelljs"), + tester = require("./tester"); //------------------------------------------------------------------------------ // Setup @@ -29,15 +30,6 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.ts" }); -/** - * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} - //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ @@ -66,7 +58,7 @@ describe("typescript", function() { try { result = parser.parse(code, config); - result = getRaw(result); + result = tester.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected From 318d4f5090e9032a2ab2ac6a1b63fa8634ce71b8 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 27 Feb 2017 04:15:50 -0600 Subject: [PATCH 104/326] Chore: Add test for constructor and methods with parameters (refs #168) (#178) --- ...lass-with-constructor-parameters.result.js | 413 +++++++++++ .../class-with-constructor-parameters.src.js | 1 + .../defaultParams/class-constructor.result.js | 430 +++++++++++ .../defaultParams/class-constructor.src.js | 4 + .../defaultParams/class-method.result.js | 431 +++++++++++ .../defaultParams/class-method.src.js | 4 + .../class-constructor-params-array.result.js | 468 ++++++++++++ .../class-constructor-params-array.src.js | 4 + ...onstructor-params-defaults-array.result.js | 612 ++++++++++++++++ ...s-constructor-params-defaults-array.src.js | 4 + ...nstructor-params-defaults-object.result.js | 690 ++++++++++++++++++ ...-constructor-params-defaults-object.src.js | 4 + .../class-constructor-params-object.result.js | 546 ++++++++++++++ .../class-constructor-params-object.src.js | 4 + .../class-method-params-array.result.js | 468 ++++++++++++ .../class-method-params-array.src.js | 4 + ...ass-method-params-defaults-array.result.js | 612 ++++++++++++++++ .../class-method-params-defaults-array.src.js | 4 + ...ss-method-params-defaults-object.result.js | 690 ++++++++++++++++++ ...class-method-params-defaults-object.src.js | 4 + .../class-method-params-object.result.js | 546 ++++++++++++++ .../class-method-params-object.src.js | 4 + .../restParams/class-constructor.result.js | 393 ++++++++++ .../restParams/class-constructor.src.js | 4 + .../restParams/class-method.result.js | 394 ++++++++++ .../restParams/class-method.src.js | 4 + 26 files changed, 6742 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js new file mode 100644 index 000000000000..0dea27c174db --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js @@ -0,0 +1,413 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 9, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "foo", + "decorators": [] + }, + { + "type": "Identifier", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "name": "bar", + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "body": [] + }, + "range": [ + 20, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 8, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.src.js new file mode 100644 index 000000000000..92ffc4912b13 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.src.js @@ -0,0 +1 @@ +class A {constructor(foo, bar){}} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js new file mode 100644 index 000000000000..97b08adae6ee --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js @@ -0,0 +1,430 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "AssignmentPattern", + "range": [ + 26, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "foo" + }, + "right": { + "type": "Literal", + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "value": "bar", + "raw": "'bar'" + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 37, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 25, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 8, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "String", + "value": "'bar'", + "range": [ + 30, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.src.js new file mode 100644 index 000000000000..901358c2f16c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.src.js @@ -0,0 +1,4 @@ +class A { + constructor(foo='bar') { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js new file mode 100644 index 000000000000..e3d75fecfc78 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js @@ -0,0 +1,431 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 29, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 17, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "AssignmentPattern", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "left": { + "type": "Identifier", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "name": "bar" + }, + "right": { + "type": "Literal", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "value": "baz", + "raw": "'baz'" + }, + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "String", + "value": "'baz'", + "range": [ + 22, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.src.js new file mode 100644 index 000000000000..cb113e755fff --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.src.js @@ -0,0 +1,4 @@ +class A { + foo(bar='baz') { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js new file mode 100644 index 000000000000..8cacbe9822e3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js @@ -0,0 +1,468 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "name": "consturctor" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 25, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ArrayPattern", + "range": [ + 26, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "elements": [ + { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "name": "foo" + }, + { + "type": "Identifier", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "name": "bar" + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "consturctor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.src.js new file mode 100644 index 000000000000..8a926b84c4f1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.src.js @@ -0,0 +1,4 @@ +class A { + consturctor([foo, bar]) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js new file mode 100644 index 000000000000..8fb598ab6b57 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js @@ -0,0 +1,612 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "name": "consturctor" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 42, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 25, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ArrayPattern", + "range": [ + 26, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "name": "foo" + }, + "right": { + "type": "Literal", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "value": 3, + "raw": "3" + } + }, + { + "type": "AssignmentPattern", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "name": "bar" + }, + "right": { + "type": "Literal", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "value": 4, + "raw": "4" + } + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "consturctor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.src.js new file mode 100644 index 000000000000..9afe8da6814b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.src.js @@ -0,0 +1,4 @@ +class A { + consturctor([foo=3, bar=4]) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js new file mode 100644 index 000000000000..12d9262f6bdf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js @@ -0,0 +1,690 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "name": "consturctor" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 42, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 25, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ObjectPattern", + "range": [ + 26, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "properties": [ + { + "type": "Property", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "key": { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "name": "foo" + }, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "name": "foo" + }, + "right": { + "type": "Literal", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "value": 3, + "raw": "3" + }, + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + }, + { + "type": "Property", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "key": { + "type": "Identifier", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "name": "bar" + }, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "name": "bar" + }, + "right": { + "type": "Literal", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "value": 4, + "raw": "4" + }, + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "consturctor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.src.js new file mode 100644 index 000000000000..c840ebe15cfb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.src.js @@ -0,0 +1,4 @@ +class A { + consturctor({foo=3, bar=4}) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js new file mode 100644 index 000000000000..83c12f973c20 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js @@ -0,0 +1,546 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "name": "consturctor" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 25, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ObjectPattern", + "range": [ + 26, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "properties": [ + { + "type": "Property", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "key": { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "name": "foo" + }, + "value": { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "name": "foo" + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + }, + { + "type": "Property", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "key": { + "type": "Identifier", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "name": "bar" + }, + "value": { + "type": "Identifier", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "name": "bar" + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "consturctor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.src.js new file mode 100644 index 000000000000..49bb33c2b093 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.src.js @@ -0,0 +1,4 @@ +class A { + consturctor({foo, bar}) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js new file mode 100644 index 000000000000..1848852ccf68 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js @@ -0,0 +1,468 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 17, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ArrayPattern", + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "elements": [ + { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "bar" + }, + { + "type": "Identifier", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "baz" + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.src.js new file mode 100644 index 000000000000..93e433f196b4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.src.js @@ -0,0 +1,4 @@ +class A { + foo([bar, baz]) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js new file mode 100644 index 000000000000..dee1037b507f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js @@ -0,0 +1,612 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 17, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ArrayPattern", + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "elements": [ + { + "type": "AssignmentPattern", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "bar" + }, + "right": { + "type": "Literal", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": 3, + "raw": "3" + } + }, + { + "type": "AssignmentPattern", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "baz" + }, + "right": { + "type": "Literal", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": 4, + "raw": "4" + } + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.src.js new file mode 100644 index 000000000000..d11458520d7f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.src.js @@ -0,0 +1,4 @@ +class A { + foo([bar=3, baz=4]) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js new file mode 100644 index 000000000000..d298fa780e4e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js @@ -0,0 +1,690 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 17, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ObjectPattern", + "range": [ + 18, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "properties": [ + { + "type": "Property", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "key": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "bar" + }, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "bar" + }, + "right": { + "type": "Literal", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": 3, + "raw": "3" + }, + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + }, + { + "type": "Property", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "key": { + "type": "Identifier", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "baz" + }, + "value": { + "type": "AssignmentPattern", + "left": { + "type": "Identifier", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "baz" + }, + "right": { + "type": "Literal", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": 3, + "raw": "3" + }, + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.src.js new file mode 100644 index 000000000000..ff1eb4c59cf0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.src.js @@ -0,0 +1,4 @@ +class A { + foo({bar=3, baz=3}) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js new file mode 100644 index 000000000000..4782cb4415c1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js @@ -0,0 +1,546 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 30, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 17, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "ObjectPattern", + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "properties": [ + { + "type": "Property", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "key": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "bar" + }, + "value": { + "type": "Identifier", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "bar" + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + }, + { + "type": "Property", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "key": { + "type": "Identifier", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "baz" + }, + "value": { + "type": "Identifier", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "baz" + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" + } + ], + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.src.js new file mode 100644 index 000000000000..32683cf92773 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.src.js @@ -0,0 +1,4 @@ +class A { + foo({bar, baz}) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js new file mode 100644 index 000000000000..ef7b72e38b49 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js @@ -0,0 +1,393 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "RestElement", + "range": [ + 26, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "argument": { + "type": "Identifier", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "name": "foo" + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 25, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 8, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 14, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.src.js new file mode 100644 index 000000000000..03407bf25900 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.src.js @@ -0,0 +1,4 @@ +class A { + constructor(...foo) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js new file mode 100644 index 000000000000..ecac0c2355cc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js @@ -0,0 +1,394 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 17, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "params": [ + { + "type": "RestElement", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "argument": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "bar" + }, + "decorators": [] + } + ] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.src.js new file mode 100644 index 000000000000..48319379e161 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.src.js @@ -0,0 +1,4 @@ +class A { + foo(...bar) { + } +} From 8112604322f584befe0cc992326a5c5c8c0d5620 Mon Sep 17 00:00:00 2001 From: patricio trevino Date: Mon, 27 Feb 2017 10:01:17 -0600 Subject: [PATCH 105/326] Fix: Missing parameter properties info in constructors (fixes #143) (#168) --- .../lib/ast-converter.js | 21 +- ...ith-private-parameter-properties.result.js | 1131 +++++++++++++++++ ...s-with-private-parameter-properties.src.ts | 6 + ...h-protected-parameter-properties.result.js | 1131 +++++++++++++++++ ...with-protected-parameter-properties.src.ts | 6 + ...with-public-parameter-properties.result.js | 1131 +++++++++++++++++ ...ss-with-public-parameter-properties.src.ts | 6 + ...th-readonly-parameter-properties.result.js | 699 ++++++++++ ...-with-readonly-parameter-properties.src.ts | 4 + 9 files changed, 4133 insertions(+), 2 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index fd8b72f4fa9c..67858380ab5a 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1187,10 +1187,27 @@ module.exports = function(ast, extra) { id: null, params: node.parameters.map(function(param) { var convertedParam = convertChild(param); - convertedParam.decorators = (param.decorators) ? param.decorators.map(function(d) { + var decorators = (param.decorators) ? param.decorators.map(function(d) { return convertChild(d.expression); }) : []; - return convertedParam; + + if (param.modifiers) { + return { + type: "TSParameterProperty", + range: [param.getStart(), param.end], + loc: getLoc(param, ast), + accessibility: getTSNodeAccessibility(param), + isReadonly: param.modifiers.some(function(modifier) { + return modifier.kind === SyntaxKind.ReadonlyKeyword; + }), + parameter: convertedParam, + decorators: decorators + }; + } + + return assign(convertedParam, { + decorators: decorators + }); }), generator: false, expression: false, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js new file mode 100644 index 000000000000..464b490d2ec0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js @@ -0,0 +1,1131 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 203 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "body": { + "body": [ + { + "type": "MethodDefinition", + "kind": "constructor", + "range": [ + 14, + 201 + ], + "loc": { + "end": { + "line": 5, + "column": 59 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "accessibility": null, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "name": "constructor" + }, + "static": false, + "value": { + "type": "FunctionExpression", + "range": [ + 25, + 201 + ], + "loc": { + "end": { + "line": 5, + "column": 59 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 199, + 201 + ], + "loc": { + "end": { + "line": 5, + "column": 59 + }, + "start": { + "line": 5, + "column": 57 + } + }, + "body": [] + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "TSParameterProperty", + "range": [ + 26, + 51 + ], + "loc": { + "end": { + "line": 2, + "column": 39 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "decorators": [], + "accessibility": "private", + "isReadonly": false, + "parameter": { + "type": "Identifier", + "range": [ + 34, + 43 + ], + "loc": { + "end": { + "line": 2, + "column": 31 + }, + "start": { + "line": 2, + "column": 22 + } + }, + "name": "firstName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 45, + 51 + ], + "loc": { + "end": { + "line": 2, + "column": 39 + }, + "start": { + "line": 2, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 45, + 51 + ], + "loc": { + "end": { + "line": 2, + "column": 39 + }, + "start": { + "line": 2, + "column": 33 + } + } + } + } + } + }, + { + "type": "TSParameterProperty", + "range": [ + 67, + 100 + ], + "loc": { + "end": { + "line": 3, + "column": 47 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "decorators": [], + "accessibility": "private", + "isReadonly": true, + "parameter": { + "type": "Identifier", + "range": [ + 84, + 92 + ], + "loc": { + "end": { + "line": 3, + "column": 39 + }, + "start": { + "line": 3, + "column": 31 + } + }, + "name": "lastName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 94, + 100 + ], + "loc": { + "end": { + "line": 3, + "column": 47 + }, + "start": { + "line": 3, + "column": 41 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 94, + 100 + ], + "loc": { + "end": { + "line": 3, + "column": 47 + }, + "start": { + "line": 3, + "column": 41 + } + } + } + } + } + }, + { + "type": "TSParameterProperty", + "range": [ + 116, + 140 + ], + "loc": { + "end": { + "line": 4, + "column": 38 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "decorators": [], + "accessibility": "private", + "isReadonly": false, + "parameter": { + "left": { + "type": "Identifier", + "range": [ + 124, + 127 + ], + "loc": { + "end": { + "line": 4, + "column": 25 + }, + "start": { + "line": 4, + "column": 22 + } + }, + "name": "age", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 129, + 135 + ], + "loc": { + "end": { + "line": 4, + "column": 33 + }, + "start": { + "line": 4, + "column": 27 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 129, + 135 + ], + "loc": { + "end": { + "line": 4, + "column": 33 + }, + "start": { + "line": 4, + "column": 27 + } + } + } + } + }, + "type": "AssignmentPattern", + "range": [ + 116, + 140 + ], + "loc": { + "end": { + "line": 4, + "column": 38 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "right": { + "loc": { + "end": { + "line": 4, + "column": 38 + }, + "start": { + "line": 4, + "column": 36 + } + }, + "range": [ + 138, + 140 + ], + "raw": "30", + "type": "Literal", + "value": 30 + } + } + }, + { + "type": "TSParameterProperty", + "range": [ + 156, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 55 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "decorators": [], + "accessibility": "private", + "isReadonly": true, + "parameter": { + "left": { + "type": "Identifier", + "range": [ + 173, + 180 + ], + "loc": { + "end": { + "line": 5, + "column": 38 + }, + "start": { + "line": 5, + "column": 31 + } + }, + "name": "student", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 182, + 189 + ], + "loc": { + "end": { + "line": 5, + "column": 47 + }, + "start": { + "line": 5, + "column": 40 + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "range": [ + 182, + 189 + ], + "loc": { + "end": { + "line": 5, + "column": 47 + }, + "start": { + "line": 5, + "column": 40 + } + } + } + } + }, + "type": "AssignmentPattern", + "range": [ + 156, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 55 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "right": { + "type": "Literal", + "range": [ + 192, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 55 + }, + "start": { + "line": 5, + "column": 50 + } + }, + "raw": "false", + "value": false + } + } + } + ] + } + } + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "range": [ + 10, + 203 + ], + "type": "ClassBody" + }, + "decorators": [], + "id": { + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "name": "Foo", + "range": [ + 6, + 9 + ], + "type": "Identifier" + }, + "implements": [], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "range": [ + 0, + 203 + ], + "superClass": null, + "type": "ClassDeclaration" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 5 + ], + "loc": { + "end": { + "line": 1, + "column": 5 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "class" + }, + { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "value": "Foo" + }, + { + "type": "Punctuator", + "range": [ + 10, + 11 + ], + "loc": { + "end": { + "line": 1, + "column": 11 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "value": "{" + }, + { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "value": "constructor" + }, + { + "type": "Punctuator", + "range": [ + 25, + 26 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "value": "(" + }, + { + "type": "Keyword", + "range": [ + 26, + 33 + ], + "loc": { + "end": { + "line": 2, + "column": 21 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "value": "private" + }, + { + "type": "Identifier", + "range": [ + 34, + 43 + ], + "loc": { + "end": { + "line": 2, + "column": 31 + }, + "start": { + "line": 2, + "column": 22 + } + }, + "value": "firstName" + }, + { + "type": "Punctuator", + "range": [ + 43, + 44 + ], + "loc": { + "end": { + "line": 2, + "column": 32 + }, + "start": { + "line": 2, + "column": 31 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 45, + 51 + ], + "loc": { + "end": { + "line": 2, + "column": 39 + }, + "start": { + "line": 2, + "column": 33 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 51, + 52 + ], + "loc": { + "end": { + "line": 2, + "column": 40 + }, + "start": { + "line": 2, + "column": 39 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 67, + 74 + ], + "loc": { + "end": { + "line": 3, + "column": 21 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "value": "private" + }, + { + "type": "Identifier", + "range": [ + 75, + 83 + ], + "loc": { + "end": { + "line": 3, + "column": 30 + }, + "start": { + "line": 3, + "column": 22 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 84, + 92 + ], + "loc": { + "end": { + "line": 3, + "column": 39 + }, + "start": { + "line": 3, + "column": 31 + } + }, + "value": "lastName" + }, + { + "type": "Punctuator", + "range": [ + 92, + 93 + ], + "loc": { + "end": { + "line": 3, + "column": 40 + }, + "start": { + "line": 3, + "column": 39 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 94, + 100 + ], + "loc": { + "end": { + "line": 3, + "column": 47 + }, + "start": { + "line": 3, + "column": 41 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 100, + 101 + ], + "loc": { + "end": { + "line": 3, + "column": 48 + }, + "start": { + "line": 3, + "column": 47 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 116, + 123 + ], + "loc": { + "end": { + "line": 4, + "column": 21 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "value": "private" + }, + { + "type": "Identifier", + "range": [ + 124, + 127 + ], + "loc": { + "end": { + "line": 4, + "column": 25 + }, + "start": { + "line": 4, + "column": 22 + } + }, + "value": "age" + }, + { + "type": "Punctuator", + "range": [ + 127, + 128 + ], + "loc": { + "end": { + "line": 4, + "column": 26 + }, + "start": { + "line": 4, + "column": 25 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 129, + 135 + ], + "loc": { + "end": { + "line": 4, + "column": 33 + }, + "start": { + "line": 4, + "column": 27 + } + }, + "value": "number" + }, + { + "type": "Punctuator", + "range": [ + 136, + 137 + ], + "loc": { + "end": { + "line": 4, + "column": 35 + }, + "start": { + "line": 4, + "column": 34 + } + }, + "value": "=" + }, + { + "type": "Numeric", + "range": [ + 138, + 140 + ], + "loc": { + "end": { + "line": 4, + "column": 38 + }, + "start": { + "line": 4, + "column": 36 + } + }, + "value": "30" + }, + { + "type": "Punctuator", + "range": [ + 140, + 141 + ], + "loc": { + "end": { + "line": 4, + "column": 39 + }, + "start": { + "line": 4, + "column": 38 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 156, + 163 + ], + "loc": { + "end": { + "line": 5, + "column": 21 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "value": "private" + }, + { + "type": "Identifier", + "range": [ + 164, + 172 + ], + "loc": { + "end": { + "line": 5, + "column": 30 + }, + "start": { + "line": 5, + "column": 22 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 173, + 180 + ], + "loc": { + "end": { + "line": 5, + "column": 38 + }, + "start": { + "line": 5, + "column": 31 + } + }, + "value": "student" + }, + { + "type": "Punctuator", + "range": [ + 180, + 181 + ], + "loc": { + "end": { + "line": 5, + "column": 39 + }, + "start": { + "line": 5, + "column": 38 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 182, + 189 + ], + "loc": { + "end": { + "line": 5, + "column": 47 + }, + "start": { + "line": 5, + "column": 40 + } + }, + "value": "boolean" + }, + { + "type": "Punctuator", + "range": [ + 190, + 191 + ], + "loc": { + "end": { + "line": 5, + "column": 49 + }, + "start": { + "line": 5, + "column": 48 + } + }, + "value": "=" + }, + { + "type": "Boolean", + "range": [ + 192, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 55 + }, + "start": { + "line": 5, + "column": 50 + } + }, + "value": "false" + }, + { + "type": "Punctuator", + "range": [ + 197, + 198 + ], + "loc": { + "end": { + "line": 5, + "column": 56 + }, + "start": { + "line": 5, + "column": 55 + } + }, + "value": ")" + }, + { + "type": "Punctuator", + "range": [ + 199, + 200 + ], + "loc": { + "end": { + "line": 5, + "column": 58 + }, + "start": { + "line": 5, + "column": 57 + } + }, + "value": "{" + }, + { + "type": "Punctuator", + "range": [ + 200, + 201 + ], + "loc": { + "end": { + "line": 5, + "column": 59 + }, + "start": { + "line": 5, + "column": 58 + } + }, + "value": "}" + }, + { + "type": "Punctuator", + "range": [ + 202, + 203 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 6, + "column": 0 + } + }, + "value": "}" + } + ], +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts new file mode 100644 index 000000000000..f806c1ee9f8a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.src.ts @@ -0,0 +1,6 @@ +class Foo { + constructor(private firstName: string, + private readonly lastName: string, + private age: number = 30, + private readonly student: boolean = false) {} +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js new file mode 100644 index 000000000000..412dc9ada2c4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js @@ -0,0 +1,1131 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 211 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 211 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": { + "type": "ClassBody", + "range": [ + 10, + 211 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 209 + ], + "loc": { + "end": { + "line": 5, + "column": 61 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "kind": "constructor", + "accessibility": null, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "name": "constructor" + }, + "static": false, + "value": { + "type": "FunctionExpression", + "range": [ + 25, + 209 + ], + "loc": { + "end": { + "line": 5, + "column": 61 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 207, + 209 + ], + "loc": { + "end": { + "line": 5, + "column": 61 + }, + "start": { + "line": 5, + "column": 59 + } + }, + "body": [] + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "TSParameterProperty", + "range": [ + 26, + 53 + ], + "loc": { + "end": { + "line": 2, + "column": 41 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "decorators": [], + "accessibility": "protected", + "isReadonly": false, + "parameter": { + "type": "Identifier", + "range": [ + 36, + 45 + ], + "loc": { + "end": { + "line": 2, + "column": 33 + }, + "start": { + "line": 2, + "column": 24 + } + }, + "name": "firstName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 47, + 53 + ], + "loc": { + "end": { + "line": 2, + "column": 41 + }, + "start": { + "line": 2, + "column": 35 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 47, + 53 + ], + "loc": { + "end": { + "line": 2, + "column": 41 + }, + "start": { + "line": 2, + "column": 35 + } + } + } + } + } + }, + { + "type": "TSParameterProperty", + "range": [ + 69, + 104 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "decorators": [], + "accessibility": "protected", + "isReadonly": true, + "parameter": { + "type": "Identifier", + "range": [ + 88, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 41 + }, + "start": { + "line": 3, + "column": 33 + } + }, + "name": "lastName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 98, + 104 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 43 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 98, + 104 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 43 + } + } + } + } + } + }, + { + "type": "TSParameterProperty", + "range": [ + 120, + 146 + ], + "loc": { + "end": { + "line": 4, + "column": 40 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "decorators": [], + "accessibility": "protected", + "isReadonly": false, + "parameter": { + "type": "AssignmentPattern", + "range": [ + 120, + 146 + ], + "loc": { + "end": { + "line": 4, + "column": 40 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "range": [ + 130, + 133 + ], + "loc": { + "end": { + "line": 4, + "column": 27 + }, + "start": { + "line": 4, + "column": 24 + } + }, + "name": "age", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 135, + 141 + ], + "loc": { + "end": { + "line": 4, + "column": 35 + }, + "start": { + "line": 4, + "column": 29 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 135, + 141 + ], + "loc": { + "end": { + "line": 4, + "column": 35 + }, + "start": { + "line": 4, + "column": 29 + } + } + } + } + }, + "right": { + "type": "Literal", + "range": [ + 144, + 146 + ], + "loc": { + "end": { + "line": 4, + "column": 40 + }, + "start": { + "line": 4, + "column": 38 + } + }, + "raw": "30", + "value": 30 + } + } + }, + { + "type": "TSParameterProperty", + "range": [ + 162, + 205 + ], + "loc": { + "end": { + "line": 5, + "column": 57 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "decorators": [], + "accessibility": "protected", + "isReadonly": true, + "parameter": { + "type": "AssignmentPattern", + "range": [ + 162, + 205 + ], + "loc": { + "end": { + "line": 5, + "column": 57 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "range": [ + 181, + 188 + ], + "loc": { + "end": { + "line": 5, + "column": 40 + }, + "start": { + "line": 5, + "column": 33 + } + }, + "name": "student", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 190, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 49 + }, + "start": { + "line": 5, + "column": 42 + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "range": [ + 190, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 49 + }, + "start": { + "line": 5, + "column": 42 + } + } + } + } + }, + "right": { + "type": "Literal", + "range": [ + 200, + 205 + ], + "loc": { + "end": { + "line": 5, + "column": 57 + }, + "start": { + "line": 5, + "column": 52 + } + }, + "raw": "false", + "value": false + } + } + } + ] + } + } + ] + }, + "decorators": [], + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "name": "Foo", + }, + "implements": [], + "superClass": null, + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 5 + ], + "loc": { + "end": { + "line": 1, + "column": 5 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "class" + }, + { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "value": "Foo" + }, + { + "type": "Punctuator", + "range": [ + 10, + 11 + ], + "loc": { + "end": { + "line": 1, + "column": 11 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "value": "{" + }, + { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "value": "constructor" + }, + { + "type": "Punctuator", + "range": [ + 25, + 26 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "value": "(" + }, + { + "type": "Keyword", + "range": [ + 26, + 35 + ], + "loc": { + "end": { + "line": 2, + "column": 23 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "value": "protected" + }, + { + "type": "Identifier", + "range": [ + 36, + 45 + ], + "loc": { + "end": { + "line": 2, + "column": 33 + }, + "start": { + "line": 2, + "column": 24 + } + }, + "value": "firstName" + }, + { + "type": "Punctuator", + "range": [ + 45, + 46 + ], + "loc": { + "end": { + "line": 2, + "column": 34 + }, + "start": { + "line": 2, + "column": 33 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 47, + 53 + ], + "loc": { + "end": { + "line": 2, + "column": 41 + }, + "start": { + "line": 2, + "column": 35 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 53, + 54 + ], + "loc": { + "end": { + "line": 2, + "column": 42 + }, + "start": { + "line": 2, + "column": 41 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 69, + 78 + ], + "loc": { + "end": { + "line": 3, + "column": 23 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "value": "protected" + }, + { + "type": "Identifier", + "range": [ + 79, + 87 + ], + "loc": { + "end": { + "line": 3, + "column": 32 + }, + "start": { + "line": 3, + "column": 24 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 88, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 41 + }, + "start": { + "line": 3, + "column": 33 + } + }, + "value": "lastName" + }, + { + "type": "Punctuator", + "range": [ + 96, + 97 + ], + "loc": { + "end": { + "line": 3, + "column": 42 + }, + "start": { + "line": 3, + "column": 41 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 98, + 104 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 43 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 104, + 105 + ], + "loc": { + "end": { + "line": 3, + "column": 50 + }, + "start": { + "line": 3, + "column": 49 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 120, + 129 + ], + "loc": { + "end": { + "line": 4, + "column": 23 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "value": "protected" + }, + { + "type": "Identifier", + "range": [ + 130, + 133 + ], + "loc": { + "end": { + "line": 4, + "column": 27 + }, + "start": { + "line": 4, + "column": 24 + } + }, + "value": "age" + }, + { + "loc": { + "end": { + "line": 4, + "column": 28 + }, + "start": { + "line": 4, + "column": 27 + } + }, + "range": [ + 133, + 134 + ], + "type": "Punctuator", + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 135, + 141 + ], + "loc": { + "end": { + "line": 4, + "column": 35 + }, + "start": { + "line": 4, + "column": 29 + } + }, + "value": "number" + }, + { + "type": "Punctuator", + "range": [ + 142, + 143 + ], + "loc": { + "end": { + "line": 4, + "column": 37 + }, + "start": { + "line": 4, + "column": 36 + } + }, + "value": "=" + }, + { + "type": "Numeric", + "range": [ + 144, + 146 + ], + "loc": { + "end": { + "line": 4, + "column": 40 + }, + "start": { + "line": 4, + "column": 38 + } + }, + "value": "30" + }, + { + "type": "Punctuator", + "range": [ + 146, + 147 + ], + "loc": { + "end": { + "line": 4, + "column": 41 + }, + "start": { + "line": 4, + "column": 40 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 162, + 171 + ], + "loc": { + "end": { + "line": 5, + "column": 23 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "value": "protected" + }, + { + "type": "Identifier", + "range": [ + 172, + 180 + ], + "loc": { + "end": { + "line": 5, + "column": 32 + }, + "start": { + "line": 5, + "column": 24 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 181, + 188 + ], + "loc": { + "end": { + "line": 5, + "column": 40 + }, + "start": { + "line": 5, + "column": 33 + } + }, + "value": "student" + }, + { + "type": "Punctuator", + "range": [ + 188, + 189 + ], + "loc": { + "end": { + "line": 5, + "column": 41 + }, + "start": { + "line": 5, + "column": 40 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 190, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 49 + }, + "start": { + "line": 5, + "column": 42 + } + }, + "value": "boolean" + }, + { + "type": "Punctuator", + "range": [ + 198, + 199 + ], + "loc": { + "end": { + "line": 5, + "column": 51 + }, + "start": { + "line": 5, + "column": 50 + } + }, + "value": "=" + }, + { + "type": "Boolean", + "range": [ + 200, + 205 + ], + "loc": { + "end": { + "line": 5, + "column": 57 + }, + "start": { + "line": 5, + "column": 52 + } + }, + "value": "false" + }, + { + "type": "Punctuator", + "range": [ + 205, + 206 + ], + "loc": { + "end": { + "line": 5, + "column": 58 + }, + "start": { + "line": 5, + "column": 57 + } + }, + "value": ")" + }, + { + "type": "Punctuator", + "range": [ + 207, + 208 + ], + "loc": { + "end": { + "line": 5, + "column": 60 + }, + "start": { + "line": 5, + "column": 59 + } + }, + "value": "{" + }, + { + "type": "Punctuator", + "range": [ + 208, + 209 + ], + "loc": { + "end": { + "line": 5, + "column": 61 + }, + "start": { + "line": 5, + "column": 60 + } + }, + "value": "}" + }, + { + "type": "Punctuator", + "range": [ + 210, + 211 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 6, + "column": 0 + } + }, + "value": "}" + } + ], +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts new file mode 100644 index 000000000000..1abd3446ff0d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.src.ts @@ -0,0 +1,6 @@ +class Foo { + constructor(protected firstName: string, + protected readonly lastName: string, + protected age: number = 30, + protected readonly student: boolean = false) {} +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js new file mode 100644 index 000000000000..777e252e6768 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js @@ -0,0 +1,1131 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 199 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 199 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": { + "type": "ClassBody", + "range": [ + 10, + 199 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 58 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "kind": "constructor", + "accessibility": null, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "name": "constructor" + }, + "static": false, + "value": { + "type": "FunctionExpression", + "range": [ + 25, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 58 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 195, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 58 + }, + "start": { + "line": 5, + "column": 56 + } + }, + "body": [] + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "TSParameterProperty", + "range": [ + 26, + 50 + ], + "loc": { + "end": { + "line": 2, + "column": 38 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "decorators": [], + "accessibility": "public", + "isReadonly": false, + "parameter": { + "type": "Identifier", + "range": [ + 33, + 42 + ], + "loc": { + "end": { + "line": 2, + "column": 30 + }, + "start": { + "line": 2, + "column": 21 + } + }, + "name": "firstName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 44, + 50 + ], + "loc": { + "end": { + "line": 2, + "column": 38 + }, + "start": { + "line": 2, + "column": 32 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 44, + 50 + ], + "loc": { + "end": { + "line": 2, + "column": 38 + }, + "start": { + "line": 2, + "column": 32 + } + } + } + } + }, + }, + { + "type": "TSParameterProperty", + "range": [ + 66, + 98 + ], + "loc": { + "end": { + "line": 3, + "column": 46 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "decorators": [], + "accessibility": "public", + "isReadonly": true, + "parameter": { + "type": "Identifier", + "range": [ + 82, + 90 + ], + "loc": { + "end": { + "line": 3, + "column": 38 + }, + "start": { + "line": 3, + "column": 30 + } + }, + "name": "lastName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 92, + 98 + ], + "loc": { + "end": { + "line": 3, + "column": 46 + }, + "start": { + "line": 3, + "column": 40 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 92, + 98 + ], + "loc": { + "end": { + "line": 3, + "column": 46 + }, + "start": { + "line": 3, + "column": 40 + } + } + } + } + }, + }, + { + "type": "TSParameterProperty", + "range": [ + 114, + 137 + ], + "loc": { + "end": { + "line": 4, + "column": 37 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "decorators": [], + "accessibility": "public", + "isReadonly": false, + "parameter": { + "type": "AssignmentPattern", + "range": [ + 114, + 137 + ], + "loc": { + "end": { + "line": 4, + "column": 37 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "range": [ + 121, + 124 + ], + "loc": { + "end": { + "line": 4, + "column": 24 + }, + "start": { + "line": 4, + "column": 21 + } + }, + "name": "age", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 126, + 132 + ], + "loc": { + "end": { + "line": 4, + "column": 32 + }, + "start": { + "line": 4, + "column": 26 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 126, + 132 + ], + "loc": { + "end": { + "line": 4, + "column": 32 + }, + "start": { + "line": 4, + "column": 26 + } + } + } + } + }, + "right": { + "type": "Literal", + "range": [ + 135, + 137 + ], + "loc": { + "end": { + "line": 4, + "column": 37 + }, + "start": { + "line": 4, + "column": 35 + } + }, + "raw": "30", + "value": 30 + } + }, + }, + { + "type": "TSParameterProperty", + "range": [ + 153, + 193 + ], + "loc": { + "end": { + "line": 5, + "column": 54 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "decorators": [], + "accessibility": "public", + "isReadonly": true, + "parameter": { + "type": "AssignmentPattern", + "range": [ + 153, + 193 + ], + "loc": { + "end": { + "line": 5, + "column": 54 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "range": [ + 169, + 176 + ], + "loc": { + "end": { + "line": 5, + "column": 37 + }, + "start": { + "line": 5, + "column": 30 + } + }, + "name": "student", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 178, + 185 + ], + "loc": { + "end": { + "line": 5, + "column": 46 + }, + "start": { + "line": 5, + "column": 39 + } + }, + "typeAnnotation": { + "type": "TSBooleanKeyword", + "range": [ + 178, + 185 + ], + "loc": { + "end": { + "line": 5, + "column": 46 + }, + "start": { + "line": 5, + "column": 39 + } + } + } + } + }, + "right": { + "type": "Literal", + "range": [ + 188, + 193 + ], + "loc": { + "end": { + "line": 5, + "column": 54 + }, + "start": { + "line": 5, + "column": 49 + } + }, + "raw": "false", + "value": false + } + } + } + ] + } + } + ] + }, + "decorators": [], + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "name": "Foo" + }, + "implements": [], + "superClass": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 5 + ], + "loc": { + "end": { + "line": 1, + "column": 5 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "class" + }, + { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "value": "Foo" + }, + { + "type": "Punctuator", + "range": [ + 10, + 11 + ], + "loc": { + "end": { + "line": 1, + "column": 11 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "value": "{" + }, + { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "value": "constructor" + }, + { + "type": "Punctuator", + "range": [ + 25, + 26 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "value": "(" + }, + { + "type": "Keyword", + "range": [ + 26, + 32 + ], + "loc": { + "end": { + "line": 2, + "column": 20 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "value": "public" + }, + { + "type": "Identifier", + "range": [ + 33, + 42 + ], + "loc": { + "end": { + "line": 2, + "column": 30 + }, + "start": { + "line": 2, + "column": 21 + } + }, + "value": "firstName" + }, + { + "type": "Punctuator", + "range": [ + 42, + 43 + ], + "loc": { + "end": { + "line": 2, + "column": 31 + }, + "start": { + "line": 2, + "column": 30 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 44, + 50 + ], + "loc": { + "end": { + "line": 2, + "column": 38 + }, + "start": { + "line": 2, + "column": 32 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 50, + 51 + ], + "loc": { + "end": { + "line": 2, + "column": 39 + }, + "start": { + "line": 2, + "column": 38 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 66, + 72 + ], + "loc": { + "end": { + "line": 3, + "column": 20 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "value": "public" + }, + { + "type": "Identifier", + "range": [ + 73, + 81 + ], + "loc": { + "end": { + "line": 3, + "column": 29 + }, + "start": { + "line": 3, + "column": 21 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 82, + 90 + ], + "loc": { + "end": { + "line": 3, + "column": 38 + }, + "start": { + "line": 3, + "column": 30 + } + }, + "value": "lastName" + }, + { + "type": "Punctuator", + "range": [ + 90, + 91 + ], + "loc": { + "end": { + "line": 3, + "column": 39 + }, + "start": { + "line": 3, + "column": 38 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 92, + 98 + ], + "loc": { + "end": { + "line": 3, + "column": 46 + }, + "start": { + "line": 3, + "column": 40 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 98, + 99 + ], + "loc": { + "end": { + "line": 3, + "column": 47 + }, + "start": { + "line": 3, + "column": 46 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 114, + 120 + ], + "loc": { + "end": { + "line": 4, + "column": 20 + }, + "start": { + "line": 4, + "column": 14 + } + }, + "value": "public" + }, + { + "type": "Identifier", + "range": [ + 121, + 124 + ], + "loc": { + "end": { + "line": 4, + "column": 24 + }, + "start": { + "line": 4, + "column": 21 + } + }, + "value": "age" + }, + { + "type": "Punctuator", + "range": [ + 124, + 125 + ], + "loc": { + "end": { + "line": 4, + "column": 25 + }, + "start": { + "line": 4, + "column": 24 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 126, + 132 + ], + "loc": { + "end": { + "line": 4, + "column": 32 + }, + "start": { + "line": 4, + "column": 26 + } + }, + "value": "number" + }, + { + "type": "Punctuator", + "range": [ + 133, + 134 + ], + "loc": { + "end": { + "line": 4, + "column": 34 + }, + "start": { + "line": 4, + "column": 33 + } + }, + "value": "=" + }, + { + "type": "Numeric", + "range": [ + 135, + 137 + ], + "loc": { + "end": { + "line": 4, + "column": 37 + }, + "start": { + "line": 4, + "column": 35 + } + }, + "value": "30" + }, + { + "type": "Punctuator", + "range": [ + 137, + 138 + ], + "loc": { + "end": { + "line": 4, + "column": 38 + }, + "start": { + "line": 4, + "column": 37 + } + }, + "value": "," + }, + { + "type": "Keyword", + "range": [ + 153, + 159 + ], + "loc": { + "end": { + "line": 5, + "column": 20 + }, + "start": { + "line": 5, + "column": 14 + } + }, + "value": "public" + }, + { + "type": "Identifier", + "range": [ + 160, + 168 + ], + "loc": { + "end": { + "line": 5, + "column": 29 + }, + "start": { + "line": 5, + "column": 21 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 169, + 176 + ], + "loc": { + "end": { + "line": 5, + "column": 37 + }, + "start": { + "line": 5, + "column": 30 + } + }, + "value": "student" + }, + { + "type": "Punctuator", + "range": [ + 176, + 177 + ], + "loc": { + "end": { + "line": 5, + "column": 38 + }, + "start": { + "line": 5, + "column": 37 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 178, + 185 + ], + "loc": { + "end": { + "line": 5, + "column": 46 + }, + "start": { + "line": 5, + "column": 39 + } + }, + "value": "boolean" + }, + { + "type": "Punctuator", + "range": [ + 186, + 187 + ], + "loc": { + "end": { + "line": 5, + "column": 48 + }, + "start": { + "line": 5, + "column": 47 + } + }, + "value": "=" + }, + { + "type": "Boolean", + "range": [ + 188, + 193 + ], + "loc": { + "end": { + "line": 5, + "column": 54 + }, + "start": { + "line": 5, + "column": 49 + } + }, + "value": "false" + }, + { + "type": "Punctuator", + "range": [ + 193, + 194 + ], + "loc": { + "end": { + "line": 5, + "column": 55 + }, + "start": { + "line": 5, + "column": 54 + } + }, + "value": ")" + }, + { + "type": "Punctuator", + "range": [ + 195, + 196 + ], + "loc": { + "end": { + "line": 5, + "column": 57 + }, + "start": { + "line": 5, + "column": 56 + } + }, + "value": "{" + }, + { + "type": "Punctuator", + "range": [ + 196, + 197 + ], + "loc": { + "end": { + "line": 5, + "column": 58 + }, + "start": { + "line": 5, + "column": 57 + } + }, + "value": "}" + }, + { + "type": "Punctuator", + "range": [ + 198, + 199 + ], + "loc": { + "end": { + "line": 6, + "column": 1 + }, + "start": { + "line": 6, + "column": 0 + } + }, + "value": "}" + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts new file mode 100644 index 000000000000..cf2ee5a5062e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.src.ts @@ -0,0 +1,6 @@ +class Foo { + constructor(public firstName: string, + public readonly lastName: string, + public age: number = 30, + public readonly student: boolean = false) {} +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js new file mode 100644 index 000000000000..862b587daa08 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js @@ -0,0 +1,699 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 109 + ], + "loc": { + "end": { + "line": 4, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 109 + ], + "loc": { + "end": { + "line": 4, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "body": { + "type": "ClassBody", + "range": [ + 10, + 109 + ], + "loc": { + "end": { + "line": 4, + "column": 1 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 107 + ], + "loc": { + "end": { + "line": 3, + "column": 53 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "kind": "constructor", + "accessibility": null, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "name": "constructor" + }, + "static": false, + "value": { + "type": "FunctionExpression", + "range": [ + 25, + 107 + ], + "loc": { + "end": { + "line": 3, + "column": 53 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 105, + 107 + ], + "loc": { + "end": { + "line": 3, + "column": 53 + }, + "start": { + "line": 3, + "column": 51 + } + }, + "body": [] + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "TSParameterProperty", + "range": [ + 26, + 52 + ], + "loc": { + "end": { + "line": 2, + "column": 40 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "decorators": [], + "accessibility": null, + "isReadonly": true, + "parameter": { + "type": "Identifier", + "range": [ + 35, + 44 + ], + "loc": { + "end": { + "line": 2, + "column": 32 + }, + "start": { + "line": 2, + "column": 23 + } + }, + "name": "firstName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 46, + 52 + ], + "loc": { + "end": { + "line": 2, + "column": 40 + }, + "start": { + "line": 2, + "column": 34 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 46, + 52 + ], + "loc": { + "end": { + "line": 2, + "column": 40 + }, + "start": { + "line": 2, + "column": 34 + } + } + } + } + } + }, + { + "type": "TSParameterProperty", + "range": [ + 68, + 103 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "decorators": [], + "accessibility": null, + "isReadonly": true, + "parameter": { + "type": "AssignmentPattern", + "range": [ + 68, + 103 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "left": { + "type": "Identifier", + "range": [ + 77, + 85 + ], + "loc": { + "end": { + "line": 3, + "column": 31 + }, + "start": { + "line": 3, + "column": 23 + } + }, + "name": "lastName", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 87, + 93 + ], + "loc": { + "end": { + "line": 3, + "column": 39 + }, + "start": { + "line": 3, + "column": 33 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 87, + 93 + ], + "loc": { + "end": { + "line": 3, + "column": 39 + }, + "start": { + "line": 3, + "column": 33 + } + } + } + } + }, + "right": { + "type": "Literal", + "range": [ + 96, + 103 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 42 + } + }, + "raw": "'Smith'", + "value": "Smith" + }, + } + } + ] + } + } + ] + }, + "decorators": [], + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "name": "Foo" + }, + "implements": [], + "superClass": null + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 5 + ], + "loc": { + "end": { + "line": 1, + "column": 5 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "class" + }, + { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "end": { + "line": 1, + "column": 9 + }, + "start": { + "line": 1, + "column": 6 + } + }, + "value": "Foo" + }, + { + "type": "Punctuator", + "range": [ + 10, + 11 + ], + "loc": { + "end": { + "line": 1, + "column": 11 + }, + "start": { + "line": 1, + "column": 10 + } + }, + "value": "{" + }, + { + "type": "Identifier", + "range": [ + 14, + 25 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "value": "constructor" + }, + { + "type": "Punctuator", + "range": [ + 25, + 26 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "value": "(" + }, + { + "type": "Identifier", + "range": [ + 26, + 34 + ], + "loc": { + "end": { + "line": 2, + "column": 22 + }, + "start": { + "line": 2, + "column": 14 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 35, + 44 + ], + "loc": { + "end": { + "line": 2, + "column": 32 + }, + "start": { + "line": 2, + "column": 23 + } + }, + "value": "firstName" + }, + { + "type": "Punctuator", + "range": [ + 44, + 45 + ], + "loc": { + "end": { + "line": 2, + "column": 33 + }, + "start": { + "line": 2, + "column": 32 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 46, + 52 + ], + "loc": { + "end": { + "line": 2, + "column": 40 + }, + "start": { + "line": 2, + "column": 34 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 52, + 53 + ], + "loc": { + "end": { + "line": 2, + "column": 41 + }, + "start": { + "line": 2, + "column": 40 + } + }, + "value": "," + }, + { + "type": "Identifier", + "range": [ + 68, + 76 + ], + "loc": { + "end": { + "line": 3, + "column": 22 + }, + "start": { + "line": 3, + "column": 14 + } + }, + "value": "readonly" + }, + { + "type": "Identifier", + "range": [ + 77, + 85 + ], + "loc": { + "end": { + "line": 3, + "column": 31 + }, + "start": { + "line": 3, + "column": 23 + } + }, + "value": "lastName" + }, + { + "type": "Punctuator", + "range": [ + 85, + 86 + ], + "loc": { + "end": { + "line": 3, + "column": 32 + }, + "start": { + "line": 3, + "column": 31 + } + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 87, + 93 + ], + "loc": { + "end": { + "line": 3, + "column": 39 + }, + "start": { + "line": 3, + "column": 33 + } + }, + "value": "string" + }, + { + "type": "Punctuator", + "range": [ + 94, + 95 + ], + "loc": { + "end": { + "line": 3, + "column": 41 + }, + "start": { + "line": 3, + "column": 40 + } + }, + "value": "=" + }, + { + "type": "String", + "range": [ + 96, + 103 + ], + "loc": { + "end": { + "line": 3, + "column": 49 + }, + "start": { + "line": 3, + "column": 42 + } + }, + "value": "'Smith'" + }, + { + "type": "Punctuator", + "range": [ + 103, + 104 + ], + "loc": { + "end": { + "line": 3, + "column": 50 + }, + "start": { + "line": 3, + "column": 49 + } + }, + "value": ")" + }, + { + "type": "Punctuator", + "range": [ + 105, + 106 + ], + "loc": { + "end": { + "line": 3, + "column": 52 + }, + "start": { + "line": 3, + "column": 51 + } + }, + "value": "{" + }, + { + "type": "Punctuator", + "range": [ + 106, + 107 + ], + "loc": { + "end": { + "line": 3, + "column": 53 + }, + "start": { + "line": 3, + "column": 52 + } + }, + "value": "}" + }, + { + "type": "Punctuator", + "range": [ + 108, + 109 + ], + "loc": { + "end": { + "line": 4, + "column": 1 + }, + "start": { + "line": 4, + "column": 0 + } + }, + "value": "}" + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts new file mode 100644 index 000000000000..2525c6720f21 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.src.ts @@ -0,0 +1,4 @@ +class Foo { + constructor(readonly firstName: string, + readonly lastName: string = 'Smith') {} +} \ No newline at end of file From 0e4a5246488dee14031fa9b1fe9b7a4438956af8 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 6 Mar 2017 14:28:12 +0000 Subject: [PATCH 106/326] Fix: Change DoWhileStatement to DoStatement to match TS (fixes #180) (#181) --- .../lib/ast-converter.js | 6 +- .../basics/do-while-statements.result.js | 780 ++++++++++++++++++ .../basics/do-while-statements.src.js | 6 + 3 files changed, 791 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 67858380ab5a..36db57c3c171 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -852,7 +852,11 @@ module.exports = function(ast, extra) { }); break; - case SyntaxKind.DoWhileStatement: + /** + * Unlike other parsers, TypeScript calls a "DoWhileStatement" + * a "DoStatement" + */ + case SyntaxKind.DoStatement: assign(result, { type: "DoWhileStatement", test: convertChild(node.expression), diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js new file mode 100644 index 000000000000..c31d35005fff --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js @@ -0,0 +1,780 @@ +module.exports = { + "body": [ + { + "body": { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 2, + "line": 1 + } + }, + "range": [ + 2, + 3 + ], + "type": "EmptyStatement" + }, + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 13 + ], + "test": { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 11 + ], + "raw": "1", + "type": "Literal", + "value": 1 + }, + "type": "DoWhileStatement" + }, + { + "declarations": [ + { + "id": { + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "name": "i", + "range": [ + 19, + 20 + ], + "type": "Identifier" + }, + "init": { + "loc": { + "end": { + "column": 9, + "line": 3 + }, + "start": { + "column": 8, + "line": 3 + } + }, + "range": [ + 23, + 24 + ], + "raw": "0", + "type": "Literal", + "value": 0 + }, + "loc": { + "end": { + "column": 9, + "line": 3 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "range": [ + 19, + 24 + ], + "type": "VariableDeclarator" + } + ], + "kind": "var", + "loc": { + "end": { + "column": 10, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 15, + 25 + ], + "type": "VariableDeclaration" + }, + { + "body": { + "body": [ + { + "expression": { + "left": { + "loc": { + "end": { + "column": 4, + "line": 5 + }, + "start": { + "column": 3, + "line": 5 + } + }, + "name": "i", + "range": [ + 34, + 35 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 9, + "line": 5 + }, + "start": { + "column": 3, + "line": 5 + } + }, + "operator": "+=", + "range": [ + 34, + 40 + ], + "right": { + "loc": { + "end": { + "column": 9, + "line": 5 + }, + "start": { + "column": 8, + "line": 5 + } + }, + "range": [ + 39, + 40 + ], + "raw": "1", + "type": "Literal", + "value": 1 + }, + "type": "AssignmentExpression" + }, + "loc": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 3, + "line": 5 + } + }, + "range": [ + 34, + 41 + ], + "type": "ExpressionStatement" + } + ], + "loc": { + "end": { + "column": 1, + "line": 6 + }, + "start": { + "column": 3, + "line": 4 + } + }, + "range": [ + 29, + 43 + ], + "type": "BlockStatement" + }, + "loc": { + "end": { + "column": 16, + "line": 6 + }, + "start": { + "column": 0, + "line": 4 + } + }, + "range": [ + 26, + 58 + ], + "test": { + "left": { + "loc": { + "end": { + "column": 10, + "line": 6 + }, + "start": { + "column": 9, + "line": 6 + } + }, + "name": "i", + "range": [ + 51, + 52 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 14, + "line": 6 + }, + "start": { + "column": 9, + "line": 6 + } + }, + "operator": "<", + "range": [ + 51, + 56 + ], + "right": { + "loc": { + "end": { + "column": 14, + "line": 6 + }, + "start": { + "column": 13, + "line": 6 + } + }, + "range": [ + 55, + 56 + ], + "raw": "5", + "type": "Literal", + "value": 5 + }, + "type": "BinaryExpression" + }, + "type": "DoWhileStatement" + } + ], + "loc": { + "end": { + "column": 16, + "line": 6 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 58 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 2, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 2 + ], + "type": "Keyword", + "value": "do" + }, + { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 2, + "line": 1 + } + }, + "range": [ + 2, + 3 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 9 + ], + "type": "Keyword", + "value": "while" + }, + { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "range": [ + 9, + 10 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 11 + ], + "type": "Numeric", + "value": "1" + }, + { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "range": [ + 11, + 12 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 12, + "line": 1 + } + }, + "range": [ + 12, + 13 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 3, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 15, + 18 + ], + "type": "Keyword", + "value": "var" + }, + { + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "range": [ + 19, + 20 + ], + "type": "Identifier", + "value": "i" + }, + { + "loc": { + "end": { + "column": 7, + "line": 3 + }, + "start": { + "column": 6, + "line": 3 + } + }, + "range": [ + 21, + 22 + ], + "type": "Punctuator", + "value": "=" + }, + { + "loc": { + "end": { + "column": 9, + "line": 3 + }, + "start": { + "column": 8, + "line": 3 + } + }, + "range": [ + 23, + 24 + ], + "type": "Numeric", + "value": "0" + }, + { + "loc": { + "end": { + "column": 10, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + }, + "range": [ + 24, + 25 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 2, + "line": 4 + }, + "start": { + "column": 0, + "line": 4 + } + }, + "range": [ + 26, + 28 + ], + "type": "Keyword", + "value": "do" + }, + { + "loc": { + "end": { + "column": 4, + "line": 4 + }, + "start": { + "column": 3, + "line": 4 + } + }, + "range": [ + 29, + 30 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 4, + "line": 5 + }, + "start": { + "column": 3, + "line": 5 + } + }, + "range": [ + 34, + 35 + ], + "type": "Identifier", + "value": "i" + }, + { + "loc": { + "end": { + "column": 7, + "line": 5 + }, + "start": { + "column": 5, + "line": 5 + } + }, + "range": [ + 36, + 38 + ], + "type": "Punctuator", + "value": "+=" + }, + { + "loc": { + "end": { + "column": 9, + "line": 5 + }, + "start": { + "column": 8, + "line": 5 + } + }, + "range": [ + 39, + 40 + ], + "type": "Numeric", + "value": "1" + }, + { + "loc": { + "end": { + "column": 10, + "line": 5 + }, + "start": { + "column": 9, + "line": 5 + } + }, + "range": [ + 40, + 41 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 6 + }, + "start": { + "column": 0, + "line": 6 + } + }, + "range": [ + 42, + 43 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 7, + "line": 6 + }, + "start": { + "column": 2, + "line": 6 + } + }, + "range": [ + 44, + 49 + ], + "type": "Keyword", + "value": "while" + }, + { + "loc": { + "end": { + "column": 9, + "line": 6 + }, + "start": { + "column": 8, + "line": 6 + } + }, + "range": [ + 50, + 51 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 10, + "line": 6 + }, + "start": { + "column": 9, + "line": 6 + } + }, + "range": [ + 51, + 52 + ], + "type": "Identifier", + "value": "i" + }, + { + "loc": { + "end": { + "column": 12, + "line": 6 + }, + "start": { + "column": 11, + "line": 6 + } + }, + "range": [ + 53, + 54 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 14, + "line": 6 + }, + "start": { + "column": 13, + "line": 6 + } + }, + "range": [ + 55, + 56 + ], + "type": "Numeric", + "value": "5" + }, + { + "loc": { + "end": { + "column": 15, + "line": 6 + }, + "start": { + "column": 14, + "line": 6 + } + }, + "range": [ + 56, + 57 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 16, + "line": 6 + }, + "start": { + "column": 15, + "line": 6 + } + }, + "range": [ + 57, + 58 + ], + "type": "Punctuator", + "value": ";" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.src.js new file mode 100644 index 000000000000..f2c72e8efc56 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.src.js @@ -0,0 +1,6 @@ +do; while(1); + +var i = 0; +do { + i += 1; +} while (i < 5); From 76d0f034fb021e81b6cc8930229c172b1ba81ca9 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sat, 18 Mar 2017 16:06:08 +0100 Subject: [PATCH 107/326] Fix: Add missing typeAnnotation to class properties (fixes #190) (#191) --- .../lib/ast-converter.js | 3 +- ...ass-with-accessibility-modifiers.result.js | 73 ++++++++++++++++++- ...ecorator-factory-instance-member.result.js | 8 +- ...-decorator-factory-static-member.result.js | 8 +- ...operty-decorator-instance-member.result.js | 8 +- ...property-decorator-static-member.result.js | 8 +- 6 files changed, 93 insertions(+), 15 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 36db57c3c171..08eac2a1aaad 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1082,7 +1082,8 @@ module.exports = function(ast, extra) { accessibility: getTSNodeAccessibility(node), decorators: (node.decorators) ? node.decorators.map(function(d) { return convertChild(d.expression); - }) : [] + }) : [], + typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null }); break; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js index f9d174fdf140..45c030fed010 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js @@ -90,7 +90,41 @@ module.exports = { "computed": false, "static": false, "accessibility": "private", - "decorators": [] + "decorators": [], + "typeAnnotation": { + "loc": { + "end": { + "column": 22, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "range": [ + 28, + 34 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 22, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "range": [ + 28, + 34 + ], + "type": "TSStringKeyword" + } + } }, { "type": "ClassProperty", @@ -130,7 +164,42 @@ module.exports = { "computed": false, "static": true, "accessibility": "public", - "decorators": [] + "decorators": [], + "typeAnnotation": { + "loc": { + "end": { + "column": 28, + "line": 3 + }, + "start": { + "column": 22, + "line": 3 + } + }, + "range": [ + 58, + 64 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 28, + "line": 3 + }, + "start": { + "column": 22, + "line": 3 + } + }, + "range": [ + 58, + 64 + ], + "type": "TSNumberKeyword" + } + } + }, { "type": "MethodDefinition", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js index 13d258bf263e..51a1a55fc20d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js @@ -127,7 +127,8 @@ module.exports = { }, "arguments": [] } - ] + ], + "typeAnnotation": null }, { "type": "ClassProperty", @@ -239,7 +240,8 @@ module.exports = { }, "arguments": [] } - ] + ], + "typeAnnotation": null } ], "range": [ @@ -643,4 +645,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js index 4fa4ec4a5fa9..9a4933fb5740 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js @@ -147,7 +147,8 @@ module.exports = { } ] } - ] + ], + "typeAnnotation": null }, { "type": "ClassProperty", @@ -244,7 +245,8 @@ module.exports = { } ] } - ] + ], + "typeAnnotation": null } ], "range": [ @@ -630,4 +632,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js index fbce854ed9f2..a00abaaa424f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js @@ -109,7 +109,8 @@ module.exports = { }, "name": "foo" } - ] + ], + "typeAnnotation": null }, { "type": "ClassProperty", @@ -168,7 +169,8 @@ module.exports = { }, "name": "bar" } - ] + ], + "typeAnnotation": null } ], "range": [ @@ -410,4 +412,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js index 46bfead2b630..76c42c882c53 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js @@ -109,7 +109,8 @@ module.exports = { }, "name": "baz" } - ] + ], + "typeAnnotation": null }, { "type": "ClassProperty", @@ -168,7 +169,8 @@ module.exports = { }, "name": "qux" } - ] + ], + "typeAnnotation": null } ], "range": [ @@ -446,4 +448,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From 8b43628244209031cc4c8eb10115c476f8209cc4 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sat, 18 Mar 2017 16:52:40 +0100 Subject: [PATCH 108/326] New: Mark optional parameters and properties (fixes #186) (#187) --- .../lib/ast-converter.js | 8 + .../class-with-optional-properties.result.js | 526 +++++++++++ .../class-with-optional-properties.src.ts | 5 + ...ct-type-with-optional-properties.result.js | 768 +++++++++++++++++ ...bject-type-with-optional-properties.src.ts | 3 + ...terface-with-optional-properties.result.js | 813 ++++++++++++++++++ .../interface-with-optional-properties.src.ts | 5 + .../non-null-assertion-operator.result.js | 3 +- 8 files changed, 2130 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 08eac2a1aaad..ea91dd84d785 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -752,6 +752,14 @@ module.exports = function(ast, extra) { type: "Identifier", name: ts.unescapeIdentifier(node.text) }); + if (node.parent.questionToken && ( + SyntaxKind.Parameter === node.parent.kind || + SyntaxKind.PropertyDeclaration === node.parent.kind || + SyntaxKind.PropertySignature === node.parent.kind || + SyntaxKind.MethodSignature === node.parent.kind + )) { + result.optional = true; + } break; case SyntaxKind.WithStatement: diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js new file mode 100644 index 000000000000..0a6d6f8321e8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js @@ -0,0 +1,526 @@ +module.exports = { + "body": [ + { + "body": { + "body": [ + { + "accessibility": null, + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 5, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "name": "foo", + "optional": true, + "range": [ + 14, + 17 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 14, + 19 + ], + "static": false, + "type": "ClassProperty", + "value": null + }, + { + "accessibility": null, + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "name": "bar", + "optional": true, + "range": [ + 22, + 25 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "range": [ + 22, + 36 + ], + "static": false, + "type": "ClassProperty", + "value": null + }, + { + "accessibility": "private", + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 13, + "line": 4 + }, + "start": { + "column": 10, + "line": 4 + } + }, + "name": "baz", + "optional": true, + "range": [ + 47, + 50 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 24, + "line": 4 + }, + "start": { + "column": 2, + "line": 4 + } + }, + "range": [ + 39, + 61 + ], + "static": false, + "type": "ClassProperty", + "value": null + } + ], + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 63 + ], + "type": "ClassBody" + }, + "decorators": [], + "id": { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "name": "Foo", + "range": [ + 6, + 9 + ], + "type": "Identifier" + }, + "implements": [], + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 63 + ], + "superClass": null, + "type": "ClassDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 63 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 5 + ], + "type": "Keyword", + "value": "class" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 9 + ], + "type": "Identifier", + "value": "Foo" + }, + { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 11 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 5, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 14, + 17 + ], + "type": "Identifier", + "value": "foo" + }, + { + "loc": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "range": [ + 17, + 18 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 6, + "line": 2 + } + }, + "range": [ + 18, + 19 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "range": [ + 22, + 25 + ], + "type": "Identifier", + "value": "bar" + }, + { + "loc": { + "end": { + "column": 6, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + }, + "range": [ + 25, + 26 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 8, + "line": 3 + }, + "start": { + "column": 7, + "line": 3 + } + }, + "range": [ + 27, + 28 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 15, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + }, + "range": [ + 29, + 35 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 15, + "line": 3 + } + }, + "range": [ + 35, + 36 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 9, + "line": 4 + }, + "start": { + "column": 2, + "line": 4 + } + }, + "range": [ + 39, + 46 + ], + "type": "Keyword", + "value": "private" + }, + { + "loc": { + "end": { + "column": 13, + "line": 4 + }, + "start": { + "column": 10, + "line": 4 + } + }, + "range": [ + 47, + 50 + ], + "type": "Identifier", + "value": "baz" + }, + { + "loc": { + "end": { + "column": 14, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + }, + "range": [ + 50, + 51 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 16, + "line": 4 + }, + "start": { + "column": 15, + "line": 4 + } + }, + "range": [ + 52, + 53 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 23, + "line": 4 + }, + "start": { + "column": 17, + "line": 4 + } + }, + "range": [ + 54, + 60 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 24, + "line": 4 + }, + "start": { + "column": 23, + "line": 4 + } + }, + "range": [ + 60, + 61 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 5 + } + }, + "range": [ + 62, + 63 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.src.ts new file mode 100644 index 000000000000..536aab8062dc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.src.ts @@ -0,0 +1,5 @@ +class Foo { + foo?; + bar? : string; + private baz? : string; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js new file mode 100644 index 000000000000..ad9e5031023a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js @@ -0,0 +1,768 @@ +module.exports = { + "body": [ + { + "async": false, + "body": { + "body": [], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 47, + "line": 1 + } + }, + "range": [ + 47, + 51 + ], + "type": "BlockStatement" + }, + "expression": false, + "generator": false, + "id": { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "name": "foo", + "range": [ + 9, + 12 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 13, + "line": 1 + } + }, + "properties": [ + { + "computed": false, + "key": { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "name": "bar", + "range": [ + 14, + 17 + ], + "type": "Identifier" + }, + "kind": "init", + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "method": false, + "range": [ + 14, + 17 + ], + "shorthand": true, + "type": "Property", + "value": { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "name": "bar", + "range": [ + 14, + 17 + ], + "type": "Identifier" + } + }, + { + "computed": false, + "key": { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "name": "baz", + "range": [ + 19, + 22 + ], + "type": "Identifier" + }, + "kind": "init", + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "method": false, + "range": [ + 19, + 22 + ], + "shorthand": true, + "type": "Property", + "value": { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "name": "baz", + "range": [ + 19, + 22 + ], + "type": "Identifier" + } + } + ], + "range": [ + 13, + 23 + ], + "type": "ObjectPattern", + "typeAnnotation": { + "loc": { + "end": { + "column": 45, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } + }, + "range": [ + 25, + 45 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 45, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } + }, + "members": [ + { + "loc": { + "end": { + "column": 39, + "line": 1 + }, + "start": { + "column": 26, + "line": 1 + } + }, + "name": { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 26, + "line": 1 + } + }, + "name": "bar", + "optional": true, + "range": [ + 26, + 29 + ], + "type": "Identifier" + }, + "questionToken": { + "loc": { + "end": { + "column": 30, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "range": [ + 29, + 30 + ], + "type": "TSQuestionToken" + }, + "range": [ + 26, + 39 + ], + "type": "TSPropertySignature", + "typeAnnotation": { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 38 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 38 + ], + "type": "TSStringKeyword" + } + } + }, + { + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 40, + "line": 1 + } + }, + "name": { + "loc": { + "end": { + "column": 43, + "line": 1 + }, + "start": { + "column": 40, + "line": 1 + } + }, + "name": "baz", + "optional": true, + "range": [ + 40, + 43 + ], + "type": "Identifier" + }, + "questionToken": { + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 43, + "line": 1 + } + }, + "range": [ + 43, + 44 + ], + "type": "TSQuestionToken" + }, + "range": [ + 40, + 44 + ], + "type": "TSPropertySignature", + "typeAnnotation": null + } + ], + "range": [ + 25, + 45 + ], + "type": "TSTypeLiteral" + } + } + } + ], + "range": [ + 0, + 51 + ], + "type": "FunctionDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 51 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 8, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 8 + ], + "type": "Keyword", + "value": "function" + }, + { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "range": [ + 9, + 12 + ], + "type": "Identifier", + "value": "foo" + }, + { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 12, + "line": 1 + } + }, + "range": [ + 12, + 13 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 13, + "line": 1 + } + }, + "range": [ + 13, + 14 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "range": [ + 14, + 17 + ], + "type": "Identifier", + "value": "bar" + }, + { + "loc": { + "end": { + "column": 18, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 18 + ], + "type": "Punctuator", + "value": "," + }, + { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "range": [ + 19, + 22 + ], + "type": "Identifier", + "value": "baz" + }, + { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "range": [ + 22, + 23 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "range": [ + 23, + 24 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } + }, + "range": [ + 25, + 26 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 26, + "line": 1 + } + }, + "range": [ + 26, + 29 + ], + "type": "Identifier", + "value": "bar" + }, + { + "loc": { + "end": { + "column": 30, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "range": [ + 29, + 30 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 31, + "line": 1 + }, + "start": { + "column": 30, + "line": 1 + } + }, + "range": [ + 30, + 31 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 38 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 39, + "line": 1 + }, + "start": { + "column": 38, + "line": 1 + } + }, + "range": [ + 38, + 39 + ], + "type": "Punctuator", + "value": "," + }, + { + "loc": { + "end": { + "column": 43, + "line": 1 + }, + "start": { + "column": 40, + "line": 1 + } + }, + "range": [ + 40, + 43 + ], + "type": "Identifier", + "value": "baz" + }, + { + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 43, + "line": 1 + } + }, + "range": [ + 43, + 44 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 45, + "line": 1 + }, + "start": { + "column": 44, + "line": 1 + } + }, + "range": [ + 44, + 45 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 46, + "line": 1 + }, + "start": { + "column": 45, + "line": 1 + } + }, + "range": [ + 45, + 46 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 47, + "line": 1 + } + }, + "range": [ + 47, + 48 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 50, + 51 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts new file mode 100644 index 000000000000..49837b4a1505 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.src.ts @@ -0,0 +1,3 @@ +function foo({bar, baz}: {bar?: string, baz?}) { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js new file mode 100644 index 000000000000..346edb1a62cd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js @@ -0,0 +1,813 @@ +module.exports = { + "body": [ + { + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "members": [ + { + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "name": { + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "name": "foo", + "optional": true, + "range": [ + 21, + 24 + ], + "type": "Identifier" + }, + "questionToken": { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 7, + "line": 2 + } + }, + "range": [ + 24, + 25 + ], + "type": "TSQuestionToken" + }, + "range": [ + 21, + 26 + ], + "type": "TSPropertySignature", + "typeAnnotation": null + }, + { + "loc": { + "end": { + "column": 17, + "line": 3 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "name": { + "loc": { + "end": { + "column": 7, + "line": 3 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "name": "bar", + "optional": true, + "range": [ + 31, + 34 + ], + "type": "Identifier" + }, + "questionToken": { + "loc": { + "end": { + "column": 8, + "line": 3 + }, + "start": { + "column": 7, + "line": 3 + } + }, + "range": [ + 34, + 35 + ], + "type": "TSQuestionToken" + }, + "range": [ + 31, + 44 + ], + "type": "TSPropertySignature", + "typeAnnotation": { + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 10, + "line": 3 + } + }, + "range": [ + 37, + 43 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 10, + "line": 3 + } + }, + "range": [ + 37, + 43 + ], + "type": "TSStringKeyword" + } + } + }, + { + "loc": { + "end": { + "column": 34, + "line": 4 + }, + "start": { + "column": 4, + "line": 4 + } + }, + "name": { + "loc": { + "end": { + "column": 7, + "line": 4 + }, + "start": { + "column": 4, + "line": 4 + } + }, + "name": "baz", + "optional": true, + "range": [ + 49, + 52 + ], + "type": "Identifier" + }, + "parameters": [ + { + "loc": { + "end": { + "column": 12, + "line": 4 + }, + "start": { + "column": 9, + "line": 4 + } + }, + "name": "foo", + "range": [ + 54, + 57 + ], + "type": "Identifier" + }, + { + "loc": { + "end": { + "column": 17, + "line": 4 + }, + "start": { + "column": 14, + "line": 4 + } + }, + "name": "bar", + "optional": true, + "range": [ + 59, + 62 + ], + "type": "Identifier", + "typeAnnotation": { + "loc": { + "end": { + "column": 26, + "line": 4 + }, + "start": { + "column": 20, + "line": 4 + } + }, + "range": [ + 65, + 71 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 26, + "line": 4 + }, + "start": { + "column": 20, + "line": 4 + } + }, + "range": [ + 65, + 71 + ], + "type": "TSStringKeyword" + } + } + }, + { + "loc": { + "end": { + "column": 31, + "line": 4 + }, + "start": { + "column": 28, + "line": 4 + } + }, + "name": "baz", + "optional": true, + "range": [ + 73, + 76 + ], + "type": "Identifier" + } + ], + "questionToken": { + "loc": { + "end": { + "column": 8, + "line": 4 + }, + "start": { + "column": 7, + "line": 4 + } + }, + "range": [ + 52, + 53 + ], + "type": "TSQuestionToken" + }, + "range": [ + 49, + 79 + ], + "type": "TSMethodSignature" + } + ], + "name": { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "name": "test", + "range": [ + 10, + 14 + ], + "type": "Identifier" + }, + "range": [ + 0, + 81 + ], + "type": "TSInterfaceDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 81 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 9 + ], + "type": "Keyword", + "value": "interface" + }, + { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 14 + ], + "type": "Identifier", + "value": "test" + }, + { + "loc": { + "end": { + "column": 16, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 16 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 21, + 24 + ], + "type": "Identifier", + "value": "foo" + }, + { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 7, + "line": 2 + } + }, + "range": [ + 24, + 25 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 8, + "line": 2 + } + }, + "range": [ + 25, + 26 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 7, + "line": 3 + }, + "start": { + "column": 4, + "line": 3 + } + }, + "range": [ + 31, + 34 + ], + "type": "Identifier", + "value": "bar" + }, + { + "loc": { + "end": { + "column": 8, + "line": 3 + }, + "start": { + "column": 7, + "line": 3 + } + }, + "range": [ + 34, + 35 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 9, + "line": 3 + }, + "start": { + "column": 8, + "line": 3 + } + }, + "range": [ + 35, + 36 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 10, + "line": 3 + } + }, + "range": [ + 37, + 43 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 17, + "line": 3 + }, + "start": { + "column": 16, + "line": 3 + } + }, + "range": [ + 43, + 44 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 7, + "line": 4 + }, + "start": { + "column": 4, + "line": 4 + } + }, + "range": [ + 49, + 52 + ], + "type": "Identifier", + "value": "baz" + }, + { + "loc": { + "end": { + "column": 8, + "line": 4 + }, + "start": { + "column": 7, + "line": 4 + } + }, + "range": [ + 52, + 53 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 9, + "line": 4 + }, + "start": { + "column": 8, + "line": 4 + } + }, + "range": [ + 53, + 54 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 12, + "line": 4 + }, + "start": { + "column": 9, + "line": 4 + } + }, + "range": [ + 54, + 57 + ], + "type": "Identifier", + "value": "foo" + }, + { + "loc": { + "end": { + "column": 13, + "line": 4 + }, + "start": { + "column": 12, + "line": 4 + } + }, + "range": [ + 57, + 58 + ], + "type": "Punctuator", + "value": "," + }, + { + "loc": { + "end": { + "column": 17, + "line": 4 + }, + "start": { + "column": 14, + "line": 4 + } + }, + "range": [ + 59, + 62 + ], + "type": "Identifier", + "value": "bar" + }, + { + "loc": { + "end": { + "column": 18, + "line": 4 + }, + "start": { + "column": 17, + "line": 4 + } + }, + "range": [ + 62, + 63 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 19, + "line": 4 + }, + "start": { + "column": 18, + "line": 4 + } + }, + "range": [ + 63, + 64 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 26, + "line": 4 + }, + "start": { + "column": 20, + "line": 4 + } + }, + "range": [ + 65, + 71 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 27, + "line": 4 + }, + "start": { + "column": 26, + "line": 4 + } + }, + "range": [ + 71, + 72 + ], + "type": "Punctuator", + "value": "," + }, + { + "loc": { + "end": { + "column": 31, + "line": 4 + }, + "start": { + "column": 28, + "line": 4 + } + }, + "range": [ + 73, + 76 + ], + "type": "Identifier", + "value": "baz" + }, + { + "loc": { + "end": { + "column": 32, + "line": 4 + }, + "start": { + "column": 31, + "line": 4 + } + }, + "range": [ + 76, + 77 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 33, + "line": 4 + }, + "start": { + "column": 32, + "line": 4 + } + }, + "range": [ + 77, + 78 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 34, + "line": 4 + }, + "start": { + "column": 33, + "line": 4 + } + }, + "range": [ + 78, + 79 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 5 + } + }, + "range": [ + 80, + 81 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.src.ts new file mode 100644 index 000000000000..448d419a81cd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.src.ts @@ -0,0 +1,5 @@ +interface test { + foo?; + bar?: string; + baz?(foo, bar?: string, baz?); +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js index 9fa6cc769251..3cab39a3d838 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js @@ -70,6 +70,7 @@ module.exports = { } }, "name": "e", + "optional": true, "typeAnnotation": { "type": "TypeAnnotation", "loc": { @@ -760,4 +761,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From 4b56d43d009cf982854e66a7920f31dd26ce41d8 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 18 Mar 2017 16:14:26 +0000 Subject: [PATCH 109/326] Fix: Updated broken class-with-optional-properties test result (#192) --- .../class-with-optional-properties.result.js | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js index 0a6d6f8321e8..54b35443fe7a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js @@ -42,6 +42,7 @@ module.exports = { ], "static": false, "type": "ClassProperty", + "typeAnnotation": null, "value": null }, { @@ -83,6 +84,40 @@ module.exports = { ], "static": false, "type": "ClassProperty", + "typeAnnotation": { + "loc": { + "end": { + "column": 15, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + }, + "range": [ + 29, + 35 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 15, + "line": 3 + }, + "start": { + "column": 9, + "line": 3 + } + }, + "range": [ + 29, + 35 + ], + "type": "TSStringKeyword" + } + }, "value": null }, { @@ -124,6 +159,40 @@ module.exports = { ], "static": false, "type": "ClassProperty", + "typeAnnotation": { + "loc": { + "end": { + "column": 23, + "line": 4 + }, + "start": { + "column": 17, + "line": 4 + } + }, + "range": [ + 54, + 60 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 23, + "line": 4 + }, + "start": { + "column": 17, + "line": 4 + } + }, + "range": [ + 54, + 60 + ], + "type": "TSStringKeyword" + } + }, "value": null } ], From bd4ba37d1826bfcb18a7e1b526a5e313347eec5c Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sat, 18 Mar 2017 18:25:04 +0100 Subject: [PATCH 110/326] New: Store type parameter constraints (fixes #188) (#189) --- .../lib/ast-converter.js | 5 +- ...ow-function-with-type-parameters.result.js | 3 +- ...-type-parameters-with-constraint.result.js | 670 ++++++++++++++++++ ...ith-type-parameters-with-constraint.src.ts | 3 + .../function-with-type-parameters.result.js | 5 +- ...-with-constrained-type-parameter.result.js | 545 ++++++++++++++ ...ion-with-constrained-type-parameter.src.ts | 1 + .../basics/type-alias-declaration.result.js | 5 +- 8 files changed, 1231 insertions(+), 6 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index ea91dd84d785..1559222b0a91 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -636,7 +636,10 @@ module.exports = function(ast, extra) { typeParameter.end ], loc: getLocFor(typeParameterStart, typeParameter.end, ast), - name: typeParameter.name.text + name: typeParameter.name.text, + constraint: (typeParameter.constraint) + ? convertTypeAnnotation(typeParameter.constraint) + : null }; }) }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js index 7b6c530d0e0a..b000ecfbcf4f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js @@ -262,7 +262,8 @@ module.exports = { "column": 2 } }, - "name": "X" + "name": "X", + "constraint": null } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js new file mode 100644 index 000000000000..e212335b28b3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js @@ -0,0 +1,670 @@ +module.exports = { + "body": [ + { + "async": false, + "body": { + "body": [ + { + "argument": { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "name": "b", + "range": [ + 47, + 48 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 40, + 49 + ], + "type": "ReturnStatement" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 34, + "line": 1 + } + }, + "range": [ + 34, + 51 + ], + "type": "BlockStatement" + }, + "expression": false, + "generator": false, + "id": { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "name": "a", + "range": [ + 9, + 10 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } + }, + "name": "b", + "range": [ + 25, + 26 + ], + "type": "Identifier", + "typeAnnotation": { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 29 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 29 + ], + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "name": "X", + "range": [ + 28, + 29 + ], + "type": "Identifier" + } + } + } + } + ], + "range": [ + 0, + 51 + ], + "returnType": { + "loc": { + "end": { + "column": 33, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 33 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 33, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 33 + ], + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 33, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "name": "X", + "range": [ + 32, + 33 + ], + "type": "Identifier" + } + } + }, + "type": "FunctionDeclaration", + "typeParameters": { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "params": [ + { + "constraint": { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 23 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "members": [], + "range": [ + 21, + 23 + ], + "type": "TSTypeLiteral" + } + }, + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "name": "X", + "range": [ + 11, + 23 + ], + "type": "TypeParameter" + } + ], + "range": [ + 10, + 24 + ], + "type": "TypeParameterDeclaration" + } + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 51 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 8, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 8 + ], + "type": "Keyword", + "value": "function" + }, + { + "loc": { + "end": { + "column": 10, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "range": [ + 9, + 10 + ], + "type": "Identifier", + "value": "a" + }, + { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 11 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "range": [ + 11, + 12 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 20, + "line": 1 + }, + "start": { + "column": 13, + "line": 1 + } + }, + "range": [ + 13, + 20 + ], + "type": "Keyword", + "value": "extends" + }, + { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 22 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "range": [ + 22, + 23 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "range": [ + 23, + 24 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 25, + "line": 1 + }, + "start": { + "column": 24, + "line": 1 + } + }, + "range": [ + 24, + 25 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } + }, + "range": [ + 25, + 26 + ], + "type": "Identifier", + "value": "b" + }, + { + "loc": { + "end": { + "column": 27, + "line": 1 + }, + "start": { + "column": 26, + "line": 1 + } + }, + "range": [ + 26, + 27 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 29 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 30, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "range": [ + 29, + 30 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 31, + "line": 1 + }, + "start": { + "column": 30, + "line": 1 + } + }, + "range": [ + 30, + 31 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 33, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 33 + ], + "type": "Identifier", + "value": "X" + }, + { + "loc": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 34, + "line": 1 + } + }, + "range": [ + 34, + 35 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 40, + 46 + ], + "type": "Keyword", + "value": "return" + }, + { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "range": [ + 47, + 48 + ], + "type": "Identifier", + "value": "b" + }, + { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 48, + 49 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 50, + 51 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts new file mode 100644 index 000000000000..f3c4d2eaa906 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.src.ts @@ -0,0 +1,3 @@ +function a(b: X): X { + return b; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js index 79b15d25dadb..6263e613bafe 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js @@ -263,7 +263,8 @@ module.exports = { "column": 12 } }, - "name": "X" + "name": "X", + "constraint": null } ] } @@ -578,4 +579,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js new file mode 100644 index 000000000000..9fecbbd47cef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js @@ -0,0 +1,545 @@ +module.exports = { + "body": [ + { + "declarations": [ + { + "id": { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 5, + "line": 1 + } + }, + "name": "Result", + "range": [ + 5, + 11 + ], + "type": "Identifier" + }, + "init": { + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 48 + ], + "type": "TSUnionType", + "types": [ + { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 38 + ], + "type": "TSTypeReference", + "typeArguments": [ + { + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 36, + "line": 1 + } + }, + "range": [ + 36, + 37 + ], + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 36, + "line": 1 + } + }, + "name": "T", + "range": [ + 36, + 37 + ], + "type": "Identifier" + } + } + ], + "typeName": { + "loc": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "name": "Success", + "range": [ + 28, + 35 + ], + "type": "Identifier" + } + }, + { + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 41, + "line": 1 + } + }, + "range": [ + 41, + 48 + ], + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 41, + "line": 1 + } + }, + "name": "Failure", + "range": [ + 41, + 48 + ], + "type": "Identifier" + } + } + ] + }, + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 5, + "line": 1 + } + }, + "range": [ + 5, + 48 + ], + "type": "VariableDeclarator", + "typeParameters": { + "loc": { + "end": { + "column": 25, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "params": [ + { + "constraint": { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "range": [ + 22, + 24 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "members": [], + "range": [ + 22, + 24 + ], + "type": "TSTypeLiteral" + } + }, + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 12, + "line": 1 + } + }, + "name": "T", + "range": [ + 12, + 24 + ], + "type": "TypeParameter" + } + ], + "range": [ + 11, + 25 + ], + "type": "TypeParameterDeclaration" + } + } + ], + "kind": "type", + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 48 + ], + "type": "VariableDeclaration" + } + ], + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 48 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 4, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 4 + ], + "type": "Identifier", + "value": "type" + }, + { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 5, + "line": 1 + } + }, + "range": [ + 5, + 11 + ], + "type": "Identifier", + "value": "Result" + }, + { + "loc": { + "end": { + "column": 12, + "line": 1 + }, + "start": { + "column": 11, + "line": 1 + } + }, + "range": [ + 11, + 12 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 12, + "line": 1 + } + }, + "range": [ + 12, + 13 + ], + "type": "Identifier", + "value": "T" + }, + { + "loc": { + "end": { + "column": 21, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "range": [ + 14, + 21 + ], + "type": "Keyword", + "value": "extends" + }, + { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "range": [ + 22, + 23 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "range": [ + 23, + 24 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 25, + "line": 1 + }, + "start": { + "column": 24, + "line": 1 + } + }, + "range": [ + 24, + 25 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 27, + "line": 1 + }, + "start": { + "column": 26, + "line": 1 + } + }, + "range": [ + 26, + 27 + ], + "type": "Punctuator", + "value": "=" + }, + { + "loc": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 35 + ], + "type": "Identifier", + "value": "Success" + }, + { + "loc": { + "end": { + "column": 36, + "line": 1 + }, + "start": { + "column": 35, + "line": 1 + } + }, + "range": [ + 35, + 36 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 36, + "line": 1 + } + }, + "range": [ + 36, + 37 + ], + "type": "Identifier", + "value": "T" + }, + { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 37, + "line": 1 + } + }, + "range": [ + 37, + 38 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 40, + "line": 1 + }, + "start": { + "column": 39, + "line": 1 + } + }, + "range": [ + 39, + 40 + ], + "type": "Punctuator", + "value": "|" + }, + { + "loc": { + "end": { + "column": 48, + "line": 1 + }, + "start": { + "column": 41, + "line": 1 + } + }, + "range": [ + 41, + 48 + ], + "type": "Identifier", + "value": "Failure" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts new file mode 100644 index 000000000000..0c5e89163a40 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts @@ -0,0 +1 @@ +type Result = Success | Failure \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js index 6e2b01e67d88..276b5d88c3b1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -226,7 +226,8 @@ module.exports = { "column": 13 } }, - "name": "T" + "name": "T", + "constraint": null } ] } @@ -453,4 +454,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From f823e08c9a16af81d9fac68bc670a5ec92c539f5 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 18 Mar 2017 17:32:37 -0500 Subject: [PATCH 111/326] Fix: Convert MetaProperty (new.target) nodes correcly (fixes #194) (#195) --- .../lib/ast-converter.js | 34 +-- .../new-with-member-expression.result.js | 237 ++++++++++++++++++ .../basics/new-with-member-expression.src.js | 1 + .../tests/lib/ecma-features.js | 2 +- 4 files changed, 258 insertions(+), 16 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 1559222b0a91..c7132e1419e6 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1819,23 +1819,27 @@ module.exports = function(ast, extra) { break; case SyntaxKind.NewExpression: - - // new.target - if (node.expression.kind === SyntaxKind.PropertyAccessExpression) { - assign(result, { - type: "MetaProperty", - meta: convertChild(node.expression.name), - property: convertChild(node.expression.propertyName) - }); - } else { - assign(result, { - type: "NewExpression", - callee: convertChild(node.expression), - arguments: (node.arguments) ? node.arguments.map(convertChild) : [] - }); - } + assign(result, { + type: "NewExpression", + callee: convertChild(node.expression), + arguments: (node.arguments) ? node.arguments.map(convertChild) : [] + }); break; + case SyntaxKind.MetaProperty: + var newToken = convertToken(node.getFirstToken(), ast); + + assign(result, { + type: "MetaProperty", + meta: { + type: "Identifier", + range: newToken.range, + loc: newToken.loc, + name: "new" + }, + property: convertChild(node.name) + }); + break; // Literals diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js new file mode 100644 index 000000000000..e790c4f826b6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js @@ -0,0 +1,237 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "NewExpression", + "range": [ + 0, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "callee": { + "type": "MemberExpression", + "range": [ + 4, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "object": { + "type": "Identifier", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "foo" + }, + "property": { + "type": "Identifier", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "bar" + }, + "computed": false + }, + "arguments": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "new", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.src.js new file mode 100644 index 000000000000..01c67fc786c0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.src.js @@ -0,0 +1 @@ +new foo.bar(); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 9433406f947d..c89cd2b4ecaa 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -41,7 +41,7 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { }).map(function(filename) { return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" }).filter(function(filename) { - return !(/error\-|invalid\-|globalReturn|experimental|newTarget/.test(filename)); + return !(/error\-|invalid\-|globalReturn|experimental/.test(filename)); }); // var moduleTestFiles = testFiles.filter(function(filename) { From 3609d46ecb9c717bd11397bc40b448094c743654 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sun, 19 Mar 2017 13:19:36 +0100 Subject: [PATCH 112/326] New: Add type parameters to more AST nodes (fixes #184) (#183) --- .../lib/ast-converter.js | 9 +- ...xport-default-class-with-generic.result.js | 38 ++ ...ult-class-with-multiple-generics.result.js | 57 ++ .../export-named-class-with-generic.result.js | 38 ++ ...med-class-with-multiple-generics.result.js | 57 ++ .../call-expression-type-arguments.result.js | 487 ++++++++++++++++++ .../call-expression-type-arguments.src.ts | 2 + .../new-expression-type-arguments.result.js | 365 +++++++++++++ .../new-expression-type-arguments.src.ts | 1 + 9 files changed, 1053 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index c7132e1419e6..ea8a187bc132 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -546,7 +546,7 @@ module.exports = function(ast, extra) { typeArgument.end ], loc: getLocFor(typeArgumentStart, typeArgument.end, ast), - id: convertChild(typeArgument.typeName) + id: convertChild(typeArgument.typeName || typeArgument) }; }) }; @@ -1518,6 +1518,7 @@ module.exports = function(ast, extra) { if (!lastClassToken || lastTypeParameter.pos > lastClassToken.pos) { lastClassToken = ts.findNextToken(lastTypeParameter, ast); } + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); } if (node.modifiers && node.modifiers.length) { @@ -1816,6 +1817,9 @@ module.exports = function(ast, extra) { callee: convertChild(node.expression), arguments: node.arguments.map(convertChild) }); + if (node.typeArguments && node.typeArguments.length) { + result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); + } break; case SyntaxKind.NewExpression: @@ -1824,6 +1828,9 @@ module.exports = function(ast, extra) { callee: convertChild(node.expression), arguments: (node.arguments) ? node.arguments.map(convertChild) : [] }); + if (node.typeArguments && node.typeArguments.length) { + result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); + } break; case SyntaxKind.MetaProperty: diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js index 870644fa3baf..6b048df8ee6b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js @@ -34,6 +34,44 @@ module.exports = { } }, "id": null, + "typeParameters": { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 20, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "name": "T", + "range": [ + 21, + 22 + ], + "type": "TypeParameter", + "constraint": null + } + ], + "range": [ + 20, + 23 + ], + "type": "TypeParameterDeclaration" + }, "body": { "type": "ClassBody", "body": [], diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js index 582090a74769..e858b3449832 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js @@ -34,6 +34,63 @@ module.exports = { } }, "id": null, + "typeParameters": { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 20, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "name": "T", + "range": [ + 21, + 22 + ], + "type": "TypeParameter", + "constraint": null + }, + { + "loc": { + "end": { + "column": 25, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "name": "U", + "range": [ + 23, + 25 + ], + "type": "TypeParameter", + "constraint": null + } + ], + "range": [ + 20, + 26 + ], + "type": "TypeParameterDeclaration" + }, "body": { "type": "ClassBody", "body": [], diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js index 510f54d0f74b..cfbd48538b33 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js @@ -51,6 +51,44 @@ module.exports = { }, "name": "Foo" }, + "typeParameters": { + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 18, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "name": "T", + "range": [ + 17, + 18 + ], + "type": "TypeParameter", + "constraint": null + } + ], + "range": [ + 16, + 19 + ], + "type": "TypeParameterDeclaration" + }, "body": { "type": "ClassBody", "body": [], diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js index 653ba524af0e..759414a93372 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js @@ -51,6 +51,63 @@ module.exports = { }, "name": "Foo" }, + "typeParameters": { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 18, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "name": "T", + "range": [ + 17, + 18 + ], + "type": "TypeParameter", + "constraint": null + }, + { + "loc": { + "end": { + "column": 21, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "name": "U", + "range": [ + 19, + 21 + ], + "type": "TypeParameter", + "constraint": null + } + ], + "range": [ + 16, + 22 + ], + "type": "TypeParameterDeclaration" + }, "body": { "type": "ClassBody", "body": [], diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js new file mode 100644 index 000000000000..e8077a5ce4f7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js @@ -0,0 +1,487 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "body": [ + { + "expression": { + "arguments": [], + "callee": { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "name": "foo", + "range": [ + 0, + 3 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 8, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 8 + ], + "type": "CallExpression", + "typeParameters": { + "loc": { + "end": { + "column": 6, + "line": 1 + }, + "start": { + "column": 3, + "line": 1 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "name": "A", + "range": [ + 4, + 5 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 5 + ], + "type": "GenericTypeAnnotation" + } + ], + "range": [ + 3, + 6 + ], + "type": "TypeParameterInstantiation" + } + }, + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 9 + ], + "type": "ExpressionStatement" + }, + { + "expression": { + "arguments": [], + "callee": { + "loc": { + "end": { + "column": 3, + "line": 2 + }, + "start": { + "column": 0, + "line": 2 + } + }, + "name": "foo", + "range": [ + 10, + 13 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 0, + "line": 2 + } + }, + "range": [ + 10, + 23 + ], + "type": "CallExpression", + "typeParameters": { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 3, + "line": 2 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 14, + 20 + ], + "type": "TSNumberKeyword" + }, + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 14, + 20 + ], + "type": "GenericTypeAnnotation" + } + ], + "range": [ + 13, + 21 + ], + "type": "TypeParameterInstantiation" + } + }, + "loc": { + "end": { + "column": 14, + "line": 2 + }, + "start": { + "column": 0, + "line": 2 + } + }, + "range": [ + 10, + 24 + ], + "type": "ExpressionStatement" + } + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 3 + ], + "type": "Identifier", + "value": "foo" + }, + { + "loc": { + "end": { + "column": 4, + "line": 1 + }, + "start": { + "column": 3, + "line": 1 + } + }, + "range": [ + 3, + 4 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 5 + ], + "type": "Identifier", + "value": "A" + }, + { + "loc": { + "end": { + "column": 6, + "line": 1 + }, + "start": { + "column": 5, + "line": 1 + } + }, + "range": [ + 5, + 6 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 7 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 8, + "line": 1 + }, + "start": { + "column": 7, + "line": 1 + } + }, + "range": [ + 7, + 8 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 9 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 3, + "line": 2 + }, + "start": { + "column": 0, + "line": 2 + } + }, + "range": [ + 10, + 13 + ], + "type": "Identifier", + "value": "foo" + }, + { + "loc": { + "end": { + "column": 4, + "line": 2 + }, + "start": { + "column": 3, + "line": 2 + } + }, + "range": [ + 13, + 14 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 14, + 20 + ], + "type": "Identifier", + "value": "number" + }, + { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 10, + "line": 2 + } + }, + "range": [ + 20, + 21 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "range": [ + 21, + 22 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 22, + 23 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 14, + "line": 2 + }, + "start": { + "column": 13, + "line": 2 + } + }, + "range": [ + 23, + 24 + ], + "type": "Punctuator", + "value": ";" + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.src.ts new file mode 100644 index 000000000000..2421c8b7a8c2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.src.ts @@ -0,0 +1,2 @@ +foo
(); +foo(); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js new file mode 100644 index 000000000000..5110a6f8f25b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js @@ -0,0 +1,365 @@ +module.exports = { + "body": [ + { + "declarations": [ + { + "id": { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "name": "a", + "range": [ + 6, + 7 + ], + "type": "Identifier" + }, + "init": { + "arguments": [], + "callee": { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "name": "A", + "range": [ + 14, + 15 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 20, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 20 + ], + "type": "NewExpression", + "typeParameters": { + "loc": { + "end": { + "column": 18, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "name": "B", + "range": [ + 16, + 17 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "range": [ + 16, + 17 + ], + "type": "GenericTypeAnnotation" + } + ], + "range": [ + 15, + 18 + ], + "type": "TypeParameterInstantiation" + } + }, + "loc": { + "end": { + "column": 20, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 20 + ], + "type": "VariableDeclarator" + } + ], + "kind": "const", + "loc": { + "end": { + "column": 21, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 21 + ], + "type": "VariableDeclaration" + } + ], + "loc": { + "end": { + "column": 21, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 21 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 5 + ], + "type": "Keyword", + "value": "const" + }, + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 7 + ], + "type": "Identifier", + "value": "a" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 9 + ], + "type": "Punctuator", + "value": "=" + }, + { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 13 + ], + "type": "Keyword", + "value": "new" + }, + { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "range": [ + 14, + 15 + ], + "type": "Identifier", + "value": "A" + }, + { + "loc": { + "end": { + "column": 16, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 16 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "range": [ + 16, + 17 + ], + "type": "Identifier", + "value": "B" + }, + { + "loc": { + "end": { + "column": 18, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 18 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "range": [ + 18, + 19 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 20, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "range": [ + 19, + 20 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 21, + "line": 1 + }, + "start": { + "column": 20, + "line": 1 + } + }, + "range": [ + 20, + 21 + ], + "type": "Punctuator", + "value": ";" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.src.ts new file mode 100644 index 000000000000..7e38b6d3d662 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.src.ts @@ -0,0 +1 @@ +const a = new A(); \ No newline at end of file From 003caf0c20961bacfe3c38eff3b4db9c39fdf331 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sat, 1 Apr 2017 20:04:48 +0200 Subject: [PATCH 113/326] Fix: Preserve type parameters for methods (fixes #202) (#203) --- .../lib/ast-converter.js | 6 + .../class-with-generic-method.result.js | 413 ++++++++++++++++++ .../basics/class-with-generic-method.src.ts | 3 + 3 files changed, 422 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index ea8a187bc132..e612cf324dae 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1190,6 +1190,12 @@ module.exports = function(ast, extra) { } else if (!result.static && node.name.kind === SyntaxKind.StringLiteral && node.name.text === "constructor") { result.kind = "constructor"; } + + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + method.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + break; // TypeScript uses this even for static methods named "constructor" diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js new file mode 100644 index 000000000000..fcdcbb2a7ab2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js @@ -0,0 +1,413 @@ +module.exports = { + "body": [ + { + "body": { + "body": [ + { + "accessibility": null, + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "name": "getBar", + "range": [ + 14, + 20 + ], + "type": "Identifier" + }, + "kind": "method", + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 14, + 28 + ], + "static": false, + "type": "MethodDefinition", + "value": { + "async": false, + "body": { + "body": [], + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 14, + "line": 2 + } + }, + "range": [ + 26, + 28 + ], + "type": "BlockStatement" + }, + "expression": false, + "generator": false, + "id": null, + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 8, + "line": 2 + } + }, + "params": [], + "range": [ + 23, + 28 + ], + "type": "FunctionExpression", + "typeParameters": { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 8, + "line": 2 + } + }, + "params": [ + { + "constraint": null, + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "name": "T", + "range": [ + 21, + 22 + ], + "type": "TypeParameter" + } + ], + "range": [ + 20, + 23 + ], + "type": "TypeParameterDeclaration" + } + } + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 30 + ], + "type": "ClassBody" + }, + "decorators": [], + "id": { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "name": "Foo", + "range": [ + 6, + 9 + ], + "type": "Identifier" + }, + "implements": [], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 30 + ], + "superClass": null, + "type": "ClassDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 30 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 5 + ], + "type": "Keyword", + "value": "class" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 9 + ], + "type": "Identifier", + "value": "Foo" + }, + { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 11 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 14, + 20 + ], + "type": "Identifier", + "value": "getBar" + }, + { + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 8, + "line": 2 + } + }, + "range": [ + 20, + 21 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 21, + 22 + ], + "type": "Identifier", + "value": "T" + }, + { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 10, + "line": 2 + } + }, + "range": [ + 22, + 23 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 12, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "range": [ + 23, + 24 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 13, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 24, + 25 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 15, + "line": 2 + }, + "start": { + "column": 14, + "line": 2 + } + }, + "range": [ + 26, + 27 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 15, + "line": 2 + } + }, + "range": [ + 27, + 28 + ], + "type": "Punctuator", + "value": "}" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 29, + 30 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.src.ts new file mode 100644 index 000000000000..abef5e5909c6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.src.ts @@ -0,0 +1,3 @@ +class Foo { + getBar() {} +} From ea02808d3a67d5dc28c528c8e43d35c369c9c28b Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sat, 1 Apr 2017 20:11:01 +0200 Subject: [PATCH 114/326] Fix: Nested type arguments are not preserved (fixes #204) (#205) --- .../lib/ast-converter.js | 5 +- ...with-implements-generic-multiple.result.js | 8 +- .../class-with-implements-generic.result.js | 5 +- .../basics/nested-type-arguments.result.js | 457 ++++++++++++++++++ .../basics/nested-type-arguments.src.ts | 1 + .../call-expression-type-arguments.result.js | 2 + .../new-expression-type-arguments.result.js | 1 + 7 files changed, 473 insertions(+), 6 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index e612cf324dae..d98bc28026b2 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -546,7 +546,10 @@ module.exports = function(ast, extra) { typeArgument.end ], loc: getLocFor(typeArgumentStart, typeArgument.end, ast), - id: convertChild(typeArgument.typeName || typeArgument) + id: convertChild(typeArgument.typeName || typeArgument), + typeParameters: (typeArgument.typeArguments) + ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) + : null }; }) }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js index 8669c88384a3..aa81d2e15a57 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js @@ -153,7 +153,8 @@ module.exports = { } }, "name": "S" - } + }, + "typeParameters": null }, { "type": "GenericTypeAnnotation", @@ -188,7 +189,8 @@ module.exports = { } }, "name": "T" - } + }, + "typeParameters": null } ] } @@ -398,4 +400,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js index 69b3e69893f8..ac8fd325bae2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js @@ -153,7 +153,8 @@ module.exports = { } }, "name": "S" - } + }, + "typeParameters": null } ] } @@ -327,4 +328,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js new file mode 100644 index 000000000000..2810f9d6cd9c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js @@ -0,0 +1,457 @@ +module.exports = { + "body": [ + { + "declarations": [ + { + "id": { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "name": "nestedArray", + "range": [ + 4, + 15 + ], + "type": "Identifier", + "typeAnnotation": { + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 44 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 44 + ], + "type": "TSTypeReference", + "typeArguments": [ + { + "loc": { + "end": { + "column": 43, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "range": [ + 23, + 43 + ], + "type": "TSTypeReference", + "typeArguments": [ + { + "loc": { + "end": { + "column": 42, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "range": [ + 29, + 42 + ], + "type": "TSTypeReference", + "typeArguments": [ + { + "loc": { + "end": { + "column": 41, + "line": 1 + }, + "start": { + "column": 35, + "line": 1 + } + }, + "range": [ + 35, + 41 + ], + "type": "TSStringKeyword" + } + ], + "typeName": { + "loc": { + "end": { + "column": 34, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "name": "Array", + "range": [ + 29, + 34 + ], + "type": "Identifier" + } + } + ], + "typeName": { + "loc": { + "end": { + "column": 28, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "name": "Array", + "range": [ + 23, + 28 + ], + "type": "Identifier" + } + } + ], + "typeName": { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "name": "Array", + "range": [ + 17, + 22 + ], + "type": "Identifier" + } + } + } + }, + "init": null, + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 44 + ], + "type": "VariableDeclarator" + } + ], + "kind": "var", + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 44 + ], + "type": "VariableDeclaration" + } + ], + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 44 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 3, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 3 + ], + "type": "Keyword", + "value": "var" + }, + { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 4, + "line": 1 + } + }, + "range": [ + 4, + 15 + ], + "type": "Identifier", + "value": "nestedArray" + }, + { + "loc": { + "end": { + "column": 16, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 16 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 22, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 22 + ], + "type": "Identifier", + "value": "Array" + }, + { + "loc": { + "end": { + "column": 23, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "range": [ + 22, + 23 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 28, + "line": 1 + }, + "start": { + "column": 23, + "line": 1 + } + }, + "range": [ + 23, + 28 + ], + "type": "Identifier", + "value": "Array" + }, + { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "range": [ + 28, + 29 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 34, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "range": [ + 29, + 34 + ], + "type": "Identifier", + "value": "Array" + }, + { + "loc": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 34, + "line": 1 + } + }, + "range": [ + 34, + 35 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 41, + "line": 1 + }, + "start": { + "column": 35, + "line": 1 + } + }, + "range": [ + 35, + 41 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 42, + "line": 1 + }, + "start": { + "column": 41, + "line": 1 + } + }, + "range": [ + 41, + 42 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 43, + "line": 1 + }, + "start": { + "column": 42, + "line": 1 + } + }, + "range": [ + 42, + 43 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 44, + "line": 1 + }, + "start": { + "column": 43, + "line": 1 + } + }, + "range": [ + 43, + 44 + ], + "type": "Punctuator", + "value": ">" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.src.ts new file mode 100644 index 000000000000..1e9f54230af3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.src.ts @@ -0,0 +1 @@ +var nestedArray: Array>> \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js index e8077a5ce4f7..3dfc5256786d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js @@ -82,6 +82,7 @@ module.exports = { ], "type": "Identifier" }, + "typeParameters": null, "loc": { "end": { "column": 5, @@ -188,6 +189,7 @@ module.exports = { ], "type": "TSNumberKeyword" }, + "typeParameters": null, "loc": { "end": { "column": 10, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js index 5110a6f8f25b..1d3d5bc26dca 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js @@ -87,6 +87,7 @@ module.exports = { ], "type": "Identifier" }, + "typeParameters": null, "loc": { "end": { "column": 17, From 6b1e90ad53e7b792b18a425d8e63447859337c18 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sat, 1 Apr 2017 20:17:30 +0200 Subject: [PATCH 115/326] Fix: Optional methods are not marked as optional (fixes #206) (#207) --- .../lib/ast-converter.js | 1 + ...tract-class-with-optional-method.result.js | 521 ++++++++++++ ...abstract-class-with-optional-method.src.ts | 3 + .../class-with-optional-methods.result.js | 771 ++++++++++++++++++ .../basics/class-with-optional-methods.src.ts | 5 + ...clare-class-with-optional-method.result.js | 393 +++++++++ .../declare-class-with-optional-method.src.ts | 3 + 7 files changed, 1697 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index d98bc28026b2..656169af8724 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -762,6 +762,7 @@ module.exports = function(ast, extra) { SyntaxKind.Parameter === node.parent.kind || SyntaxKind.PropertyDeclaration === node.parent.kind || SyntaxKind.PropertySignature === node.parent.kind || + SyntaxKind.MethodDeclaration === node.parent.kind || SyntaxKind.MethodSignature === node.parent.kind )) { result.optional = true; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js new file mode 100644 index 000000000000..9e409d84abc6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js @@ -0,0 +1,521 @@ +module.exports = { + "body": [ + { + "declaration": { + "body": { + "body": [ + { + "accessibility": null, + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "name": "createSocket", + "optional": true, + "range": [ + 43, + 55 + ], + "type": "Identifier" + }, + "kind": "method", + "loc": { + "end": { + "column": 37, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 43, + 76 + ], + "static": false, + "type": "MethodDefinition", + "value": { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": { + "end": { + "column": 37, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "params": [], + "range": [ + 56, + 76 + ], + "returnType": { + "loc": { + "end": { + "column": 36, + "line": 2 + }, + "start": { + "column": 21, + "line": 2 + } + }, + "range": [ + 60, + 75 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 36, + "line": 2 + }, + "start": { + "column": 21, + "line": 2 + } + }, + "range": [ + 60, + 75 + ], + "type": "TSTypeReference", + "typeArguments": [ + { + "loc": { + "end": { + "column": 35, + "line": 2 + }, + "start": { + "column": 29, + "line": 2 + } + }, + "range": [ + 68, + 74 + ], + "type": "TSStringKeyword" + } + ], + "typeName": { + "loc": { + "end": { + "column": 28, + "line": 2 + }, + "start": { + "column": 21, + "line": 2 + } + }, + "name": "Promise", + "range": [ + 60, + 67 + ], + "type": "Identifier" + } + } + }, + "type": "FunctionExpression" + } + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 37, + "line": 1 + } + }, + "range": [ + 37, + 78 + ], + "type": "ClassBody" + }, + "decorators": [], + "id": { + "loc": { + "end": { + "column": 36, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "name": "AbstractSocket", + "range": [ + 22, + 36 + ], + "type": "Identifier" + }, + "implements": [], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "range": [ + 16, + 78 + ], + "superClass": null, + "type": "TSAbstractClassDeclaration" + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 78 + ], + "source": null, + "specifiers": [], + "type": "ExportNamedDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 78 + ], + "sourceType": "module", + "tokens": [ + { + "loc": { + "end": { + "column": 6, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 6 + ], + "type": "Keyword", + "value": "export" + }, + { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 7, + "line": 1 + } + }, + "range": [ + 7, + 15 + ], + "type": "Identifier", + "value": "abstract" + }, + { + "loc": { + "end": { + "column": 21, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "range": [ + 16, + 21 + ], + "type": "Keyword", + "value": "class" + }, + { + "loc": { + "end": { + "column": 36, + "line": 1 + }, + "start": { + "column": 22, + "line": 1 + } + }, + "range": [ + 22, + 36 + ], + "type": "Identifier", + "value": "AbstractSocket" + }, + { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 37, + "line": 1 + } + }, + "range": [ + 37, + 38 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 43, + 55 + ], + "type": "Identifier", + "value": "createSocket" + }, + { + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "range": [ + 55, + 56 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 18, + "line": 2 + }, + "start": { + "column": 17, + "line": 2 + } + }, + "range": [ + 56, + 57 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 18, + "line": 2 + } + }, + "range": [ + 57, + 58 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 20, + "line": 2 + }, + "start": { + "column": 19, + "line": 2 + } + }, + "range": [ + 58, + 59 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 28, + "line": 2 + }, + "start": { + "column": 21, + "line": 2 + } + }, + "range": [ + 60, + 67 + ], + "type": "Identifier", + "value": "Promise" + }, + { + "loc": { + "end": { + "column": 29, + "line": 2 + }, + "start": { + "column": 28, + "line": 2 + } + }, + "range": [ + 67, + 68 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 35, + "line": 2 + }, + "start": { + "column": 29, + "line": 2 + } + }, + "range": [ + 68, + 74 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 36, + "line": 2 + }, + "start": { + "column": 35, + "line": 2 + } + }, + "range": [ + 74, + 75 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 37, + "line": 2 + }, + "start": { + "column": 36, + "line": 2 + } + }, + "range": [ + 75, + 76 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 77, + 78 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts new file mode 100644 index 000000000000..f39ba3fc0b8c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.src.ts @@ -0,0 +1,3 @@ +export abstract class AbstractSocket { + createSocket?(): Promise; +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js new file mode 100644 index 000000000000..13b27ea6ae96 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js @@ -0,0 +1,771 @@ +module.exports = { + "body": [ + { + "body": { + "body": [ + { + "accessibility": null, + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 5, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "name": "foo", + "optional": true, + "range": [ + 14, + 17 + ], + "type": "Identifier" + }, + "kind": "method", + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 14, + 21 + ], + "static": false, + "type": "MethodDefinition", + "value": { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "params": [], + "range": [ + 18, + 21 + ], + "type": "FunctionExpression" + } + }, + { + "accessibility": null, + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "name": "bar", + "optional": true, + "range": [ + 24, + 27 + ], + "type": "Identifier" + }, + "kind": "method", + "loc": { + "end": { + "column": 17, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "range": [ + 24, + 39 + ], + "static": false, + "type": "MethodDefinition", + "value": { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": { + "end": { + "column": 17, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + }, + "params": [], + "range": [ + 28, + 39 + ], + "returnType": { + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 10, + "line": 3 + } + }, + "range": [ + 32, + 38 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 10, + "line": 3 + } + }, + "range": [ + 32, + 38 + ], + "type": "TSStringKeyword" + } + }, + "type": "FunctionExpression" + } + }, + { + "accessibility": "private", + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 13, + "line": 4 + }, + "start": { + "column": 10, + "line": 4 + } + }, + "name": "baz", + "optional": true, + "range": [ + 50, + 53 + ], + "type": "Identifier" + }, + "kind": "method", + "loc": { + "end": { + "column": 25, + "line": 4 + }, + "start": { + "column": 2, + "line": 4 + } + }, + "range": [ + 42, + 65 + ], + "static": false, + "type": "MethodDefinition", + "value": { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": { + "end": { + "column": 25, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + }, + "params": [], + "range": [ + 54, + 65 + ], + "returnType": { + "loc": { + "end": { + "column": 24, + "line": 4 + }, + "start": { + "column": 18, + "line": 4 + } + }, + "range": [ + 58, + 64 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 24, + "line": 4 + }, + "start": { + "column": 18, + "line": 4 + } + }, + "range": [ + 58, + 64 + ], + "type": "TSStringKeyword" + } + }, + "type": "FunctionExpression" + } + } + ], + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 67 + ], + "type": "ClassBody" + }, + "decorators": [], + "id": { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "name": "Foo", + "range": [ + 6, + 9 + ], + "type": "Identifier" + }, + "implements": [], + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 67 + ], + "superClass": null, + "type": "ClassDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 67 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 5, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 5 + ], + "type": "Keyword", + "value": "class" + }, + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 6, + "line": 1 + } + }, + "range": [ + 6, + 9 + ], + "type": "Identifier", + "value": "Foo" + }, + { + "loc": { + "end": { + "column": 11, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 11 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 5, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 14, + 17 + ], + "type": "Identifier", + "value": "foo" + }, + { + "loc": { + "end": { + "column": 6, + "line": 2 + }, + "start": { + "column": 5, + "line": 2 + } + }, + "range": [ + 17, + 18 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 6, + "line": 2 + } + }, + "range": [ + 18, + 19 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 7, + "line": 2 + } + }, + "range": [ + 19, + 20 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 8, + "line": 2 + } + }, + "range": [ + 20, + 21 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 5, + "line": 3 + }, + "start": { + "column": 2, + "line": 3 + } + }, + "range": [ + 24, + 27 + ], + "type": "Identifier", + "value": "bar" + }, + { + "loc": { + "end": { + "column": 6, + "line": 3 + }, + "start": { + "column": 5, + "line": 3 + } + }, + "range": [ + 27, + 28 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 7, + "line": 3 + }, + "start": { + "column": 6, + "line": 3 + } + }, + "range": [ + 28, + 29 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 8, + "line": 3 + }, + "start": { + "column": 7, + "line": 3 + } + }, + "range": [ + 29, + 30 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 9, + "line": 3 + }, + "start": { + "column": 8, + "line": 3 + } + }, + "range": [ + 30, + 31 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 16, + "line": 3 + }, + "start": { + "column": 10, + "line": 3 + } + }, + "range": [ + 32, + 38 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 17, + "line": 3 + }, + "start": { + "column": 16, + "line": 3 + } + }, + "range": [ + 38, + 39 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 9, + "line": 4 + }, + "start": { + "column": 2, + "line": 4 + } + }, + "range": [ + 42, + 49 + ], + "type": "Keyword", + "value": "private" + }, + { + "loc": { + "end": { + "column": 13, + "line": 4 + }, + "start": { + "column": 10, + "line": 4 + } + }, + "range": [ + 50, + 53 + ], + "type": "Identifier", + "value": "baz" + }, + { + "loc": { + "end": { + "column": 14, + "line": 4 + }, + "start": { + "column": 13, + "line": 4 + } + }, + "range": [ + 53, + 54 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 15, + "line": 4 + }, + "start": { + "column": 14, + "line": 4 + } + }, + "range": [ + 54, + 55 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 16, + "line": 4 + }, + "start": { + "column": 15, + "line": 4 + } + }, + "range": [ + 55, + 56 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 17, + "line": 4 + }, + "start": { + "column": 16, + "line": 4 + } + }, + "range": [ + 56, + 57 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 24, + "line": 4 + }, + "start": { + "column": 18, + "line": 4 + } + }, + "range": [ + 58, + 64 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 25, + "line": 4 + }, + "start": { + "column": 24, + "line": 4 + } + }, + "range": [ + 64, + 65 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 5 + }, + "start": { + "column": 0, + "line": 5 + } + }, + "range": [ + 66, + 67 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.src.ts new file mode 100644 index 000000000000..2fe152d3d419 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.src.ts @@ -0,0 +1,5 @@ +class Foo { + foo?(); + bar?(): string; + private baz?(): string; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js new file mode 100644 index 000000000000..d834af49e0d7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js @@ -0,0 +1,393 @@ +module.exports = { + "body": [ + { + "body": { + "body": [ + { + "accessibility": null, + "computed": false, + "decorators": [], + "key": { + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "name": "bar", + "optional": true, + "range": [ + 24, + 27 + ], + "type": "Identifier" + }, + "kind": "method", + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 24, + 36 + ], + "static": false, + "type": "MethodDefinition", + "value": { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 7, + "line": 2 + } + }, + "params": [], + "range": [ + 28, + 36 + ], + "returnType": { + "loc": { + "end": { + "column": 15, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 32, + 35 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 15, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 32, + 35 + ], + "type": "TSAnyKeyword" + } + }, + "type": "FunctionExpression" + } + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "range": [ + 18, + 38 + ], + "type": "ClassBody" + }, + "decorators": [], + "id": { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "name": "Foo", + "range": [ + 14, + 17 + ], + "type": "Identifier" + }, + "implements": [], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 38 + ], + "superClass": null, + "type": "ClassDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 38 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 7 + ], + "type": "Identifier", + "value": "declare" + }, + { + "loc": { + "end": { + "column": 13, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 13 + ], + "type": "Keyword", + "value": "class" + }, + { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "range": [ + 14, + 17 + ], + "type": "Identifier", + "value": "Foo" + }, + { + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "range": [ + 18, + 19 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 24, + 27 + ], + "type": "Identifier", + "value": "bar" + }, + { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 7, + "line": 2 + } + }, + "range": [ + 27, + 28 + ], + "type": "Punctuator", + "value": "?" + }, + { + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 8, + "line": 2 + } + }, + "range": [ + 28, + 29 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 29, + 30 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 10, + "line": 2 + } + }, + "range": [ + 30, + 31 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 15, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 32, + 35 + ], + "type": "Identifier", + "value": "any" + }, + { + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 15, + "line": 2 + } + }, + "range": [ + 35, + 36 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 37, + 38 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.src.ts new file mode 100644 index 000000000000..ecb4a4e11487 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.src.ts @@ -0,0 +1,3 @@ +declare class Foo { + bar?(): any; +} \ No newline at end of file From 5ca975f3dbc6f48666a800a85f7382b9074afb68 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Tue, 4 Apr 2017 19:02:43 -0500 Subject: [PATCH 116/326] Fix: Set root to true in eslintrc (fixes #211) (#212) --- packages/typescript-eslint-parser/.eslintrc.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/typescript-eslint-parser/.eslintrc.yml b/packages/typescript-eslint-parser/.eslintrc.yml index 57a7ad7f5455..49ee699c7d2d 100644 --- a/packages/typescript-eslint-parser/.eslintrc.yml +++ b/packages/typescript-eslint-parser/.eslintrc.yml @@ -1,3 +1,5 @@ +root: true + env: node: true From 370a217ee0e2034a17a235202074d69ef244db57 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 4 Apr 2017 20:39:19 -0400 Subject: [PATCH 117/326] Build: changelog update for 2.1.0 --- .../typescript-eslint-parser/CHANGELOG.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 40193d5eecf6..84074d2a04c4 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,23 @@ +v2.1.0 - April 4, 2017 + +* d709fd8 Fix: Set root to true in eslintrc (fixes #211) (#212) (Reyad Attiyat) +* 1e73711 Fix: Optional methods are not marked as optional (fixes #206) (#207) (Rasmus Eneman) +* 1cee2e3 Fix: Nested type arguments are not preserved (fixes #204) (#205) (Rasmus Eneman) +* 5a324a3 Fix: Preserve type parameters for methods (fixes #202) (#203) (Rasmus Eneman) +* bfb1506 New: Add type parameters to more AST nodes (fixes #184) (#183) (Rasmus Eneman) +* 0fadfc3 Fix: Convert MetaProperty (new.target) nodes correcly (fixes #194) (#195) (Reyad Attiyat) +* 4d755ed New: Store type parameter constraints (fixes #188) (#189) (Rasmus Eneman) +* 29d848c Fix: Updated broken class-with-optional-properties test result (#192) (James Henry) +* 04f6556 New: Mark optional parameters and properties (fixes #186) (#187) (Rasmus Eneman) +* cc9d4b3 Fix: Add missing typeAnnotation to class properties (fixes #190) (#191) (Rasmus Eneman) +* 215a012 Fix: Change DoWhileStatement to DoStatement to match TS (fixes #180) (#181) (James Henry) +* 581a7a5 Fix: Missing parameter properties info in constructors (fixes #143) (#168) (patricio trevino) +* 69d2537 Chore: Add test for constructor and methods with parameters (refs #168) (#178) (Reyad Attiyat) +* c2a0b71 Fix: Add start and end property to tokens (fixes #172) (#176) (Reyad Attiyat) +* 2640d81 Fix: Remove jsdoc node property from ts nodes (fixes #164) (#177) (Reyad Attiyat) +* 701e2c5 Fix: Set name to type JSXIdentifier and fix selfClosing (fixes #172) (#175) (Reyad Attiyat) +* 8b4e548 Fix: Convert Void and Delete expressions to UnaryExpression (fixes #171) (#174) (Reyad Attiyat) + v2.0.0 - February 24, 2017 * 38aef53 Breaking: Updated supported TypeScript version to ~2.2.1 (fixes #149) (#169) (James Henry) From a4651a11241e476bf54045abd22f78ca06f4ab57 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 4 Apr 2017 20:39:20 -0400 Subject: [PATCH 118/326] 2.1.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 8347ae058c81..751126b9cfa4 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "2.0.0", + "version": "2.1.0", "files": [ "lib", "parser.js" From 9412d29fd85377522173df208a01d013cd943d14 Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sun, 9 Apr 2017 11:23:43 +0200 Subject: [PATCH 119/326] Fix: Wrap any parameter with modifiers, not just in constructors (#214) --- .../lib/ast-converter.js | 34 +- ...ure-with-parameter-accessibility.result.js | 386 ++++++++++++++++++ ...nature-with-parameter-accessibility.src.ts | 3 + 3 files changed, 404 insertions(+), 19 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 656169af8724..1d253e4d1b0e 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1217,20 +1217,6 @@ module.exports = function(ast, extra) { return convertChild(d.expression); }) : []; - if (param.modifiers) { - return { - type: "TSParameterProperty", - range: [param.getStart(), param.end], - loc: getLoc(param, ast), - accessibility: getTSNodeAccessibility(param), - isReadonly: param.modifiers.some(function(modifier) { - return modifier.kind === SyntaxKind.ReadonlyKeyword; - }), - parameter: convertedParam, - decorators: decorators - }; - } - return assign(convertedParam, { decorators: decorators }); @@ -1499,11 +1485,8 @@ module.exports = function(ast, extra) { right: convertChild(node.initializer) }); } else { - var convertedParameter = convert(node.name, parent); - if (node.type) { - convertedParameter.typeAnnotation = convertTypeAnnotation(node.type); - } - return convertedParameter; + parameter = convert(node.name, parent); + result = parameter; } if (node.type) { @@ -1512,6 +1495,19 @@ module.exports = function(ast, extra) { }); } + if (node.modifiers) { + return { + type: "TSParameterProperty", + range: [node.getStart(), node.end], + loc: getLoc(node, ast), + accessibility: getTSNodeAccessibility(node), + isReadonly: node.modifiers.some(function(modifier) { + return modifier.kind === SyntaxKind.ReadonlyKeyword; + }), + parameter: result + }; + } + break; // Classes diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js new file mode 100644 index 000000000000..bf1db350c492 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -0,0 +1,386 @@ +module.exports = { + "body": [ + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "members": [ + { + "loc": { + "end": { + "column": 30, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "parameters": [ + { + "accessibility": "public", + "isReadonly": false, + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "parameter": { + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "name": "x", + "range": [ + 33, + 34 + ], + "type": "Identifier" + }, + "range": [ + 26, + 34 + ], + "type": "TSParameterProperty" + }, + { + "accessibility": "private", + "isReadonly": false, + "loc": { + "end": { + "column": 28, + "line": 2 + }, + "start": { + "column": 19, + "line": 2 + } + }, + "parameter": { + "loc": { + "end": { + "column": 28, + "line": 2 + }, + "start": { + "column": 27, + "line": 2 + } + }, + "name": "y", + "range": [ + 44, + 45 + ], + "type": "Identifier" + }, + "range": [ + 36, + 45 + ], + "type": "TSParameterProperty" + } + ], + "range": [ + 21, + 47 + ], + "type": "TSConstructSignature" + } + ], + "name": { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "name": "Test", + "range": [ + 10, + 14 + ], + "type": "Identifier" + }, + "range": [ + 0, + 49 + ], + "type": "TSInterfaceDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 49 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 9 + ], + "type": "Keyword", + "value": "interface" + }, + { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 14 + ], + "type": "Identifier", + "value": "Test" + }, + { + "loc": { + "end": { + "column": 16, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 16 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 7, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 21, + 24 + ], + "type": "Keyword", + "value": "new" + }, + { + "loc": { + "end": { + "column": 9, + "line": 2 + }, + "start": { + "column": 8, + "line": 2 + } + }, + "range": [ + 25, + 26 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 15, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 26, + 32 + ], + "type": "Keyword", + "value": "public" + }, + { + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 16, + "line": 2 + } + }, + "range": [ + 33, + 34 + ], + "type": "Identifier", + "value": "x" + }, + { + "loc": { + "end": { + "column": 18, + "line": 2 + }, + "start": { + "column": 17, + "line": 2 + } + }, + "range": [ + 34, + 35 + ], + "type": "Punctuator", + "value": "," + }, + { + "loc": { + "end": { + "column": 26, + "line": 2 + }, + "start": { + "column": 19, + "line": 2 + } + }, + "range": [ + 36, + 43 + ], + "type": "Keyword", + "value": "private" + }, + { + "loc": { + "end": { + "column": 28, + "line": 2 + }, + "start": { + "column": 27, + "line": 2 + } + }, + "range": [ + 44, + 45 + ], + "type": "Identifier", + "value": "y" + }, + { + "loc": { + "end": { + "column": 29, + "line": 2 + }, + "start": { + "column": 28, + "line": 2 + } + }, + "range": [ + 45, + 46 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 30, + "line": 2 + }, + "start": { + "column": 29, + "line": 2 + } + }, + "range": [ + 46, + 47 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 48, + 49 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts new file mode 100644 index 000000000000..4d52aa4cc16c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts @@ -0,0 +1,3 @@ +interface Test { + new (public x, private y); +} From af8fec45435c06b0fd7610c5d4aba189b7a76aaf Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 9 Apr 2017 10:25:11 +0100 Subject: [PATCH 120/326] Update: Open TS peerDependency, warn non-supported version (fixes #167) (#193) --- packages/typescript-eslint-parser/README.md | 8 +++++-- .../typescript-eslint-parser/package.json | 5 +++-- packages/typescript-eslint-parser/parser.js | 22 ++++++++++++++++++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 91e3cd3a01d3..5a8746532186 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -6,9 +6,13 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est ## Supported TypeScript Version -The version of TypeScript supported by this parser is `~2.2.1`. This is reflected in the `peerDependency` requirement within the package.json file. +We will always endeavor to support the latest stable version of TypeScript. -**Please ensure that you are using this version before submitting any issues.** +The version of TypeScript currently supported by this parser is `~2.2.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. + +If you use a non-supported version of TypeScript, the parser will log a warning to the console. + +**Please ensure that you are using a supported version before submitting any issues/bug reports.** ## Usage diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 751126b9cfa4..e0e3c0e63d6a 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -52,9 +52,10 @@ }, "dependencies": { "lodash.unescape": "4.0.0", - "object-assign": "^4.0.1" + "object-assign": "^4.0.1", + "semver": "^4.3.6" }, "peerDependencies": { - "typescript": "~2.2.1" + "typescript": "*" } } diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 34e5edef885b..c2f85a67fb37 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -9,7 +9,27 @@ "use strict"; var astNodeTypes = require("./lib/ast-node-types"), - ts = require("typescript"); + ts = require("typescript"), + semver = require("semver"); + +var SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.typescript; +var ACTIVE_TYPESCRIPT_VERSION = ts.version; + +var isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS); + +if (!isRunningSupportedTypeScriptVersion) { + var border = "============="; + var versionWarning = [ + border, + "WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser.", + "You may find that it works just fine, or you may not.", + "SUPPORTED TYPESCRIPT VERSIONS: " + SUPPORTED_TYPESCRIPT_VERSIONS, + "YOUR TYPESCRIPT VERSION: " + ACTIVE_TYPESCRIPT_VERSION, + "Please only submit bug reports when using the officially supported version.", + border + ]; + console.warn(versionWarning.join("\n\n")); +} var extra; From 416d21bbaf6cb9a8562fd3bdddec1c0f560094f9 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Fri, 21 Apr 2017 12:13:25 -0500 Subject: [PATCH 121/326] Chore: Cleanup Makefile (#221) --- packages/typescript-eslint-parser/Makefile.js | 134 +----------------- 1 file changed, 3 insertions(+), 131 deletions(-) diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index bf04bc55044c..823c65162f79 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -4,7 +4,7 @@ * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ -/* global cat, cp, echo, exec, exit, find, mkdir, mv, rm, target, test */ +/* global echo, exit, find, target */ "use strict"; @@ -16,9 +16,7 @@ require("shelljs/make"); var checker = require("npm-license"), - dateformat = require("dateformat"), - nodeCLI = require("shelljs-nodecli"), - semver = require("semver"); + nodeCLI = require("shelljs-nodecli"); //------------------------------------------------------------------------------ // Settings @@ -33,8 +31,6 @@ var OPEN_SOURCE_LICENSES = [ //------------------------------------------------------------------------------ var NODE_MODULES = "./node_modules/", - TEMP_DIR = "./tmp/", - BUILD_DIR = "./build/", // Utilities - intentional extra space at the end of each string MOCHA = NODE_MODULES + "mocha/bin/_mocha ", @@ -42,7 +38,7 @@ var NODE_MODULES = "./node_modules/", // Files MAKEFILE = "./Makefile.js", /* eslint-disable no-use-before-define */ - JS_FILES = find("lib/").filter(fileType("js")).join(" ") + " espree.js", + JS_FILES = find("lib/").filter(fileType("js")).join(" ") + " parser.js", TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "); /* eslint-enable no-use-before-define */ @@ -62,64 +58,6 @@ function fileType(extension) { }; } -/** - * Executes a command and returns the output instead of printing it to stdout. - * @param {string} cmd The command string to execute. - * @returns {string} The result of the executed command. - */ -function execSilent(cmd) { - return exec(cmd, { silent: true }).output; -} - -/** - * Creates a release version tag and pushes to origin. - * @param {string} type The type of release to do (patch, minor, major) - * @returns {void} - */ -function release(type) { - var newVersion; - - target.test(); - newVersion = execSilent("npm version " + type).trim(); - target.changelog(); - - // add changelog to commit - exec("git add CHANGELOG.md"); - exec("git commit --amend --no-edit"); - - // replace existing tag - exec("git tag -f " + newVersion); - - // push all the things - exec("git push origin master --tags"); - exec("npm publish"); -} - - -/** - * Splits a command result to separate lines. - * @param {string} result The command result string. - * @returns {array} The separated lines. - */ -function splitCommandResultToLines(result) { - return result.trim().split("\n"); -} - -/** - * Returns a list of sorted, valid semtantic-verisioning git tags - * @returns {string[]} The version tags - */ -function getVersionTags() { - var tags = splitCommandResultToLines(exec("git tag", { silent: true }).output); - - return tags.reduce(function(list, tag) { - if (semver.valid(tag)) { - list.push(tag); - } - return list; - }, []).sort(semver.compare); -} - //------------------------------------------------------------------------------ // Tasks //------------------------------------------------------------------------------ @@ -180,60 +118,6 @@ target.docs = function() { echo("Documentation has been output to /jsdoc"); }; -target.browserify = function() { - - // 1. create temp and build directory - if (!test("-d", TEMP_DIR)) { - mkdir(TEMP_DIR); - mkdir(TEMP_DIR + "/lib"); - } - - if (!test("-d", BUILD_DIR)) { - mkdir(BUILD_DIR); - } - - // 2. copy files into temp directory - cp("-r", "lib/*", TEMP_DIR + "/lib"); - cp("espree.js", TEMP_DIR); - cp("package.json", TEMP_DIR); - - - // 3. browserify the temp directory - nodeCLI.exec("browserify", TEMP_DIR + "espree.js", "-o", BUILD_DIR + "espree.js", "-s espree"); - - // 4. remove temp directory - rm("-r", TEMP_DIR); -}; - -target.changelog = function() { - - // get most recent two tags - var tags = getVersionTags(), - rangeTags = tags.slice(tags.length - 2), - now = new Date(), - timestamp = dateformat(now, "mmmm d, yyyy"); - - // output header - (rangeTags[1] + " - " + timestamp + "\n").to("CHANGELOG.tmp"); - - // get log statements - var logs = exec("git log --pretty=format:\"* %s (%an)\" " + rangeTags.join(".."), {silent: true}).output.split(/\n/g); - logs = logs.filter(function(line) { - return line.indexOf("Merge pull request") === -1 && line.indexOf("Merge branch") === -1; - }); - logs.push(""); // to create empty lines - logs.unshift(""); - - // output log statements - logs.join("\n").toEnd("CHANGELOG.tmp"); - - // switch-o change-o - cat("CHANGELOG.tmp", "CHANGELOG.md").to("CHANGELOG.md.tmp"); - rm("CHANGELOG.tmp"); - rm("CHANGELOG.md"); - mv("CHANGELOG.md.tmp", "CHANGELOG.md"); -}; - target.checkLicenses = function() { /** @@ -283,15 +167,3 @@ target.checkLicenses = function() { } }); }; - -target.patch = function() { - release("patch"); -}; - -target.minor = function() { - release("minor"); -}; - -target.major = function() { - release("major"); -}; From e2bb55cf6cd7ed75478ddf3d1b6124cc1c9bda9b Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 29 Apr 2017 14:06:09 +0100 Subject: [PATCH 122/326] Chore: Remove before_script from .travis.yml (fixes #231) (#230) --- packages/typescript-eslint-parser/.travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index 5dec3ad5df96..accaab3b945b 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -4,8 +4,5 @@ node_js: - "0.12" - 4 - 6 -before_script: - - npm install -g npm-install-peers - - npm-install-peers after_success: - npm run coveralls From 9bad73ff1fa5f8c9be6db0a1effb7f621caa1e0e Mon Sep 17 00:00:00 2001 From: Philipp A Date: Sat, 29 Apr 2017 18:59:24 +0200 Subject: [PATCH 123/326] Breaking: Add .body to TSModuleBlock nodes (fixes #217) (#218) --- .../lib/ast-converter.js | 7 + ...t-module-declaration-with-import.result.js | 349 ++++++++++++++++++ ...ient-module-declaration-with-import.src.ts | 3 + ...namespace-with-exported-function.result.js | 4 +- 4 files changed, 361 insertions(+), 2 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 1d253e4d1b0e..2fe0fc8fde80 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1594,6 +1594,13 @@ module.exports = function(ast, extra) { break; // Modules + case SyntaxKind.ModuleBlock: + assign(result, { + type: "TSModuleBlock", + body: node.statements.map(convertChild) + }); + break; + case SyntaxKind.ImportDeclaration: assign(result, { type: "ImportDeclaration", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js new file mode 100644 index 000000000000..63172cd3b1ca --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js @@ -0,0 +1,349 @@ +module.exports = { + "body": [ + { + "body": { + "body": [ + { + "loc": { + "end": { + "column": 22, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 34, + 54 + ], + "source": { + "loc": { + "end": { + "column": 21, + "line": 2 + }, + "start": { + "column": 17, + "line": 2 + } + }, + "range": [ + 49, + 53 + ], + "raw": "'fs'", + "type": "Literal", + "value": "fs" + }, + "specifiers": [ + { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "local": { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "name": "fs", + "range": [ + 41, + 43 + ], + "type": "Identifier" + }, + "range": [ + 41, + 43 + ], + "type": "ImportDefaultSpecifier" + } + ], + "type": "ImportDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 30, + "line": 1 + } + }, + "range": [ + 30, + 56 + ], + "type": "TSModuleBlock" + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "modifiers": [ + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 7 + ], + "type": "TSDeclareKeyword" + } + ], + "name": { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 29 + ], + "raw": "\"i-use-things\"", + "type": "Literal", + "value": "i-use-things" + }, + "range": [ + 0, + 56 + ], + "type": "TSModuleDeclaration" + } + ], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 56 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 7, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 7 + ], + "type": "Identifier", + "value": "declare" + }, + { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 8, + "line": 1 + } + }, + "range": [ + 8, + 14 + ], + "type": "Identifier", + "value": "module" + }, + { + "loc": { + "end": { + "column": 29, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 29 + ], + "type": "String", + "value": "\"i-use-things\"" + }, + { + "loc": { + "end": { + "column": 31, + "line": 1 + }, + "start": { + "column": 30, + "line": 1 + } + }, + "range": [ + 30, + 31 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 8, + "line": 2 + }, + "start": { + "column": 2, + "line": 2 + } + }, + "range": [ + 34, + 40 + ], + "type": "Keyword", + "value": "import" + }, + { + "loc": { + "end": { + "column": 11, + "line": 2 + }, + "start": { + "column": 9, + "line": 2 + } + }, + "range": [ + 41, + 43 + ], + "type": "Identifier", + "value": "fs" + }, + { + "loc": { + "end": { + "column": 16, + "line": 2 + }, + "start": { + "column": 12, + "line": 2 + } + }, + "range": [ + 44, + 48 + ], + "type": "Identifier", + "value": "from" + }, + { + "loc": { + "end": { + "column": 21, + "line": 2 + }, + "start": { + "column": 17, + "line": 2 + } + }, + "range": [ + 49, + 53 + ], + "type": "String", + "value": "'fs'" + }, + { + "loc": { + "end": { + "column": 22, + "line": 2 + }, + "start": { + "column": 21, + "line": 2 + } + }, + "range": [ + 53, + 54 + ], + "type": "Punctuator", + "value": ";" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 55, + 56 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts new file mode 100644 index 000000000000..9b551c215336 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts @@ -0,0 +1,3 @@ +declare module "i-use-things" { + import fs from 'fs'; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js index 47242ab8d303..9c60013b10c4 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js @@ -84,7 +84,7 @@ module.exports = { "column": 1 } }, - "statements": [ + "body": [ { "type": "TSNamespaceExportDeclaration", "declaration": { @@ -617,4 +617,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From c01e40eb0ee816cb14d998c11a94292ad8e31092 Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Sun, 30 Apr 2017 03:00:30 +1000 Subject: [PATCH 124/326] Fix: Use TSAbsractMethodDefinition for abstract constructor (fixes #228) (#229) --- .../lib/ast-converter.js | 47 +-- ...-class-with-abstract-constructor.result.js | 358 ++++++++++++++++++ ...act-class-with-abstract-constructor.src.ts | 3 + 3 files changed, 379 insertions(+), 29 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 2fe0fc8fde80..ba2eaa2878ee 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -106,13 +106,14 @@ function isESTreeClassMember(node) { } /** - * Returns true if the given node is an async function - * @param {TSNode} node TypeScript AST node - * @returns {boolean} is an async function + * Checks if a TSNode has a modifier + * @param {SyntaxKind} modifierKind TypeScript SyntaxKind modifier + * @param {TSNode} node TypeScript AST node + * @returns {boolean} has the modifier specified */ -function isAsyncFunction(node) { +function hasModifier(modifierKind, node) { return !!node.modifiers && !!node.modifiers.length && node.modifiers.some(function(modifier) { - return modifier.kind === SyntaxKind.AsyncKeyword; + return modifier.kind === modifierKind; }); } @@ -905,9 +906,7 @@ module.exports = function(ast, extra) { var functionDeclarationType = "FunctionDeclaration"; if (node.modifiers && node.modifiers.length) { - var isDeclareFunction = node.modifiers.some(function(modifier) { - return modifier.kind === ts.SyntaxKind.DeclareKeyword; - }); + var isDeclareFunction = hasModifier(ts.SyntaxKind.DeclareKeyword, node); if (isDeclareFunction) { functionDeclarationType = "DeclareFunction"; } @@ -925,7 +924,7 @@ module.exports = function(ast, extra) { id: convertChild(node.name), generator: !!node.asteriskToken, expression: false, - async: isAsyncFunction(node), + async: hasModifier(SyntaxKind.AsyncKeyword, node), params: node.parameters.map(convertChild), body: convertChild(node.body) }); @@ -1114,7 +1113,7 @@ module.exports = function(ast, extra) { id: null, generator: false, expression: false, - async: isAsyncFunction(node), + async: hasModifier(SyntaxKind.AsyncKeyword, node), body: convertChild(node.body), range: [ node.parameters.pos - 1, result.range[1]], loc: { @@ -1162,15 +1161,9 @@ module.exports = function(ast, extra) { /** * TypeScript class methods can be defined as "abstract" */ - var methodDefinitionType = "MethodDefinition"; - if (node.modifiers && node.modifiers.length) { - var isAbstractMethod = node.modifiers.some(function(modifier) { - return modifier.kind === ts.SyntaxKind.AbstractKeyword; - }); - if (isAbstractMethod) { - methodDefinitionType = "TSAbstractMethodDefinition"; - } - } + var methodDefinitionType = hasModifier(SyntaxKind.AbstractKeyword, node) + ? "TSAbstractMethodDefinition" + : "MethodDefinition"; assign(result, { type: methodDefinitionType, @@ -1206,6 +1199,7 @@ module.exports = function(ast, extra) { case SyntaxKind.Constructor: var constructorIsStatic = Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static), + constructorIsAbstract = hasModifier(SyntaxKind.AbstractKeyword, node), firstConstructorToken = constructorIsStatic ? ts.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), constructorLoc = ast.getLineAndCharacterOfPosition(node.parameters.pos - 1), constructor = { @@ -1275,7 +1269,7 @@ module.exports = function(ast, extra) { } assign(result, { - type: "MethodDefinition", + type: constructorIsAbstract ? "TSAbstractMethodDefinition" : "MethodDefinition", key: constructorKey, value: constructor, computed: constructorIsComputed, @@ -1292,7 +1286,7 @@ module.exports = function(ast, extra) { generator: !!node.asteriskToken, params: node.parameters.map(convertChild), body: convertChild(node.body), - async: isAsyncFunction(node), + async: hasModifier(SyntaxKind.AbstractKeyword, node), expression: false }); // Process returnType @@ -1375,7 +1369,7 @@ module.exports = function(ast, extra) { id: null, params: node.parameters.map(convertChild), body: convertChild(node.body), - async: isAsyncFunction(node), + async: hasModifier(SyntaxKind.AsyncKeyword, node), expression: node.body.kind !== SyntaxKind.Block }); // Process returnType @@ -1501,9 +1495,7 @@ module.exports = function(ast, extra) { range: [node.getStart(), node.end], loc: getLoc(node, ast), accessibility: getTSNodeAccessibility(node), - isReadonly: node.modifiers.some(function(modifier) { - return modifier.kind === SyntaxKind.ReadonlyKeyword; - }), + isReadonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), parameter: result }; } @@ -1533,10 +1525,7 @@ module.exports = function(ast, extra) { * TypeScript class declarations can be defined as "abstract" */ if (node.kind === SyntaxKind.ClassDeclaration) { - var isAbstractClass = node.modifiers.some(function(modifier) { - return modifier.kind === ts.SyntaxKind.AbstractKeyword; - }); - if (isAbstractClass) { + if (hasModifier(SyntaxKind.AbstractKeyword, node)) { classNodeType = "TSAbstract" + classNodeType; } } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js new file mode 100644 index 000000000000..a9b9530c4b81 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js @@ -0,0 +1,358 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "TSAbstractClassDeclaration", + "range": [ + 16, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "name": "AbstractSocket" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "TSAbstractMethodDefinition", + "range": [ + 43, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 43, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "generator": false, + "expression": false, + "async": false, + "body": null, + "range": [ + 63, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 37, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 0, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "AbstractSocket", + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 43, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 52, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts new file mode 100644 index 000000000000..66b70824ae24 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.src.ts @@ -0,0 +1,3 @@ +export abstract class AbstractSocket { + abstract constructor(); +} \ No newline at end of file From d12d4b4f9d6b9b45f6670745577b76e762e4da4b Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Sun, 30 Apr 2017 03:02:02 +1000 Subject: [PATCH 125/326] Breaking: Support TypeScript 2.3 (fixes #232) (#233) --- packages/typescript-eslint-parser/README.md | 2 +- packages/typescript-eslint-parser/lib/ast-converter.js | 2 +- packages/typescript-eslint-parser/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 5a8746532186..170350a360ca 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -8,7 +8,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.2.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~2.3.2`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index ba2eaa2878ee..76805fc21911 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1943,7 +1943,7 @@ module.exports = function(ast, extra) { type: "JSXOpeningElement", selfClosing: false, name: openingTagName, - attributes: node.attributes.map(convertChild) + attributes: node.attributes.properties.map(convertChild) }); break; diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index e0e3c0e63d6a..95d132cd62fb 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -30,7 +30,7 @@ "semver": "^4.1.1", "shelljs": "^0.3.0", "shelljs-nodecli": "^0.1.1", - "typescript": "~2.2.1" + "typescript": "~2.3.2" }, "keywords": [ "ast", From d4d54881be63b2d0e53782e2f9485a54557cfdac Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Sun, 30 Apr 2017 21:32:57 +1000 Subject: [PATCH 126/326] Fix: Support superTypeParameters (fixes #242) (#243) --- .../lib/ast-converter.js | 3 + ...ss-with-extends-generic-multiple.result.js | 563 +++++ ...class-with-extends-generic-multiple.src.ts | 3 + .../class-with-extends-generic.result.js | 404 ++++ .../basics/class-with-extends-generic.src.ts | 3 + .../basics/class-with-mixin.result.js | 2027 +++++++++++++++++ .../typescript/basics/class-with-mixin.src.ts | 9 + 7 files changed, 3012 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 76805fc21911..c9dd0ce4d681 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1550,6 +1550,9 @@ module.exports = function(ast, extra) { if (hasExtends) { superClass = heritageClauses.shift(); + if (superClass.types[0] && superClass.types[0].typeArguments) { + result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); + } } hasImplements = heritageClauses.length > 0; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js new file mode 100644 index 000000000000..090134c2d87e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js @@ -0,0 +1,563 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 9, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 10, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "name": "A", + "constraint": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "name": "B" + } + } + } + } + ] + }, + "superTypeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 34, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "name": "C" + }, + "typeParameters": null + }, + { + "type": "GenericTypeAnnotation", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "id": { + "type": "Identifier", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "name": "D" + }, + "typeParameters": null + } + ] + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 41, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": { + "type": "Identifier", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "name": "Bar" + }, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 12, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Identifier", + "value": "D", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts new file mode 100644 index 000000000000..a37bc0a5d9b8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.src.ts @@ -0,0 +1,3 @@ +class Foo extends Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js new file mode 100644 index 000000000000..f6bd1399d9f7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js @@ -0,0 +1,404 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "A", + "constraint": null + } + ] + }, + "superTypeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 24, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "B" + }, + "typeParameters": null + } + ] + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "Bar" + }, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.src.ts new file mode 100644 index 000000000000..0c32155ff2f6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.src.ts @@ -0,0 +1,3 @@ +class Foo extends Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js new file mode 100644 index 000000000000..a0a35c282040 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js @@ -0,0 +1,2027 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 206 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 48 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "M" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "range": [ + 38, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "name": "Base", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "name": "T" + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "range": [ + 47, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 53, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "argument": { + "type": "ClassExpression", + "range": [ + 60, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "id": null, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 79, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "superClass": { + "type": "Identifier", + "range": [ + 74, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "name": "Base" + }, + "implements": [], + "decorators": [] + } + } + ] + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 10, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 11, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "name": "T", + "constraint": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 21, + 36 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 21, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "name": "Constructor" + }, + "typeArguments": [ + { + "type": "TSTypeLiteral", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "members": [] + } + ] + } + } + } + ] + } + }, + { + "type": "ClassDeclaration", + "range": [ + 86, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 42 + } + }, + "id": { + "type": "Identifier", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "name": "X" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 125, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + "superClass": { + "type": "CallExpression", + "range": [ + 102, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + }, + "name": "M" + }, + "arguments": [ + { + "type": "Identifier", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "name": "C" + } + ], + "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 103, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 22 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 21 + } + }, + "id": { + "type": "TSAnyKeyword", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "typeParameters": null + } + ] + } + }, + "implements": [ + { + "type": "ClassImplements", + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "range": [ + 123, + 124 + ], + "id": { + "type": "Identifier", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "name": "I" + } + } + ], + "decorators": [] + }, + { + "type": "ClassDeclaration", + "range": [ + 130, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 11 + } + }, + "id": { + "type": "Identifier", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "name": "C" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 138, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + { + "type": "TSInterfaceDeclaration", + "range": [ + 142, + 157 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 15 + } + }, + "name": { + "type": "Identifier", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 11 + } + }, + "name": "I" + }, + "members": [] + }, + { + "type": "VariableDeclaration", + "range": [ + 158, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 48 + } + }, + "kind": "type", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "range": [ + 163, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 16 + } + }, + "name": "Constructor" + }, + "init": { + "type": "TSConstructorType", + "range": [ + 180, + 205 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 47 + } + }, + "parameters": [ + { + "type": "RestElement", + "range": [ + 185, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 41 + } + }, + "argument": { + "type": "Identifier", + "range": [ + 188, + 192 + ], + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 34 + } + }, + "name": "args", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 9, + "column": 36 + }, + "end": { + "line": 9, + "column": 41 + } + }, + "range": [ + 194, + 199 + ], + "typeAnnotation": { + "type": "TSArrayType", + "range": [ + 194, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 36 + }, + "end": { + "line": 9, + "column": 41 + } + }, + "elementType": { + "type": "TSAnyKeyword", + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 9, + "column": 36 + }, + "end": { + "line": 9, + "column": 39 + } + } + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 9, + "column": 46 + }, + "end": { + "line": 9, + "column": 47 + } + }, + "range": [ + 204, + 205 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 9, + "column": 46 + }, + "end": { + "line": 9, + "column": 47 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 9, + "column": 46 + }, + "end": { + "line": 9, + "column": 47 + } + }, + "name": "T" + } + } + } + }, + "range": [ + 163, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 48 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 19 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + }, + "name": "T", + "constraint": null + } + ] + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "M", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "Constructor", + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "Base", + "range": [ + 38, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 66, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "Base", + "range": [ + 74, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 94, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "M", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "any", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Keyword", + "value": "implements", + "range": [ + 112, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "I", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 130, + 135 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 138, + 139 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 140, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "interface", + "range": [ + 142, + 151 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "I", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 8, + "column": 12 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 158, + 162 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "Constructor", + "range": [ + 163, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 180, + 183 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 9, + "column": 26 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 185, + 188 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 30 + } + } + }, + { + "type": "Identifier", + "value": "args", + "range": [ + 188, + 192 + ], + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 9, + "column": 34 + }, + "end": { + "line": 9, + "column": 35 + } + } + }, + { + "type": "Identifier", + "value": "any", + "range": [ + 194, + 197 + ], + "loc": { + "start": { + "line": 9, + "column": 36 + }, + "end": { + "line": 9, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 40 + }, + "end": { + "line": 9, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 9, + "column": 41 + }, + "end": { + "line": 9, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 201, + 203 + ], + "loc": { + "start": { + "line": 9, + "column": 43 + }, + "end": { + "line": 9, + "column": 45 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 9, + "column": 46 + }, + "end": { + "line": 9, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 47 + }, + "end": { + "line": 9, + "column": 48 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.src.ts new file mode 100644 index 000000000000..975b36a3e7d1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.src.ts @@ -0,0 +1,9 @@ +function M>(Base: T) { + return class extends Base { } +} + +class X extends M(C) implements I { } + +class C { } +interface I { } +type Constructor = new (...args: any[]) => T; From 784bf30f2cbb80f0956b6ee39d055ab69a803a46 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 30 Apr 2017 06:35:25 -0500 Subject: [PATCH 127/326] New: Add support for default type parameters (fixes #235) (#240) --- .../lib/ast-converter.js | 9 +- ...lass-with-generic-method-default.result.js | 484 ++++++++++++++++++ .../class-with-generic-method-default.src.ts | 3 + ...lass-with-type-parameter-default.result.js | 313 +++++++++++ .../class-with-type-parameter-default.src.ts | 3 + .../class-with-type-parameter.result.js | 242 +++++++++ .../basics/class-with-type-parameter.src.ts | 3 + 7 files changed, 1056 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index c9dd0ce4d681..0aeceb99494f 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -618,6 +618,7 @@ module.exports = function(ast, extra) { function convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { var firstTypeParameter = typeParameters[0]; var lastTypeParameter = typeParameters[typeParameters.length - 1]; + return { type: "TypeParameterDeclaration", range: [ @@ -633,6 +634,11 @@ module.exports = function(ast, extra) { var typeParameterStart = (typeParameter.typeName && typeParameter.typeName.text) ? typeParameter.end - typeParameter.typeName.text.length : typeParameter.pos; + + var defaultParameter = typeParameter.default + ? convert(typeParameter.default, typeParameter) + : typeParameter.default; + return { type: "TypeParameter", range: [ @@ -643,7 +649,8 @@ module.exports = function(ast, extra) { name: typeParameter.name.text, constraint: (typeParameter.constraint) ? convertTypeAnnotation(typeParameter.constraint) - : null + : null, + default: defaultParameter }; }) }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js new file mode 100644 index 000000000000..a93d92694992 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js @@ -0,0 +1,484 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "key": { + "type": "Identifier", + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "getBar" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 32, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "body": [] + }, + "range": [ + 29, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "params": [], + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 20, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 21, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "name": "T", + "constraint": null, + "default": { + "type": "TSTypeReference", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "name": "Bar" + } + } + } + ] + } + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 10, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "getBar", + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.src.ts new file mode 100644 index 000000000000..957a382b419a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.src.ts @@ -0,0 +1,3 @@ +class Foo { + getBar() {} +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js new file mode 100644 index 000000000000..a86cefb1a9ef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js @@ -0,0 +1,313 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 9, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "T", + "constraint": null, + "default": { + "type": "TSTypeReference", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "Bar" + } + } + } + ] + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 19, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.src.ts new file mode 100644 index 000000000000..b416539347d4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.src.ts @@ -0,0 +1,3 @@ +class Foo { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js new file mode 100644 index 000000000000..dac497379c96 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js @@ -0,0 +1,242 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "T", + "constraint": null + } + ] + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 13, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.src.ts new file mode 100644 index 000000000000..4c6ce17948cb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.src.ts @@ -0,0 +1,3 @@ +class Foo { + +} From f48ab1624bb6a5994949ab1cd7f474525e4720ec Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 30 Apr 2017 06:39:19 -0500 Subject: [PATCH 128/326] Fix: Label abstract class properties (fixes #234) (#238) --- .../lib/ast-converter.js | 4 +- ...t-class-with-abstract-properties.result.js | 413 ++++++++++++++++++ ...ract-class-with-abstract-properties.src.ts | 4 + 3 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 0aeceb99494f..02302ca80442 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1094,8 +1094,10 @@ module.exports = function(ast, extra) { break; case SyntaxKind.PropertyDeclaration: + var isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); + assign(result, { - type: "ClassProperty", + type: (isAbstract) ? "TSAbstractClassProperty" : "ClassProperty", key: convertChild(node.name), value: convertChild(node.initializer), computed: (node.name.kind === SyntaxKind.ComputedPropertyName), diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js new file mode 100644 index 000000000000..d5b3cbc34cfd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js @@ -0,0 +1,413 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "TSAbstractClassDeclaration", + "range": [ + 0, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "TSAbstractClassProperty", + "range": [ + 25, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "key": { + "type": "Identifier", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "name": "bar" + }, + "value": null, + "computed": false, + "static": false, + "accessibility": null, + "decorators": [], + "typeAnnotation": null + }, + { + "type": "TSAbstractClassProperty", + "range": [ + 43, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "key": { + "type": "Identifier", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "name": "baz" + }, + "value": { + "type": "Literal", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "value": 3, + "raw": "3" + }, + "computed": false, + "static": false, + "accessibility": null, + "decorators": [], + "typeAnnotation": null + } + ], + "range": [ + 19, + 62 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "abstract", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 25, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 43, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts new file mode 100644 index 000000000000..42128953cb7d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.src.ts @@ -0,0 +1,4 @@ +abstract class Foo { + abstract bar; + abstract baz = 3; +} From ff48efc09de7d75e8c6f52b61a34f16f2af09ecb Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 30 Apr 2017 06:43:10 -0500 Subject: [PATCH 129/326] Chore: Add tests for object spread and async generator (refs #236) (#237) --- .../async-generators.result.js | 223 ++++++++++++++++++ .../async-generators.src.js | 3 + .../property-spread.result.js | 4 +- .../single-spread.result.js | 4 +- .../two-spread.result.js | 6 +- .../tests/lib/ecma-features.js | 2 +- 6 files changed, 234 insertions(+), 8 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js new file mode 100644 index 000000000000..c13485195ac3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js @@ -0,0 +1,223 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "name": "foo" + }, + "generator": true, + "expression": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "async", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 16, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.src.js new file mode 100644 index 000000000000..75fcd2647be0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.src.js @@ -0,0 +1,3 @@ +async function* foo() { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js index 25637c84f674..8895201efd2e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js @@ -326,7 +326,7 @@ module.exports = { "kind": "init" }, { - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", "loc": { "start": { "line": 8, @@ -856,4 +856,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js index f2afb48d3de8..573b616a212f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js @@ -326,7 +326,7 @@ module.exports = { "kind": "init" }, { - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", "loc": { "start": { "line": 8, @@ -784,4 +784,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js index 15a023481c19..28044a0ee779 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js @@ -269,7 +269,7 @@ module.exports = { "kind": "init" }, { - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", "loc": { "start": { "line": 7, @@ -304,7 +304,7 @@ module.exports = { } }, { - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", "loc": { "start": { "line": 8, @@ -744,4 +744,4 @@ module.exports = { ] } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index c89cd2b4ecaa..402d8c9b02cc 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -41,7 +41,7 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { }).map(function(filename) { return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" }).filter(function(filename) { - return !(/error\-|invalid\-|globalReturn|experimental/.test(filename)); + return !(/error\-|invalid\-|globalReturn/.test(filename)); }); // var moduleTestFiles = testFiles.filter(function(filename) { From 97fe4a638c5a7e60d27c36855ee9c1b43b82fb01 Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Mon, 1 May 2017 01:20:19 +1000 Subject: [PATCH 130/326] Fix: Set async on async FunctionExpressions (fixes #244) (#245) --- .../lib/ast-converter.js | 2 +- .../async-function-expression.result.js | 330 ++++++++++++++++++ .../basics/async-function-expression.src.ts | 2 + 3 files changed, 333 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 02302ca80442..dbd2dd5612a1 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1295,7 +1295,7 @@ module.exports = function(ast, extra) { generator: !!node.asteriskToken, params: node.parameters.map(convertChild), body: convertChild(node.body), - async: hasModifier(SyntaxKind.AbstractKeyword, node), + async: hasModifier(SyntaxKind.AsyncKeyword, node), expression: false }); // Process returnType diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js new file mode 100644 index 000000000000..f0961045153c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js @@ -0,0 +1,330 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "expression": { + "type": "CallExpression", + "range": [ + 0, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "callee": { + "type": "FunctionExpression", + "range": [ + 1, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": "test" + }, + "generator": false, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [] + }, + "async": true, + "expression": false + }, + "arguments": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "async", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "test", + "range": [ + 16, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.src.ts new file mode 100644 index 000000000000..7849af4e1bca --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.src.ts @@ -0,0 +1,2 @@ +(async function test() { +})(); \ No newline at end of file From 035d0eeceb63626fc7c34ba6cc66d19bf4fbbb0f Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 1 May 2017 05:55:26 -0500 Subject: [PATCH 131/326] Fix: Set await property on async iterators (for await) (fixes #236) (#239) --- .../lib/ast-converter.js | 6 +- .../async-iterator.result.js | 496 ++++++++++++++++++ .../async-iterator.src.js | 5 + 3 files changed, 506 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index dbd2dd5612a1..05d1d47c7028 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -899,11 +899,15 @@ module.exports = function(ast, extra) { case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: + var isAwait = node.awaitModifier + && node.awaitModifier.kind === ts.SyntaxKind.AwaitKeyword; + assign(result, { type: SyntaxKind[node.kind], left: convertChild(node.initializer), right: convertChild(node.expression), - body: convertChild(node.statement) + body: convertChild(node.statement), + await: isAwait }); break; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js new file mode 100644 index 000000000000..abb80b360b52 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js @@ -0,0 +1,496 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "foo" + }, + "generator": false, + "expression": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 21, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ForOfStatement", + "range": [ + 27, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "left": { + "type": "VariableDeclaration", + "range": [ + 38, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "name": "item" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "name": "items" + }, + "body": { + "type": "BlockStatement", + "range": [ + 59, + 67 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [] + }, + "await": true + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "async", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 6, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "for", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Identifier", + "value": "await", + "range": [ + 31, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "item", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "of", + "range": [ + 49, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "items", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.src.js new file mode 100644 index 000000000000..742ec47ad7ba --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.src.js @@ -0,0 +1,5 @@ +async function foo() { + for await (const item of items) { + + } +} From 16eb44a0433287f746246d8ec6e5907b28666c68 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 1 May 2017 07:30:11 -0500 Subject: [PATCH 132/326] Breaking: Change how interface node gets converted (fixes #201) (#241) --- .../lib/ast-converter.js | 51 + .../basics/class-with-mixin.result.js | 24 +- .../interface-extends-multiple.result.js | 291 +++++ .../basics/interface-extends-multiple.src.ts | 3 + .../basics/interface-extends.result.js | 220 ++++ .../basics/interface-extends.src.ts | 3 + .../interface-type-parameters.result.js | 240 ++++ .../basics/interface-type-parameters.src.ts | 3 + ...ure-with-parameter-accessibility.result.js | 548 ++++---- ...ace-with-extends-type-parameters.result.js | 421 +++++++ ...erface-with-extends-type-parameters.src.ts | 3 + .../basics/interface-with-jsdoc.result.js | 120 +- ...terface-with-optional-properties.result.js | 1118 +++++++++-------- ...nterface-without-type-annotation.result.js | 96 +- .../typescript/basics/typed-this.result.js | 360 +++--- 15 files changed, 2422 insertions(+), 1079 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 05d1d47c7028..929fbebac872 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -676,6 +676,25 @@ module.exports = function(ast, extra) { return classImplementsNode; } + /** + * Converts a child into a interface heritage node. + * @param {TSNode} child The TypeScript AST node to convert. + * @returns {ESTreeNode} The type annotation node. + */ + function convertInterfaceHeritageClause(child) { + var id = convertChild(child.expression); + var classImplementsNode = { + type: "TSInterfaceHeritage", + loc: id.loc, + range: id.range, + id: id + }; + if (child.typeArguments && child.typeArguments.length) { + classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); + } + return classImplementsNode; + } + /** * For nodes that are copied directly from the TypeScript AST into * ESTree mostly as-is. The only difference is the addition of a type @@ -2083,6 +2102,38 @@ module.exports = function(ast, extra) { break; + case SyntaxKind.InterfaceDeclaration: + var interfaceHeritageClauses = node.heritageClauses || []; + var interfaceLastClassToken = interfaceHeritageClauses.length ? interfaceHeritageClauses[interfaceHeritageClauses.length - 1] : node.name; + + if (node.typeParameters && node.typeParameters.length) { + var interfaceLastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; + if (!interfaceLastClassToken || interfaceLastTypeParameter.pos > interfaceLastClassToken.pos) { + interfaceLastClassToken = ts.findNextToken(interfaceLastTypeParameter, ast); + } + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + var hasImplementsClause = interfaceHeritageClauses.length > 0; + var interfaceOpenBrace = ts.findNextToken(interfaceLastClassToken, ast); + + var interfaceBody = { + type: "TSInterfaceBody", + body: node.members.map(function(member) { + return convertChild(member); + }), + range: [ interfaceOpenBrace.getStart(), result.range[1] ], + loc: getLocFor(interfaceOpenBrace.getStart(), node.end, ast) + }; + + assign(result, { + type: "TSInterfaceDeclaration", + body: interfaceBody, + id: convertChild(node.name), + heritage: hasImplementsClause ? interfaceHeritageClauses[0].types.map(convertInterfaceHeritageClause) : [] + }); + break; + default: deeplyCopy(); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js index a0a35c282040..8d4522c1c503 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js @@ -598,7 +598,25 @@ module.exports = { "column": 15 } }, - "name": { + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 154, + 157 + ], + "loc": { + "start": { + "line": 8, + "column": 12 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + "id": { "type": "Identifier", "range": [ 152, @@ -616,7 +634,7 @@ module.exports = { }, "name": "I" }, - "members": [] + "heritage": [] }, { "type": "VariableDeclaration", @@ -2024,4 +2042,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js new file mode 100644 index 000000000000..ba61edaa0f6b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js @@ -0,0 +1,291 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Foo" + }, + "heritage": [ + { + "type": "TSInterfaceHeritage", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 22, + 25 + ], + "id": { + "type": "Identifier", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "name": "Bar" + } + }, + { + "type": "TSInterfaceHeritage", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 26, + 29 + ], + "id": { + "type": "Identifier", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "name": "Baz" + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "Baz", + "range": [ + 26, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.src.ts new file mode 100644 index 000000000000..e3b646613572 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.src.ts @@ -0,0 +1,3 @@ +interface Foo extends Bar,Baz { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js new file mode 100644 index 000000000000..b09ee67a3b3f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js @@ -0,0 +1,220 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 26, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Foo" + }, + "heritage": [ + { + "type": "TSInterfaceHeritage", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 22, + 25 + ], + "id": { + "type": "Identifier", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "name": "Bar" + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 22, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.src.ts new file mode 100644 index 000000000000..1cc0e41709ea --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.src.ts @@ -0,0 +1,3 @@ +interface Foo extends Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js new file mode 100644 index 000000000000..0e29b4a687c3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js @@ -0,0 +1,240 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "name": "T", + "constraint": null + } + ] + }, + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Foo" + }, + "heritage": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.src.ts new file mode 100644 index 000000000000..d2c9ee32ff79 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.src.ts @@ -0,0 +1,3 @@ +interface Foo { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js index bf1db350c492..5416b11a08bd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -1,386 +1,404 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 49 + ], "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 } }, - "members": [ - { - "loc": { - "end": { - "column": 30, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "parameters": [ - { - "accessibility": "public", - "isReadonly": false, - "loc": { - "end": { - "column": 17, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "TSConstructSignature", + "range": [ + 21, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 4 }, - "parameter": { - "loc": { - "end": { - "column": 17, - "line": 2 - }, - "start": { - "column": 16, - "line": 2 - } - }, - "name": "x", + "end": { + "line": 2, + "column": 30 + } + }, + "parameters": [ + { + "type": "TSParameterProperty", "range": [ - 33, + 26, 34 ], - "type": "Identifier" - }, - "range": [ - 26, - 34 - ], - "type": "TSParameterProperty" - }, - { - "accessibility": "private", - "isReadonly": false, - "loc": { - "end": { - "column": 28, - "line": 2 - }, - "start": { - "column": 19, - "line": 2 - } - }, - "parameter": { "loc": { - "end": { - "column": 28, - "line": 2 - }, "start": { - "column": 27, - "line": 2 + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 17 } }, - "name": "y", + "accessibility": "public", + "isReadonly": false, + "parameter": { + "type": "Identifier", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "name": "x" + } + }, + { + "type": "TSParameterProperty", "range": [ - 44, + 36, 45 ], - "type": "Identifier" - }, - "range": [ - 36, - 45 - ], - "type": "TSParameterProperty" - } - ], - "range": [ - 21, - 47 - ], - "type": "TSConstructSignature" - } - ], - "name": { + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "accessibility": "private", + "isReadonly": false, + "parameter": { + "type": "Identifier", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "name": "y" + } + } + ] + } + ], + "range": [ + 15, + 49 + ], "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 } - }, - "name": "Test", + } + }, + "id": { + "type": "Identifier", "range": [ 10, 14 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "Test" }, - "range": [ - 0, - 49 - ], - "type": "TSInterfaceDeclaration" + "heritage": [] } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 49 - ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 9, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "interface", "range": [ 0, 9 ], - "type": "Keyword", - "value": "interface" - }, - { "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "Test", "range": [ 10, 14 ], - "type": "Identifier", - "value": "Test" - }, - { "loc": { - "end": { - "column": 16, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 15, 16 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 7, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 } - }, + } + }, + { + "type": "Keyword", + "value": "new", "range": [ 21, 24 ], - "type": "Keyword", - "value": "new" - }, - { "loc": { - "end": { - "column": 9, - "line": 2 - }, "start": { - "column": 8, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 25, 26 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 15, - "line": 2 - }, "start": { - "column": 9, - "line": 2 + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 } - }, + } + }, + { + "type": "Keyword", + "value": "public", "range": [ 26, 32 ], - "type": "Keyword", - "value": "public" - }, - { "loc": { - "end": { - "column": 17, - "line": 2 - }, "start": { - "column": 16, - "line": 2 + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 } - }, + } + }, + { + "type": "Identifier", + "value": "x", "range": [ 33, 34 ], - "type": "Identifier", - "value": "x" - }, - { "loc": { - "end": { - "column": 18, - "line": 2 - }, "start": { - "column": 17, - "line": 2 + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 } - }, + } + }, + { + "type": "Punctuator", + "value": ",", "range": [ 34, 35 ], - "type": "Punctuator", - "value": "," - }, - { "loc": { - "end": { - "column": 26, - "line": 2 - }, "start": { - "column": 19, - "line": 2 + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 } - }, + } + }, + { + "type": "Keyword", + "value": "private", "range": [ 36, 43 ], - "type": "Keyword", - "value": "private" - }, - { "loc": { - "end": { - "column": 28, - "line": 2 - }, "start": { - "column": 27, - "line": 2 + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 26 } - }, + } + }, + { + "type": "Identifier", + "value": "y", "range": [ 44, 45 ], - "type": "Identifier", - "value": "y" - }, - { "loc": { - "end": { - "column": 29, - "line": 2 - }, "start": { - "column": 28, - "line": 2 + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 45, 46 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 30, - "line": 2 - }, "start": { - "column": 29, - "line": 2 + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 46, 47 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 30 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 48, 49 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" + ] }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js new file mode 100644 index 000000000000..59505ce92ed4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js @@ -0,0 +1,421 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "name": "T", + "constraint": null + } + ] + }, + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 32, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Foo" + }, + "heritage": [ + { + "type": "TSInterfaceHeritage", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 25, + 28 + ], + "id": { + "type": "Identifier", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "name": "Bar" + }, + "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "params": [ + { + "type": "GenericTypeAnnotation", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "name": "J" + }, + "typeParameters": null + } + ] + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "T", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "J", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts new file mode 100644 index 000000000000..5387a76cc744 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.src.ts @@ -0,0 +1,3 @@ +interface Foo extends Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js index fc134d46f0cc..c94201ababba 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js @@ -31,46 +31,14 @@ module.exports = { "column": 1 } }, - "name": { - "type": "Identifier", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "Test" - }, - "members": [ - { - "type": "TSMethodSignature", - "range": [ - 76, - 85 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "name": { - "type": "Identifier", + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "TSMethodSignature", "range": [ 76, - 79 + 85 ], "loc": { "start": { @@ -79,33 +47,83 @@ module.exports = { }, "end": { "line": 6, - "column": 7 + "column": 13 } }, - "name": "foo" - }, - "parameters": [ - { + "name": { "type": "Identifier", "range": [ - 80, - 83 + 76, + 79 ], "loc": { "start": { "line": 6, - "column": 8 + "column": 4 }, "end": { "line": 6, - "column": 11 + "column": 7 } }, - "name": "bar" - } - ] + "name": "foo" + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 80, + 83 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "name": "bar" + } + ] + } + ], + "range": [ + 15, + 87 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 7, + "column": 1 + } } - ] + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "Test" + }, + "heritage": [] } ], "sourceType": "script", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js index 346edb1a62cd..bdf5fa6d8c4b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js @@ -1,813 +1,831 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 81 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, "body": [ { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 81 + ], "loc": { - "end": { - "column": 1, - "line": 5 - }, "start": { - "column": 0, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 } }, - "members": [ - { - "loc": { - "end": { - "column": 9, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "name": { - "loc": { - "end": { - "column": 7, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "name": "foo", - "optional": true, + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "TSPropertySignature", "range": [ 21, - 24 + 26 ], - "type": "Identifier" - }, - "questionToken": { "loc": { - "end": { - "column": 8, - "line": 2 - }, "start": { - "column": 7, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 } }, - "range": [ - 24, - 25 - ], - "type": "TSQuestionToken" - }, - "range": [ - 21, - 26 - ], - "type": "TSPropertySignature", - "typeAnnotation": null - }, - { - "loc": { - "end": { - "column": 17, - "line": 3 - }, - "start": { - "column": 4, - "line": 3 - } - }, - "name": { - "loc": { - "end": { - "column": 7, - "line": 3 + "name": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } }, - "start": { - "column": 4, - "line": 3 + "name": "foo", + "optional": true + }, + "questionToken": { + "type": "TSQuestionToken", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } } }, - "name": "bar", - "optional": true, + "typeAnnotation": null + }, + { + "type": "TSPropertySignature", "range": [ 31, - 34 + 44 ], - "type": "Identifier" - }, - "questionToken": { "loc": { - "end": { - "column": 8, - "line": 3 - }, "start": { - "column": 7, - "line": 3 + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 17 } }, - "range": [ - 34, - 35 - ], - "type": "TSQuestionToken" - }, - "range": [ - 31, - 44 - ], - "type": "TSPropertySignature", - "typeAnnotation": { - "loc": { - "end": { - "column": 16, - "line": 3 + "name": { + "type": "Identifier", + "range": [ + 31, + 34 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } }, - "start": { - "column": 10, - "line": 3 + "name": "bar", + "optional": true + }, + "questionToken": { + "type": "TSQuestionToken", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } } }, - "range": [ - 37, - 43 - ], - "type": "TypeAnnotation", "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 16, - "line": 3 - }, "start": { - "column": 10, - "line": 3 + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 } }, "range": [ 37, 43 ], - "type": "TSStringKeyword" - } - } - }, - { - "loc": { - "end": { - "column": 34, - "line": 4 - }, - "start": { - "column": 4, - "line": 4 + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 + } + } + } } }, - "name": { + { + "type": "TSMethodSignature", + "range": [ + 49, + 79 + ], "loc": { - "end": { - "column": 7, - "line": 4 - }, "start": { - "column": 4, - "line": 4 + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 34 } }, - "name": "baz", - "optional": true, - "range": [ - 49, - 52 - ], - "type": "Identifier" - }, - "parameters": [ - { + "name": { + "type": "Identifier", + "range": [ + 49, + 52 + ], "loc": { - "end": { - "column": 12, - "line": 4 - }, "start": { - "column": 9, - "line": 4 + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 7 } }, - "name": "foo", + "name": "baz", + "optional": true + }, + "questionToken": { + "type": "TSQuestionToken", "range": [ - 54, - 57 + 52, + 53 ], - "type": "Identifier" - }, - { "loc": { - "end": { - "column": 17, - "line": 4 - }, "start": { - "column": 14, - "line": 4 + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 } - }, - "name": "bar", - "optional": true, - "range": [ - 59, - 62 - ], - "type": "Identifier", - "typeAnnotation": { + } + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 54, + 57 + ], "loc": { - "end": { - "column": 26, - "line": 4 - }, "start": { - "column": 20, - "line": 4 + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 12 } }, + "name": "foo" + }, + { + "type": "Identifier", "range": [ - 65, - 71 + 59, + 62 ], - "type": "TypeAnnotation", + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "name": "bar", + "optional": true, "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 26, - "line": 4 - }, "start": { - "column": 20, - "line": 4 + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 26 } }, "range": [ 65, 71 ], - "type": "TSStringKeyword" - } - } - }, - { - "loc": { - "end": { - "column": 31, - "line": 4 - }, - "start": { - "column": 28, - "line": 4 + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 65, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 26 + } + } + } } }, - "name": "baz", - "optional": true, - "range": [ - 73, - 76 - ], - "type": "Identifier" - } - ], - "questionToken": { - "loc": { - "end": { - "column": 8, - "line": 4 - }, - "start": { - "column": 7, - "line": 4 + { + "type": "Identifier", + "range": [ + 73, + 76 + ], + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 31 + } + }, + "name": "baz", + "optional": true } - }, - "range": [ - 52, - 53 - ], - "type": "TSQuestionToken" - }, - "range": [ - 49, - 79 - ], - "type": "TSMethodSignature" - } - ], - "name": { + ] + } + ], + "range": [ + 15, + 81 + ], "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 5, + "column": 1 } - }, - "name": "test", + } + }, + "id": { + "type": "Identifier", "range": [ 10, 14 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "test" }, - "range": [ - 0, - 81 - ], - "type": "TSInterfaceDeclaration" - } - ], - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 0, - "line": 1 + "heritage": [] } - }, - "range": [ - 0, - 81 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 9, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "interface", "range": [ 0, 9 ], - "type": "Keyword", - "value": "interface" - }, - { "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "test", "range": [ 10, 14 ], - "type": "Identifier", - "value": "test" - }, - { "loc": { - "end": { - "column": 16, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 15, 16 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 7, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 } - }, + } + }, + { + "type": "Identifier", + "value": "foo", "range": [ 21, 24 ], - "type": "Identifier", - "value": "foo" - }, - { "loc": { - "end": { - "column": 8, - "line": 2 - }, "start": { - "column": 7, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 24, 25 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 9, - "line": 2 - }, "start": { - "column": 8, - "line": 2 + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 25, 26 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 7, - "line": 3 - }, "start": { - "column": 4, - "line": 3 + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "bar", "range": [ 31, 34 ], - "type": "Identifier", - "value": "bar" - }, - { "loc": { - "end": { - "column": 8, - "line": 3 - }, "start": { - "column": 7, - "line": 3 + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 34, 35 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 9, - "line": 3 - }, "start": { - "column": 8, - "line": 3 + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 35, 36 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 16, - "line": 3 - }, "start": { - "column": 10, - "line": 3 + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 37, 43 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 17, - "line": 3 - }, "start": { - "column": 16, - "line": 3 + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 43, 44 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 7, - "line": 4 - }, "start": { - "column": 4, - "line": 4 + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 } - }, + } + }, + { + "type": "Identifier", + "value": "baz", "range": [ 49, 52 ], - "type": "Identifier", - "value": "baz" - }, - { "loc": { - "end": { - "column": 8, - "line": 4 - }, "start": { - "column": 7, - "line": 4 + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 52, 53 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 9, - "line": 4 - }, "start": { - "column": 8, - "line": 4 + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 53, 54 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 12, - "line": 4 - }, "start": { - "column": 9, - "line": 4 + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "foo", "range": [ 54, 57 ], - "type": "Identifier", - "value": "foo" - }, - { "loc": { - "end": { - "column": 13, - "line": 4 - }, "start": { - "column": 12, - "line": 4 + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": ",", "range": [ 57, 58 ], - "type": "Punctuator", - "value": "," - }, - { "loc": { - "end": { - "column": 17, - "line": 4 - }, "start": { - "column": 14, - "line": 4 + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 } - }, + } + }, + { + "type": "Identifier", + "value": "bar", "range": [ 59, 62 ], - "type": "Identifier", - "value": "bar" - }, - { "loc": { - "end": { - "column": 18, - "line": 4 - }, "start": { - "column": 17, - "line": 4 + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 17 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 62, 63 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 19, - "line": 4 - }, "start": { - "column": 18, - "line": 4 + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 63, 64 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 26, - "line": 4 - }, "start": { - "column": 20, - "line": 4 + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 19 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 65, 71 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 27, - "line": 4 - }, "start": { - "column": 26, - "line": 4 + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 26 } - }, + } + }, + { + "type": "Punctuator", + "value": ",", "range": [ 71, 72 ], - "type": "Punctuator", - "value": "," - }, - { "loc": { - "end": { - "column": 31, - "line": 4 - }, "start": { - "column": 28, - "line": 4 + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 } - }, + } + }, + { + "type": "Identifier", + "value": "baz", "range": [ 73, 76 ], - "type": "Identifier", - "value": "baz" - }, - { "loc": { - "end": { - "column": 32, - "line": 4 - }, "start": { - "column": 31, - "line": 4 + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 31 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 76, 77 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 33, - "line": 4 - }, "start": { - "column": 32, - "line": 4 + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 77, 78 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 34, - "line": 4 - }, "start": { - "column": 33, - "line": 4 + "line": 4, + "column": 32 + }, + "end": { + "line": 4, + "column": 33 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 78, 79 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 5 - }, "start": { - "column": 0, - "line": 5 + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 80, 81 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } } - ], - "type": "Program" + ] }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js index 40c8fbc31ca7..83f82dec1f43 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js @@ -31,7 +31,62 @@ module.exports = { "column": 1 } }, - "name": { + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "TSPropertySignature", + "range": [ + 21, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": { + "type": "Identifier", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "foo" + }, + "typeAnnotation": null + } + ], + "range": [ + 15, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "id": { "type": "Identifier", "range": [ 10, @@ -49,44 +104,7 @@ module.exports = { }, "name": "test" }, - "members": [ - { - "type": "TSPropertySignature", - "range": [ - 21, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "typeAnnotation": null - } - ] + "heritage": [] } ], "sourceType": "script", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js index 3414d4ce021a..e9756380c562 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js @@ -31,46 +31,14 @@ module.exports = { "column": 1 } }, - "name": { - "type": "Identifier", - "range": [ - 10, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "UIElement" - }, - "members": [ - { - "type": "TSMethodSignature", - "range": [ - 23, - 87 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 65 - } - }, - "name": { - "type": "Identifier", + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "TSMethodSignature", "range": [ 23, - 39 + 87 ], "loc": { "start": { @@ -79,51 +47,47 @@ module.exports = { }, "end": { "line": 2, - "column": 17 + "column": 65 } }, - "name": "addClickListener" - }, - "parameters": [ - { + "name": { "type": "Identifier", "range": [ - 40, - 47 + 23, + 39 ], "loc": { "start": { "line": 2, - "column": 18 + "column": 1 }, "end": { "line": 2, - "column": 25 + "column": 17 } }, - "name": "onclick", - "typeAnnotation": { - "type": "TypeAnnotation", + "name": "addClickListener" + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 40, + 47 + ], "loc": { "start": { "line": 2, - "column": 27 + "column": 18 }, "end": { "line": 2, - "column": 57 + "column": 25 } }, - "range": [ - 49, - 79 - ], + "name": "onclick", "typeAnnotation": { - "type": "TSFunctionType", - "range": [ - 49, - 79 - ], + "type": "TypeAnnotation", "loc": { "start": { "line": 2, @@ -134,46 +98,46 @@ module.exports = { "column": 57 } }, - "parameters": [ - { - "type": "Identifier", - "range": [ - 50, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 32 - } + "range": [ + 49, + 79 + ], + "typeAnnotation": { + "type": "TSFunctionType", + "range": [ + 49, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 27 }, - "name": "this", - "typeAnnotation": { - "type": "TypeAnnotation", + "end": { + "line": 2, + "column": 57 + } + }, + "parameters": [ + { + "type": "Identifier", + "range": [ + 50, + 54 + ], "loc": { "start": { "line": 2, - "column": 34 + "column": 28 }, "end": { "line": 2, - "column": 38 + "column": 32 } }, - "range": [ - 56, - 60 - ], + "name": "this", "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 56, - 60 - ], + "type": "TypeAnnotation", "loc": { "start": { "line": 2, @@ -183,49 +147,49 @@ module.exports = { "line": 2, "column": 38 } + }, + "range": [ + 56, + 60 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 56, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 38 + } + } } } - } - }, - { - "type": "Identifier", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 2, - "column": 41 - } }, - "name": "e", - "typeAnnotation": { - "type": "TypeAnnotation", + { + "type": "Identifier", + "range": [ + 62, + 63 + ], "loc": { "start": { "line": 2, - "column": 43 + "column": 40 }, "end": { "line": 2, - "column": 48 + "column": 41 } }, - "range": [ - 65, - 70 - ], + "name": "e", "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 65, - 70 - ], + "type": "TypeAnnotation", "loc": { "start": { "line": 2, @@ -236,8 +200,12 @@ module.exports = { "column": 48 } }, - "typeName": { - "type": "Identifier", + "range": [ + 65, + 70 + ], + "typeAnnotation": { + "type": "TSTypeReference", "range": [ 65, 70 @@ -252,34 +220,30 @@ module.exports = { "column": 48 } }, - "name": "Event" + "typeName": { + "type": "Identifier", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 48 + } + }, + "name": "Event" + } } } } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 57 - } - }, - "range": [ - 75, - 79 ], "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 75, - 79 - ], + "type": "TypeAnnotation", "loc": { "start": { "line": 2, @@ -289,35 +253,35 @@ module.exports = { "line": 2, "column": 57 } + }, + "range": [ + 75, + 79 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 57 + } + } } } } } } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 60 - }, - "end": { - "line": 2, - "column": 64 - } - }, - "range": [ - 82, - 86 ], "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 82, - 86 - ], + "type": "TypeAnnotation", "loc": { "start": { "line": 2, @@ -327,11 +291,65 @@ module.exports = { "line": 2, "column": 64 } + }, + "range": [ + 82, + 86 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 82, + 86 + ], + "loc": { + "start": { + "line": 2, + "column": 60 + }, + "end": { + "line": 2, + "column": 64 + } + } } } } + ], + "range": [ + 20, + 89 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 3, + "column": 1 + } } - ] + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "name": "UIElement" + }, + "heritage": [] } ], "sourceType": "script", @@ -751,4 +769,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From 73d24cf7e49c644a254f4c2601cd610669acfee0 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 2 May 2017 14:51:28 +0200 Subject: [PATCH 133/326] Upgrade: Update semver package (#246) --- packages/typescript-eslint-parser/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 95d132cd62fb..e0f71eaade20 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -27,7 +27,6 @@ "leche": "^1.0.1", "mocha": "^2.0.1", "npm-license": "^0.2.3", - "semver": "^4.1.1", "shelljs": "^0.3.0", "shelljs-nodecli": "^0.1.1", "typescript": "~2.3.2" @@ -53,7 +52,7 @@ "dependencies": { "lodash.unescape": "4.0.0", "object-assign": "^4.0.1", - "semver": "^4.3.6" + "semver": "^5.3.0" }, "peerDependencies": { "typescript": "*" From c92d356be9866ea9cc7318f41cea3bf7c657d48b Mon Sep 17 00:00:00 2001 From: Danny Arnold Date: Fri, 5 May 2017 00:14:13 +0200 Subject: [PATCH 134/326] Fix: add `instanceof` to ast-converter (fixes #252) (#251) --- .../lib/ast-converter.js | 1 + .../fixtures/basics/instanceof.result.js | 148 ++++++++++++++++++ .../tests/fixtures/basics/instanceof.src.js | 1 + 3 files changed, 150 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 929fbebac872..fb9f114feaa5 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -59,6 +59,7 @@ TOKEN_TO_TEXT[SyntaxKind.GreaterThanEqualsToken] = ">="; TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsToken] = "=="; TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsToken] = "!="; TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsEqualsToken] = "==="; +TOKEN_TO_TEXT[SyntaxKind.InstanceOfKeyword] = "instanceof"; TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsEqualsToken] = "!=="; TOKEN_TO_TEXT[SyntaxKind.EqualsGreaterThanToken] = "=>"; TOKEN_TO_TEXT[SyntaxKind.PlusToken] = "+"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js new file mode 100644 index 000000000000..c68fecd17912 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js @@ -0,0 +1,148 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "BinaryExpression", + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "left": { + "type": "Literal", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "value": "", + "raw": "''" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "Set" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "String", + "value": "''", + "range": [ + 0, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Keyword", + "value": "instanceof", + "range": [ + 3, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "Set", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.src.js b/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.src.js new file mode 100644 index 000000000000..909f769f83de --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.src.js @@ -0,0 +1 @@ +'' instanceof Set \ No newline at end of file From e0360f19341a5152b72792bb82fe475af5265659 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 6 May 2017 07:05:43 -0500 Subject: [PATCH 135/326] Fix: Handle case where class has extends but no super class (fixes #249) (#254) --- .../lib/ast-converter.js | 2 +- .../class-empty-extends-implements.result.js | 204 ++++++++++++++++ .../class-empty-extends-implements.src.ts | 3 + .../class-empty-extends.result.js | 168 +++++++++++++ .../errorRecovery/class-empty-extends.src.ts | 3 + .../class-extends-empty-implements.result.js | 221 ++++++++++++++++++ .../class-extends-empty-implements.src.ts | 3 + .../interface-empty-extends.result.js | 166 +++++++++++++ .../interface-empty-extends.src.ts | 3 + 9 files changed, 772 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index fb9f114feaa5..2824bfa9f862 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1581,7 +1581,7 @@ module.exports = function(ast, extra) { superClass, hasImplements = false; - if (hasExtends) { + if (hasExtends && heritageClauses[0].types.length > 0) { superClass = heritageClauses.shift(); if (superClass.types[0] && superClass.types[0].typeArguments) { result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js new file mode 100644 index 000000000000..dec45ce27030 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js @@ -0,0 +1,204 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "implements", + "range": [ + 18, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 29, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts new file mode 100644 index 000000000000..0d08522dbc07 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.src.ts @@ -0,0 +1,3 @@ +class Foo extends implements Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js new file mode 100644 index 000000000000..5f0f82e7833f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js @@ -0,0 +1,168 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 18, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.src.ts new file mode 100644 index 000000000000..47a27e783f28 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.src.ts @@ -0,0 +1,3 @@ +class Foo extends { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js new file mode 100644 index 000000000000..4c1f0ac8ace9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js @@ -0,0 +1,221 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": { + "type": "Identifier", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "name": "Bar" + }, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "Bar", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "implements", + "range": [ + 22, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts new file mode 100644 index 000000000000..42b4c0565f4b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.src.ts @@ -0,0 +1,3 @@ +class Foo extends Bar implements { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js new file mode 100644 index 000000000000..2561f9ea41ec --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js @@ -0,0 +1,166 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Foo" + }, + "heritage": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Keyword", + "value": "extends", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts new file mode 100644 index 000000000000..dae1275e6b11 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.src.ts @@ -0,0 +1,3 @@ +interface Foo extends { + +} From 06cb0af1c68f04214c5c062d4feb7f7210073f29 Mon Sep 17 00:00:00 2001 From: Igor Oleinikov Date: Sat, 6 May 2017 10:36:27 -0700 Subject: [PATCH 136/326] Fix: Type parameter start location calculation (fixes #260) (#259) --- .../lib/ast-converter.js | 4 +- ...ult-class-with-multiple-generics.result.js | 4 +- ...med-class-with-multiple-generics.result.js | 4 +- ...pe-parameters-that-have-comments.result.js | 229 ++++++++++++++++++ ...-type-parameters-that-have-comments.src.ts | 1 + 5 files changed, 236 insertions(+), 6 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 2824bfa9f862..6b1aa15258c2 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -632,8 +632,8 @@ module.exports = function(ast, extra) { * Have to manually calculate the start of the range, * because TypeScript includes leading whitespace but Flow does not */ - var typeParameterStart = (typeParameter.typeName && typeParameter.typeName.text) - ? typeParameter.end - typeParameter.typeName.text.length + var typeParameterStart = (typeParameter.name && typeParameter.name.text) + ? typeParameter.name.end - typeParameter.name.text.length : typeParameter.pos; var defaultParameter = typeParameter.default diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js index e858b3449832..e89d71549c99 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js @@ -72,13 +72,13 @@ module.exports = { "line": 1 }, "start": { - "column": 23, + "column": 24, "line": 1 } }, "name": "U", "range": [ - 23, + 24, 25 ], "type": "TypeParameter", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js index 759414a93372..046761743815 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js @@ -89,13 +89,13 @@ module.exports = { "line": 1 }, "start": { - "column": 19, + "column": 20, "line": 1 } }, "name": "U", "range": [ - 19, + 20, 21 ], "type": "TypeParameter", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js new file mode 100644 index 000000000000..bf999101281a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js @@ -0,0 +1,229 @@ +module.exports = { + body: [{ + async: false, + body: { + body: [], + loc: { + end: { + column: 35, + line: 1 + }, + start: { + column: 33, + line: 1 + } + }, + range: [33, 35], + type: "BlockStatement" + }, + expression: false, + generator: false, + id: { + loc: { + end: { + column: 16, + line: 1 + }, + start: { + column: 9, + line: 1 + } + }, + name: "compare", + range: [9, 16], + type: "Identifier" + }, + loc: { + end: { + column: 35, + line: 1 + }, + start: { + column: 0, + line: 1 + } + }, + params: [], + range: [0, 35], + type: "FunctionDeclaration", + typeParameters: { + loc: { + end: { + column: 30, + line: 1 + }, + start: { + column: 16, + line: 1 + } + }, + params: [{ + constraint: null, + loc: { + end: { + column: 29, + line: 1 + }, + start: { + column: 28, + line: 1 + } + }, + name: "T", + range: [28, 29], + type: "TypeParameter" + }], + range: [16, 30], + type: "TypeParameterDeclaration" + } + }], + loc: { + end: { + column: 35, + line: 1 + }, + start: { + column: 0, + line: 1 + } + }, + range: [0, 35], + sourceType: "script", + tokens: [{ + loc: { + end: { + column: 8, + line: 1 + }, + start: { + column: 0, + line: 1 + } + }, + range: [0, 8], + type: "Keyword", + value: "function" + }, + { + loc: { + end: { + column: 16, + line: 1 + }, + start: { + column: 9, + line: 1 + } + }, + range: [9, 16], + type: "Identifier", + value: "compare" + }, + { + loc: { + end: { + column: 17, + line: 1 + }, + start: { + column: 16, + line: 1 + } + }, + range: [16, 17], + type: "Punctuator", + value: "<" + }, + { + loc: { + end: { + column: 29, + line: 1 + }, + start: { + column: 28, + line: 1 + } + }, + range: [28, 29], + type: "Identifier", + value: "T" + }, + { + loc: { + end: { + column: 30, + line: 1 + }, + start: { + column: 29, + line: 1 + } + }, + range: [29, 30], + type: "Punctuator", + value: ">" + }, + { + loc: { + end: { + column: 31, + line: 1 + }, + start: { + column: 30, + line: 1 + } + }, + range: [30, 31], + type: "Punctuator", + value: "(" + }, + { + loc: { + end: { + column: 32, + line: 1 + }, + start: { + column: 31, + line: 1 + } + }, + range: [31, 32], + type: "Punctuator", + value: ")" + }, + { + loc: { + end: { + column: 34, + line: 1 + }, + start: { + column: 33, + line: 1 + } + }, + range: [33, 34], + type: "Punctuator", + value: "{" + }, + { + loc: { + end: { + column: 35, + line: 1 + }, + start: { + column: 34, + line: 1 + } + }, + range: [34, 35], + type: "Punctuator", + value: "}" + } + ], + type: "Program" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts new file mode 100644 index 000000000000..1b328010c98b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.src.ts @@ -0,0 +1 @@ +function compare() {} \ No newline at end of file From 6eb80c582ee5aa423cd59787680cea0ec488231f Mon Sep 17 00:00:00 2001 From: Rasmus Eneman Date: Sun, 7 May 2017 00:22:24 +0200 Subject: [PATCH 137/326] Breaking: Normalize type parameters (fixes #197) (#196) --- .../lib/ast-converter.js | 8 + ...tract-class-with-abstract-method.result.js | 69 +- ...tract-class-with-optional-method.result.js | 73 +- .../basics/class-with-mixin.result.js | 75 +- ...export-type-function-declaration.result.js | 1 + .../function-with-types-assignation.result.js | 1687 +++++++++-------- ...ure-with-parameter-accessibility.result.js | 1 + .../basics/interface-with-generic.result.js | 240 +++ .../basics/interface-with-generic.src.ts | 2 + .../basics/interface-with-jsdoc.result.js | 1 + ...terface-with-optional-properties.result.js | 1 + .../basics/nested-type-arguments.result.js | 203 +- ...-with-constrained-type-parameter.result.js | 92 +- .../basics/type-alias-declaration.result.js | 76 +- .../typescript/basics/typed-this.result.js | 6 +- ...namespace-with-exported-function.result.js | 70 +- 16 files changed, 1573 insertions(+), 1032 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 6b1aa15258c2..3d0fbafc8912 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -709,6 +709,14 @@ module.exports = function(ast, extra) { }).forEach(function(key) { if (key === "type") { result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; + } else if (key === "typeArguments") { + result.typeParameters = (node.typeArguments) + ? convertTypeArgumentsToTypeParameters(node.typeArguments) + : null; + } else if (key === "typeParameters") { + result.typeParameters = (node.typeParameters) + ? convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters) + : null; } else { if (Array.isArray(node[key])) { result[key] = node[key].map(convertChild); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js index c476c036844b..ff0f61f06671 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js @@ -159,25 +159,60 @@ module.exports = { }, "name": "Promise" }, - "typeArguments": [ - { - "type": "TSStringKeyword", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 37 + "typeParameters": { + "loc": { + "end": { + "column": 44, + "line": 2 + }, + "start": { + "column": 36, + "line": 2 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 43, + "line": 2 + }, + "start": { + "column": 37, + "line": 2 + } + }, + "range": [ + 76, + 82 + ], + "type": "TSStringKeyword" }, - "end": { - "line": 2, - "column": 43 - } + "loc": { + "end": { + "column": 43, + "line": 2 + }, + "start": { + "column": 37, + "line": 2 + } + }, + "range": [ + 76, + 82 + ], + "type": "GenericTypeAnnotation", + "typeParameters": null } - } - ] + ], + "range": [ + 75, + 83 + ], + "type": "TypeParameterInstantiation" + } } }, "params": [] diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js index 9e409d84abc6..39abec7b375c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js @@ -97,25 +97,6 @@ module.exports = { 75 ], "type": "TSTypeReference", - "typeArguments": [ - { - "loc": { - "end": { - "column": 35, - "line": 2 - }, - "start": { - "column": 29, - "line": 2 - } - }, - "range": [ - 68, - 74 - ], - "type": "TSStringKeyword" - } - ], "typeName": { "loc": { "end": { @@ -133,6 +114,60 @@ module.exports = { 67 ], "type": "Identifier" + }, + "typeParameters": { + "loc": { + "end": { + "column": 36, + "line": 2 + }, + "start": { + "column": 28, + "line": 2 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 35, + "line": 2 + }, + "start": { + "column": 29, + "line": 2 + } + }, + "range": [ + 68, + 74 + ], + "type": "TSStringKeyword" + }, + "loc": { + "end": { + "column": 35, + "line": 2 + }, + "start": { + "column": 29, + "line": 2 + } + }, + "range": [ + 68, + 74 + ], + "type": "GenericTypeAnnotation", + "typeParameters": null + } + ], + "range": [ + 67, + 75 + ], + "type": "TypeParameterInstantiation" } } }, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js index 8d4522c1c503..c5864a639781 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js @@ -300,26 +300,61 @@ module.exports = { }, "name": "Constructor" }, - "typeArguments": [ - { - "type": "TSTypeLiteral", - "range": [ - 33, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } + "typeParameters": { + "loc": { + "end": { + "column": 36, + "line": 1 }, - "members": [] - } - ] + "start": { + "column": 32, + "line": 1 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 33, + "line": 1 + } + }, + "members": [], + "range": [ + 33, + 35 + ], + "type": "TSTypeLiteral" + }, + "loc": { + "end": { + "column": 35, + "line": 1 + }, + "start": { + "column": 33, + "line": 1 + } + }, + "range": [ + 33, + 35 + ], + "type": "GenericTypeAnnotation", + "typeParameters": null + } + ], + "range": [ + 32, + 36 + ], + "type": "TypeParameterInstantiation" + } } } } @@ -656,6 +691,7 @@ module.exports = { "declarations": [ { "type": "VariableDeclarator", + "typeParameters": null, "id": { "type": "Identifier", "range": [ @@ -778,6 +814,7 @@ module.exports = { } } ], + "typeParameters": null, "typeAnnotation": { "type": "TypeAnnotation", "loc": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js index 1ed404aa592d..92f182993a0e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js @@ -99,6 +99,7 @@ module.exports = { "column": 27 } }, + "typeParameters": null, "parameters": [ { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js index 4ca5b486aeba..0a1f4f5d1768 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js @@ -1,899 +1,936 @@ module.exports = { - "type": "Program", - "range": [ - 0, - 96 - ], - "loc": { - "end": { - "line": 3, - "column": 1 + "type": "Program", + "range": [ + 0, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 1, + "column": 0 + } }, - "start": { - "line": 1, - "column": 0 - } - }, - "body": [ - { - "async": false, - "body": { - "body": [ - { - "argument": { - "type": "Identifier", - "range": [ - 89, - 93 - ], - "loc": { + "body": [ + { + "async": false, + "body": { + "body": [ + { + "argument": { + "type": "Identifier", + "range": [ + 89, + 93 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 9 + } + }, + "name": "name" + }, + "type": "ReturnStatement", + "range": [ + 82, + 94 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 2 + } + } + } + ], + "type": "BlockStatement", + "range": [ + 78, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 1, + "column": 78 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "range": [ + 9, + 16 + ], + "loc": { + "end": { + "line": 1, + "column": 16 + }, + "start": { + "line": 1, + "column": 9 + } + }, + "name": "message" + }, + "type": "FunctionDeclaration", + "range": [ + 0, + 96 + ], + "loc": { "end": { - "line": 2, - "column": 13 + "line": 3, + "column": 1 }, "start": { - "line": 2, - "column": 9 + "line": 1, + "column": 0 } - }, - "name": "name" }, - "type": "ReturnStatement", - "range": [ - 82, - 94 + "params": [ + { + "loc": { + "end": { + "line": 1, + "column": 21 + }, + "start": { + "line": 1, + "column": 17 + } + }, + "name": "name", + "range": [ + 17, + 21 + ], + "type": "Identifier", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 22, + 28 + ], + "loc": { + "end": { + "line": 1, + "column": 28 + }, + "start": { + "line": 1, + "column": 22 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 22, + 28 + ], + "loc": { + "end": { + "line": 1, + "column": 28 + }, + "start": { + "line": 1, + "column": 22 + } + } + } + } + }, + { + "type": "AssignmentPattern", + "range": [ + 30, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "range": [ + 30, + 33 + ], + "loc": { + "end": { + "line": 1, + "column": 33 + }, + "start": { + "line": 1, + "column": 30 + } + }, + "name": "age", + "typeAnnotation": { + "type": "TypeAnnotation", + "range": [ + 34, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 34 + } + }, + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 34, + 40 + ], + "loc": { + "end": { + "line": 1, + "column": 40 + }, + "start": { + "line": 1, + "column": 34 + } + } + } + } + }, + "right": { + "type": "Literal", + "range": [ + 43, + 46 + ], + "loc": { + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 43 + } + }, + "raw": "100", + "value": 100 + } + }, + { + "argument": { + "loc": { + "end": { + "line": 1, + "column": 55 + }, + "start": { + "line": 1, + "column": 51 + } + }, + "name": "args", + "range": [ + 51, + 55 + ], + "type": "Identifier", + "typeAnnotation": { + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "range": [ + 56, + 69 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "range": [ + 56, + 69 + ], + "type": "TSTypeReference", + "typeName": { + "loc": { + "end": { + "line": 1, + "column": 61 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "name": "Array", + "range": [ + 56, + 61 + ], + "type": "Identifier" + }, + "typeParameters": { + "loc": { + "end": { + "column": 69, + "line": 1 + }, + "start": { + "column": 61, + "line": 1 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 68, + "line": 1 + }, + "start": { + "column": 62, + "line": 1 + } + }, + "range": [ + 62, + 68 + ], + "type": "TSStringKeyword" + }, + + "loc": { + "end": { + "column": 68, + "line": 1 + }, + "start": { + "column": 62, + "line": 1 + } + }, + "range": [ + 62, + 68 + ], + "type": "GenericTypeAnnotation", + "typeParameters": null + } + ], + "range": [ + 61, + 69 + ], + "type": "TypeParameterInstantiation" + } + } + } + }, + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 48 + } + }, + "range": [ + 48, + 69 + ], + "type": "RestElement" + } ], - "loc": { - "end": { - "line": 2, - "column": 14 - }, - "start": { - "line": 2, - "column": 2 - } + "returnType": { + "type": "TypeAnnotation", + "range": [ + 71, + 77 + ], + "loc": { + "end": { + "line": 1, + "column": 77 + }, + "start": { + "line": 1, + "column": 71 + } + }, + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 71, + 77 + ], + "loc": { + "end": { + "line": 1, + "column": 77 + }, + "start": { + "line": 1, + "column": 71 + } + } + } } - } - ], - "type": "BlockStatement", - "range": [ - 78, - 96 - ], - "loc": { - "end": { - "line": 3, - "column": 1 - }, - "start": { - "line": 1, - "column": 78 - } } - }, - "expression": false, - "generator": false, - "id": { - "type": "Identifier", - "range": [ - 9, - 16 - ], - "loc": { - "end": { - "line": 1, - "column": 16 - }, - "start": { - "line": 1, - "column": 9 - } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "range": [ + 0, + 8 + ], + "loc": { + "end": { + "line": 1, + "column": 8 + }, + "start": { + "line": 1, + "column": 0 + } + }, + "value": "function" }, - "name": "message" - }, - "type": "FunctionDeclaration", - "range": [ - 0, - 96 - ], - "loc": { - "end": { - "line": 3, - "column": 1 + { + "type": "Identifier", + "range": [ + 9, + 16 + ], + "loc": { + "end": { + "line": 1, + "column": 16 + }, + "start": { + "line": 1, + "column": 9 + } + }, + "value": "message" }, - "start": { - "line": 1, - "column": 0 - } - }, - "params": [ { - "loc": { - "end": { - "line": 1, - "column": 21 + "type": "Punctuator", + "range": [ + 16, + 17 + ], + "loc": { + "end": { + "line": 1, + "column": 17 + }, + "start": { + "line": 1, + "column": 16 + } }, - "start": { - "line": 1, - "column": 17 - } - }, - "name": "name", - "range": [ - 17, - 21 - ], - "type": "Identifier", - "typeAnnotation": { - "type": "TypeAnnotation", + "value": "(" + }, + { + "type": "Identifier", + "range": [ + 17, + 21 + ], + "loc": { + "end": { + "line": 1, + "column": 21 + }, + "start": { + "line": 1, + "column": 17 + } + }, + "value": "name" + }, + { + "type": "Punctuator", "range": [ - 22, - 28 + 21, + 22 ], "loc": { - "end": { - "line": 1, - "column": 28 - }, - "start": { - "line": 1, - "column": 22 - } + "end": { + "line": 1, + "column": 22 + }, + "start": { + "line": 1, + "column": 21 + } }, - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ + "value": ":" + }, + { + "type": "Identifier", + "range": [ 22, 28 - ], - "loc": { + ], + "loc": { "end": { - "line": 1, - "column": 28 + "line": 1, + "column": 28 }, "start": { - "line": 1, - "column": 22 + "line": 1, + "column": 22 } - } - } - } + }, + "value": "string" }, { - "type": "AssignmentPattern", - "range": [ - 30, - 46 - ], - "loc": { - "end": { - "line": 1, - "column": 46 + "type": "Punctuator", + "range": [ + 28, + 29 + ], + "loc": { + "end": { + "line": 1, + "column": 29 + }, + "start": { + "line": 1, + "column": 28 + } }, - "start": { - "line": 1, - "column": 30 - } - }, - "left": { + "value": "," + }, + { "type": "Identifier", "range": [ - 30, - 33 + 30, + 33 ], "loc": { - "end": { - "line": 1, - "column": 33 - }, - "start": { - "line": 1, - "column": 30 - } + "end": { + "line": 1, + "column": 33 + }, + "start": { + "line": 1, + "column": 30 + } }, - "name": "age", - "typeAnnotation": { - "type": "TypeAnnotation", - "range": [ - 34, - 40 - ], - "loc": { + "value": "age" + }, + { + "type": "Punctuator", + "range": [ + 33, + 34 + ], + "loc": { "end": { - "line": 1, - "column": 40 + "line": 1, + "column": 34 }, "start": { - "line": 1, - "column": 34 + "line": 1, + "column": 33 } - }, - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 34, - 40 - ],"loc": { - "end": { + }, + "value": ":" + }, + { + "type": "Identifier", + "range": [ + 34, + 40 + ], + "loc": { + "end": { "line": 1, "column": 40 - }, - "start": { + }, + "start": { "line": 1, "column": 34 - } } - } - } - }, - "right": { - "type": "Literal", + }, + "value": "number" + }, + { + "type": "Punctuator", "range": [ - 43, - 46 + 41, + 42 ], "loc": { - "end": { - "line": 1, - "column": 46 - }, - "start": { - "line": 1, - "column": 43 - } + "end": { + "line": 1, + "column": 42 + }, + "start": { + "line": 1, + "column": 41 + } }, - "raw": "100", - "value": 100 - } + "value": "=" }, { - "argument": { + "type": "Numeric", + "range": [ + 43, + 46 + ], "loc": { - "end": { - "line": 1, - "column": 55 - }, - "start": { - "line": 1, - "column": 51 - } + "end": { + "line": 1, + "column": 46 + }, + "start": { + "line": 1, + "column": 43 + } }, - "name": "args", + "value": "100" + }, + { + "type": "Punctuator", "range": [ - 51, - 55 + 46, + 47 ], - "type": "Identifier", - "typeAnnotation": { - "loc": { + "loc": { "end": { - "line": 1, - "column": 69 + "line": 1, + "column": 47 }, "start": { - "line": 1, - "column": 56 - } - }, - "range": [ - 56, - 69 - ], - "type": "TypeAnnotation", - "typeAnnotation": { - "loc": { - "end": { "line": 1, - "column": 69 - }, - "start": { + "column": 46 + } + }, + "value": "," + }, + { + "type": "Punctuator", + "range": [ + 48, + 51 + ], + "loc": { + "end": { "line": 1, - "column": 56 - } + "column": 51 }, - "range": [ - 56, - 69 - ], - "type": "TSTypeReference", - "typeArguments": [ - { - "loc": { - "end": { - "line": 1, - "column": 68 - }, - "start": { - "line": 1, - "column": 62 - } - }, - "range": [ - 62, - 68 - ], - "type": "TSStringKeyword" - } - ], - "typeName": { - "loc": { - "end": { - "line": 1, - "column": 61 - }, - "start": { - "line": 1, - "column": 56 - } - }, - "name": "Array", - "range": [ - 56, - 61 - ], - "type": "Identifier" - } - } - } - }, - "loc": { - "end": { - "line": 1, - "column": 69 + "start": { + "line": 1, + "column": 48 + } }, - "start": { - "line": 1, - "column": 48 - } - }, - "range": [ - 48, - 69 - ], - "type": "RestElement" - } - ], - "returnType": { - "type": "TypeAnnotation", - "range": [ - 71, - 77 - ], - "loc": { - "end": { - "line": 1, - "column": 77 - }, - "start": { - "line": 1, - "column": 71 - } + "value": "..." }, - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 71, - 77 - ], - "loc": { - "end": { - "line": 1, - "column": 77 - }, - "start": { - "line": 1, - "column": 71 - } - } - } - }, - } - ], - "sourceType": "script", - "tokens": [ { - "type": "Keyword", - "range": [ - 0, - 8 - ], - "loc": { - "end": { - "line": 1, - "column": 8 - }, - "start": { - "line": 1, - "column": 0 - } - }, - "value": "function" - }, - { - "type": "Identifier", - "range": [ - 9, - 16 - ], - "loc": { - "end": { - "line": 1, - "column": 16 - }, - "start": { - "line": 1, - "column": 9 - } - }, - "value": "message" - }, - { - "type": "Punctuator", - "range": [ - 16, - 17 - ], - "loc": { - "end": { - "line": 1, - "column": 17 - }, - "start": { - "line": 1, - "column": 16 - } - }, - "value": "(" - }, - { - "type": "Identifier", - "range": [ - 17, - 21 - ], - "loc": { - "end": { - "line": 1, - "column": 21 - }, - "start": { - "line": 1, - "column": 17 - } - }, - "value": "name" - }, - { - "type": "Punctuator", - "range": [ - 21, - 22 - ], - "loc": { - "end": { - "line": 1, - "column": 22 - }, - "start": { - "line": 1, - "column": 21 - } - }, - "value": ":" - }, - { - "type": "Identifier", - "range": [ - 22, - 28 - ], - "loc": { - "end": { - "line": 1, - "column": 28 - }, - "start": { - "line": 1, - "column": 22 - } - }, - "value": "string" - }, - { - "type": "Punctuator", - "range": [ - 28, - 29 - ], - "loc": { - "end": { - "line": 1, - "column": 29 - }, - "start": { - "line": 1, - "column": 28 - } - }, - "value": "," - }, - { - "type": "Identifier", - "range": [ - 30, - 33 - ], - "loc": { - "end": { - "line": 1, - "column": 33 - }, - "start": { - "line": 1, - "column": 30 - } - }, - "value": "age" - }, - { - "type": "Punctuator", - "range": [ - 33, - 34 - ], - "loc": { - "end": { - "line": 1, - "column": 34 - }, - "start": { - "line": 1, - "column": 33 - } - }, - "value": ":" - }, - { - "type": "Identifier", - "range": [ - 34, - 40 - ], - "loc": { - "end": { - "line": 1, - "column": 40 - }, - "start": { - "line": 1, - "column": 34 - } - }, - "value": "number" - }, - { - "type": "Punctuator", - "range": [ - 41, - 42 - ], - "loc": { - "end": { - "line": 1, - "column": 42 - }, - "start": { - "line": 1, - "column": 41 - } - }, - "value": "=" - }, - { - "type": "Numeric", - "range": [ - 43, - 46 - ], - "loc": { - "end": { - "line": 1, - "column": 46 - }, - "start": { - "line": 1, - "column": 43 - } - }, - "value": "100" - }, - { - "type": "Punctuator", - "range": [ - 46, - 47 - ], - "loc": { - "end": { - "line": 1, - "column": 47 - }, - "start": { - "line": 1, - "column": 46 - } - }, - "value": "," - }, - { - "type": "Punctuator", - "range": [ - 48, - 51 - ], - "loc": { - "end": { - "line": 1, - "column": 51 - }, - "start": { - "line": 1, - "column": 48 - } - }, - "value": "..." - }, - { - "type": "Identifier", - "range": [ - 51, - 55 - ], - "loc": { - "end": { - "line": 1, - "column": 55 - }, - "start": { - "line": 1, - "column": 51 - } - }, - "value": "args" - }, - { - "type": "Punctuator", - "range": [ - 55, - 56 - ], - "loc": { - "end": { - "line": 1, - "column": 56 + "type": "Identifier", + "range": [ + 51, + 55 + ], + "loc": { + "end": { + "line": 1, + "column": 55 + }, + "start": { + "line": 1, + "column": 51 + } + }, + "value": "args" }, - "start": { - "line": 1, - "column": 55 - } - }, - "value": ":" - }, - { - "type": "Identifier", - "range": [ - 56, - 61 - ], - "loc": { - "end": { - "line": 1, - "column": 61 + { + "type": "Punctuator", + "range": [ + 55, + 56 + ], + "loc": { + "end": { + "line": 1, + "column": 56 + }, + "start": { + "line": 1, + "column": 55 + } + }, + "value": ":" }, - "start": { - "line": 1, - "column": 56 - } - }, - "value": "Array" - }, - { - "type": "Punctuator", - "range": [ - 61, - 62 - ], - "loc": { - "end": { - "line": 1, - "column": 62 + { + "type": "Identifier", + "range": [ + 56, + 61 + ], + "loc": { + "end": { + "line": 1, + "column": 61 + }, + "start": { + "line": 1, + "column": 56 + } + }, + "value": "Array" }, - "start": { - "line": 1, - "column": 61 - } - }, - "value": "<" - }, - { - "type": "Identifier", - "range": [ - 62, - 68 - ], - "loc": { - "end": { - "line": 1, - "column": 68 + { + "type": "Punctuator", + "range": [ + 61, + 62 + ], + "loc": { + "end": { + "line": 1, + "column": 62 + }, + "start": { + "line": 1, + "column": 61 + } + }, + "value": "<" }, - "start": { - "line": 1, - "column": 62 - } - }, - "value": "string" - }, - { - "type": "Punctuator", - "range": [ - 68, - 69 - ], - "loc": { - "end": { - "line": 1, - "column": 69 + { + "type": "Identifier", + "range": [ + 62, + 68 + ], + "loc": { + "end": { + "line": 1, + "column": 68 + }, + "start": { + "line": 1, + "column": 62 + } + }, + "value": "string" }, - "start": { - "line": 1, - "column": 68 - } - }, - "value": ">" - }, - { - "type": "Punctuator", - "range": [ - 69, - 70 - ], - "loc": { - "end": { - "line": 1, - "column": 70 + { + "type": "Punctuator", + "range": [ + 68, + 69 + ], + "loc": { + "end": { + "line": 1, + "column": 69 + }, + "start": { + "line": 1, + "column": 68 + } + }, + "value": ">" }, - "start": { - "line": 1, - "column": 69 - } - }, - "value": ")" - }, - { - "type": "Punctuator", - "range": [ - 70, - 71 - ], - "loc": { - "end": { - "line": 1, - "column": 71 + { + "type": "Punctuator", + "range": [ + 69, + 70 + ], + "loc": { + "end": { + "line": 1, + "column": 70 + }, + "start": { + "line": 1, + "column": 69 + } + }, + "value": ")" }, - "start": { - "line": 1, - "column": 70 - } - }, - "value": ":" - }, - { - "type": "Identifier", - "range": [ - 71, - 77 - ], - "loc": { - "end": { - "line": 1, - "column": 77 + { + "type": "Punctuator", + "range": [ + 70, + 71 + ], + "loc": { + "end": { + "line": 1, + "column": 71 + }, + "start": { + "line": 1, + "column": 70 + } + }, + "value": ":" }, - "start": { - "line": 1, - "column": 71 - } - }, - "value": "string" - }, - { - "type": "Punctuator", - "range": [ - 78, - 79 - ], - "loc": { - "end": { - "line": 1, - "column": 79 + { + "type": "Identifier", + "range": [ + 71, + 77 + ], + "loc": { + "end": { + "line": 1, + "column": 77 + }, + "start": { + "line": 1, + "column": 71 + } + }, + "value": "string" }, - "start": { - "line": 1, - "column": 78 - } - }, - "value": "{" - }, - { - "type": "Keyword", - "range": [ - 82, - 88 - ], - "loc": { - "end": { - "line": 2, - "column": 8 + { + "type": "Punctuator", + "range": [ + 78, + 79 + ], + "loc": { + "end": { + "line": 1, + "column": 79 + }, + "start": { + "line": 1, + "column": 78 + } + }, + "value": "{" }, - "start": { - "line": 2, - "column": 2 - } - }, - "value": "return" - }, - { - "type": "Identifier", - "range": [ - 89, - 93 - ], - "loc": { - "end": { - "line": 2, - "column": 13 + { + "type": "Keyword", + "range": [ + 82, + 88 + ], + "loc": { + "end": { + "line": 2, + "column": 8 + }, + "start": { + "line": 2, + "column": 2 + } + }, + "value": "return" }, - "start": { - "line": 2, - "column": 9 - } - }, - "value": "name" - }, - { - "type": "Punctuator", - "range": [ - 93, - 94 - ], - "loc": { - "end": { - "line": 2, - "column": 14 + { + "type": "Identifier", + "range": [ + 89, + 93 + ], + "loc": { + "end": { + "line": 2, + "column": 13 + }, + "start": { + "line": 2, + "column": 9 + } + }, + "value": "name" }, - "start": { - "line": 2, - "column": 13 - } - }, - "value": ";" - }, - { - "type": "Punctuator", - "range": [ - 95, - 96 - ], - "loc": { - "end": { - "line": 3, - "column": 1 + { + "type": "Punctuator", + "range": [ + 93, + 94 + ], + "loc": { + "end": { + "line": 2, + "column": 14 + }, + "start": { + "line": 2, + "column": 13 + } + }, + "value": ";" }, - "start": { - "line": 3, - "column": 0 + { + "type": "Punctuator", + "range": [ + 95, + 96 + ], + "loc": { + "end": { + "line": 3, + "column": 1 + }, + "start": { + "line": 3, + "column": 0 + } + }, + "value": "}" } - }, - "value": "}" - } - ] -}; \ No newline at end of file + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js index 5416b11a08bd..657caa55ddef 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -36,6 +36,7 @@ module.exports = { "body": [ { "type": "TSConstructSignature", + "typeParameters": null, "range": [ 21, 47 diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js new file mode 100644 index 000000000000..55d39eb9e42f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js @@ -0,0 +1,240 @@ +module.exports = { + "body": [ + { + "body": { + "body": [], + "loc": { + "end": { + "column": 1, + "line": 2 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "range": [ + 18, + 21 + ], + "type": "TSInterfaceBody" + }, + "heritage": [], + "id": { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "name": "Test", + "range": [ + 10, + 14 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 1, + "line": 2 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 21 + ], + "type": "TSInterfaceDeclaration", + "typeParameters": { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "params": [ + { + "constraint": null, + "loc": { + "end": { + "column": 16, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "name": "T", + "range": [ + 15, + 16 + ], + "type": "TypeParameter" + } + ], + "range": [ + 14, + 17 + ], + "type": "TypeParameterDeclaration" + } + } + ], + "loc": { + "end": { + "column": 1, + "line": 2 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 21 + ], + "sourceType": "script", + "tokens": [ + { + "loc": { + "end": { + "column": 9, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 9 + ], + "type": "Keyword", + "value": "interface" + }, + { + "loc": { + "end": { + "column": 14, + "line": 1 + }, + "start": { + "column": 10, + "line": 1 + } + }, + "range": [ + 10, + 14 + ], + "type": "Identifier", + "value": "Test" + }, + { + "loc": { + "end": { + "column": 15, + "line": 1 + }, + "start": { + "column": 14, + "line": 1 + } + }, + "range": [ + 14, + 15 + ], + "type": "Punctuator", + "value": "<" + }, + { + "loc": { + "end": { + "column": 16, + "line": 1 + }, + "start": { + "column": 15, + "line": 1 + } + }, + "range": [ + 15, + 16 + ], + "type": "Identifier", + "value": "T" + }, + { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 16, + "line": 1 + } + }, + "range": [ + 16, + 17 + ], + "type": "Punctuator", + "value": ">" + }, + { + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "range": [ + 18, + 19 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 1, + "line": 2 + }, + "start": { + "column": 0, + "line": 2 + } + }, + "range": [ + 20, + 21 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.src.ts new file mode 100644 index 000000000000..ec88864d2f07 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.src.ts @@ -0,0 +1,2 @@ +interface Test { +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js index c94201ababba..0732fc50c080 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js @@ -36,6 +36,7 @@ module.exports = { "body": [ { "type": "TSMethodSignature", + "typeParameters": null, "range": [ 76, 85 diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js index bdf5fa6d8c4b..46c4fcf419dd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js @@ -177,6 +177,7 @@ module.exports = { }, { "type": "TSMethodSignature", + "typeParameters": null, "range": [ 49, 79 diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js index 2810f9d6cd9c..12a1a89a02d7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js @@ -52,99 +52,168 @@ module.exports = { 44 ], "type": "TSTypeReference", - "typeArguments": [ - { - "loc": { - "end": { - "column": 43, - "line": 1 - }, - "start": { - "column": 23, - "line": 1 - } + "typeParameters": { + "loc": { + "end": { + "column": 44, + "line": 1 }, - "range": [ - 23, - 43 - ], - "type": "TSTypeReference", - "typeArguments": [ - { + "start": { + "column": 22, + "line": 1 + } + }, + "params": [ + { + "id": { "loc": { "end": { - "column": 42, + "column": 28, "line": 1 }, "start": { - "column": 29, + "column": 23, "line": 1 } }, + "name": "Array", "range": [ - 29, - 42 + 23, + 28 ], - "type": "TSTypeReference", - "typeArguments": [ + "type": "Identifier" + }, + "loc": { + "end": { + "column": 43, + "line": 1 + }, + "start": { + "column": 38, + "line": 1 + } + }, + "range": [ + 38, + 43 + ], + "type": "GenericTypeAnnotation", + "typeParameters": { + "loc": { + "end": { + "column": 43, + "line": 1 + }, + "start": { + "column": 28, + "line": 1 + } + }, + "params": [ { + "id": { + "loc": { + "end": { + "column": 34, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "name": "Array", + "range": [ + 29, + 34 + ], + "type": "Identifier" + }, "loc": { "end": { - "column": 41, + "column": 42, "line": 1 }, "start": { - "column": 35, + "column": 37, "line": 1 } }, "range": [ - 35, - 41 + 37, + 42 ], - "type": "TSStringKeyword" + "type": "GenericTypeAnnotation", + "typeParameters": { + "loc": { + "end": { + "column": 42, + "line": 1 + }, + "start": { + "column": 34, + "line": 1 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 41, + "line": 1 + }, + "start": { + "column": 35, + "line": 1 + } + }, + "range": [ + 35, + 41 + ], + "type": "TSStringKeyword" + }, + "loc": { + "end": { + "column": 41, + "line": 1 + }, + "start": { + "column": 35, + "line": 1 + } + }, + "range": [ + 35, + 41 + ], + "type": "GenericTypeAnnotation", + "typeParameters": null + } + ], + "range": [ + 34, + 42 + ], + "type": "TypeParameterInstantiation" + } } ], - "typeName": { - "loc": { - "end": { - "column": 34, - "line": 1 - }, - "start": { - "column": 29, - "line": 1 - } - }, - "name": "Array", - "range": [ - 29, - 34 - ], - "type": "Identifier" - } + "range": [ + 28, + 43 + ], + "type": "TypeParameterInstantiation" } - ], - "typeName": { - "loc": { - "end": { - "column": 28, - "line": 1 - }, - "start": { - "column": 23, - "line": 1 - } - }, - "name": "Array", - "range": [ - 23, - 28 - ], - "type": "Identifier" } - } - ], + ], + "range": [ + 22, + 44 + ], + "type": "TypeParameterInstantiation" + }, "typeName": { "loc": { "end": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js index 9fecbbd47cef..f2a8f46d22de 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js @@ -54,43 +54,6 @@ module.exports = { 38 ], "type": "TSTypeReference", - "typeArguments": [ - { - "loc": { - "end": { - "column": 37, - "line": 1 - }, - "start": { - "column": 36, - "line": 1 - } - }, - "range": [ - 36, - 37 - ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 37, - "line": 1 - }, - "start": { - "column": 36, - "line": 1 - } - }, - "name": "T", - "range": [ - 36, - 37 - ], - "type": "Identifier" - } - } - ], "typeName": { "loc": { "end": { @@ -108,6 +71,61 @@ module.exports = { 35 ], "type": "Identifier" + }, + "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 35, + 38 + ], + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 35, + "line": 1 + } + }, + "params": [ + { + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 36, + "line": 1 + } + }, + "range": [ + 36, + 37 + ], + "id": { + "loc": { + "end": { + "column": 37, + "line": 1 + }, + "start": { + "column": 36, + "line": 1 + } + }, + "name": "T", + "range": [ + 36, + 37 + ], + "type": "Identifier" + }, + "type": "GenericTypeAnnotation", + "typeParameters": null + } + ] } }, { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js index 276b5d88c3b1..c6c963fd77ae 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -104,43 +104,61 @@ module.exports = { }, "name": "Success" }, - "typeArguments": [ - { - "type": "TSTypeReference", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } + "typeParameters": { + "loc": { + "end": { + "column": 27, + "line": 1 }, - "typeName": { - "type": "Identifier", + "start": { + "column": 24, + "line": 1 + } + }, + "range": [ + 24, + 27 + ], + "params": [ + { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } + }, "range": [ 25, 26 ], - "loc": { - "start": { - "line": 1, - "column": 25 + "id": { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } }, - "end": { - "line": 1, - "column": 26 - } + "name": "T", + "range": [ + 25, + 26 + ], + "type": "Identifier" }, - "name": "T" + "type": "GenericTypeAnnotation", + "typeParameters": null } - } - ] + ], + "type": "TypeParameterInstantiation" + } }, { "type": "TSTypeReference", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js index e9756380c562..74a7d177f0cb 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js @@ -275,7 +275,8 @@ module.exports = { } } } - } + }, + "typeParameters": null } } } @@ -313,7 +314,8 @@ module.exports = { } } } - } + }, + "typeParameters": null } ], "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js index 9c60013b10c4..5d7507c54760 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js @@ -229,25 +229,61 @@ module.exports = { }, "name": "Selection" }, - "typeArguments": [ - { - "type": "TSAnyKeyword", - "range": [ - 77, - 80 - ], - "loc": { - "start": { - "line": 2, - "column": 54 + "typeParameters": { + "loc": { + "end": { + "column": 58, + "line": 2 + }, + "start": { + "column": 53, + "line": 2 + } + }, + "params": [ + { + "id": { + "loc": { + "end": { + "column": 57, + "line": 2 + }, + "start": { + "column": 54, + "line": 2 + } + }, + "range": [ + 77, + 80 + ], + "type": "TSAnyKeyword" }, - "end": { - "line": 2, - "column": 57 - } + + "loc": { + "end": { + "column": 57, + "line": 2 + }, + "start": { + "column": 54, + "line": 2 + } + }, + "range": [ + 77, + 80 + ], + "type": "GenericTypeAnnotation", + "typeParameters": null } - } - ] + ], + "range": [ + 76, + 81 + ], + "type": "TypeParameterInstantiation" + } } } }, From e2c98af9370fabdcfac832ef89e9dcd986570704 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 6 May 2017 17:28:26 -0500 Subject: [PATCH 138/326] Chore: Update README with list of known issues (#247) --- packages/typescript-eslint-parser/README.md | 34 ++++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 170350a360ca..d94324cf0d04 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -1,8 +1,8 @@ # TypeScript ESLint Parser (Experimental) -A parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint. The goal is to allow TypeScript files to be parsed by ESLint (though not necessarily pass all ESLint rules). +A parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint. -**Important:** This parser is still in the very early stages and is considered experimental. There are likely a lot of bugs. You should not rely on this in a production environment yet. +**Important:** This parser is not fully compatbile with all ESLint rules and plugins. Some rules will improperly mark source code as failing or not find problems where it should. ## Supported TypeScript Version @@ -14,6 +14,23 @@ If you use a non-supported version of TypeScript, the parser will log a warning **Please ensure that you are using a supported version before submitting any issues/bug reports.** +## Known Issues + +The following ESLint rules will fail on acceptable code: + - no-undef [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) + - no-unused-vars [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) + - no-useless-constructor [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) + - space-infix-ops [#224](https://github.com/eslint/typescript-eslint-parser/issues/224) + +The follow ESLint plugins have issues when used with this parser: + - eslint-plugin-react [#213](https://github.com/eslint/typescript-eslint-parser/issues/213) + +The following TypeScript syntax will cause rules to fail or ESLint v3 to crash: + - Empty body functions + - Abstract methods + - Function overloading + - Declared functions + ## Usage Install: @@ -34,12 +51,13 @@ If you're familiar with TypeScript and ESLint, and you'd like to see this projec ## Reporting Bugs -**Do not** file bugs about ESLint rule failures. This is expected because ESLint doesn't know anything about TypeScript syntax. It's likely that many ESLint rules will have failures as a result. Longer-term, it's likely we'll need to create a custom set of ESLint rules that are TypeScript-specific. - -Bugs should be filed for: - -1. TypeScript syntax that fails to parse. -1. TypeScript syntax that produces an unexpected AST. +Please check the current list of open and known issues and ensure the bug has not been reported before. When creating a new issue provide as much information about your enviroment as possible. This includes: + - ESLint Version + - TypeScript version + - TypeScript parser version + - ESLint config or rules and plugins currently enabled + +As well include a small code sample that can be used to reproduce the issue. ## Contributing From c0a84cbe689c8980e08aa72aa653bde20cec4083 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 6 May 2017 23:35:00 +0100 Subject: [PATCH 139/326] Chore: Refactor the codebase (fixes #220) (#261) --- .../typescript-eslint-parser/.eslintrc.yml | 13 +- packages/typescript-eslint-parser/.travis.yml | 7 +- packages/typescript-eslint-parser/Makefile.js | 52 +- .../lib/ast-converter.js | 2132 +---------------- .../lib/ast-node-types.js | 91 +- .../typescript-eslint-parser/lib/convert.js | 1731 +++++++++++++ .../typescript-eslint-parser/lib/features.js | 94 - .../lib/node-utils.js | 635 +++++ .../lib/token-translator.js | 252 -- .../typescript-eslint-parser/package.json | 30 +- packages/typescript-eslint-parser/parser.js | 92 +- .../tests/lib/attach-comments.js | 33 +- .../tests/lib/basics.js | 38 +- .../tests/lib/ecma-features.js | 50 +- .../tests/lib/parse.js | 18 +- .../tests/lib/tester.js | 10 +- .../tests/lib/typescript.js | 38 +- 17 files changed, 2646 insertions(+), 2670 deletions(-) create mode 100644 packages/typescript-eslint-parser/lib/convert.js delete mode 100644 packages/typescript-eslint-parser/lib/features.js create mode 100644 packages/typescript-eslint-parser/lib/node-utils.js delete mode 100644 packages/typescript-eslint-parser/lib/token-translator.js diff --git a/packages/typescript-eslint-parser/.eslintrc.yml b/packages/typescript-eslint-parser/.eslintrc.yml index 49ee699c7d2d..b706d16bc7eb 100644 --- a/packages/typescript-eslint-parser/.eslintrc.yml +++ b/packages/typescript-eslint-parser/.eslintrc.yml @@ -1,6 +1,11 @@ root: true -env: - node: true - -extends: eslint +plugins: + - node +extends: + - "eslint" + - "plugin:node/recommended" +rules: + no-undefined: "off" + lines-around-comment: "off" + newline-after-var: "off" diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index accaab3b945b..c7e7112d7336 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -1,8 +1,9 @@ language: node_js sudo: false node_js: - - "0.12" - - 4 - - 6 + - "4" + - "5" + - "6" + - "7" after_success: - npm run coveralls diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index 823c65162f79..50d6cfa394ec 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -15,14 +15,14 @@ require("shelljs/make"); -var checker = require("npm-license"), +const checker = require("npm-license"), nodeCLI = require("shelljs-nodecli"); //------------------------------------------------------------------------------ // Settings //------------------------------------------------------------------------------ -var OPEN_SOURCE_LICENSES = [ +const OPEN_SOURCE_LICENSES = [ /MIT/, /BSD/, /Apache/, /ISC/, /WTF/, /Public Domain/ ]; @@ -30,15 +30,15 @@ var OPEN_SOURCE_LICENSES = [ // Data //------------------------------------------------------------------------------ -var NODE_MODULES = "./node_modules/", +const NODE_MODULES = "./node_modules/", // Utilities - intentional extra space at the end of each string - MOCHA = NODE_MODULES + "mocha/bin/_mocha ", + MOCHA = `${NODE_MODULES}mocha/bin/_mocha `, // Files MAKEFILE = "./Makefile.js", /* eslint-disable no-use-before-define */ - JS_FILES = find("lib/").filter(fileType("js")).join(" ") + " parser.js", + JS_FILES = `${find("lib/").filter(fileType("js")).join(" ")} parser.js`, TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "); /* eslint-enable no-use-before-define */ @@ -67,7 +67,7 @@ target.all = function() { }; target.lint = function() { - var errors = 0, + let errors = 0, lastReturn; echo("Validating Makefile.js"); @@ -96,10 +96,8 @@ target.lint = function() { target.test = function() { target.lint(); - var errors = 0, - lastReturn; - - lastReturn = nodeCLI.exec("istanbul", "cover", MOCHA, "-- -c", TEST_FILES); + const lastReturn = nodeCLI.exec("istanbul", "cover", MOCHA, "-- -c", TEST_FILES); + let errors = 0; if (lastReturn.code !== 0) { errors++; @@ -122,42 +120,34 @@ target.checkLicenses = function() { /** * Returns true if the given dependency's licenses are all permissable for use in OSS - * @param {object} dependency object containing the name and licenses of the given dependency + * @param {Object} dependency object containing the name and licenses of the given dependency * @returns {boolean} is permissable dependency */ function isPermissible(dependency) { - var licenses = dependency.licenses; + const licenses = dependency.licenses; if (Array.isArray(licenses)) { - return licenses.some(function(license) { - return isPermissible({ - name: dependency.name, - licenses: license - }); - }); + return licenses.some(license => isPermissible({ + name: dependency.name, + licenses: license + })); } - return OPEN_SOURCE_LICENSES.some(function(license) { - return license.test(licenses); - }); + return OPEN_SOURCE_LICENSES.some(license => license.test(licenses)); } echo("Validating licenses"); checker.init({ start: __dirname - }, function(deps) { - var impermissible = Object.keys(deps).map(function(dependency) { - return { - name: dependency, - licenses: deps[dependency].licenses - }; - }).filter(function(dependency) { - return !isPermissible(dependency); - }); + }, deps => { + const impermissible = Object.keys(deps).map(dependency => ({ + name: dependency, + licenses: deps[dependency].licenses + })).filter(dependency => !isPermissible(dependency)); if (impermissible.length) { - impermissible.forEach(function(dependency) { + impermissible.forEach(dependency => { console.error("%s license for %s is impermissible.", dependency.licenses, dependency.name diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 3d0fbafc8912..363eb842600a 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -11,298 +11,20 @@ // Requirements //------------------------------------------------------------------------------ -var ts = require("typescript"), - assign = require("object-assign"), - unescape = require("lodash.unescape"); +const convert = require("./convert"), + nodeUtils = require("./node-utils"); //------------------------------------------------------------------------------ // Private //------------------------------------------------------------------------------ -var SyntaxKind = ts.SyntaxKind; - -var ASSIGNMENT_OPERATORS = [ - SyntaxKind.EqualsToken, - SyntaxKind.PlusEqualsToken, - SyntaxKind.MinusEqualsToken, - SyntaxKind.AsteriskEqualsToken, - SyntaxKind.SlashEqualsToken, - SyntaxKind.PercentEqualsToken, - SyntaxKind.LessThanLessThanEqualsToken, - SyntaxKind.GreaterThanGreaterThanEqualsToken, - SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, - SyntaxKind.AmpersandEqualsToken, - SyntaxKind.BarEqualsToken, - SyntaxKind.CaretEqualsToken -]; - -var LOGICAL_OPERATORS = [ - SyntaxKind.BarBarToken, - SyntaxKind.AmpersandAmpersandToken -]; - -var TOKEN_TO_TEXT = {}; -TOKEN_TO_TEXT[SyntaxKind.OpenBraceToken] = "{"; -TOKEN_TO_TEXT[SyntaxKind.CloseBraceToken] = "}"; -TOKEN_TO_TEXT[SyntaxKind.OpenParenToken] = "("; -TOKEN_TO_TEXT[SyntaxKind.CloseParenToken] = ")"; -TOKEN_TO_TEXT[SyntaxKind.OpenBracketToken] = "["; -TOKEN_TO_TEXT[SyntaxKind.CloseBracketToken] = "]"; -TOKEN_TO_TEXT[SyntaxKind.DotToken] = "."; -TOKEN_TO_TEXT[SyntaxKind.DotDotDotToken] = "..."; -TOKEN_TO_TEXT[SyntaxKind.SemicolonToken] = ";"; -TOKEN_TO_TEXT[SyntaxKind.CommaToken] = ","; -TOKEN_TO_TEXT[SyntaxKind.LessThanToken] = "<"; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanToken] = ">"; -TOKEN_TO_TEXT[SyntaxKind.LessThanEqualsToken] = "<="; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanEqualsToken] = ">="; -TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsToken] = "=="; -TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsToken] = "!="; -TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsEqualsToken] = "==="; -TOKEN_TO_TEXT[SyntaxKind.InstanceOfKeyword] = "instanceof"; -TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsEqualsToken] = "!=="; -TOKEN_TO_TEXT[SyntaxKind.EqualsGreaterThanToken] = "=>"; -TOKEN_TO_TEXT[SyntaxKind.PlusToken] = "+"; -TOKEN_TO_TEXT[SyntaxKind.MinusToken] = "-"; -TOKEN_TO_TEXT[SyntaxKind.AsteriskToken] = "*"; -TOKEN_TO_TEXT[SyntaxKind.SlashToken] = "/"; -TOKEN_TO_TEXT[SyntaxKind.PercentToken] = "%"; -TOKEN_TO_TEXT[SyntaxKind.PlusPlusToken] = "++"; -TOKEN_TO_TEXT[SyntaxKind.MinusMinusToken] = "--"; -TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanToken] = "<<"; -TOKEN_TO_TEXT[SyntaxKind.LessThanSlashToken] = ">"; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanToken] = ">>>"; -TOKEN_TO_TEXT[SyntaxKind.AmpersandToken] = "&"; -TOKEN_TO_TEXT[SyntaxKind.BarToken] = "|"; -TOKEN_TO_TEXT[SyntaxKind.CaretToken] = "^"; -TOKEN_TO_TEXT[SyntaxKind.ExclamationToken] = "!"; -TOKEN_TO_TEXT[SyntaxKind.TildeToken] = "~"; -TOKEN_TO_TEXT[SyntaxKind.AmpersandAmpersandToken] = "&&"; -TOKEN_TO_TEXT[SyntaxKind.BarBarToken] = "||"; -TOKEN_TO_TEXT[SyntaxKind.QuestionToken] = "?"; -TOKEN_TO_TEXT[SyntaxKind.ColonToken] = ":"; -TOKEN_TO_TEXT[SyntaxKind.EqualsToken] = "="; -TOKEN_TO_TEXT[SyntaxKind.PlusEqualsToken] = "+="; -TOKEN_TO_TEXT[SyntaxKind.MinusEqualsToken] = "-="; -TOKEN_TO_TEXT[SyntaxKind.AsteriskEqualsToken] = "*="; -TOKEN_TO_TEXT[SyntaxKind.SlashEqualsToken] = "/="; -TOKEN_TO_TEXT[SyntaxKind.PercentEqualsToken] = "%="; -TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanEqualsToken] = "<<="; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanEqualsToken] = ">>="; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken] = ">>>="; -TOKEN_TO_TEXT[SyntaxKind.AmpersandEqualsToken] = "&="; -TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|="; -TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^="; -TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; -TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; - -/** - * Returns true if the given TSNode is a valid ESTree class member - * @param {TSNode} node TypeScript AST node - * @returns {boolean} is valid ESTree class member - */ -function isESTreeClassMember(node) { - return node.kind !== SyntaxKind.SemicolonClassElement; -} - -/** - * Checks if a TSNode has a modifier - * @param {SyntaxKind} modifierKind TypeScript SyntaxKind modifier - * @param {TSNode} node TypeScript AST node - * @returns {boolean} has the modifier specified - */ -function hasModifier(modifierKind, node) { - return !!node.modifiers && !!node.modifiers.length && node.modifiers.some(function(modifier) { - return modifier.kind === modifierKind; - }); -} - -/** - * Returns true if the given TSToken is a comma - * @param {TSToken} token the TypeScript token - * @returns {boolean} is comma - */ -function isComma(token) { - return token.kind === SyntaxKind.CommaToken; -} - -/** - * Returns true if the given TSToken is the assignment operator - * @param {TSToken} operator the operator token - * @returns {boolean} is assignment - */ -function isAssignmentOperator(operator) { - return ASSIGNMENT_OPERATORS.indexOf(operator.kind) > -1; -} - -/** - * Returns true if the given TSToken is a logical operator - * @param {TSToken} operator the operator token - * @returns {boolean} is a logical operator - */ -function isLogicalOperator(operator) { - return LOGICAL_OPERATORS.indexOf(operator.kind) > -1; -} - -/** - * Returns the binary expression type of the given TSToken - * @param {TSToken} operator the operator token - * @returns {string} the binary expression type - */ -function getBinaryExpressionType(operator) { - if (isAssignmentOperator(operator)) { - return "AssignmentExpression"; - } else if (isLogicalOperator(operator)) { - return "LogicalExpression"; - } else { - return "BinaryExpression"; - } -} - -/** - * Returns line and column data for the given start and end positions, - * for the given AST - * @param {Object} start start data - * @param {Object} end end data - * @param {Object} ast the AST object - * @returns {Object} the loc data - */ -function getLocFor(start, end, ast) { - var startLoc = ast.getLineAndCharacterOfPosition(start), - endLoc = ast.getLineAndCharacterOfPosition(end); - - return { - start: { - line: startLoc.line + 1, - column: startLoc.character - }, - end: { - line: endLoc.line + 1, - column: endLoc.character - } - }; -} - -/** - * Returns line and column data for the given ESTreeNode or ESTreeToken, - * for the given AST - * @param {ESTreeToken|ESTreeNode} nodeOrToken the ESTreeNode or ESTreeToken - * @param {Object} ast the AST object - * @returns {Object} the loc data - */ -function getLoc(nodeOrToken, ast) { - return getLocFor(nodeOrToken.getStart(), nodeOrToken.end, ast); - // var start = nodeOrToken.getStart(), - // startLoc = ast.getLineAndCharacterOfPosition(start), - // endLoc = ast.getLineAndCharacterOfPosition(nodeOrToken.end); - - // return { - // start: { - // line: startLoc.line + 1, - // column: startLoc.character - // }, - // end: { - // line: endLoc.line + 1, - // column: endLoc.character - // } - // }; -} - -/** - * Fixes the exports of the given TSNode - * @param {TSNode} node the TSNode - * @param {Object} result result - * @param {Object} ast the AST - * @returns {TSNode} the TSNode with fixed exports - */ -function fixExports(node, result, ast) { - // check for exports - if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { - var exportKeyword = node.modifiers[0], - nextModifier = node.modifiers[1], - lastModifier = node.modifiers[node.modifiers.length - 1], - declarationIsDefault = nextModifier && (nextModifier.kind === SyntaxKind.DefaultKeyword), - varToken = ts.findNextToken(lastModifier, ast); - - result.range[0] = varToken.getStart(); - result.loc = getLocFor(result.range[0], result.range[1], ast); - - var declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration"; - - /** - * Prefix exports from TypeScript namespaces with "TS" to distinguish - * them from ES2015 exports - */ - if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { - declarationType = "TSNamespaceExportDeclaration"; - } - - var newResult = { - type: declarationType, - declaration: result, - range: [ exportKeyword.getStart(), result.range[1] ], - loc: getLocFor(exportKeyword.getStart(), result.range[1], ast) - }; - - if (!declarationIsDefault) { - newResult.specifiers = []; - newResult.source = null; - } - - return newResult; - - } - - return result; -} - -/** - * Returns true if a given TSNode is a token - * @param {TSNode} node the TSNode - * @returns {boolean} is a token - */ -function isToken(node) { - return node.kind >= ts.SyntaxKind.FirstToken && node.kind <= ts.SyntaxKind.LastToken; -} - -/** - * Returns true if a given TSNode is a JSX token - * @param {TSNode} node TSNode to be checked - * @returns {boolean} is a JSX token - */ -function isJSXToken(node) { - return ( - node.kind >= SyntaxKind.JsxElement - && node.kind <= SyntaxKind.JsxAttribute - ); -} - -/** - * Returns true if a given TSNode has a JSX token within its hierarchy - * @param {TSNode} node TSNode to be checked - * @returns {boolean} has JSX ancestor - */ -function hasJSXAncestor(node) { - while (node) { - if (isJSXToken(node)) { - return true; - } - node = node.parent; - } - return false; -} - - /** * Extends and formats a given error object * @param {Object} error the error object * @returns {Object} converted error object */ function convertError(error) { - - var loc = error.file.getLineAndCharacterOfPosition(error.start); - + const loc = error.file.getLineAndCharacterOfPosition(error.start); return { index: error.start, lineNumber: loc.line + 1, @@ -311,1855 +33,41 @@ function convertError(error) { }; } -/** - * Returns the type of a given ESTreeToken - * @param {ESTreeToken} token the ESTreeToken - * @returns {string} the token type - */ -function getTokenType(token) { - - // Need two checks for keywords since some are also identifiers - if (token.originalKeywordKind) { - - switch (token.originalKeywordKind) { - case SyntaxKind.NullKeyword: - return "Null"; - - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.TypeKeyword: - case SyntaxKind.ModuleKeyword: - return "Identifier"; - - default: - return "Keyword"; - } - } - - if (token.kind >= SyntaxKind.FirstKeyword && token.kind <= SyntaxKind.LastFutureReservedWord) { - if (token.kind === SyntaxKind.FalseKeyword || token.kind === SyntaxKind.TrueKeyword) { - return "Boolean"; - } - - return "Keyword"; - } - - if (token.kind >= SyntaxKind.FirstPunctuation && token.kind <= SyntaxKind.LastBinaryOperator) { - return "Punctuator"; - } - - if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && token.kind <= SyntaxKind.TemplateTail) { - return "Template"; - } - - switch (token.kind) { - case SyntaxKind.NumericLiteral: - return "Numeric"; - - case SyntaxKind.JsxText: - return "JSXText"; - - case SyntaxKind.StringLiteral: - // A TypeScript-StringLiteral token with a TypeScript-JsxAttribute or TypeScript-JsxElement parent, - // must actually be an ESTree-JSXText token - if (token.parent && (token.parent.kind === SyntaxKind.JsxAttribute || token.parent.kind === SyntaxKind.JsxElement)) { - return "JSXText"; - } - - return "String"; - - case SyntaxKind.RegularExpressionLiteral: - return "RegularExpression"; - - case SyntaxKind.Identifier: - case SyntaxKind.ConstructorKeyword: - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - // falls through - default: - } - - // Some JSX tokens have to be determined based on their parent - if (token.parent) { - if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.PropertyAccessExpression && hasJSXAncestor(token)) { - return "JSXIdentifier"; - } - - if (isJSXToken(token.parent)) { - if (token.kind === SyntaxKind.PropertyAccessExpression) { - return "JSXMemberExpression"; - } - - if (token.kind === SyntaxKind.Identifier) { - return "JSXIdentifier"; - } - } - } - - return "Identifier"; -} - -/** - * Extends and formats a given ESTreeToken, for a given AST - * @param {ESTreeToken} token the ESTreeToken - * @param {Object} ast the AST object - * @returns {ESTreeToken} the converted ESTreeToken - */ -function convertToken(token, ast) { - - var start = token.getStart(), - value = ast.text.slice(start, token.end), - newToken = { - type: getTokenType(token), - value: value, - start: start, - end: token.end, - range: [start, token.end], - loc: getLoc(token, ast) - }; - - if (newToken.type === "RegularExpression") { - newToken.regex = { - pattern: value.slice(1, value.lastIndexOf("/")), - flags: value.slice(value.lastIndexOf("/") + 1) - }; - } - - return newToken; -} - -/** - * Converts all tokens for the given AST - * @param {Object} ast the AST object - * @returns {ESTreeToken[]} the converted ESTreeTokens - */ -function convertTokens(ast) { - var result = []; - /** - * @param {TSNode} node the TSNode - * @returns {undefined} - */ - function walk(node) { - if (isToken(node) && node.kind !== ts.SyntaxKind.EndOfFileToken) { - var converted = convertToken(node, ast); - if (converted) { - result.push(converted); - } - } else { - node.getChildren().forEach(walk); - } - } - walk(ast); - return result; -} - //------------------------------------------------------------------------------ // Public //------------------------------------------------------------------------------ -module.exports = function(ast, extra) { +module.exports = (ast, extra) => { + /** + * The TypeScript compiler produced fundamental parse errors when parsing the + * source. + */ if (ast.parseDiagnostics.length) { throw convertError(ast.parseDiagnostics[0]); } /** - * Converts a TypeScript node into an ESTree node - * @param {TSNode} node the TSNode - * @param {TSNode} parent the parent TSNode - * @returns {ESTreeNode} the converted ESTreeNode + * Recursively convert the TypeScript AST into an ESTree-compatible AST */ - function convert(node, parent) { - - // exit early for null and undefined - if (!node) { - return null; - } - - var result = { - type: "", - range: [node.getStart(), node.end], - loc: getLoc(node, ast) - }; - - /** - * Copies the result object into an ESTree node with just a type property. - * This is used only for leaf nodes that have no other properties. - * @returns {void} - */ - function simplyCopy() { - assign(result, { - type: SyntaxKind[node.kind] - }); - } - - /** - * Converts a TypeScript node into an ESTree node. - * @param {TSNode} child the child TSNode - * @returns {ESTreeNode} the converted ESTree node - */ - function convertChild(child) { - return convert(child, node); - } - - /** - * Converts a child into a type annotation. This creates an intermediary - * TypeAnnotation node to match what Flow does. - * @param {TSNode} child The TypeScript AST node to convert. - * @returns {ESTreeNode} The type annotation node. - */ - function convertTypeAnnotation(child) { - var annotation = convertChild(child); - return { - type: "TypeAnnotation", - loc: annotation.loc, - range: annotation.range, - typeAnnotation: annotation - }; - } - - /** - * Converts a TSNode's typeArguments array to a flow-like typeParameters node - * @param {TSNode[]} typeArguments TSNode typeArguments - * @returns {TypeParameterInstantiation} TypeParameterInstantiation node - */ - function convertTypeArgumentsToTypeParameters(typeArguments) { - var firstTypeArgument = typeArguments[0]; - var lastTypeArgument = typeArguments[typeArguments.length - 1]; - return { - type: "TypeParameterInstantiation", - range: [ - firstTypeArgument.pos - 1, - lastTypeArgument.end + 1 - ], - loc: getLocFor(firstTypeArgument.pos - 1, lastTypeArgument.end + 1, ast), - params: typeArguments.map(function(typeArgument) { - /** - * Have to manually calculate the start of the range, - * because TypeScript includes leading whitespace but Flow does not - */ - var typeArgumentStart = (typeArgument.typeName && typeArgument.typeName.text) - ? typeArgument.end - typeArgument.typeName.text.length - : typeArgument.pos; - return { - type: "GenericTypeAnnotation", - range: [ - typeArgumentStart, - typeArgument.end - ], - loc: getLocFor(typeArgumentStart, typeArgument.end, ast), - id: convertChild(typeArgument.typeName || typeArgument), - typeParameters: (typeArgument.typeArguments) - ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) - : null - }; - }) - }; - } - - /** - * Gets a TSNode's accessibility level - * @param {TSNode} tsNode The TSNode - * @returns {string | null} accessibility "public", "protected", "private", or null - */ - function getTSNodeAccessibility(tsNode) { - var modifiers = tsNode.modifiers; - if (!modifiers) { - return null; - } - for (var i = 0; i < modifiers.length; i++) { - var modifier = modifiers[i]; - switch (modifier.kind) { - case SyntaxKind.PublicKeyword: - return "public"; - case SyntaxKind.ProtectedKeyword: - return "protected"; - case SyntaxKind.PrivateKeyword: - return "private"; - default: - continue; - } - } - return null; - } - - /** - * Returns the declaration kind of the given TSNode - * @param {TSNode} tsNode TypeScript AST node - * @returns {string} declaration kind - */ - function getDeclarationKind(tsNode) { - var varDeclarationKind; - - switch (tsNode.kind) { - case SyntaxKind.TypeAliasDeclaration: - varDeclarationKind = "type"; - break; - case SyntaxKind.VariableDeclarationList: - if (ts.isLet(tsNode)) { - varDeclarationKind = "let"; - } else if (ts.isConst(tsNode)) { - varDeclarationKind = "const"; - } else { - varDeclarationKind = "var"; - } - break; - default: - throw "Unable to determine declaration kind."; - } - - return varDeclarationKind; - } - - /** - * Converts a TSNode's typeParameters array to a flow-like TypeParameterDeclaration node - * @param {TSNode[]} typeParameters TSNode typeParameters - * @returns {TypeParameterDeclaration} TypeParameterDeclaration node - */ - function convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { - var firstTypeParameter = typeParameters[0]; - var lastTypeParameter = typeParameters[typeParameters.length - 1]; - - return { - type: "TypeParameterDeclaration", - range: [ - firstTypeParameter.pos - 1, - lastTypeParameter.end + 1 - ], - loc: getLocFor(firstTypeParameter.pos - 1, lastTypeParameter.end + 1, ast), - params: typeParameters.map(function(typeParameter) { - /** - * Have to manually calculate the start of the range, - * because TypeScript includes leading whitespace but Flow does not - */ - var typeParameterStart = (typeParameter.name && typeParameter.name.text) - ? typeParameter.name.end - typeParameter.name.text.length - : typeParameter.pos; - - var defaultParameter = typeParameter.default - ? convert(typeParameter.default, typeParameter) - : typeParameter.default; - - return { - type: "TypeParameter", - range: [ - typeParameterStart, - typeParameter.end - ], - loc: getLocFor(typeParameterStart, typeParameter.end, ast), - name: typeParameter.name.text, - constraint: (typeParameter.constraint) - ? convertTypeAnnotation(typeParameter.constraint) - : null, - default: defaultParameter - }; - }) - }; - } - - /** - * Converts a child into a class implements node. This creates an intermediary - * ClassImplements node to match what Flow does. - * @param {TSNode} child The TypeScript AST node to convert. - * @returns {ESTreeNode} The type annotation node. - */ - function convertClassImplements(child) { - var id = convertChild(child.expression); - var classImplementsNode = { - type: "ClassImplements", - loc: id.loc, - range: id.range, - id: id - }; - if (child.typeArguments && child.typeArguments.length) { - classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); - } - return classImplementsNode; - } - - /** - * Converts a child into a interface heritage node. - * @param {TSNode} child The TypeScript AST node to convert. - * @returns {ESTreeNode} The type annotation node. - */ - function convertInterfaceHeritageClause(child) { - var id = convertChild(child.expression); - var classImplementsNode = { - type: "TSInterfaceHeritage", - loc: id.loc, - range: id.range, - id: id - }; - if (child.typeArguments && child.typeArguments.length) { - classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); - } - return classImplementsNode; - } - - /** - * For nodes that are copied directly from the TypeScript AST into - * ESTree mostly as-is. The only difference is the addition of a type - * property instead of a kind property. Recursively copies all children. - * @returns {void} - */ - function deeplyCopy() { - result.type = "TS" + SyntaxKind[node.kind]; - Object.keys(node).filter(function(key) { - return !(/^(?:kind|parent|pos|end|flags|modifierFlagsCache|jsDoc)$/.test(key)); - }).forEach(function(key) { - if (key === "type") { - result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; - } else if (key === "typeArguments") { - result.typeParameters = (node.typeArguments) - ? convertTypeArgumentsToTypeParameters(node.typeArguments) - : null; - } else if (key === "typeParameters") { - result.typeParameters = (node.typeParameters) - ? convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters) - : null; - } else { - if (Array.isArray(node[key])) { - result[key] = node[key].map(convertChild); - } else if (node[key] && typeof node[key] === "object") { - result[key] = convertChild(node[key]); - } else { - result[key] = node[key]; - } - } - }); - } - - /** - * Converts a TypeScript JSX node.tagName into an ESTree node.name - * @param {Object} tagName the tagName object from a JSX TSNode - * @param {Object} ast the AST object - * @returns {Object} the converted ESTree name object - */ - function convertTypeScriptJSXTagNameToESTreeName(tagName) { - var tagNameToken = convertToken(tagName, ast); - - if (tagNameToken.type === "JSXMemberExpression") { - - var isNestedMemberExpression = (node.tagName.expression.kind === SyntaxKind.PropertyAccessExpression); - - // Convert TSNode left and right objects into ESTreeNode object - // and property objects - tagNameToken.object = convertChild(node.tagName.expression); - tagNameToken.property = convertChild(node.tagName.name); - - // Assign the appropriate types - tagNameToken.object.type = (isNestedMemberExpression) ? "JSXMemberExpression" : "JSXIdentifier"; - tagNameToken.property.type = "JSXIdentifier"; - - } else { - - tagNameToken.name = tagNameToken.value; - } - - delete tagNameToken.value; - - return tagNameToken; - } - - switch (node.kind) { - case SyntaxKind.SourceFile: - assign(result, { - type: "Program", - body: [], - sourceType: node.externalModuleIndicator ? "module" : "script" - }); - - // filter out unknown nodes for now - node.statements.forEach(function(statement) { - var convertedStatement = convertChild(statement); - if (convertedStatement) { - result.body.push(convertedStatement); - } - }); - - // fix end location - result.range[1] = node.endOfFileToken.pos; - result.loc = getLocFor(node.getStart(), result.range[1], ast); - break; - - case SyntaxKind.Block: - assign(result, { - type: "BlockStatement", - body: node.statements.map(convertChild) - }); - break; - - case SyntaxKind.Identifier: - assign(result, { - type: "Identifier", - name: ts.unescapeIdentifier(node.text) - }); - if (node.parent.questionToken && ( - SyntaxKind.Parameter === node.parent.kind || - SyntaxKind.PropertyDeclaration === node.parent.kind || - SyntaxKind.PropertySignature === node.parent.kind || - SyntaxKind.MethodDeclaration === node.parent.kind || - SyntaxKind.MethodSignature === node.parent.kind - )) { - result.optional = true; - } - break; - - case SyntaxKind.WithStatement: - assign(result, { - type: "WithStatement", - object: convertChild(node.expression), - body: convertChild(node.statement) - }); - break; - - // Control Flow - - case SyntaxKind.ReturnStatement: - assign(result, { - type: "ReturnStatement", - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.LabeledStatement: - assign(result, { - type: "LabeledStatement", - label: convertChild(node.label), - body: convertChild(node.statement) - }); - break; - - case SyntaxKind.BreakStatement: - case SyntaxKind.ContinueStatement: - assign(result, { - type: SyntaxKind[node.kind], - label: convertChild(node.label) - }); - break; - - // Choice - - case SyntaxKind.IfStatement: - assign(result, { - type: "IfStatement", - test: convertChild(node.expression), - consequent: convertChild(node.thenStatement), - alternate: convertChild(node.elseStatement) - }); - break; - - case SyntaxKind.SwitchStatement: - assign(result, { - type: "SwitchStatement", - discriminant: convertChild(node.expression), - cases: node.caseBlock.clauses.map(convertChild) - }); - break; - - case SyntaxKind.CaseClause: - case SyntaxKind.DefaultClause: - assign(result, { - type: "SwitchCase", - test: convertChild(node.expression), - consequent: node.statements.map(convertChild) - }); - break; - - // Exceptions - - case SyntaxKind.ThrowStatement: - assign(result, { - type: "ThrowStatement", - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.TryStatement: - assign(result, { - type: "TryStatement", - block: convert(node.tryBlock), - handler: convertChild(node.catchClause), - finalizer: convertChild(node.finallyBlock) - }); - break; - - case SyntaxKind.CatchClause: - assign(result, { - type: "CatchClause", - param: convertChild(node.variableDeclaration.name), - body: convertChild(node.block) - }); - break; - - - // Loops - - case SyntaxKind.WhileStatement: - assign(result, { - type: "WhileStatement", - test: convertChild(node.expression), - body: convertChild(node.statement) - }); - break; - - /** - * Unlike other parsers, TypeScript calls a "DoWhileStatement" - * a "DoStatement" - */ - case SyntaxKind.DoStatement: - assign(result, { - type: "DoWhileStatement", - test: convertChild(node.expression), - body: convertChild(node.statement) - }); - break; - - case SyntaxKind.ForStatement: - assign(result, { - type: "ForStatement", - init: convertChild(node.initializer), - test: convertChild(node.condition), - update: convertChild(node.incrementor), - body: convertChild(node.statement) - }); - break; - - case SyntaxKind.ForInStatement: - case SyntaxKind.ForOfStatement: - var isAwait = node.awaitModifier - && node.awaitModifier.kind === ts.SyntaxKind.AwaitKeyword; - - assign(result, { - type: SyntaxKind[node.kind], - left: convertChild(node.initializer), - right: convertChild(node.expression), - body: convertChild(node.statement), - await: isAwait - }); - break; - - // Declarations - - case SyntaxKind.FunctionDeclaration: - - var functionDeclarationType = "FunctionDeclaration"; - if (node.modifiers && node.modifiers.length) { - var isDeclareFunction = hasModifier(ts.SyntaxKind.DeclareKeyword, node); - if (isDeclareFunction) { - functionDeclarationType = "DeclareFunction"; - } - } - - /** - * Prefix FunctionDeclarations within TypeScript namespaces with "TS" - */ - if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { - functionDeclarationType = "TSNamespaceFunctionDeclaration"; - } - - assign(result, { - type: functionDeclarationType, - id: convertChild(node.name), - generator: !!node.asteriskToken, - expression: false, - async: hasModifier(SyntaxKind.AsyncKeyword, node), - params: node.parameters.map(convertChild), - body: convertChild(node.body) - }); - - // Process returnType - if (node.type) { - result.returnType = convertTypeAnnotation(node.type); - } - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - // check for exports - result = fixExports(node, result, ast); - - break; - - case SyntaxKind.VariableDeclaration: - assign(result, { - type: "VariableDeclarator", - id: convertChild(node.name), - init: convertChild(node.initializer) - }); - - if (node.type) { - result.id.typeAnnotation = convertTypeAnnotation(node.type); - } - break; - - case SyntaxKind.VariableStatement: - assign(result, { - type: "VariableDeclaration", - declarations: node.declarationList.declarations.map(convertChild), - kind: getDeclarationKind(node.declarationList) - }); - - // check for exports - result = fixExports(node, result, ast); - break; - - // mostly for for-of, for-in - case SyntaxKind.VariableDeclarationList: - assign(result, { - type: "VariableDeclaration", - declarations: node.declarations.map(convertChild), - kind: getDeclarationKind(node) - }); - break; - - // Expressions - - case SyntaxKind.ExpressionStatement: - assign(result, { - type: "ExpressionStatement", - expression: convertChild(node.expression) - }); - break; - - case SyntaxKind.ThisKeyword: - assign(result, { - type: "ThisExpression" - }); - break; - - case SyntaxKind.ArrayLiteralExpression: - - var arrayAssignNode = ts.getAncestor(node, SyntaxKind.BinaryExpression), - arrayIsInAssignment; - - if (arrayAssignNode) { - if (arrayAssignNode.left === node) { - arrayIsInAssignment = true; - } else { - arrayIsInAssignment = (ts.findChildOfKind(arrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === node); - } - } - - // TypeScript uses ArrayLiteralExpression in destructuring assignment, too - if (arrayIsInAssignment) { - assign(result, { - type: "ArrayPattern", - elements: node.elements.map(convertChild) - }); - } else { - assign(result, { - type: "ArrayExpression", - elements: node.elements.map(convertChild) - }); - } - break; - - case SyntaxKind.ObjectLiteralExpression: - - var objectAssignNode = ts.getAncestor(node, SyntaxKind.BinaryExpression), - objectIsInAssignment; - - if (objectAssignNode) { - if (objectAssignNode.left === node) { - objectIsInAssignment = true; - } else { - objectIsInAssignment = (ts.findChildOfKind(objectAssignNode.left, SyntaxKind.ObjectLiteralExpression, ast) === node); - } - } - - // TypeScript uses ObjectLiteralExpression in destructuring assignment, too - if (objectIsInAssignment) { - assign(result, { - type: "ObjectPattern", - properties: node.properties.map(convertChild) - }); - } else { - assign(result, { - type: "ObjectExpression", - properties: node.properties.map(convertChild) - }); - } - break; - - case SyntaxKind.PropertyAssignment: - assign(result, { - type: "Property", - key: convertChild(node.name), - value: convertChild(node.initializer), - computed: (node.name.kind === SyntaxKind.ComputedPropertyName), - method: false, - shorthand: false, - kind: "init" - }); - break; - - case SyntaxKind.ShorthandPropertyAssignment: - assign(result, { - type: "Property", - key: convertChild(node.name), - value: convertChild(node.name), - computed: false, - method: false, - shorthand: true, - kind: "init" - }); - break; - - case SyntaxKind.ComputedPropertyName: - - if (parent.kind === SyntaxKind.ObjectLiteralExpression) { - assign(result, { - type: "Property", - key: convertChild(node.name), - value: convertChild(node.name), - computed: false, - method: false, - shorthand: true, - kind: "init" - }); - } else { - return convertChild(node.expression); - } - break; - - case SyntaxKind.PropertyDeclaration: - var isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); - - assign(result, { - type: (isAbstract) ? "TSAbstractClassProperty" : "ClassProperty", - key: convertChild(node.name), - value: convertChild(node.initializer), - computed: (node.name.kind === SyntaxKind.ComputedPropertyName), - static: Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static), - accessibility: getTSNodeAccessibility(node), - decorators: (node.decorators) ? node.decorators.map(function(d) { - return convertChild(d.expression); - }) : [], - typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null - }); - break; - - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.MethodDeclaration: - - // TODO: double-check that these positions are correct - var methodLoc = ast.getLineAndCharacterOfPosition(node.name.end + 1), - nodeIsMethod = (node.kind === SyntaxKind.MethodDeclaration), - method = { - type: "FunctionExpression", - id: null, - generator: false, - expression: false, - async: hasModifier(SyntaxKind.AsyncKeyword, node), - body: convertChild(node.body), - range: [ node.parameters.pos - 1, result.range[1]], - loc: { - start: { - line: methodLoc.line + 1, - column: methodLoc.character - 1 - }, - end: result.loc.end - } - }; - - if (node.type) { - method.returnType = convertTypeAnnotation(node.type); - } - - if (parent.kind === SyntaxKind.ObjectLiteralExpression) { - - method.params = node.parameters.map(convertChild); - - assign(result, { - type: "Property", - key: convertChild(node.name), - value: method, - computed: (node.name.kind === SyntaxKind.ComputedPropertyName), - method: nodeIsMethod, - shorthand: false, - kind: "init" - }); - - } else { // class - - /** - * Unlike in object literal methods, class method params can have decorators - */ - method.params = node.parameters.map(function(param) { - var convertedParam = convertChild(param); - convertedParam.decorators = (param.decorators) ? param.decorators.map(function(d) { - return convertChild(d.expression); - }) : []; - return convertedParam; - }); - - var isMethodNameComputed = (node.name.kind === SyntaxKind.ComputedPropertyName); - - /** - * TypeScript class methods can be defined as "abstract" - */ - var methodDefinitionType = hasModifier(SyntaxKind.AbstractKeyword, node) - ? "TSAbstractMethodDefinition" - : "MethodDefinition"; - - assign(result, { - type: methodDefinitionType, - key: convertChild(node.name), - value: method, - computed: isMethodNameComputed, - static: Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static), - kind: "method", - accessibility: getTSNodeAccessibility(node), - decorators: (node.decorators) ? node.decorators.map(function(d) { - return convertChild(d.expression); - }) : [] - }); - - } - - if (node.kind === SyntaxKind.GetAccessor) { - result.kind = "get"; - } else if (node.kind === SyntaxKind.SetAccessor) { - result.kind = "set"; - } else if (!result.static && node.name.kind === SyntaxKind.StringLiteral && node.name.text === "constructor") { - result.kind = "constructor"; - } - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - method.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - break; - - // TypeScript uses this even for static methods named "constructor" - case SyntaxKind.Constructor: - - var constructorIsStatic = Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static), - constructorIsAbstract = hasModifier(SyntaxKind.AbstractKeyword, node), - firstConstructorToken = constructorIsStatic ? ts.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), - constructorLoc = ast.getLineAndCharacterOfPosition(node.parameters.pos - 1), - constructor = { - type: "FunctionExpression", - id: null, - params: node.parameters.map(function(param) { - var convertedParam = convertChild(param); - var decorators = (param.decorators) ? param.decorators.map(function(d) { - return convertChild(d.expression); - }) : []; - - return assign(convertedParam, { - decorators: decorators - }); - }), - generator: false, - expression: false, - async: false, - body: convertChild(node.body), - range: [ node.parameters.pos - 1, result.range[1]], - loc: { - start: { - line: constructorLoc.line + 1, - column: constructorLoc.character - }, - end: result.loc.end - } - }; - - var constructorIdentifierLoc = ast.getLineAndCharacterOfPosition(firstConstructorToken.getStart()), - constructorIsComputed = !!node.name && (node.name.kind === SyntaxKind.ComputedPropertyName), - constructorKey; - - if (constructorIsComputed) { - constructorKey = { - type: "Literal", - value: "constructor", - raw: node.name.getText(), - range: [ firstConstructorToken.getStart(), firstConstructorToken.end ], - loc: { - start: { - line: constructorIdentifierLoc.line + 1, - column: constructorIdentifierLoc.character - }, - end: { - line: constructor.loc.start.line, - column: constructor.loc.start.column - } - } - }; - } else { - constructorKey = { - type: "Identifier", - name: "constructor", - range: [ firstConstructorToken.getStart(), firstConstructorToken.end ], - loc: { - start: { - line: constructorIdentifierLoc.line + 1, - column: constructorIdentifierLoc.character - }, - end: { - line: constructor.loc.start.line, - column: constructor.loc.start.column - } - } - }; - } - - assign(result, { - type: constructorIsAbstract ? "TSAbstractMethodDefinition" : "MethodDefinition", - key: constructorKey, - value: constructor, - computed: constructorIsComputed, - accessibility: getTSNodeAccessibility(node), - static: constructorIsStatic, - kind: (constructorIsStatic || constructorIsComputed) ? "method" : "constructor" - }); - break; - - case SyntaxKind.FunctionExpression: - assign(result, { - type: "FunctionExpression", - id: convertChild(node.name), - generator: !!node.asteriskToken, - params: node.parameters.map(convertChild), - body: convertChild(node.body), - async: hasModifier(SyntaxKind.AsyncKeyword, node), - expression: false - }); - // Process returnType - if (node.type) { - result.returnType = convertTypeAnnotation(node.type); - } - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - break; - - case SyntaxKind.SuperKeyword: - assign(result, { - type: "Super" - }); - break; - - case SyntaxKind.ArrayBindingPattern: - assign(result, { - type: "ArrayPattern", - elements: node.elements.map(convertChild) - }); - break; - - // occurs with missing array elements like [,] - case SyntaxKind.OmittedExpression: - return null; - - case SyntaxKind.ObjectBindingPattern: - assign(result, { - type: "ObjectPattern", - properties: node.elements.map(convertChild) - }); - break; - - case SyntaxKind.BindingElement: - - if (parent.kind === SyntaxKind.ArrayBindingPattern) { - var arrayItem = convert(node.name, parent); - if (node.initializer) { - assign(result, { - type: "AssignmentPattern", - left: arrayItem, - right: convertChild(node.initializer) - }); - } else { - return arrayItem; - } - } else { - - assign(result, { - type: "Property", - key: convertChild(node.propertyName || node.name), - value: convertChild(node.name), - computed: false, - method: false, - shorthand: !node.propertyName, - kind: "init" - }); - - if (node.initializer) { - result.value = { - type: "AssignmentPattern", - left: convertChild(node.name), - right: convertChild(node.initializer), - range: [ node.name.getStart(), node.initializer.end ], - loc: getLocFor(node.name.getStart(), node.initializer.end, ast) - }; - } - - } - break; - - - case SyntaxKind.ArrowFunction: - assign(result, { - type: "ArrowFunctionExpression", - generator: false, - id: null, - params: node.parameters.map(convertChild), - body: convertChild(node.body), - async: hasModifier(SyntaxKind.AsyncKeyword, node), - expression: node.body.kind !== SyntaxKind.Block - }); - // Process returnType - if (node.type) { - result.returnType = convertTypeAnnotation(node.type); - } - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - break; - - case SyntaxKind.YieldExpression: - assign(result, { - type: "YieldExpression", - delegate: !!node.asteriskToken, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.AwaitExpression: - assign(result, { - type: "AwaitExpression", - argument: convertChild(node.expression) - }); - break; - - // Template Literals - - case SyntaxKind.NoSubstitutionTemplateLiteral: - assign(result, { - type: "TemplateLiteral", - quasis: [ - { - type: "TemplateElement", - value: { - raw: ast.text.slice(node.getStart() + 1, node.end - 1), - cooked: node.text - }, - tail: true, - range: result.range, - loc: result.loc - } - ], - expressions: [] - }); - break; - - case SyntaxKind.TemplateExpression: - assign(result, { - type: "TemplateLiteral", - quasis: [ convertChild(node.head) ], - expressions: [] - }); - - node.templateSpans.forEach(function(templateSpan) { - result.expressions.push(convertChild(templateSpan.expression)); - result.quasis.push(convertChild(templateSpan.literal)); - }); - break; - - case SyntaxKind.TaggedTemplateExpression: - assign(result, { - type: "TaggedTemplateExpression", - tag: convertChild(node.tag), - quasi: convertChild(node.template) - }); - break; - - case SyntaxKind.TemplateHead: - case SyntaxKind.TemplateMiddle: - case SyntaxKind.TemplateTail: - var tail = (node.kind === SyntaxKind.TemplateTail); - assign(result, { - type: "TemplateElement", - value: { - raw: ast.text.slice(node.getStart() + 1, node.end - (tail ? 1 : 2)), - cooked: node.text - }, - tail: tail - }); - break; - - // Patterns - - case SyntaxKind.SpreadElement: - case SyntaxKind.SpreadAssignment: - assign(result, { - type: "SpreadElement", - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.Parameter: - var parameter; - if (node.dotDotDotToken) { - parameter = convertChild(node.name); - assign(result, { - type: "RestElement", - argument: parameter - }); - } else if (node.initializer) { - parameter = convertChild(node.name); - assign(result, { - type: "AssignmentPattern", - left: parameter, - right: convertChild(node.initializer) - }); - } else { - parameter = convert(node.name, parent); - result = parameter; - } - - if (node.type) { - assign(parameter, { - typeAnnotation: convertTypeAnnotation(node.type) - }); - } - - if (node.modifiers) { - return { - type: "TSParameterProperty", - range: [node.getStart(), node.end], - loc: getLoc(node, ast), - accessibility: getTSNodeAccessibility(node), - isReadonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), - parameter: result - }; - } - - break; - - // Classes - - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: - - var heritageClauses = node.heritageClauses || []; - var lastClassToken = heritageClauses.length ? heritageClauses[heritageClauses.length - 1] : node.name; - var classNodeType = SyntaxKind[node.kind]; - - if (node.typeParameters && node.typeParameters.length) { - var lastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; - if (!lastClassToken || lastTypeParameter.pos > lastClassToken.pos) { - lastClassToken = ts.findNextToken(lastTypeParameter, ast); - } - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - if (node.modifiers && node.modifiers.length) { - - /** - * TypeScript class declarations can be defined as "abstract" - */ - if (node.kind === SyntaxKind.ClassDeclaration) { - if (hasModifier(SyntaxKind.AbstractKeyword, node)) { - classNodeType = "TSAbstract" + classNodeType; - } - } - - /** - * We need check for modifiers, and use the last one, as there - * could be multiple before the open brace - */ - var lastModifier = node.modifiers[node.modifiers.length - 1]; - if (!lastClassToken || lastModifier.pos > lastClassToken.pos) { - lastClassToken = ts.findNextToken(lastModifier, ast); - } - - } else if (!lastClassToken) { // no name - lastClassToken = node.getFirstToken(); - } - - var openBrace = ts.findNextToken(lastClassToken, ast); - var hasExtends = (heritageClauses.length && node.heritageClauses[0].token === SyntaxKind.ExtendsKeyword), - superClass, - hasImplements = false; - - if (hasExtends && heritageClauses[0].types.length > 0) { - superClass = heritageClauses.shift(); - if (superClass.types[0] && superClass.types[0].typeArguments) { - result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); - } - } - - hasImplements = heritageClauses.length > 0; - - assign(result, { - type: classNodeType, - id: convertChild(node.name), - body: { - type: "ClassBody", - body: [], - - // TODO: Fix location info - range: [ openBrace.getStart(), result.range[1] ], - loc: getLocFor(openBrace.getStart(), node.end, ast) - }, - superClass: (superClass ? convertChild(superClass.types[0].expression) : null), - implements: hasImplements ? heritageClauses[0].types.map(convertClassImplements) : [], - decorators: (node.decorators) ? node.decorators.map(function(d) { - return convertChild(d.expression); - }) : [] - }); - - var filteredMembers = node.members.filter(isESTreeClassMember); - if (filteredMembers.length) { - result.body.body = filteredMembers.map(convertChild); - } - - // check for exports - result = fixExports(node, result, ast); - - break; - - // Modules - case SyntaxKind.ModuleBlock: - assign(result, { - type: "TSModuleBlock", - body: node.statements.map(convertChild) - }); - break; - - case SyntaxKind.ImportDeclaration: - assign(result, { - type: "ImportDeclaration", - source: convertChild(node.moduleSpecifier), - specifiers: [] - }); - - if (node.importClause) { - if (node.importClause.name) { - result.specifiers.push(convertChild(node.importClause)); - } - - if (node.importClause.namedBindings) { - if (node.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { - result.specifiers.push(convertChild(node.importClause.namedBindings)); - } else { - result.specifiers = result.specifiers.concat(node.importClause.namedBindings.elements.map(convertChild)); - } - } - } - - break; - - case SyntaxKind.NamespaceImport: - assign(result, { - type: "ImportNamespaceSpecifier", - local: convertChild(node.name) - }); - break; - - case SyntaxKind.ImportSpecifier: - assign(result, { - type: "ImportSpecifier", - local: convertChild(node.name), - imported: convertChild(node.propertyName || node.name) - }); - break; - - case SyntaxKind.ImportClause: - assign(result, { - type: "ImportDefaultSpecifier", - local: convertChild(node.name) - }); - - // have to adjust location information due to tree differences - result.range[1] = node.name.end; - result.loc = getLocFor(result.range[0], result.range[1], ast); - break; - - case SyntaxKind.NamedImports: - assign(result, { - type: "ImportDefaultSpecifier", - local: convertChild(node.name) - }); - break; - - case SyntaxKind.ExportDeclaration: - if (node.exportClause) { - assign(result, { - type: "ExportNamedDeclaration", - source: convertChild(node.moduleSpecifier), - specifiers: node.exportClause.elements.map(convertChild), - declaration: null - }); - } else { - assign(result, { - type: "ExportAllDeclaration", - source: convertChild(node.moduleSpecifier) - }); - } - break; - - case SyntaxKind.ExportSpecifier: - assign(result, { - type: "ExportSpecifier", - local: convertChild(node.propertyName || node.name), - exported: convertChild(node.name) - }); - break; - - case SyntaxKind.ExportAssignment: - assign(result, { - type: "ExportDefaultDeclaration", - declaration: convertChild(node.expression) - }); - break; - - // Unary Operations - - case SyntaxKind.PrefixUnaryExpression: - case SyntaxKind.PostfixUnaryExpression: - var operator = TOKEN_TO_TEXT[node.operator]; - assign(result, { - // ESTree uses UpdateExpression for ++/-- - type: /^(?:\+\+|\-\-)$/.test(operator) ? "UpdateExpression" : "UnaryExpression", - operator: operator, - prefix: node.kind === SyntaxKind.PrefixUnaryExpression, - argument: convertChild(node.operand) - }); - break; - - case SyntaxKind.DeleteExpression: - assign(result, { - type: "UnaryExpression", - operator: "delete", - prefix: true, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.VoidExpression: - assign(result, { - type: "UnaryExpression", - operator: "void", - prefix: true, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.TypeOfExpression: - assign(result, { - type: "UnaryExpression", - operator: "typeof", - prefix: true, - argument: convertChild(node.expression) - }); - break; - - // Binary Operations - - case SyntaxKind.BinaryExpression: - - // TypeScript uses BinaryExpression for sequences as well - if (isComma(node.operatorToken)) { - assign(result, { - type: "SequenceExpression", - expressions: [] - }); - - var left = convertChild(node.left), - right = convertChild(node.right); - - if (left.type === "SequenceExpression") { - result.expressions = result.expressions.concat(left.expressions); - } else { - result.expressions.push(left); - } - - if (right.type === "SequenceExpression") { - result.expressions = result.expressions.concat(right.expressions); - } else { - result.expressions.push(right); - } - - } else { - assign(result, { - type: getBinaryExpressionType(node.operatorToken), - operator: TOKEN_TO_TEXT[node.operatorToken.kind], - left: convertChild(node.left), - right: convertChild(node.right) - }); - - // if the binary expression is in a destructured array, switch it - if (result.type === "AssignmentExpression") { - var upperArrayNode = ts.getAncestor(node, SyntaxKind.ArrayLiteralExpression), - upperArrayAssignNode = upperArrayNode && ts.getAncestor(upperArrayNode, SyntaxKind.BinaryExpression), - upperArrayIsInAssignment; - - if (upperArrayAssignNode) { - if (upperArrayAssignNode.left === upperArrayNode) { - upperArrayIsInAssignment = true; - } else { - upperArrayIsInAssignment = (ts.findChildOfKind(upperArrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === upperArrayNode); - } - } - - if (upperArrayIsInAssignment) { - delete result.operator; - result.type = "AssignmentPattern"; - } - } - } - break; - - case SyntaxKind.PropertyAccessExpression: - if (isJSXToken(parent)) { - var jsxMemberExpression = { - type: "MemberExpression", - object: convertChild(node.expression), - property: convertChild(node.name) - }; - var isNestedMemberExpression = (node.expression.kind === SyntaxKind.PropertyAccessExpression); - jsxMemberExpression.object.type = (isNestedMemberExpression) ? "MemberExpression" : "JSXIdentifier"; - jsxMemberExpression.property.type = "JSXIdentifier"; - assign(result, jsxMemberExpression); - } else { - assign(result, { - type: "MemberExpression", - object: convertChild(node.expression), - property: convertChild(node.name), - computed: false - }); - } - break; - - case SyntaxKind.ElementAccessExpression: - assign(result, { - type: "MemberExpression", - object: convertChild(node.expression), - property: convertChild(node.argumentExpression), - computed: true - }); - break; - - case SyntaxKind.ConditionalExpression: - assign(result, { - type: "ConditionalExpression", - test: convertChild(node.condition), - consequent: convertChild(node.whenTrue), - alternate: convertChild(node.whenFalse) - }); - break; - - case SyntaxKind.CallExpression: - assign(result, { - type: "CallExpression", - callee: convertChild(node.expression), - arguments: node.arguments.map(convertChild) - }); - if (node.typeArguments && node.typeArguments.length) { - result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); - } - break; - - case SyntaxKind.NewExpression: - assign(result, { - type: "NewExpression", - callee: convertChild(node.expression), - arguments: (node.arguments) ? node.arguments.map(convertChild) : [] - }); - if (node.typeArguments && node.typeArguments.length) { - result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); - } - break; - - case SyntaxKind.MetaProperty: - var newToken = convertToken(node.getFirstToken(), ast); - - assign(result, { - type: "MetaProperty", - meta: { - type: "Identifier", - range: newToken.range, - loc: newToken.loc, - name: "new" - }, - property: convertChild(node.name) - }); - break; - - - // Literals - - case SyntaxKind.StringLiteral: - assign(result, { - type: "Literal", - value: unescape(node.text), - raw: ast.text.slice(result.range[0], result.range[1]) - }); - break; - - case SyntaxKind.NumericLiteral: - assign(result, { - type: "Literal", - value: Number(node.text), - raw: ast.text.slice(result.range[0], result.range[1]) - }); - break; - - case SyntaxKind.RegularExpressionLiteral: - assign(result, { - type: "Literal", - value: Number(node.text), - raw: node.text, - regex: { - pattern: node.text.slice(1, node.text.lastIndexOf("/")), - flags: node.text.slice(node.text.lastIndexOf("/") + 1) - } - }); - break; - - case SyntaxKind.TrueKeyword: - assign(result, { - type: "Literal", - value: true, - raw: "true" - }); - break; - - case SyntaxKind.FalseKeyword: - assign(result, { - type: "Literal", - value: false, - raw: "false" - }); - break; - - case SyntaxKind.NullKeyword: - assign(result, { - type: "Literal", - value: null, - raw: "null" - }); - break; - - case SyntaxKind.EmptyStatement: - case SyntaxKind.DebuggerStatement: - simplyCopy(); - break; - - // JSX - - case SyntaxKind.JsxElement: - assign(result, { - type: "JSXElement", - openingElement: convertChild(node.openingElement), - closingElement: convertChild(node.closingElement), - children: node.children.map(convertChild) - }); - - break; - - case SyntaxKind.JsxSelfClosingElement: - // Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, - // TypeScript does not seem to have the idea of openingElement when tag is self-closing - node.kind = SyntaxKind.JsxOpeningElement; - var openingElement = convertChild(node); - openingElement.selfClosing = true; - assign(result, { - type: "JSXElement", - openingElement: openingElement, - closingElement: null, - children: [] - }); - - break; - - case SyntaxKind.JsxOpeningElement: - var openingTagName = convertTypeScriptJSXTagNameToESTreeName(node.tagName); - assign(result, { - type: "JSXOpeningElement", - selfClosing: false, - name: openingTagName, - attributes: node.attributes.properties.map(convertChild) - }); - - break; - - case SyntaxKind.JsxClosingElement: - var closingTagName = convertTypeScriptJSXTagNameToESTreeName(node.tagName); - assign(result, { - type: "JSXClosingElement", - name: closingTagName - }); - - break; - - case SyntaxKind.JsxExpression: - var eloc = ast.getLineAndCharacterOfPosition(result.range[0] + 1); - var expression = (node.expression) ? convertChild(node.expression) : { - type: "JSXEmptyExpression", - loc: { - start: { - line: eloc.line + 1, - column: eloc.character - }, - end: { - line: result.loc.end.line, - column: result.loc.end.column - 1 - } - }, - range: [result.range[0] + 1, result.range[1] - 1] - }; - - assign(result, { - type: "JSXExpressionContainer", - expression: expression - }); - - break; - - case SyntaxKind.JsxAttribute: - var attributeName = convertToken(node.name, ast); - attributeName.type = "JSXIdentifier"; - attributeName.name = attributeName.value; - delete attributeName.value; - - assign(result, { - type: "JSXAttribute", - name: attributeName, - value: convertChild(node.initializer) - }); - - break; - - case SyntaxKind.JsxText: - assign(result, { - type: "Literal", - value: ast.text.slice(node.pos, node.end), - raw: ast.text.slice(node.pos, node.end) - }); - - result.loc.start.column = node.pos; - result.range[0] = node.pos; - - break; - - case SyntaxKind.JsxSpreadAttribute: - assign(result, { - type: "JSXSpreadAttribute", - argument: convertChild(node.expression) - }); - - break; - - case SyntaxKind.FirstNode: - var jsxMemberExpressionObject = convertChild(node.left); - jsxMemberExpressionObject.type = "JSXIdentifier"; - delete jsxMemberExpressionObject.value; - - var jsxMemberExpressionProperty = convertChild(node.right); - jsxMemberExpressionProperty.type = "JSXIdentifier"; - delete jsxMemberExpressionObject.value; - - assign(result, { - type: "JSXMemberExpression", - object: jsxMemberExpressionObject, - property: jsxMemberExpressionProperty - }); - - break; - - // TypeScript specific - - case SyntaxKind.ParenthesizedExpression: - return convert(node.expression, parent); - - /** - * Convert TypeAliasDeclaration node into VariableDeclaration - * to allow core rules such as "semi" to work automatically - */ - case SyntaxKind.TypeAliasDeclaration: - var typeAliasDeclarator = { - type: "VariableDeclarator", - id: convertChild(node.name), - init: convertChild(node.type), - range: [node.name.getStart(), node.end] - }; - - typeAliasDeclarator.loc = getLocFor(typeAliasDeclarator.range[0], typeAliasDeclarator.range[1], ast); - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - typeAliasDeclarator.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - assign(result, { - type: "VariableDeclaration", - kind: getDeclarationKind(node), - declarations: [typeAliasDeclarator] - }); - - // check for exports - result = fixExports(node, result, ast); - - break; - - case SyntaxKind.InterfaceDeclaration: - var interfaceHeritageClauses = node.heritageClauses || []; - var interfaceLastClassToken = interfaceHeritageClauses.length ? interfaceHeritageClauses[interfaceHeritageClauses.length - 1] : node.name; - - if (node.typeParameters && node.typeParameters.length) { - var interfaceLastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; - if (!interfaceLastClassToken || interfaceLastTypeParameter.pos > interfaceLastClassToken.pos) { - interfaceLastClassToken = ts.findNextToken(interfaceLastTypeParameter, ast); - } - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - var hasImplementsClause = interfaceHeritageClauses.length > 0; - var interfaceOpenBrace = ts.findNextToken(interfaceLastClassToken, ast); - - var interfaceBody = { - type: "TSInterfaceBody", - body: node.members.map(function(member) { - return convertChild(member); - }), - range: [ interfaceOpenBrace.getStart(), result.range[1] ], - loc: getLocFor(interfaceOpenBrace.getStart(), node.end, ast) - }; - - assign(result, { - type: "TSInterfaceDeclaration", - body: interfaceBody, - id: convertChild(node.name), - heritage: hasImplementsClause ? interfaceHeritageClauses[0].types.map(convertInterfaceHeritageClause) : [] - }); - break; - - default: - deeplyCopy(); + const estree = convert({ + node: ast, + parent: null, + ast, + additionalOptions: { + errorOnUnknownASTType: extra.errorOnUnknownASTType || false } + }); - return result; - } - - var estree = convert(ast); - + /** + * Optionally convert and include all tokens in the AST + */ if (extra.tokens) { - estree.tokens = convertTokens(ast); + estree.tokens = nodeUtils.convertTokens(ast); } /** * Add the comment nodes to the AST (that were parsed separately in parser.js) - * TODO: Track the progress of https://github.com/eslint/eslint/issues/6724 - * regarding ESLint itself becoming responsible for attributing comment nodes */ if (extra.comment || extra.attachComment) { estree.comments = extra.comments || []; diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 32657125a160..90f9fa0e69f8 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -18,37 +18,60 @@ //------------------------------------------------------------------------------ module.exports = { - AssignmentExpression: "AssignmentExpression", - AssignmentPattern: "AssignmentPattern", ArrayExpression: "ArrayExpression", ArrayPattern: "ArrayPattern", ArrowFunctionExpression: "ArrowFunctionExpression", + AssignmentExpression: "AssignmentExpression", + AssignmentPattern: "AssignmentPattern", AwaitExpression: "AwaitExpression", - BlockStatement: "BlockStatement", BinaryExpression: "BinaryExpression", + BlockStatement: "BlockStatement", BreakStatement: "BreakStatement", CallExpression: "CallExpression", CatchClause: "CatchClause", ClassBody: "ClassBody", ClassDeclaration: "ClassDeclaration", ClassExpression: "ClassExpression", + ClassImplements: "ClassImplements", + ClassProperty: "ClassProperty", ConditionalExpression: "ConditionalExpression", ContinueStatement: "ContinueStatement", - DoWhileStatement: "DoWhileStatement", DebuggerStatement: "DebuggerStatement", + DeclareFunction: "DeclareFunction", + DoWhileStatement: "DoWhileStatement", EmptyStatement: "EmptyStatement", ExperimentalRestProperty: "ExperimentalRestProperty", ExperimentalSpreadProperty: "ExperimentalSpreadProperty", + ExportAllDeclaration: "ExportAllDeclaration", + ExportDefaultDeclaration: "ExportDefaultDeclaration", + ExportNamedDeclaration: "ExportNamedDeclaration", + ExportSpecifier: "ExportSpecifier", ExpressionStatement: "ExpressionStatement", - ForStatement: "ForStatement", ForInStatement: "ForInStatement", ForOfStatement: "ForOfStatement", + ForStatement: "ForStatement", FunctionDeclaration: "FunctionDeclaration", FunctionExpression: "FunctionExpression", + GenericTypeAnnotation: "GenericTypeAnnotation", Identifier: "Identifier", IfStatement: "IfStatement", - Literal: "Literal", + ImportDeclaration: "ImportDeclaration", + ImportDefaultSpecifier: "ImportDefaultSpecifier", + ImportNamespaceSpecifier: "ImportNamespaceSpecifier", + ImportSpecifier: "ImportSpecifier", + JSXAttribute: "JSXAttribute", + JSXClosingElement: "JSXClosingElement", + JSXElement: "JSXElement", + JSXEmptyExpression: "JSXEmptyExpression", + JSXExpressionContainer: "JSXExpressionContainer", + JSXIdentifier: "JSXIdentifier", + JSXMemberExpression: "JSXMemberExpression", + JSXNamespacedName: "JSXNamespacedName", + JSXOpeningElement: "JSXOpeningElement", + JSXSpreadAttribute: "JSXSpreadAttribute", + JSXText: "JSXText", LabeledStatement: "LabeledStatement", + Literal: "Literal", LogicalExpression: "LogicalExpression", MemberExpression: "MemberExpression", MetaProperty: "MetaProperty", @@ -71,30 +94,46 @@ module.exports = { ThisExpression: "ThisExpression", ThrowStatement: "ThrowStatement", TryStatement: "TryStatement", + + /** + * TS-prefixed nodes + */ + TSAbstractClassProperty: "TSAbstractClassProperty", + TSAbstractMethodDefinition: "TSAbstractMethodDefinition", + TSAnyKeyword: "TSAnyKeyword", + TSArrayType: "TSArrayType", + TSBooleanKeyword: "TSBooleanKeyword", + TSConstructorType: "TSConstructorType", + TSConstructSignature: "TSConstructSignature", + TSDeclareKeyword: "TSDeclareKeyword", + TSInterfaceBody: "TSInterfaceBody", + TSInterfaceDeclaration: "TSInterfaceDeclaration", + TSInterfaceHeritage: "TSInterfaceHeritage", + TSFunctionType: "TSFunctionType", + TSMethodSignature: "TSMethodSignature", + TSModuleBlock: "TSModuleBlock", + TSModuleDeclaration: "TSModuleDeclaration", + TSNamespaceFunctionDeclaration: "TSNamespaceFunctionDeclaration", + TSNonNullExpression: "TSNonNullExpression", + TSNumberKeyword: "TSNumberKeyword", + TSParameterProperty: "TSParameterProperty", + TSPropertySignature: "TSPropertySignature", + TSQuestionToken: "TSQuestionToken", + TSStringKeyword: "TSStringKeyword", + TSTypeLiteral: "TSTypeLiteral", + TSTypeReference: "TSTypeReference", + TSUnionType: "TSUnionType", + TSVoidKeyword: "TSVoidKeyword", + + TypeAnnotation: "TypeAnnotation", + TypeParameter: "TypeParameter", + TypeParameterDeclaration: "TypeParameterDeclaration", + TypeParameterInstantiation: "TypeParameterInstantiation", UnaryExpression: "UnaryExpression", UpdateExpression: "UpdateExpression", VariableDeclaration: "VariableDeclaration", VariableDeclarator: "VariableDeclarator", WhileStatement: "WhileStatement", WithStatement: "WithStatement", - YieldExpression: "YieldExpression", - JSXIdentifier: "JSXIdentifier", - JSXNamespacedName: "JSXNamespacedName", - JSXMemberExpression: "JSXMemberExpression", - JSXEmptyExpression: "JSXEmptyExpression", - JSXExpressionContainer: "JSXExpressionContainer", - JSXElement: "JSXElement", - JSXClosingElement: "JSXClosingElement", - JSXOpeningElement: "JSXOpeningElement", - JSXAttribute: "JSXAttribute", - JSXSpreadAttribute: "JSXSpreadAttribute", - JSXText: "JSXText", - ExportDefaultDeclaration: "ExportDefaultDeclaration", - ExportNamedDeclaration: "ExportNamedDeclaration", - ExportAllDeclaration: "ExportAllDeclaration", - ExportSpecifier: "ExportSpecifier", - ImportDeclaration: "ImportDeclaration", - ImportSpecifier: "ImportSpecifier", - ImportDefaultSpecifier: "ImportDefaultSpecifier", - ImportNamespaceSpecifier: "ImportNamespaceSpecifier" + YieldExpression: "YieldExpression" }; diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js new file mode 100644 index 000000000000..ce4ffa9dc56f --- /dev/null +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -0,0 +1,1731 @@ +/** + * @fileoverview Converts TypeScript AST into ESTree format. + * @author Nicholas C. Zakas + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const nodeUtils = require("./node-utils"), + AST_NODE_TYPES = require("./ast-node-types"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +const SyntaxKind = nodeUtils.SyntaxKind; + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +/** + * Converts a TypeScript node into an ESTree node + * @param {Object} config configuration options for the conversion + * @param {TSNode} config.node the TSNode + * @param {TSNode} config.parent the parent TSNode + * @param {TSNode} config.ast the full TypeScript AST + * @param {Object} config.additionalOptions additional options for the conversion + * @param {Object} config.additionalOptions.errorOnUnknownASTType whether whether or not to throw an error if an unknown AST Node Type is encountered + * @returns {ESTreeNode} the converted ESTreeNode + */ +module.exports = function convert(config) { + + const node = config.node; + const parent = config.parent; + const ast = config.ast; + const additionalOptions = config.additionalOptions || {}; + + /** + * Exit early for null and undefined + */ + if (!node) { + return null; + } + + /** + * Create a new ESTree node + */ + let result = { + type: "", + range: [node.getStart(), node.end], + loc: nodeUtils.getLoc(node, ast) + }; + + /** + * Copies the result object into an ESTree node with just a type property. + * This is used only for leaf nodes that have no other properties. + * @returns {void} + */ + function simplyCopy() { + Object.assign(result, { + type: SyntaxKind[node.kind] + }); + } + + /** + * Converts a TypeScript node into an ESTree node. + * @param {TSNode} child the child TSNode + * @returns {ESTreeNode} the converted ESTree node + */ + function convertChild(child) { + return convert({ node: child, parent: node, ast, additionalOptions }); + } + + /** + * Converts a child into a type annotation. This creates an intermediary + * TypeAnnotation node to match what Flow does. + * @param {TSNode} child The TypeScript AST node to convert. + * @returns {ESTreeNode} The type annotation node. + */ + function convertTypeAnnotation(child) { + const annotation = convertChild(child); + return { + type: AST_NODE_TYPES.TypeAnnotation, + loc: annotation.loc, + range: annotation.range, + typeAnnotation: annotation + }; + } + + /** + * Converts a TSNode's typeArguments array to a flow-like typeParameters node + * @param {TSNode[]} typeArguments TSNode typeArguments + * @returns {TypeParameterInstantiation} TypeParameterInstantiation node + */ + function convertTypeArgumentsToTypeParameters(typeArguments) { + const firstTypeArgument = typeArguments[0]; + const lastTypeArgument = typeArguments[typeArguments.length - 1]; + return { + type: AST_NODE_TYPES.TypeParameterInstantiation, + range: [ + firstTypeArgument.pos - 1, + lastTypeArgument.end + 1 + ], + loc: nodeUtils.getLocFor(firstTypeArgument.pos - 1, lastTypeArgument.end + 1, ast), + params: typeArguments.map(typeArgument => { + /** + * Have to manually calculate the start of the range, + * because TypeScript includes leading whitespace but Flow does not + */ + const typeArgumentStart = (typeArgument.typeName && typeArgument.typeName.text) + ? typeArgument.end - typeArgument.typeName.text.length + : typeArgument.pos; + return { + type: AST_NODE_TYPES.GenericTypeAnnotation, + range: [ + typeArgumentStart, + typeArgument.end + ], + loc: nodeUtils.getLocFor(typeArgumentStart, typeArgument.end, ast), + id: convertChild(typeArgument.typeName || typeArgument), + typeParameters: (typeArgument.typeArguments) + ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) + : null + }; + }) + }; + } + + /** + * Converts a TSNode's typeParameters array to a flow-like TypeParameterDeclaration node + * @param {TSNode[]} typeParameters TSNode typeParameters + * @returns {TypeParameterDeclaration} TypeParameterDeclaration node + */ + function convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { + const firstTypeParameter = typeParameters[0]; + const lastTypeParameter = typeParameters[typeParameters.length - 1]; + return { + type: AST_NODE_TYPES.TypeParameterDeclaration, + range: [ + firstTypeParameter.pos - 1, + lastTypeParameter.end + 1 + ], + loc: nodeUtils.getLocFor(firstTypeParameter.pos - 1, lastTypeParameter.end + 1, ast), + params: typeParameters.map(typeParameter => { + + /** + * Have to manually calculate the start of the range, + * because TypeScript includes leading whitespace but Flow does not + */ + const typeParameterStart = (typeParameter.name && typeParameter.name.text) + ? typeParameter.name.end - typeParameter.name.text.length + : typeParameter.pos; + + const defaultParameter = typeParameter.default + ? convert({ node: typeParameter.default, parent: typeParameter, ast, additionalOptions }) + : typeParameter.default; + + return { + type: AST_NODE_TYPES.TypeParameter, + range: [ + typeParameterStart, + typeParameter.end + ], + loc: nodeUtils.getLocFor(typeParameterStart, typeParameter.end, ast), + name: typeParameter.name.text, + constraint: (typeParameter.constraint) + ? convertTypeAnnotation(typeParameter.constraint) + : null, + default: defaultParameter + }; + }) + }; + } + + /** + * Converts a child into a class implements node. This creates an intermediary + * ClassImplements node to match what Flow does. + * @param {TSNode} child The TypeScript AST node to convert. + * @returns {ESTreeNode} The type annotation node. + */ + function convertClassImplements(child) { + const id = convertChild(child.expression); + const classImplementsNode = { + type: AST_NODE_TYPES.ClassImplements, + loc: id.loc, + range: id.range, + id + }; + if (child.typeArguments && child.typeArguments.length) { + classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); + } + return classImplementsNode; + } + + /** + * Converts a child into a interface heritage node. + * @param {TSNode} child The TypeScript AST node to convert. + * @returns {ESTreeNode} The type annotation node. + */ + function convertInterfaceHeritageClause(child) { + const id = convertChild(child.expression); + const classImplementsNode = { + type: AST_NODE_TYPES.TSInterfaceHeritage, + loc: id.loc, + range: id.range, + id + }; + + if (child.typeArguments && child.typeArguments.length) { + classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); + } + return classImplementsNode; + } + + /** + * For nodes that are copied directly from the TypeScript AST into + * ESTree mostly as-is. The only difference is the addition of a type + * property instead of a kind property. Recursively copies all children. + * @returns {void} + */ + function deeplyCopy() { + const customType = `TS${SyntaxKind[node.kind]}`; + /** + * If the "errorOnUnknownASTType" option is set to true, throw an error, + * otherwise fallback to just inlcuding the unknown type as-is. + */ + if (additionalOptions.errorOnUnknownASTType && !AST_NODE_TYPES[customType]) { + throw new Error(`Unknown AST_NODE_TYPE: "${customType}"`); + } + result.type = customType; + Object + .keys(node) + .filter(key => !(/^(?:kind|parent|pos|end|flags|modifierFlagsCache|jsDoc)$/.test(key))) + .forEach(key => { + if (key === "type") { + result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; + } else if (key === "typeArguments") { + result.typeParameters = (node.typeArguments) + ? convertTypeArgumentsToTypeParameters(node.typeArguments) + : null; + } else if (key === "typeParameters") { + result.typeParameters = (node.typeParameters) + ? convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters) + : null; + } else { + if (Array.isArray(node[key])) { + result[key] = node[key].map(convertChild); + } else if (node[key] && typeof node[key] === "object") { + result[key] = convertChild(node[key]); + } else { + result[key] = node[key]; + } + } + }); + } + + /** + * Converts a TypeScript JSX node.tagName into an ESTree node.name + * @param {Object} tagName the tagName object from a JSX TSNode + * @param {Object} ast the AST object + * @returns {Object} the converted ESTree name object + */ + function convertTypeScriptJSXTagNameToESTreeName(tagName) { + const tagNameToken = nodeUtils.convertToken(tagName, ast); + + if (tagNameToken.type === AST_NODE_TYPES.JSXMemberExpression) { + + const isNestedMemberExpression = (node.tagName.expression.kind === SyntaxKind.PropertyAccessExpression); + + // Convert TSNode left and right objects into ESTreeNode object + // and property objects + tagNameToken.object = convertChild(node.tagName.expression); + tagNameToken.property = convertChild(node.tagName.name); + + // Assign the appropriate types + tagNameToken.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.JSXMemberExpression : AST_NODE_TYPES.JSXIdentifier; + tagNameToken.property.type = AST_NODE_TYPES.JSXIdentifier; + + } else { + + tagNameToken.name = tagNameToken.value; + } + + delete tagNameToken.value; + + return tagNameToken; + } + + /** + * Converts an array of TSNode decorators into an array of ESTreeNode decorators + * @param {TSNode[]} decorators An array of TSNode decorators to be converted + * @returns {ESTreeNode[]} an array of converted ESTreeNode decorators + */ + function convertDecorators(decorators) { + if (!decorators || !decorators.length) { + return []; + } + return decorators.map(decorator => convertChild(decorator.expression)); + } + + /** + * The core of the conervsion logic: + * Identify and convert each relevant TypeScript SyntaxKind + */ + switch (node.kind) { + + case SyntaxKind.SourceFile: + Object.assign(result, { + type: AST_NODE_TYPES.Program, + body: [], + sourceType: node.externalModuleIndicator ? "module" : "script" + }); + + // filter out unknown nodes for now + node.statements.forEach(statement => { + const convertedStatement = convertChild(statement); + if (convertedStatement) { + result.body.push(convertedStatement); + } + }); + + // fix end location + result.range[1] = node.endOfFileToken.pos; + result.loc = nodeUtils.getLocFor(node.getStart(), result.range[1], ast); + break; + + case SyntaxKind.Block: + Object.assign(result, { + type: AST_NODE_TYPES.BlockStatement, + body: node.statements.map(convertChild) + }); + break; + + case SyntaxKind.Identifier: + Object.assign(result, { + type: AST_NODE_TYPES.Identifier, + name: nodeUtils.unescapeIdentifier(node.text) + }); + if (node.parent.questionToken && ( + SyntaxKind.Parameter === node.parent.kind || + SyntaxKind.PropertyDeclaration === node.parent.kind || + SyntaxKind.PropertySignature === node.parent.kind || + SyntaxKind.MethodDeclaration === node.parent.kind || + SyntaxKind.MethodSignature === node.parent.kind + )) { + result.optional = true; + } + break; + + case SyntaxKind.WithStatement: + Object.assign(result, { + type: AST_NODE_TYPES.WithStatement, + object: convertChild(node.expression), + body: convertChild(node.statement) + }); + break; + + // Control Flow + + case SyntaxKind.ReturnStatement: + Object.assign(result, { + type: AST_NODE_TYPES.ReturnStatement, + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.LabeledStatement: + Object.assign(result, { + type: AST_NODE_TYPES.LabeledStatement, + label: convertChild(node.label), + body: convertChild(node.statement) + }); + break; + + case SyntaxKind.BreakStatement: + case SyntaxKind.ContinueStatement: + Object.assign(result, { + type: SyntaxKind[node.kind], + label: convertChild(node.label) + }); + break; + + // Choice + + case SyntaxKind.IfStatement: + Object.assign(result, { + type: AST_NODE_TYPES.IfStatement, + test: convertChild(node.expression), + consequent: convertChild(node.thenStatement), + alternate: convertChild(node.elseStatement) + }); + break; + + case SyntaxKind.SwitchStatement: + Object.assign(result, { + type: AST_NODE_TYPES.SwitchStatement, + discriminant: convertChild(node.expression), + cases: node.caseBlock.clauses.map(convertChild) + }); + break; + + case SyntaxKind.CaseClause: + case SyntaxKind.DefaultClause: + Object.assign(result, { + type: AST_NODE_TYPES.SwitchCase, + test: convertChild(node.expression), + consequent: node.statements.map(convertChild) + }); + break; + + // Exceptions + + case SyntaxKind.ThrowStatement: + Object.assign(result, { + type: AST_NODE_TYPES.ThrowStatement, + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.TryStatement: + Object.assign(result, { + type: AST_NODE_TYPES.TryStatement, + block: convert({ node: node.tryBlock, parent: null, ast, additionalOptions }), + handler: convertChild(node.catchClause), + finalizer: convertChild(node.finallyBlock) + }); + break; + + case SyntaxKind.CatchClause: + Object.assign(result, { + type: AST_NODE_TYPES.CatchClause, + param: convertChild(node.variableDeclaration.name), + body: convertChild(node.block) + }); + break; + + // Loops + + case SyntaxKind.WhileStatement: + Object.assign(result, { + type: AST_NODE_TYPES.WhileStatement, + test: convertChild(node.expression), + body: convertChild(node.statement) + }); + break; + + /** + * Unlike other parsers, TypeScript calls a "DoWhileStatement" + * a "DoStatement" + */ + case SyntaxKind.DoStatement: + Object.assign(result, { + type: AST_NODE_TYPES.DoWhileStatement, + test: convertChild(node.expression), + body: convertChild(node.statement) + }); + break; + + case SyntaxKind.ForStatement: + Object.assign(result, { + type: AST_NODE_TYPES.ForStatement, + init: convertChild(node.initializer), + test: convertChild(node.condition), + update: convertChild(node.incrementor), + body: convertChild(node.statement) + }); + break; + + case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: { + const isAwait = node.awaitModifier && node.awaitModifier.kind === SyntaxKind.AwaitKeyword; + Object.assign(result, { + type: SyntaxKind[node.kind], + left: convertChild(node.initializer), + right: convertChild(node.expression), + body: convertChild(node.statement), + await: isAwait + }); + break; + } + + // Declarations + + case SyntaxKind.FunctionDeclaration: { + + let functionDeclarationType = AST_NODE_TYPES.FunctionDeclaration; + + if (node.modifiers && node.modifiers.length) { + const isDeclareFunction = nodeUtils.hasModifier(SyntaxKind.DeclareKeyword, node); + if (isDeclareFunction) { + functionDeclarationType = AST_NODE_TYPES.DeclareFunction; + } + } + + /** + * Prefix FunctionDeclarations within TypeScript namespaces with "TS" + */ + if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { + functionDeclarationType = AST_NODE_TYPES.TSNamespaceFunctionDeclaration; + } + + Object.assign(result, { + type: functionDeclarationType, + id: convertChild(node.name), + generator: !!node.asteriskToken, + expression: false, + async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), + params: node.parameters.map(convertChild), + body: convertChild(node.body) + }); + + // Process returnType + if (node.type) { + result.returnType = convertTypeAnnotation(node.type); + } + + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + // check for exports + result = nodeUtils.fixExports(node, result, ast); + + break; + + } + + case SyntaxKind.VariableDeclaration: + Object.assign(result, { + type: AST_NODE_TYPES.VariableDeclarator, + id: convertChild(node.name), + init: convertChild(node.initializer) + }); + + if (node.type) { + result.id.typeAnnotation = convertTypeAnnotation(node.type); + } + break; + + case SyntaxKind.VariableStatement: + Object.assign(result, { + type: AST_NODE_TYPES.VariableDeclaration, + declarations: node.declarationList.declarations.map(convertChild), + kind: nodeUtils.getDeclarationKind(node.declarationList) + }); + + // check for exports + result = nodeUtils.fixExports(node, result, ast); + break; + + // mostly for for-of, for-in + case SyntaxKind.VariableDeclarationList: + Object.assign(result, { + type: AST_NODE_TYPES.VariableDeclaration, + declarations: node.declarations.map(convertChild), + kind: nodeUtils.getDeclarationKind(node) + }); + break; + + // Expressions + + case SyntaxKind.ExpressionStatement: + Object.assign(result, { + type: AST_NODE_TYPES.ExpressionStatement, + expression: convertChild(node.expression) + }); + break; + + case SyntaxKind.ThisKeyword: + Object.assign(result, { + type: AST_NODE_TYPES.ThisExpression + }); + break; + + case SyntaxKind.ArrayLiteralExpression: { + + const arrayAssignNode = nodeUtils.findAncestorOfKind(node, SyntaxKind.BinaryExpression); + let arrayIsInAssignment; + + if (arrayAssignNode) { + if (arrayAssignNode.left === node) { + arrayIsInAssignment = true; + } else { + arrayIsInAssignment = (nodeUtils.findChildOfKind(arrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === node); + } + } + + // TypeScript uses ArrayLiteralExpression in destructuring assignment, too + if (arrayIsInAssignment) { + Object.assign(result, { + type: AST_NODE_TYPES.ArrayPattern, + elements: node.elements.map(convertChild) + }); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.ArrayExpression, + elements: node.elements.map(convertChild) + }); + } + break; + + } + + case SyntaxKind.ObjectLiteralExpression: { + + const objectAssignNode = nodeUtils.findAncestorOfKind(node, SyntaxKind.BinaryExpression); + let objectIsInAssignment; + + if (objectAssignNode) { + if (objectAssignNode.left === node) { + objectIsInAssignment = true; + } else { + objectIsInAssignment = (nodeUtils.findChildOfKind(objectAssignNode.left, SyntaxKind.ObjectLiteralExpression, ast) === node); + } + } + + // TypeScript uses ObjectLiteralExpression in destructuring assignment, too + if (objectIsInAssignment) { + Object.assign(result, { + type: AST_NODE_TYPES.ObjectPattern, + properties: node.properties.map(convertChild) + }); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.ObjectExpression, + properties: node.properties.map(convertChild) + }); + } + + break; + + } + + case SyntaxKind.PropertyAssignment: + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.name), + value: convertChild(node.initializer), + computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + method: false, + shorthand: false, + kind: "init" + }); + break; + + case SyntaxKind.ShorthandPropertyAssignment: + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.name), + value: convertChild(node.name), + computed: false, + method: false, + shorthand: true, + kind: "init" + }); + break; + + case SyntaxKind.ComputedPropertyName: + + if (parent.kind === SyntaxKind.ObjectLiteralExpression) { + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.name), + value: convertChild(node.name), + computed: false, + method: false, + shorthand: true, + kind: "init" + }); + } else { + return convertChild(node.expression); + } + break; + + case SyntaxKind.PropertyDeclaration: { + const isAbstract = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node); + Object.assign(result, { + type: (isAbstract) ? AST_NODE_TYPES.TSAbstractClassProperty : AST_NODE_TYPES.ClassProperty, + key: convertChild(node.name), + value: convertChild(node.initializer), + computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + static: nodeUtils.hasStaticModifierFlag(node), + accessibility: nodeUtils.getTSNodeAccessibility(node), + decorators: convertDecorators(node.decorators), + typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null + }); + break; + } + + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: { + + // TODO: double-check that these positions are correct + const methodLoc = ast.getLineAndCharacterOfPosition(node.name.end + 1), + nodeIsMethod = (node.kind === SyntaxKind.MethodDeclaration), + method = { + type: AST_NODE_TYPES.FunctionExpression, + id: null, + generator: false, + expression: false, + async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), + body: convertChild(node.body), + range: [node.parameters.pos - 1, result.range[1]], + loc: { + start: { + line: methodLoc.line + 1, + column: methodLoc.character - 1 + }, + end: result.loc.end + } + }; + + if (node.type) { + method.returnType = convertTypeAnnotation(node.type); + } + + if (parent.kind === SyntaxKind.ObjectLiteralExpression) { + + method.params = node.parameters.map(convertChild); + + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.name), + value: method, + computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + method: nodeIsMethod, + shorthand: false, + kind: "init" + }); + + } else { // class + + /** + * Unlike in object literal methods, class method params can have decorators + */ + method.params = node.parameters.map(param => { + const convertedParam = convertChild(param); + convertedParam.decorators = convertDecorators(param.decorators); + return convertedParam; + }); + + const isMethodNameComputed = (node.name.kind === SyntaxKind.ComputedPropertyName); + + /** + * TypeScript class methods can be defined as "abstract" + */ + const methodDefinitionType = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node) + ? AST_NODE_TYPES.TSAbstractMethodDefinition + : AST_NODE_TYPES.MethodDefinition; + + Object.assign(result, { + type: methodDefinitionType, + key: convertChild(node.name), + value: method, + computed: isMethodNameComputed, + static: nodeUtils.hasStaticModifierFlag(node), + kind: "method", + accessibility: nodeUtils.getTSNodeAccessibility(node), + decorators: convertDecorators(node.decorators) + }); + + } + + if (node.kind === SyntaxKind.GetAccessor) { + result.kind = "get"; + } else if (node.kind === SyntaxKind.SetAccessor) { + result.kind = "set"; + } else if (!result.static && node.name.kind === SyntaxKind.StringLiteral && node.name.text === "constructor") { + result.kind = "constructor"; + } + + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + method.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + break; + + } + + // TypeScript uses this even for static methods named "constructor" + case SyntaxKind.Constructor: { + + const constructorIsStatic = nodeUtils.hasStaticModifierFlag(node), + constructorIsAbstract = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node), + firstConstructorToken = constructorIsStatic ? nodeUtils.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), + constructorLoc = ast.getLineAndCharacterOfPosition(node.parameters.pos - 1), + constructor = { + type: AST_NODE_TYPES.FunctionExpression, + id: null, + params: node.parameters.map(param => { + const convertedParam = convertChild(param); + const decorators = convertDecorators(param.decorators); + return Object.assign(convertedParam, { + decorators + }); + }), + generator: false, + expression: false, + async: false, + body: convertChild(node.body), + range: [node.parameters.pos - 1, result.range[1]], + loc: { + start: { + line: constructorLoc.line + 1, + column: constructorLoc.character + }, + end: result.loc.end + } + }; + + const constructorIdentifierLoc = ast.getLineAndCharacterOfPosition(firstConstructorToken.getStart()), + constructorIsComputed = !!node.name && (node.name.kind === SyntaxKind.ComputedPropertyName); + + let constructorKey; + + if (constructorIsComputed) { + constructorKey = { + type: AST_NODE_TYPES.Literal, + value: "constructor", + raw: node.name.getText(), + range: [firstConstructorToken.getStart(), firstConstructorToken.end], + loc: { + start: { + line: constructorIdentifierLoc.line + 1, + column: constructorIdentifierLoc.character + }, + end: { + line: constructor.loc.start.line, + column: constructor.loc.start.column + } + } + }; + } else { + constructorKey = { + type: AST_NODE_TYPES.Identifier, + name: "constructor", + range: [firstConstructorToken.getStart(), firstConstructorToken.end], + loc: { + start: { + line: constructorIdentifierLoc.line + 1, + column: constructorIdentifierLoc.character + }, + end: { + line: constructor.loc.start.line, + column: constructor.loc.start.column + } + } + }; + } + + Object.assign(result, { + type: constructorIsAbstract ? AST_NODE_TYPES.TSAbstractMethodDefinition : AST_NODE_TYPES.MethodDefinition, + key: constructorKey, + value: constructor, + computed: constructorIsComputed, + accessibility: nodeUtils.getTSNodeAccessibility(node), + static: constructorIsStatic, + kind: (constructorIsStatic || constructorIsComputed) ? "method" : "constructor" + }); + break; + + } + + case SyntaxKind.FunctionExpression: + Object.assign(result, { + type: AST_NODE_TYPES.FunctionExpression, + id: convertChild(node.name), + generator: !!node.asteriskToken, + params: node.parameters.map(convertChild), + body: convertChild(node.body), + async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), + expression: false + }); + + // Process returnType + if (node.type) { + result.returnType = convertTypeAnnotation(node.type); + } + + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + break; + + case SyntaxKind.SuperKeyword: + Object.assign(result, { + type: AST_NODE_TYPES.Super + }); + break; + + case SyntaxKind.ArrayBindingPattern: + Object.assign(result, { + type: AST_NODE_TYPES.ArrayPattern, + elements: node.elements.map(convertChild) + }); + break; + + // occurs with missing array elements like [,] + case SyntaxKind.OmittedExpression: + return null; + + case SyntaxKind.ObjectBindingPattern: + Object.assign(result, { + type: AST_NODE_TYPES.ObjectPattern, + properties: node.elements.map(convertChild) + }); + break; + + case SyntaxKind.BindingElement: + + if (parent.kind === SyntaxKind.ArrayBindingPattern) { + const arrayItem = convert({ node: node.name, parent, ast, additionalOptions }); + + if (node.initializer) { + Object.assign(result, { + type: AST_NODE_TYPES.AssignmentPattern, + left: arrayItem, + right: convertChild(node.initializer) + }); + } else { + return arrayItem; + } + } else { + + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.propertyName || node.name), + value: convertChild(node.name), + computed: false, + method: false, + shorthand: !node.propertyName, + kind: "init" + }); + + if (node.initializer) { + result.value = { + type: AST_NODE_TYPES.AssignmentPattern, + left: convertChild(node.name), + right: convertChild(node.initializer), + range: [node.name.getStart(), node.initializer.end], + loc: nodeUtils.getLocFor(node.name.getStart(), node.initializer.end, ast) + }; + } + + } + break; + + + case SyntaxKind.ArrowFunction: + Object.assign(result, { + type: AST_NODE_TYPES.ArrowFunctionExpression, + generator: false, + id: null, + params: node.parameters.map(convertChild), + body: convertChild(node.body), + async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), + expression: node.body.kind !== SyntaxKind.Block + }); + + // Process returnType + if (node.type) { + result.returnType = convertTypeAnnotation(node.type); + } + + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + break; + + case SyntaxKind.YieldExpression: + Object.assign(result, { + type: AST_NODE_TYPES.YieldExpression, + delegate: !!node.asteriskToken, + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.AwaitExpression: + Object.assign(result, { + type: AST_NODE_TYPES.AwaitExpression, + argument: convertChild(node.expression) + }); + break; + + // Template Literals + + case SyntaxKind.NoSubstitutionTemplateLiteral: + Object.assign(result, { + type: AST_NODE_TYPES.TemplateLiteral, + quasis: [ + { + type: AST_NODE_TYPES.TemplateElement, + value: { + raw: ast.text.slice(node.getStart() + 1, node.end - 1), + cooked: node.text + }, + tail: true, + range: result.range, + loc: result.loc + } + ], + expressions: [] + }); + break; + + case SyntaxKind.TemplateExpression: + Object.assign(result, { + type: AST_NODE_TYPES.TemplateLiteral, + quasis: [convertChild(node.head)], + expressions: [] + }); + + node.templateSpans.forEach(templateSpan => { + result.expressions.push(convertChild(templateSpan.expression)); + result.quasis.push(convertChild(templateSpan.literal)); + }); + break; + + case SyntaxKind.TaggedTemplateExpression: + Object.assign(result, { + type: AST_NODE_TYPES.TaggedTemplateExpression, + tag: convertChild(node.tag), + quasi: convertChild(node.template) + }); + break; + + case SyntaxKind.TemplateHead: + case SyntaxKind.TemplateMiddle: + case SyntaxKind.TemplateTail: { + const tail = (node.kind === SyntaxKind.TemplateTail); + Object.assign(result, { + type: AST_NODE_TYPES.TemplateElement, + value: { + raw: ast.text.slice(node.getStart() + 1, node.end - (tail ? 1 : 2)), + cooked: node.text + }, + tail + }); + break; + } + + // Patterns + + case SyntaxKind.SpreadElement: + case SyntaxKind.SpreadAssignment: + Object.assign(result, { + type: AST_NODE_TYPES.SpreadElement, + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.Parameter: { + let parameter; + + if (node.dotDotDotToken) { + parameter = convertChild(node.name); + Object.assign(result, { + type: AST_NODE_TYPES.RestElement, + argument: parameter + }); + } else if (node.initializer) { + parameter = convertChild(node.name); + Object.assign(result, { + type: AST_NODE_TYPES.AssignmentPattern, + left: parameter, + right: convertChild(node.initializer) + }); + } else { + parameter = convert({ node: node.name, parent, ast, additionalOptions }); + result = parameter; + } + + if (node.type) { + Object.assign(parameter, { + typeAnnotation: convertTypeAnnotation(node.type) + }); + } + + if (node.modifiers) { + return { + type: AST_NODE_TYPES.TSParameterProperty, + range: [node.getStart(), node.end], + loc: nodeUtils.getLoc(node, ast), + accessibility: nodeUtils.getTSNodeAccessibility(node), + isReadonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + parameter: result + }; + } + + break; + + } + + // Classes + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: { + + const heritageClauses = node.heritageClauses || []; + + let classNodeType = SyntaxKind[node.kind]; + let lastClassToken = heritageClauses.length ? heritageClauses[heritageClauses.length - 1] : node.name; + + if (node.typeParameters && node.typeParameters.length) { + const lastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; + + if (!lastClassToken || lastTypeParameter.pos > lastClassToken.pos) { + lastClassToken = nodeUtils.findNextToken(lastTypeParameter, ast); + } + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + if (node.modifiers && node.modifiers.length) { + + /** + * TypeScript class declarations can be defined as "abstract" + */ + if (node.kind === SyntaxKind.ClassDeclaration) { + if (nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node)) { + classNodeType = `TSAbstract${classNodeType}`; + } + } + + /** + * We need check for modifiers, and use the last one, as there + * could be multiple before the open brace + */ + const lastModifier = node.modifiers[node.modifiers.length - 1]; + + if (!lastClassToken || lastModifier.pos > lastClassToken.pos) { + lastClassToken = nodeUtils.findNextToken(lastModifier, ast); + } + + } else if (!lastClassToken) { // no name + lastClassToken = node.getFirstToken(); + } + + const openBrace = nodeUtils.findNextToken(lastClassToken, ast); + const hasExtends = (heritageClauses.length && node.heritageClauses[0].token === SyntaxKind.ExtendsKeyword); + + let hasImplements = false; + let superClass; + + if (hasExtends && heritageClauses[0].types.length > 0) { + superClass = heritageClauses.shift(); + if (superClass.types[0] && superClass.types[0].typeArguments) { + result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); + } + } + + hasImplements = heritageClauses.length > 0; + + Object.assign(result, { + type: classNodeType, + id: convertChild(node.name), + body: { + type: AST_NODE_TYPES.ClassBody, + body: [], + + // TODO: Fix location info + range: [openBrace.getStart(), result.range[1]], + loc: nodeUtils.getLocFor(openBrace.getStart(), node.end, ast) + }, + superClass: (superClass ? convertChild(superClass.types[0].expression) : null), + implements: hasImplements ? heritageClauses[0].types.map(convertClassImplements) : [], + decorators: convertDecorators(node.decorators) + }); + + const filteredMembers = node.members.filter(nodeUtils.isESTreeClassMember); + + if (filteredMembers.length) { + result.body.body = filteredMembers.map(convertChild); + } + + // check for exports + result = nodeUtils.fixExports(node, result, ast); + + break; + + } + + // Modules + case SyntaxKind.ModuleBlock: + Object.assign(result, { + type: AST_NODE_TYPES.TSModuleBlock, + body: node.statements.map(convertChild) + }); + break; + + case SyntaxKind.ImportDeclaration: + Object.assign(result, { + type: AST_NODE_TYPES.ImportDeclaration, + source: convertChild(node.moduleSpecifier), + specifiers: [] + }); + + if (node.importClause) { + if (node.importClause.name) { + result.specifiers.push(convertChild(node.importClause)); + } + + if (node.importClause.namedBindings) { + if (node.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + result.specifiers.push(convertChild(node.importClause.namedBindings)); + } else { + result.specifiers = result.specifiers.concat(node.importClause.namedBindings.elements.map(convertChild)); + } + } + } + + break; + + case SyntaxKind.NamespaceImport: + Object.assign(result, { + type: AST_NODE_TYPES.ImportNamespaceSpecifier, + local: convertChild(node.name) + }); + break; + + case SyntaxKind.ImportSpecifier: + Object.assign(result, { + type: AST_NODE_TYPES.ImportSpecifier, + local: convertChild(node.name), + imported: convertChild(node.propertyName || node.name) + }); + break; + + case SyntaxKind.ImportClause: + Object.assign(result, { + type: AST_NODE_TYPES.ImportDefaultSpecifier, + local: convertChild(node.name) + }); + + // have to adjust location information due to tree differences + result.range[1] = node.name.end; + result.loc = nodeUtils.getLocFor(result.range[0], result.range[1], ast); + break; + + case SyntaxKind.NamedImports: + Object.assign(result, { + type: AST_NODE_TYPES.ImportDefaultSpecifier, + local: convertChild(node.name) + }); + break; + + case SyntaxKind.ExportDeclaration: + if (node.exportClause) { + Object.assign(result, { + type: AST_NODE_TYPES.ExportNamedDeclaration, + source: convertChild(node.moduleSpecifier), + specifiers: node.exportClause.elements.map(convertChild), + declaration: null + }); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.ExportAllDeclaration, + source: convertChild(node.moduleSpecifier) + }); + } + break; + + case SyntaxKind.ExportSpecifier: + Object.assign(result, { + type: AST_NODE_TYPES.ExportSpecifier, + local: convertChild(node.propertyName || node.name), + exported: convertChild(node.name) + }); + break; + + case SyntaxKind.ExportAssignment: + Object.assign(result, { + type: AST_NODE_TYPES.ExportDefaultDeclaration, + declaration: convertChild(node.expression) + }); + break; + + // Unary Operations + + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: { + const operator = nodeUtils.getTextForTokenKind(node.operator); + Object.assign(result, { + /** + * ESTree uses UpdateExpression for ++/-- + */ + type: /^(?:\+\+|--)$/.test(operator) ? AST_NODE_TYPES.UpdateExpression : AST_NODE_TYPES.UnaryExpression, + operator, + prefix: node.kind === SyntaxKind.PrefixUnaryExpression, + argument: convertChild(node.operand) + }); + break; + } + + case SyntaxKind.DeleteExpression: + Object.assign(result, { + type: AST_NODE_TYPES.UnaryExpression, + operator: "delete", + prefix: true, + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.VoidExpression: + Object.assign(result, { + type: AST_NODE_TYPES.UnaryExpression, + operator: "void", + prefix: true, + argument: convertChild(node.expression) + }); + break; + + case SyntaxKind.TypeOfExpression: + Object.assign(result, { + type: AST_NODE_TYPES.UnaryExpression, + operator: "typeof", + prefix: true, + argument: convertChild(node.expression) + }); + break; + + // Binary Operations + + case SyntaxKind.BinaryExpression: + + // TypeScript uses BinaryExpression for sequences as well + if (nodeUtils.isComma(node.operatorToken)) { + Object.assign(result, { + type: AST_NODE_TYPES.SequenceExpression, + expressions: [] + }); + + const left = convertChild(node.left), + right = convertChild(node.right); + + if (left.type === AST_NODE_TYPES.SequenceExpression) { + result.expressions = result.expressions.concat(left.expressions); + } else { + result.expressions.push(left); + } + + if (right.type === AST_NODE_TYPES.SequenceExpression) { + result.expressions = result.expressions.concat(right.expressions); + } else { + result.expressions.push(right); + } + + } else { + Object.assign(result, { + type: nodeUtils.getBinaryExpressionType(node.operatorToken), + operator: nodeUtils.getTextForTokenKind(node.operatorToken.kind), + left: convertChild(node.left), + right: convertChild(node.right) + }); + + // if the binary expression is in a destructured array, switch it + if (result.type === AST_NODE_TYPES.AssignmentExpression) { + const upperArrayNode = nodeUtils.findAncestorOfKind(node, SyntaxKind.ArrayLiteralExpression), + upperArrayAssignNode = upperArrayNode && nodeUtils.findAncestorOfKind(upperArrayNode, SyntaxKind.BinaryExpression); + + let upperArrayIsInAssignment; + + if (upperArrayAssignNode) { + if (upperArrayAssignNode.left === upperArrayNode) { + upperArrayIsInAssignment = true; + } else { + upperArrayIsInAssignment = (nodeUtils.findChildOfKind(upperArrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === upperArrayNode); + } + } + + if (upperArrayIsInAssignment) { + delete result.operator; + result.type = AST_NODE_TYPES.AssignmentPattern; + } + } + } + break; + + case SyntaxKind.PropertyAccessExpression: + if (nodeUtils.isJSXToken(parent)) { + const jsxMemberExpression = { + type: AST_NODE_TYPES.MemberExpression, + object: convertChild(node.expression), + property: convertChild(node.name) + }; + const isNestedMemberExpression = (node.expression.kind === SyntaxKind.PropertyAccessExpression); + + jsxMemberExpression.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.MemberExpression : AST_NODE_TYPES.JSXIdentifier; + jsxMemberExpression.property.type = AST_NODE_TYPES.JSXIdentifier; + Object.assign(result, jsxMemberExpression); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.MemberExpression, + object: convertChild(node.expression), + property: convertChild(node.name), + computed: false + }); + } + break; + + case SyntaxKind.ElementAccessExpression: + Object.assign(result, { + type: AST_NODE_TYPES.MemberExpression, + object: convertChild(node.expression), + property: convertChild(node.argumentExpression), + computed: true + }); + break; + + case SyntaxKind.ConditionalExpression: + Object.assign(result, { + type: AST_NODE_TYPES.ConditionalExpression, + test: convertChild(node.condition), + consequent: convertChild(node.whenTrue), + alternate: convertChild(node.whenFalse) + }); + break; + + case SyntaxKind.CallExpression: + Object.assign(result, { + type: AST_NODE_TYPES.CallExpression, + callee: convertChild(node.expression), + arguments: node.arguments.map(convertChild) + }); + if (node.typeArguments && node.typeArguments.length) { + result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); + } + break; + + case SyntaxKind.NewExpression: + Object.assign(result, { + type: AST_NODE_TYPES.NewExpression, + callee: convertChild(node.expression), + arguments: (node.arguments) ? node.arguments.map(convertChild) : [] + }); + if (node.typeArguments && node.typeArguments.length) { + result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); + } + break; + + case SyntaxKind.MetaProperty: { + const newToken = nodeUtils.convertToken(node.getFirstToken(), ast); + Object.assign(result, { + type: AST_NODE_TYPES.MetaProperty, + meta: { + type: AST_NODE_TYPES.Identifier, + range: newToken.range, + loc: newToken.loc, + name: "new" + }, + property: convertChild(node.name) + }); + break; + } + + // Literals + + case SyntaxKind.StringLiteral: + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: nodeUtils.unescapeStringLiteralText(node.text), + raw: ast.text.slice(result.range[0], result.range[1]) + }); + break; + + case SyntaxKind.NumericLiteral: + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: Number(node.text), + raw: ast.text.slice(result.range[0], result.range[1]) + }); + break; + + case SyntaxKind.RegularExpressionLiteral: + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: Number(node.text), + raw: node.text, + regex: { + pattern: node.text.slice(1, node.text.lastIndexOf("/")), + flags: node.text.slice(node.text.lastIndexOf("/") + 1) + } + }); + break; + + case SyntaxKind.TrueKeyword: + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: true, + raw: "true" + }); + break; + + case SyntaxKind.FalseKeyword: + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: false, + raw: "false" + }); + break; + + case SyntaxKind.NullKeyword: + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: null, + raw: "null" + }); + break; + + case SyntaxKind.EmptyStatement: + case SyntaxKind.DebuggerStatement: + simplyCopy(); + break; + + // JSX + + case SyntaxKind.JsxElement: + Object.assign(result, { + type: AST_NODE_TYPES.JSXElement, + openingElement: convertChild(node.openingElement), + closingElement: convertChild(node.closingElement), + children: node.children.map(convertChild) + }); + + break; + + case SyntaxKind.JsxSelfClosingElement: { + /** + * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, + * TypeScript does not seem to have the idea of openingElement when tag is self-closing + */ + node.kind = SyntaxKind.JsxOpeningElement; + + const openingElement = convertChild(node); + openingElement.selfClosing = true; + + Object.assign(result, { + type: AST_NODE_TYPES.JSXElement, + openingElement, + closingElement: null, + children: [] + }); + + break; + + } + + case SyntaxKind.JsxOpeningElement: + Object.assign(result, { + type: AST_NODE_TYPES.JSXOpeningElement, + selfClosing: false, + name: convertTypeScriptJSXTagNameToESTreeName(node.tagName), + attributes: node.attributes.properties.map(convertChild) + }); + break; + + case SyntaxKind.JsxClosingElement: + Object.assign(result, { + type: AST_NODE_TYPES.JSXClosingElement, + name: convertTypeScriptJSXTagNameToESTreeName(node.tagName) + }); + break; + + case SyntaxKind.JsxExpression: { + const eloc = ast.getLineAndCharacterOfPosition(result.range[0] + 1); + const expression = (node.expression) ? convertChild(node.expression) : { + type: AST_NODE_TYPES.JSXEmptyExpression, + loc: { + start: { + line: eloc.line + 1, + column: eloc.character + }, + end: { + line: result.loc.end.line, + column: result.loc.end.column - 1 + } + }, + range: [result.range[0] + 1, result.range[1] - 1] + }; + + Object.assign(result, { + type: AST_NODE_TYPES.JSXExpressionContainer, + expression + }); + + break; + + } + + case SyntaxKind.JsxAttribute: { + const attributeName = nodeUtils.convertToken(node.name, ast); + attributeName.type = AST_NODE_TYPES.JSXIdentifier; + attributeName.name = attributeName.value; + delete attributeName.value; + + Object.assign(result, { + type: AST_NODE_TYPES.JSXAttribute, + name: attributeName, + value: convertChild(node.initializer) + }); + + break; + + } + + case SyntaxKind.JsxText: + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: ast.text.slice(node.pos, node.end), + raw: ast.text.slice(node.pos, node.end) + }); + + result.loc.start.column = node.pos; + result.range[0] = node.pos; + + break; + + case SyntaxKind.JsxSpreadAttribute: + Object.assign(result, { + type: AST_NODE_TYPES.JSXSpreadAttribute, + argument: convertChild(node.expression) + }); + + break; + + case SyntaxKind.FirstNode: { + const jsxMemberExpressionObject = convertChild(node.left); + jsxMemberExpressionObject.type = AST_NODE_TYPES.JSXIdentifier; + delete jsxMemberExpressionObject.value; + + const jsxMemberExpressionProperty = convertChild(node.right); + jsxMemberExpressionProperty.type = AST_NODE_TYPES.JSXIdentifier; + delete jsxMemberExpressionObject.value; + + Object.assign(result, { + type: AST_NODE_TYPES.JSXMemberExpression, + object: jsxMemberExpressionObject, + property: jsxMemberExpressionProperty + }); + + break; + } + + // TypeScript specific + + case SyntaxKind.ParenthesizedExpression: + return convert({ node: node.expression, parent, ast, additionalOptions }); + + /** + * Convert TypeAliasDeclaration node into VariableDeclaration + * to allow core rules such as "semi" to work automatically + */ + case SyntaxKind.TypeAliasDeclaration: { + const typeAliasDeclarator = { + type: AST_NODE_TYPES.VariableDeclarator, + id: convertChild(node.name), + init: convertChild(node.type), + range: [node.name.getStart(), node.end] + }; + + typeAliasDeclarator.loc = nodeUtils.getLocFor(typeAliasDeclarator.range[0], typeAliasDeclarator.range[1], ast); + + // Process typeParameters + if (node.typeParameters && node.typeParameters.length) { + typeAliasDeclarator.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + Object.assign(result, { + type: AST_NODE_TYPES.VariableDeclaration, + kind: nodeUtils.getDeclarationKind(node), + declarations: [typeAliasDeclarator] + }); + + // check for exports + result = nodeUtils.fixExports(node, result, ast); + + break; + + } + + case SyntaxKind.InterfaceDeclaration: { + const interfaceHeritageClauses = node.heritageClauses || []; + + let interfaceLastClassToken = interfaceHeritageClauses.length ? interfaceHeritageClauses[interfaceHeritageClauses.length - 1] : node.name; + + if (node.typeParameters && node.typeParameters.length) { + const interfaceLastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; + + if (!interfaceLastClassToken || interfaceLastTypeParameter.pos > interfaceLastClassToken.pos) { + interfaceLastClassToken = nodeUtils.findNextToken(interfaceLastTypeParameter, ast); + } + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + const hasImplementsClause = interfaceHeritageClauses.length > 0; + const interfaceOpenBrace = nodeUtils.findNextToken(interfaceLastClassToken, ast); + + const interfaceBody = { + type: AST_NODE_TYPES.TSInterfaceBody, + body: node.members.map(member => convertChild(member)), + range: [interfaceOpenBrace.getStart(), result.range[1]], + loc: nodeUtils.getLocFor(interfaceOpenBrace.getStart(), node.end, ast) + }; + + Object.assign(result, { + type: AST_NODE_TYPES.TSInterfaceDeclaration, + body: interfaceBody, + id: convertChild(node.name), + heritage: hasImplementsClause ? interfaceHeritageClauses[0].types.map(convertInterfaceHeritageClause) : [] + }); + break; + + } + + default: + deeplyCopy(); + } + + return result; + +}; diff --git a/packages/typescript-eslint-parser/lib/features.js b/packages/typescript-eslint-parser/lib/features.js deleted file mode 100644 index 2a94e13adbe1..000000000000 --- a/packages/typescript-eslint-parser/lib/features.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @fileoverview The list of feature flags supported by the parser and their default - * settings. - * @author Nicholas C. Zakas - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// None! - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -module.exports = { - - // enable parsing of arrow functions - arrowFunctions: false, - - // enable parsing of let and const - blockBindings: false, - - // enable parsing of destructured arrays and objects - destructuring: false, - - // enable parsing of regex u flag - regexUFlag: false, - - // enable parsing of regex y flag - regexYFlag: false, - - // enable parsing of template strings - templateStrings: false, - - // enable parsing binary literals - binaryLiterals: false, - - // enable parsing ES6 octal literals - octalLiterals: false, - - // enable parsing unicode code point escape sequences - unicodeCodePointEscapes: true, - - // enable parsing of default parameters - defaultParams: false, - - // enable parsing of rest parameters - restParams: false, - - // enable parsing of for-of statements - forOf: false, - - // enable parsing computed object literal properties - objectLiteralComputedProperties: false, - - // enable parsing of shorthand object literal methods - objectLiteralShorthandMethods: false, - - // enable parsing of shorthand object literal properties - objectLiteralShorthandProperties: false, - - // Allow duplicate object literal properties (except '__proto__') - objectLiteralDuplicateProperties: false, - - // enable parsing of generators/yield - generators: false, - - // support the spread operator - spread: false, - - // enable parsing of classes - classes: false, - - // enable parsing of new.target - newTarget: false, - - // enable parsing of modules - modules: false, - - // React JSX parsing - jsx: false, - - // allow return statement in global scope - globalReturn: false, - - // allow experimental object rest/spread - experimentalObjectRestSpread: false -}; diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js new file mode 100644 index 000000000000..c5585d32ddee --- /dev/null +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -0,0 +1,635 @@ +/** + * @fileoverview Utilities for finding and converting TSNodes into ESTreeNodes + * @author James Henry + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const ts = require("typescript"), + unescape = require("lodash.unescape"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +const SyntaxKind = ts.SyntaxKind; + +const ASSIGNMENT_OPERATORS = [ + SyntaxKind.EqualsToken, + SyntaxKind.PlusEqualsToken, + SyntaxKind.MinusEqualsToken, + SyntaxKind.AsteriskEqualsToken, + SyntaxKind.SlashEqualsToken, + SyntaxKind.PercentEqualsToken, + SyntaxKind.LessThanLessThanEqualsToken, + SyntaxKind.GreaterThanGreaterThanEqualsToken, + SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, + SyntaxKind.AmpersandEqualsToken, + SyntaxKind.BarEqualsToken, + SyntaxKind.CaretEqualsToken +]; + +const LOGICAL_OPERATORS = [ + SyntaxKind.BarBarToken, + SyntaxKind.AmpersandAmpersandToken +]; + +const TOKEN_TO_TEXT = {}; +TOKEN_TO_TEXT[SyntaxKind.OpenBraceToken] = "{"; +TOKEN_TO_TEXT[SyntaxKind.CloseBraceToken] = "}"; +TOKEN_TO_TEXT[SyntaxKind.OpenParenToken] = "("; +TOKEN_TO_TEXT[SyntaxKind.CloseParenToken] = ")"; +TOKEN_TO_TEXT[SyntaxKind.OpenBracketToken] = "["; +TOKEN_TO_TEXT[SyntaxKind.CloseBracketToken] = "]"; +TOKEN_TO_TEXT[SyntaxKind.DotToken] = "."; +TOKEN_TO_TEXT[SyntaxKind.DotDotDotToken] = "..."; +TOKEN_TO_TEXT[SyntaxKind.SemicolonToken] = ";"; +TOKEN_TO_TEXT[SyntaxKind.CommaToken] = ","; +TOKEN_TO_TEXT[SyntaxKind.LessThanToken] = "<"; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanToken] = ">"; +TOKEN_TO_TEXT[SyntaxKind.LessThanEqualsToken] = "<="; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanEqualsToken] = ">="; +TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsToken] = "=="; +TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsToken] = "!="; +TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsEqualsToken] = "==="; +TOKEN_TO_TEXT[SyntaxKind.InstanceOfKeyword] = "instanceof"; +TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsEqualsToken] = "!=="; +TOKEN_TO_TEXT[SyntaxKind.EqualsGreaterThanToken] = "=>"; +TOKEN_TO_TEXT[SyntaxKind.PlusToken] = "+"; +TOKEN_TO_TEXT[SyntaxKind.MinusToken] = "-"; +TOKEN_TO_TEXT[SyntaxKind.AsteriskToken] = "*"; +TOKEN_TO_TEXT[SyntaxKind.SlashToken] = "/"; +TOKEN_TO_TEXT[SyntaxKind.PercentToken] = "%"; +TOKEN_TO_TEXT[SyntaxKind.PlusPlusToken] = "++"; +TOKEN_TO_TEXT[SyntaxKind.MinusMinusToken] = "--"; +TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanToken] = "<<"; +TOKEN_TO_TEXT[SyntaxKind.LessThanSlashToken] = ">"; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanToken] = ">>>"; +TOKEN_TO_TEXT[SyntaxKind.AmpersandToken] = "&"; +TOKEN_TO_TEXT[SyntaxKind.BarToken] = "|"; +TOKEN_TO_TEXT[SyntaxKind.CaretToken] = "^"; +TOKEN_TO_TEXT[SyntaxKind.ExclamationToken] = "!"; +TOKEN_TO_TEXT[SyntaxKind.TildeToken] = "~"; +TOKEN_TO_TEXT[SyntaxKind.AmpersandAmpersandToken] = "&&"; +TOKEN_TO_TEXT[SyntaxKind.BarBarToken] = "||"; +TOKEN_TO_TEXT[SyntaxKind.QuestionToken] = "?"; +TOKEN_TO_TEXT[SyntaxKind.ColonToken] = ":"; +TOKEN_TO_TEXT[SyntaxKind.EqualsToken] = "="; +TOKEN_TO_TEXT[SyntaxKind.PlusEqualsToken] = "+="; +TOKEN_TO_TEXT[SyntaxKind.MinusEqualsToken] = "-="; +TOKEN_TO_TEXT[SyntaxKind.AsteriskEqualsToken] = "*="; +TOKEN_TO_TEXT[SyntaxKind.SlashEqualsToken] = "/="; +TOKEN_TO_TEXT[SyntaxKind.PercentEqualsToken] = "%="; +TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanEqualsToken] = "<<="; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanEqualsToken] = ">>="; +TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken] = ">>>="; +TOKEN_TO_TEXT[SyntaxKind.AmpersandEqualsToken] = "&="; +TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|="; +TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^="; +TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; +TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; + +/** + * Find the first matching child based on the given sourceFile and predicate function. + * @param {TSNode} node The current TSNode + * @param {Object} sourceFile The full AST source file + * @param {Function} predicate The predicate function to apply to each checked child + * @returns {TSNode|undefined} a matching child TSNode + */ +function findFirstMatchingChild(node, sourceFile, predicate) { + const children = node.getChildren(sourceFile); + for (let i = 0; i < children.length; i++) { + const child = children[i]; + if (child && predicate(child)) { + return child; + } + } + return undefined; +} + +/** + * Find the first matching ancestor based on the given predicate function. + * @param {TSNode} node The current TSNode + * @param {Function} predicate The predicate function to apply to each checked ancestor + * @returns {TSNode|undefined} a matching parent TSNode + */ +function findFirstMatchingAncestor(node, predicate) { + while (node) { + if (predicate(node)) { + return node; + } + node = node.parent; + } + return undefined; +} + +/** + * Returns true if the given TSNode is a let variable declaration + * @param {TSNode} node The TSNode + * @returns {boolean} whether or not the given node is a let variable declaration + */ +function isLet(node) { + /** + * TODO: Remove dependency on private TypeScript method + */ + return ts.isLet(node); +} + +/** + * Returns true if the given TSNode is a const variable declaration + * @param {TSNode} node The TSNode + * @returns {boolean} whether or not the given node is a const variable declaration + */ +function isConst(node) { + /** + * TODO: Remove dependency on private TypeScript method + */ + return ts.isConst(node); +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +/* eslint-disable no-use-before-define */ +module.exports = { + /** + * Expose the enum of possible TSNode `kind`s. + */ + SyntaxKind, + isAssignmentOperator, + isLogicalOperator, + getTextForTokenKind, + isESTreeClassMember, + hasModifier, + isComma, + getBinaryExpressionType, + getLocFor, + getLoc, + isToken, + isJSXToken, + getDeclarationKind, + getTSNodeAccessibility, + hasStaticModifierFlag, + findNextToken, + findChildOfKind, + findAncestorOfKind, + hasJSXAncestor, + unescapeIdentifier, + unescapeStringLiteralText, + fixExports, + getTokenType, + convertToken, + convertTokens +}; +/* eslint-enable no-use-before-define */ + +/** + * Returns true if the given TSToken is the assignment operator + * @param {TSToken} operator the operator token + * @returns {boolean} is assignment + */ +function isAssignmentOperator(operator) { + return ASSIGNMENT_OPERATORS.indexOf(operator.kind) > -1; +} + +/** + * Returns true if the given TSToken is a logical operator + * @param {TSToken} operator the operator token + * @returns {boolean} is a logical operator + */ +function isLogicalOperator(operator) { + return LOGICAL_OPERATORS.indexOf(operator.kind) > -1; +} + +/** + * Returns the string form of the given TSToken SyntaxKind + * @param {number} kind the token's SyntaxKind + * @returns {string} the token applicable token as a string + */ +function getTextForTokenKind(kind) { + return TOKEN_TO_TEXT[kind]; +} + +/** + * Returns true if the given TSNode is a valid ESTree class member + * @param {TSNode} node TypeScript AST node + * @returns {boolean} is valid ESTree class member + */ +function isESTreeClassMember(node) { + return node.kind !== SyntaxKind.SemicolonClassElement; +} + +/** + * Checks if a TSNode has a modifier + * @param {SyntaxKind} modifierKind TypeScript SyntaxKind modifier + * @param {TSNode} node TypeScript AST node + * @returns {boolean} has the modifier specified + */ +function hasModifier(modifierKind, node) { + return !!node.modifiers && !!node.modifiers.length && node.modifiers.some(modifier => modifier.kind === modifierKind); +} + +/** + * Returns true if the given TSToken is a comma + * @param {TSToken} token the TypeScript token + * @returns {boolean} is comma + */ +function isComma(token) { + return token.kind === SyntaxKind.CommaToken; +} + +/** + * Returns the binary expression type of the given TSToken + * @param {TSToken} operator the operator token + * @returns {string} the binary expression type + */ +function getBinaryExpressionType(operator) { + if (isAssignmentOperator(operator)) { + return "AssignmentExpression"; + } else if (isLogicalOperator(operator)) { + return "LogicalExpression"; + } + return "BinaryExpression"; + +} + +/** + * Returns line and column data for the given start and end positions, + * for the given AST + * @param {Object} start start data + * @param {Object} end end data + * @param {Object} ast the AST object + * @returns {Object} the loc data + */ +function getLocFor(start, end, ast) { + const startLoc = ast.getLineAndCharacterOfPosition(start), + endLoc = ast.getLineAndCharacterOfPosition(end); + + return { + start: { + line: startLoc.line + 1, + column: startLoc.character + }, + end: { + line: endLoc.line + 1, + column: endLoc.character + } + }; +} + +/** + * Returns line and column data for the given ESTreeNode or ESTreeToken, + * for the given AST + * @param {ESTreeToken|ESTreeNode} nodeOrToken the ESTreeNode or ESTreeToken + * @param {Object} ast the AST object + * @returns {Object} the loc data + */ +function getLoc(nodeOrToken, ast) { + return getLocFor(nodeOrToken.getStart(), nodeOrToken.end, ast); +} + +/** + * Returns true if a given TSNode is a token + * @param {TSNode} node the TSNode + * @returns {boolean} is a token + */ +function isToken(node) { + return node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken; +} + +/** + * Returns true if a given TSNode is a JSX token + * @param {TSNode} node TSNode to be checked + * @returns {boolean} is a JSX token + */ +function isJSXToken(node) { + return ( + node.kind >= SyntaxKind.JsxElement && + node.kind <= SyntaxKind.JsxAttribute + ); +} + +/** + * Returns the declaration kind of the given TSNode + * @param {TSNode} node TypeScript AST node + * @returns {string} declaration kind + */ +function getDeclarationKind(node) { + let varDeclarationKind; + switch (node.kind) { + case SyntaxKind.TypeAliasDeclaration: + varDeclarationKind = "type"; + break; + case SyntaxKind.VariableDeclarationList: + if (isLet(node)) { + varDeclarationKind = "let"; + } else if (isConst(node)) { + varDeclarationKind = "const"; + } else { + varDeclarationKind = "var"; + } + break; + default: + throw "Unable to determine declaration kind."; + } + return varDeclarationKind; +} + +/** + * Gets a TSNode's accessibility level + * @param {TSNode} node The TSNode + * @returns {string | null} accessibility "public", "protected", "private", or null + */ +function getTSNodeAccessibility(node) { + const modifiers = node.modifiers; + if (!modifiers) { + return null; + } + for (let i = 0; i < modifiers.length; i++) { + const modifier = modifiers[i]; + switch (modifier.kind) { + case SyntaxKind.PublicKeyword: + return "public"; + case SyntaxKind.ProtectedKeyword: + return "protected"; + case SyntaxKind.PrivateKeyword: + return "private"; + default: + continue; + } + } + return null; +} + +/** + * Returns true if the given TSNode has the modifier flag set which corresponds + * to the static keyword. + * @param {TSNode} node The TSNode + * @returns {boolean} whether or not the static modifier flag is set + */ +function hasStaticModifierFlag(node) { + /** + * TODO: Remove dependency on private TypeScript method + */ + return Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static); +} + +/** + * Finds the next token based on the previous one and its parent + * @param {TSToken} previousToken The previous TSToken + * @param {TSNode} parent The parent TSNode + * @returns {TSToken} the next TSToken + */ +function findNextToken(previousToken, parent) { + /** + * TODO: Remove dependency on private TypeScript method + */ + return ts.findNextToken(previousToken, parent); +} + +/** + * Finds the first child TSNode which matches the given kind + * @param {TSNode} node The parent TSNode + * @param {number} kind The TSNode kind to match against + * @param {Object} sourceFile The full AST source file + * @returns {TSNode|undefined} a matching TSNode + */ +function findChildOfKind(node, kind, sourceFile) { + return findFirstMatchingChild(node, sourceFile, child => child.kind === kind); +} + +/** + * Finds the first parent TSNode which mastches the given kind + * @param {TSNode} node The current TSNode + * @param {number} kind The TSNode kind to match against + * @returns {TSNode|undefined} a matching parent TSNode + */ +function findAncestorOfKind(node, kind) { + return findFirstMatchingAncestor(node, parent => parent.kind === kind); +} + +/** + * Returns true if a given TSNode has a JSX token within its hierarchy + * @param {TSNode} node TSNode to be checked + * @returns {boolean} has JSX ancestor + */ +function hasJSXAncestor(node) { + return !!findFirstMatchingAncestor(node, isJSXToken); +} + +/** + * Remove extra underscore from escaped identifier text content. + * @param {string} identifier The escaped identifier text. + * @returns {string} The unescaped identifier text. + */ +function unescapeIdentifier(identifier) { + return ts.unescapeIdentifier(identifier); +} + +/** + * Unescape the text content of string literals, e.g. & -> & + * @param {string} text The escaped string literal text. + * @returns {string} The unescaped string literal text. + */ +function unescapeStringLiteralText(text) { + return unescape(text); +} + +/** + * Fixes the exports of the given TSNode + * @param {TSNode} node the TSNode + * @param {Object} result result + * @param {Object} ast the AST + * @returns {TSNode} the TSNode with fixed exports + */ +function fixExports(node, result, ast) { + // check for exports + if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { + const exportKeyword = node.modifiers[0], + nextModifier = node.modifiers[1], + lastModifier = node.modifiers[node.modifiers.length - 1], + declarationIsDefault = nextModifier && (nextModifier.kind === SyntaxKind.DefaultKeyword), + varToken = findNextToken(lastModifier, ast); + + result.range[0] = varToken.getStart(); + result.loc = getLocFor(result.range[0], result.range[1], ast); + + let declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration"; + + /** + * Prefix exports from TypeScript namespaces with "TS" to distinguish + * them from ES2015 exports + */ + if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { + declarationType = "TSNamespaceExportDeclaration"; + } + + const newResult = { + type: declarationType, + declaration: result, + range: [exportKeyword.getStart(), result.range[1]], + loc: getLocFor(exportKeyword.getStart(), result.range[1], ast) + }; + + if (!declarationIsDefault) { + newResult.specifiers = []; + newResult.source = null; + } + + return newResult; + + } + + return result; +} + +/** + * Returns the type of a given ESTreeToken + * @param {ESTreeToken} token the ESTreeToken + * @returns {string} the token type + */ +function getTokenType(token) { + // Need two checks for keywords since some are also identifiers + if (token.originalKeywordKind) { + + switch (token.originalKeywordKind) { + case SyntaxKind.NullKeyword: + return "Null"; + + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + case SyntaxKind.TypeKeyword: + case SyntaxKind.ModuleKeyword: + return "Identifier"; + + default: + return "Keyword"; + } + } + + if (token.kind >= SyntaxKind.FirstKeyword && token.kind <= SyntaxKind.LastFutureReservedWord) { + if (token.kind === SyntaxKind.FalseKeyword || token.kind === SyntaxKind.TrueKeyword) { + return "Boolean"; + } + + return "Keyword"; + } + + if (token.kind >= SyntaxKind.FirstPunctuation && token.kind <= SyntaxKind.LastBinaryOperator) { + return "Punctuator"; + } + + if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && token.kind <= SyntaxKind.TemplateTail) { + return "Template"; + } + + switch (token.kind) { + case SyntaxKind.NumericLiteral: + return "Numeric"; + + case SyntaxKind.JsxText: + return "JSXText"; + + case SyntaxKind.StringLiteral: + + // A TypeScript-StringLiteral token with a TypeScript-JsxAttribute or TypeScript-JsxElement parent, + // must actually be an ESTree-JSXText token + if (token.parent && (token.parent.kind === SyntaxKind.JsxAttribute || token.parent.kind === SyntaxKind.JsxElement)) { + return "JSXText"; + } + + return "String"; + + case SyntaxKind.RegularExpressionLiteral: + return "RegularExpression"; + + case SyntaxKind.Identifier: + case SyntaxKind.ConstructorKeyword: + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + + // falls through + default: + } + + // Some JSX tokens have to be determined based on their parent + if (token.parent) { + if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.PropertyAccessExpression && hasJSXAncestor(token)) { + return "JSXIdentifier"; + } + + if (isJSXToken(token.parent)) { + if (token.kind === SyntaxKind.PropertyAccessExpression) { + return "JSXMemberExpression"; + } + + if (token.kind === SyntaxKind.Identifier) { + return "JSXIdentifier"; + } + } + } + + return "Identifier"; +} + +/** + * Extends and formats a given ESTreeToken, for a given AST + * @param {ESTreeToken} token the ESTreeToken + * @param {Object} ast the AST object + * @returns {ESTreeToken} the converted ESTreeToken + */ +function convertToken(token, ast) { + const start = token.getStart(), + value = ast.text.slice(start, token.end), + newToken = { + type: getTokenType(token), + value, + start, + end: token.end, + range: [start, token.end], + loc: getLoc(token, ast) + }; + + if (newToken.type === "RegularExpression") { + newToken.regex = { + pattern: value.slice(1, value.lastIndexOf("/")), + flags: value.slice(value.lastIndexOf("/") + 1) + }; + } + + return newToken; +} + +/** + * Converts all tokens for the given AST + * @param {Object} ast the AST object + * @returns {ESTreeToken[]} the converted ESTreeTokens + */ +function convertTokens(ast) { + const result = []; + /** + * @param {TSNode} node the TSNode + * @returns {undefined} + */ + function walk(node) { + if (isToken(node) && node.kind !== SyntaxKind.EndOfFileToken) { + const converted = convertToken(node, ast); + + if (converted) { + result.push(converted); + } + } else { + node.getChildren().forEach(walk); + } + } + walk(ast); + return result; +} diff --git a/packages/typescript-eslint-parser/lib/token-translator.js b/packages/typescript-eslint-parser/lib/token-translator.js deleted file mode 100644 index a38d29f32888..000000000000 --- a/packages/typescript-eslint-parser/lib/token-translator.js +++ /dev/null @@ -1,252 +0,0 @@ -/** - * @fileoverview Translates tokens between Acorn format and Esprima format. - * @author Nicholas C. Zakas - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ -/* eslint no-underscore-dangle: 0 */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// none! - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - - -// Esprima Token Types -var Token = { - Boolean: "Boolean", - EOF: "", - Identifier: "Identifier", - Keyword: "Keyword", - Null: "Null", - Numeric: "Numeric", - Punctuator: "Punctuator", - String: "String", - RegularExpression: "RegularExpression", - Template: "Template", - JSXIdentifier: "JSXIdentifier", - JSXText: "JSXText" -}; - -/** - * Converts part of a template into an Esprima token. - * @param {AcornToken[]} tokens The Acorn tokens representing the template. - * @param {string} code The source code. - * @returns {EsprimaToken} The Esprima equivalent of the template token. - * @private - */ -function convertTemplatePart(tokens, code) { - var firstToken = tokens[0], - lastTemplateToken = tokens[tokens.length - 1]; - - var token = { - type: Token.Template, - value: code.slice(firstToken.start, lastTemplateToken.end) - }; - - if (firstToken.loc) { - token.loc = { - start: firstToken.loc.start, - end: lastTemplateToken.loc.end - }; - } - - if (firstToken.range) { - token.range = [firstToken.range[0], lastTemplateToken.range[1]]; - } - - return token; -} - -/** - * Contains logic to translate Acorn tokens into Esprima tokens. - * @param {Object} acornTokTypes The Acorn token types. - * @param {string} code The source code Acorn is parsing. This is necessary - * to correct the "value" property of some tokens. - * @constructor - */ -function TokenTranslator(acornTokTypes, code) { - - // token types - this._acornTokTypes = acornTokTypes; - - // token buffer for templates - this._tokens = []; - - // track the last curly brace - this._curlyBrace = null; - - // the source code - this._code = code; - -} - -TokenTranslator.prototype = { - constructor: TokenTranslator, - - /** - * Translates a single Esprima token to a single Acorn token. This may be - * inaccurate due to how templates are handled differently in Esprima and - * Acorn, but should be accurate for all other tokens. - * @param {AcornToken} token The Acorn token to translate. - * @param {Object} extra Espree extra object. - * @returns {EsprimaToken} The Esprima version of the token. - */ - translate: function(token, extra) { - - var type = token.type, - tt = this._acornTokTypes, - result = { - type: "", - value: token.value, - range: token.range, - loc: token.loc - }; - - if (type === tt.name) { - result.type = Token.Identifier; - - // TODO: See if this is an Acorn bug - if (result.value === "static") { - result.type = Token.Keyword; - } - - } else if (type === tt.semi || type === tt.comma || - type === tt.parenL || type === tt.parenR || - type === tt.braceL || type === tt.braceR || - type === tt.dot || type === tt.bracketL || - type === tt.colon || type === tt.question || - type === tt.bracketR || type === tt.ellipsis || - type === tt.arrow || type === tt.jsxTagStart || - type === tt.jsxTagEnd || (type.binop && !type.keyword) || - type.isAssign) { - - result.type = Token.Punctuator; - result.value = this._code.slice(token.start, token.end); - } else if (type === tt.jsxName) { - result.type = Token.JSXIdentifier; - } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { - result.type = Token.JSXText; - } else if (type.keyword) { - if (type.keyword === "true" || type.keyword === "false") { - result.type = Token.Boolean; - } else if (type.keyword === "null") { - result.type = Token.Null; - } else { - result.type = Token.Keyword; - } - } else if (type === tt.num) { - result.type = Token.Numeric; - result.value = this._code.slice(token.start, token.end); - } else if (type === tt.string) { - - if (extra.jsxAttrValueToken) { - extra.jsxAttrValueToken = false; - result.type = Token.JSXText; - } else { - result.type = Token.String; - } - - result.value = this._code.slice(token.start, token.end); - } else if (type === tt.regexp) { - result.type = Token.RegularExpression; - var value = token.value; - result.regex = { - flags: value.flags, - pattern: value.pattern - }; - result.value = "/" + value.pattern + "/" + value.flags; - } - - return result; - }, - - /** - * Function to call during Acorn's onToken handler. - * @param {AcornToken} token The Acorn token. - * @param {Object} extra The Espree extra object. - * @returns {void} - */ - onToken: function(token, extra) { - - var that = this, - tt = this._acornTokTypes, - tokens = extra.tokens, - templateTokens = this._tokens; - - /** - * Flushes the buffered template tokens and resets the template - * tracking. - * @returns {void} - * @private - */ - function translateTemplateTokens() { - tokens.push(convertTemplatePart(that._tokens, that._code)); - that._tokens = []; - } - - if (token.type === tt.eof) { - - // might be one last curlyBrace - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - } - - return; - } - - if (token.type === tt.backQuote) { - templateTokens.push(token); - - // it's the end - if (templateTokens.length > 1) { - translateTemplateTokens(); - } - - return; - } else if (token.type === tt.dollarBraceL) { - templateTokens.push(token); - translateTemplateTokens(); - return; - } else if (token.type === tt.braceR) { - - // if there's already a curly, it's not part of the template - if (this._curlyBrace) { - - tokens.push(this.translate(this._curlyBrace, extra)); - } - - // store new curly for later - this._curlyBrace = token; - return; - } else if (token.type === tt.template) { - if (this._curlyBrace) { - templateTokens.push(this._curlyBrace); - this._curlyBrace = null; - } - - templateTokens.push(token); - return; - } - - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - this._curlyBrace = null; - } - - tokens.push(this.translate(token, extra)); - } -}; - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -module.exports = TokenTranslator; diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index e0f71eaade20..d306bcbe4055 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -10,7 +10,7 @@ "parser.js" ], "engines": { - "node": ">=0.10.0" + "node": ">=4" }, "repository": "eslint/typescript-eslint-parser", "bugs": { @@ -18,17 +18,18 @@ }, "license": "BSD-2-Clause", "devDependencies": { - "chai": "^1.10.0", - "dateformat": "^1.0.11", - "eslint": "^2.2.0", - "eslint-config-eslint": "^3.0.0", - "eslint-release": "^0.10.0", - "istanbul": "~0.2.6", - "leche": "^1.0.1", - "mocha": "^2.0.1", - "npm-license": "^0.2.3", - "shelljs": "^0.3.0", - "shelljs-nodecli": "^0.1.1", + "chai": "3.5.0", + "dateformat": "2.0.0", + "eslint": "3.19.0", + "eslint-config-eslint": "4.0.0", + "eslint-plugin-node": "4.2.2", + "eslint-release": "0.10.3", + "istanbul": "0.4.5", + "leche": "2.1.2", + "mocha": "3.3.0", + "npm-license": "0.3.3", + "shelljs": "0.7.7", + "shelljs-nodecli": "0.1.1", "typescript": "~2.3.2" }, "keywords": [ @@ -50,9 +51,8 @@ "betarelease": "eslint-prerelease beta" }, "dependencies": { - "lodash.unescape": "4.0.0", - "object-assign": "^4.0.1", - "semver": "^5.3.0" + "lodash.unescape": "4.0.1", + "semver": "5.3.0" }, "peerDependencies": { "typescript": "*" diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index c2f85a67fb37..6958209da86c 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -4,34 +4,34 @@ * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ -/* eslint no-undefined:0, no-use-before-define: 0 */ "use strict"; -var astNodeTypes = require("./lib/ast-node-types"), +const astNodeTypes = require("./lib/ast-node-types"), ts = require("typescript"), semver = require("semver"); -var SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.typescript; -var ACTIVE_TYPESCRIPT_VERSION = ts.version; +const SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.typescript; +const ACTIVE_TYPESCRIPT_VERSION = ts.version; -var isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS); +const isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS); if (!isRunningSupportedTypeScriptVersion) { - var border = "============="; - var versionWarning = [ + const border = "============="; + const versionWarning = [ border, "WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser.", "You may find that it works just fine, or you may not.", - "SUPPORTED TYPESCRIPT VERSIONS: " + SUPPORTED_TYPESCRIPT_VERSIONS, - "YOUR TYPESCRIPT VERSION: " + ACTIVE_TYPESCRIPT_VERSION, + `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, + `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, "Please only submit bug reports when using the officially supported version.", border ]; - console.warn(versionWarning.join("\n\n")); + + console.warn(versionWarning.join("\n\n")); // eslint-disable-line no-console } -var extra; +let extra; /** * Resets the extra config object @@ -63,7 +63,7 @@ function resetExtra() { * @private */ function convertTypeScriptCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { - var comment = { + const comment = { type: block ? "Block" : "Line", value: text }; @@ -91,7 +91,7 @@ function convertTypeScriptCommentToEsprimaComment(block, text, start, end, start * @returns {Object} the loc data */ function getLocFor(start, end, ast) { - var startLoc = ast.getLineAndCharacterOfPosition(start), + const startLoc = ast.getLineAndCharacterOfPosition(start), endLoc = ast.getLineAndCharacterOfPosition(end); return { @@ -113,13 +113,12 @@ function getLocFor(start, end, ast) { /** * Parses the given source code to produce a valid AST * @param {mixed} code TypeScript code - * @param {object} options configuration object for the parser - * @returns {object} the AST + * @param {Object} options configuration object for the parser + * @returns {Object} the AST */ function parse(code, options) { - var program, - toString = String; + const toString = String; if (typeof code !== "string" && !(code instanceof String)) { code = toString(code); @@ -155,78 +154,89 @@ function parse(code, options) { // pass through jsx option extra.ecmaFeatures.jsx = options.ecmaFeatures.jsx; } + + /** + * Allow the user to cause the parser to error if it encounters an unknown AST Node Type + * (used in testing). + */ + if (options.errorOnUnknownASTType) { + extra.errorOnUnknownASTType = true; + } + } // Even if jsx option is set in typescript compiler, filename still has to // contain .tsx file extension - var FILENAME = (extra.ecmaFeatures.jsx) ? "eslint.tsx" : "eslint.ts"; + const FILENAME = (extra.ecmaFeatures.jsx) ? "eslint.tsx" : "eslint.ts"; - var compilerHost = { - fileExists: function() { + const compilerHost = { + fileExists() { return true; }, - getCanonicalFileName: function() { + getCanonicalFileName() { return FILENAME; }, - getCurrentDirectory: function() { + getCurrentDirectory() { return ""; }, - getDefaultLibFileName: function() { + getDefaultLibFileName() { return "lib.d.ts"; }, // TODO: Support Windows CRLF - getNewLine: function() { + getNewLine() { return "\n"; }, - getSourceFile: function(filename) { + getSourceFile(filename) { return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); }, - readFile: function() { + readFile() { return null; }, - useCaseSensitiveFileNames: function() { + useCaseSensitiveFileNames() { return true; }, - writeFile: function() { + writeFile() { return null; } }; - program = ts.createProgram([FILENAME], { + const program = ts.createProgram([FILENAME], { noResolve: true, target: ts.ScriptTarget.Latest, jsx: extra.ecmaFeatures.jsx ? "preserve" : undefined }, compilerHost); - var ast = program.getSourceFile(FILENAME); + const ast = program.getSourceFile(FILENAME); if (extra.attachComment || extra.comment) { /** * Create a TypeScript Scanner, with skipTrivia set to false so that * we can parse the comments */ - var triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); + const triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); + + let kind = triviaScanner.scan(); - var kind = triviaScanner.scan(); while (kind !== ts.SyntaxKind.EndOfFileToken) { if (kind !== ts.SyntaxKind.SingleLineCommentTrivia && kind !== ts.SyntaxKind.MultiLineCommentTrivia) { kind = triviaScanner.scan(); continue; } - var isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); - var range = { + const isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); + const range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() }; - var comment = code.substring(range.pos, range.end); - var text = comment.replace("//", "").replace("/*", "").replace("*/", ""); - var loc = getLocFor(range.pos, range.end, ast); + const comment = code.substring(range.pos, range.end); + const text = comment.replace("//", "").replace("/*", "").replace("*/", ""); + const loc = getLocFor(range.pos, range.end, ast); + + const esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); - var esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); extra.comments.push(esprimaComment); kind = triviaScanner.scan(); @@ -234,9 +244,10 @@ function parse(code, options) { } - var convert = require("./lib/ast-converter"); + const convert = require("./lib/ast-converter"); return convert(ast, extra); + } //------------------------------------------------------------------------------ @@ -250,7 +261,8 @@ exports.parse = parse; // Deep copy. /* istanbul ignore next */ exports.Syntax = (function() { - var name, types = {}; + let name, + types = {}; if (typeof Object.create === "function") { types = Object.create(null); diff --git a/packages/typescript-eslint-parser/tests/lib/attach-comments.js b/packages/typescript-eslint-parser/tests/lib/attach-comments.js index b135969da793..28120a85f35c 100644 --- a/packages/typescript-eslint-parser/tests/lib/attach-comments.js +++ b/packages/typescript-eslint-parser/tests/lib/attach-comments.js @@ -30,7 +30,7 @@ // Requirements //------------------------------------------------------------------------------ -var assert = require("chai").assert, +const assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), @@ -41,23 +41,22 @@ var assert = require("chai").assert, // Setup //------------------------------------------------------------------------------ -var FIXTURES_DIR = "./tests/fixtures/attach-comments"; +const FIXTURES_DIR = "./tests/fixtures/attach-comments"; -var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { - return filename.indexOf(".src.js") > -1; -}).map(function(filename) { - return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" -}); +const testFiles = shelljs.find(FIXTURES_DIR) + .filter(filename => filename.indexOf(".src.js") > -1) + // strip off ".src.js" + .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)); //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ -describe("attachComment: true", function() { +describe("attachComment: true", () => { - var config; + let config; - beforeEach(function() { + beforeEach(() => { config = { loc: true, range: true, @@ -67,12 +66,12 @@ describe("attachComment: true", function() { }; }); - leche.withData(testFiles, function(filename) { - var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); + leche.withData(testFiles, filename => { + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - it("should produce correct AST when parsed with attachComment", function() { - var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); - var result; + it("should produce correct AST when parsed with attachComment", () => { + const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); + let result; try { result = parser.parse(code, config); @@ -82,9 +81,9 @@ describe("attachComment: true", function() { // format of error isn't exactly the same, just check if it's expected if (expected.message) { return; - } else { - throw ex; } + throw ex; + } assert.deepEqual(result, expected); diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index db0719a67634..7ac087f604ff 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -11,7 +11,7 @@ // Requirements //------------------------------------------------------------------------------ -var assert = require("chai").assert, +const assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), @@ -22,39 +22,40 @@ var assert = require("chai").assert, // Setup //------------------------------------------------------------------------------ -var FIXTURES_DIR = "./tests/fixtures/basics"; +const FIXTURES_DIR = "./tests/fixtures/basics"; -var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { - return filename.indexOf(".src.js") > -1; -}).map(function(filename) { - return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" -}); +const testFiles = shelljs.find(FIXTURES_DIR) + .filter(filename => filename.indexOf(".src.js") > -1) + // strip off ".src.js" + .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)); //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ -describe("basics", function() { +describe("basics", () => { - var config; + let config; - beforeEach(function() { + beforeEach(() => { config = { loc: true, range: true, tokens: true, - ecmaFeatures: {} + ecmaFeatures: {}, + errorOnUnknownASTType: true }; }); - leche.withData(testFiles, function(filename) { + leche.withData(testFiles, filename => { + // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; - var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - it("should parse correctly", function() { - var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); - var result; + it("should parse correctly", () => { + const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); + let result; try { result = parser.parse(code, config); @@ -64,11 +65,12 @@ describe("basics", function() { // format of error isn't exactly the same, just check if it's expected if (expected.message) { return; - } else { - throw ex; } + throw ex; + } + // console.log(JSON.stringify(result, null, 4)); assert.deepEqual(result, expected); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 402d8c9b02cc..f7104aa9bfdf 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -11,7 +11,7 @@ // Requirements //------------------------------------------------------------------------------ -var assert = require("chai").assert, +const assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), @@ -22,27 +22,23 @@ var assert = require("chai").assert, // Setup //------------------------------------------------------------------------------ -var FIXTURES_DIR = "./tests/fixtures/ecma-features"; +const FIXTURES_DIR = "./tests/fixtures/ecma-features"; + // var FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix"; -var filesWithOutsandingTSIssues = [ +const filesWithOutsandingTSIssues = [ "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 "jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411 "jsx/multiple-blank-spaces" ]; -var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { - return filename.indexOf(".src.js") > -1; -}).filter(function(filename) { - return filesWithOutsandingTSIssues.every(function(fileName) { - return filename.indexOf(fileName) === -1; - }); -}).map(function(filename) { - return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.js" -}).filter(function(filename) { - return !(/error\-|invalid\-|globalReturn/.test(filename)); -}); +const testFiles = shelljs.find(FIXTURES_DIR) + .filter(filename => filename.indexOf(".src.js") > -1) + .filter(filename => filesWithOutsandingTSIssues.every(fileName => filename.indexOf(fileName) === -1)) + // strip off ".src.js" + .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)) + .filter(filename => !(/error-|invalid-|globalReturn/.test(filename))); // var moduleTestFiles = testFiles.filter(function(filename) { // return !/jsx|globalReturn|invalid|experimental|generators|not\-strict/.test(filename); @@ -63,29 +59,31 @@ var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { // Tests //------------------------------------------------------------------------------ -describe("ecmaFeatures", function() { +describe("ecmaFeatures", () => { - var config; + let config; - beforeEach(function() { + beforeEach(() => { config = { loc: true, range: true, tokens: true, - ecmaFeatures: {} + ecmaFeatures: {}, + errorOnUnknownASTType: true }; }); - leche.withData(testFiles, function(filename) { + leche.withData(testFiles, filename => { + // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; - var feature = path.dirname(filename), - code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); + const feature = path.dirname(filename), + code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - it("should parse correctly when " + feature + " is true", function() { + it(`should parse correctly when ${feature} is true`, () => { config.ecmaFeatures[feature] = true; - var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); - var result; + const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); + let result; try { result = parser.parse(code, config); @@ -95,9 +93,9 @@ describe("ecmaFeatures", function() { // format of error isn't exactly the same, just check if it's expected if (expected.message) { return; - } else { - throw ex; } + throw ex; + } assert.deepEqual(result, expected); diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index 76310b89e530..a6606cc15170 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -11,7 +11,7 @@ // Requirements //------------------------------------------------------------------------------ -var assert = require("chai").assert, +const assert = require("chai").assert, parser = require("../../parser"), tester = require("./tester"); @@ -19,21 +19,21 @@ var assert = require("chai").assert, // Tests //------------------------------------------------------------------------------ -describe("parse()", function() { +describe("parse()", () => { - describe("basic functionality", function() { + describe("basic functionality", () => { - it("should parse an empty string", function() { + it("should parse an empty string", () => { assert.deepEqual(parser.parse("").body, []); assert.deepEqual(parser.parse("", {}).body, []); }); }); - describe("modules", function() { + describe("modules", () => { - it("should have correct column number when strict mode error occurs", function() { + it("should have correct column number when strict mode error occurs", () => { try { parser.parse("function fn(a, a) {\n}", { sourceType: "module" }); } catch (err) { @@ -43,10 +43,10 @@ describe("parse()", function() { }); - describe("general", function() { + describe("general", () => { - it("should output tokens, comments, locs, and ranges when called with those options", function() { - var ast = parser.parse("let foo = bar;", { + it("should output tokens, comments, locs, and ranges when called with those options", () => { + const ast = parser.parse("let foo = bar;", { ecmaFeatures: { blockBindings: true }, diff --git a/packages/typescript-eslint-parser/tests/lib/tester.js b/packages/typescript-eslint-parser/tests/lib/tester.js index d20003a6efd5..aa14f38c3845 100644 --- a/packages/typescript-eslint-parser/tests/lib/tester.js +++ b/packages/typescript-eslint-parser/tests/lib/tester.js @@ -13,13 +13,13 @@ /** * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object + * @param {Object} ast the AST object + * @returns {Object} copy of the AST object */ function getRaw(ast) { - return JSON.parse(JSON.stringify(ast, function(key, value) { + return JSON.parse(JSON.stringify(ast, (key, value) => { if ((key === "start" || key === "end") && typeof value === "number") { - return undefined; // eslint-disable-line no-undefined + return undefined; } return value; @@ -27,5 +27,5 @@ function getRaw(ast) { } module.exports = { - getRaw: getRaw + getRaw }; diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index 691985edf468..8c0b12a61068 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -11,7 +11,7 @@ // Requirements //------------------------------------------------------------------------------ -var assert = require("chai").assert, +const assert = require("chai").assert, leche = require("leche"), path = require("path"), parser = require("../../parser"), @@ -22,39 +22,40 @@ var assert = require("chai").assert, // Setup //------------------------------------------------------------------------------ -var FIXTURES_DIR = "./tests/fixtures/typescript"; +const FIXTURES_DIR = "./tests/fixtures/typescript"; -var testFiles = shelljs.find(FIXTURES_DIR).filter(function(filename) { - return filename.indexOf(".src.ts") > -1; -}).map(function(filename) { - return filename.substring(FIXTURES_DIR.length - 1, filename.length - 7); // strip off ".src.ts" -}); +const testFiles = shelljs.find(FIXTURES_DIR) + .filter(filename => filename.indexOf(".src.ts") > -1) + // strip off ".src.ts" + .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)); //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ -describe("typescript", function() { +describe("typescript", () => { - var config; + let config; - beforeEach(function() { + beforeEach(() => { config = { loc: true, range: true, tokens: true, - ecmaFeatures: {} + ecmaFeatures: {}, + errorOnUnknownASTType: true }; }); - leche.withData(testFiles, function(filename) { + leche.withData(testFiles, filename => { + // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; - var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.ts"); + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`); - it("should parse correctly", function() { - var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); - var result; + it("should parse correctly", () => { + const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); + let result; try { result = parser.parse(code, config); @@ -64,11 +65,12 @@ describe("typescript", function() { // format of error isn't exactly the same, just check if it's expected if (expected.message) { return; - } else { - throw ex; } + throw ex; + } + // console.log(JSON.stringify(result, null, 4)); assert.deepEqual(result, expected); From bb4e1733a80d45fa7e9f345f0c8b6aba030dd55f Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Tue, 9 May 2017 11:26:05 -0500 Subject: [PATCH 140/326] Breaking: Allow comment scanner to rescan tokens (fixes #216) (#219) --- .../lib/ast-converter.js | 7 +- .../lib/convert-comments.js | 147 ++++ .../lib/node-utils.js | 35 +- packages/typescript-eslint-parser/parser.js | 100 +-- .../block-trailing-comment.result.js | 0 .../block-trailing-comment.src.js | 0 .../comment-within-condition.result.js | 0 .../comment-within-condition.src.js | 0 .../export-default-anonymous-class.result.js | 0 .../export-default-anonymous-class.src.js | 0 .../comments/jsx-block-comment.result.js | 732 ++++++++++++++++++ .../comments/jsx-block-comment.src.js | 7 + .../comments/jsx-tag-comments.result.js | 644 +++++++++++++++ .../fixtures/comments/jsx-tag-comments.src.js | 10 + .../line-comment-with-block-syntax.result.js | 40 + .../line-comment-with-block-syntax.src.js | 1 + .../mix-line-and-block-comments.result.js | 0 .../mix-line-and-block-comments.src.js | 0 .../comments/no-comment-regex.result.js | 195 +++++ .../fixtures/comments/no-comment-regex.src.js | 1 + .../comments/no-comment-template.result.js | 287 +++++++ .../comments/no-comment-template.src.js | 1 + .../surrounding-call-comments.result.js | 0 .../surrounding-call-comments.src.js | 0 .../surrounding-debugger-comments.result.js | 0 .../surrounding-debugger-comments.src.js | 0 .../surrounding-return-comments.result.js | 0 .../surrounding-return-comments.src.js | 0 .../surrounding-throw-comments.result.js | 0 .../surrounding-throw-comments.src.js | 0 .../surrounding-while-loop-comments.result.js | 0 .../surrounding-while-loop-comments.src.js | 0 ...-fallthrough-comment-in-function.result.js | 0 ...tch-fallthrough-comment-in-function.src.js | 0 .../switch-fallthrough-comment.result.js | 0 .../switch-fallthrough-comment.src.js | 0 ...h-no-default-comment-in-function.result.js | 0 ...itch-no-default-comment-in-function.src.js | 0 ...ault-comment-in-nested-functions.result.js | 0 ...default-comment-in-nested-functions.src.js | 0 .../switch-no-default-comment.result.js | 0 .../switch-no-default-comment.src.js | 0 .../comments/template-string-block.result.js | 414 ++++++++++ .../comments/template-string-block.src.js | 5 + .../lib/{attach-comments.js => comments.js} | 12 +- 45 files changed, 2531 insertions(+), 107 deletions(-) create mode 100644 packages/typescript-eslint-parser/lib/convert-comments.js rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/block-trailing-comment.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/block-trailing-comment.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/comment-within-condition.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/comment-within-condition.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/export-default-anonymous-class.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/export-default-anonymous-class.src.js (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.src.js rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/mix-line-and-block-comments.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/mix-line-and-block-comments.src.js (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.src.js rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-call-comments.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-call-comments.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-debugger-comments.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-debugger-comments.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-return-comments.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-return-comments.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-throw-comments.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-throw-comments.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-while-loop-comments.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/surrounding-while-loop-comments.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-fallthrough-comment-in-function.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-fallthrough-comment-in-function.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-fallthrough-comment.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-fallthrough-comment.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-no-default-comment-in-function.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-no-default-comment-in-function.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-no-default-comment-in-nested-functions.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-no-default-comment-in-nested-functions.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-no-default-comment.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{attach-comments => comments}/switch-no-default-comment.src.js (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.src.js rename packages/typescript-eslint-parser/tests/lib/{attach-comments.js => comments.js} (92%) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 363eb842600a..0ee75f64795b 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -12,6 +12,7 @@ //------------------------------------------------------------------------------ const convert = require("./convert"), + convertComments = require("./convert-comments").convertComments, nodeUtils = require("./node-utils"); //------------------------------------------------------------------------------ @@ -67,10 +68,10 @@ module.exports = (ast, extra) => { } /** - * Add the comment nodes to the AST (that were parsed separately in parser.js) + * Optionally convert and include all comments in the AST */ - if (extra.comment || extra.attachComment) { - estree.comments = extra.comments || []; + if (extra.comment) { + estree.comments = convertComments(ast, extra.code); } return estree; diff --git a/packages/typescript-eslint-parser/lib/convert-comments.js b/packages/typescript-eslint-parser/lib/convert-comments.js new file mode 100644 index 000000000000..e51cec996b5a --- /dev/null +++ b/packages/typescript-eslint-parser/lib/convert-comments.js @@ -0,0 +1,147 @@ +/** + * @fileoverview Convert comment using TypeScript token scanner + * @author James Henry + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const ts = require("typescript"), + nodeUtils = require("./node-utils"); + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +/** + * Converts a TypeScript comment to an Esprima comment. + * @param {boolean} block True if it's a block comment, false if not. + * @param {string} text The text of the comment. + * @param {int} start The index at which the comment starts. + * @param {int} end The index at which the comment ends. + * @param {Location} startLoc The location at which the comment starts. + * @param {Location} endLoc The location at which the comment ends. + * @returns {Object} The comment object. + * @private + */ +function convertTypeScriptCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { + const comment = { + type: block ? "Block" : "Line", + value: text + }; + + if (typeof start === "number") { + comment.range = [start, end]; + } + + if (typeof startLoc === "object") { + comment.loc = { + start: startLoc, + end: endLoc + }; + } + + return comment; +} + +/** + * Convert comment from TypeScript Triva Scanner. + * @param {Object} triviaScanner TS Scanner + * @param {Object} ast the AST object + * @param {string} code TypeScript code + * @returns {ESTreeComment} the converted ESTreeComment + * @private + */ +function getCommentFromTriviaScanner(triviaScanner, ast, code) { + const kind = triviaScanner.getToken(); + const isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); + const range = { + pos: triviaScanner.getTokenPos(), + end: triviaScanner.getTextPos(), + kind: triviaScanner.getToken() + }; + + const comment = code.substring(range.pos, range.end); + const text = (isBlock) ? comment.replace(/^\/\*/, "").replace(/\*\/$/, "") : comment.replace(/^\/\//, ""); + const loc = nodeUtils.getLocFor(range.pos, range.end, ast); + + const esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); + + return esprimaComment; +} + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +/* eslint-disable no-use-before-define */ +module.exports = { + convertComments +}; + + +/** + * Convert all comments for the given AST. + * @param {Object} ast the AST object + * @param {string} code the TypeScript code + * @returns {ESTreeComment[]} the converted ESTreeComment + * @private + */ +function convertComments(ast, code) { + const comments = []; + + /** + * Create a TypeScript Scanner, with skipTrivia set to false so that + * we can parse the comments + */ + const triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); + + let kind = triviaScanner.scan(); + while (kind !== ts.SyntaxKind.EndOfFileToken) { + const start = triviaScanner.getTokenPos(); + const end = triviaScanner.getTextPos(); + + let container = null; + switch (kind) { + case ts.SyntaxKind.SingleLineCommentTrivia: + case ts.SyntaxKind.MultiLineCommentTrivia: { + const comment = getCommentFromTriviaScanner(triviaScanner, ast, code); + + comments.push(comment); + break; + } + case ts.SyntaxKind.CloseBraceToken: + container = nodeUtils.getNodeContainer(ast, start, end); + + if ( + container.kind === ts.SyntaxKind.TemplateMiddle || + container.kind === ts.SyntaxKind.TemplateTail + ) { + kind = triviaScanner.reScanTemplateToken(); + continue; + } + break; + case ts.SyntaxKind.SlashToken: + case ts.SyntaxKind.SlashEqualsToken: + container = nodeUtils.getNodeContainer(ast, start, end); + + if ( + container.kind === ts.SyntaxKind.RegularExpressionLiteral + ) { + kind = triviaScanner.reScanSlashToken(); + continue; + } + break; + default: + break; + } + kind = triviaScanner.scan(); + } + + return comments; +} diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index c5585d32ddee..3e7f0deb812a 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -187,7 +187,8 @@ module.exports = { fixExports, getTokenType, convertToken, - convertTokens + convertTokens, + getNodeContainer }; /* eslint-enable no-use-before-define */ @@ -633,3 +634,35 @@ function convertTokens(ast) { walk(ast); return result; } + +/** + * Get container token node between range + * @param {Object} ast the AST object + * @param {int} start The index at which the comment starts. + * @param {int} end The index at which the comment ends. + * @returns {TSToken} typescript container token + * @private + */ +function getNodeContainer(ast, start, end) { + let container = null; + + /** + * @param {TSNode} node the TSNode + * @returns {undefined} + */ + function walk(node) { + const nodeStart = node.pos; + const nodeEnd = node.end; + + if (start >= nodeStart && end <= nodeEnd) { + if (isToken(node)) { + container = node; + } else { + node.getChildren().forEach(walk); + } + } + } + walk(ast); + + return container; +} diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 6958209da86c..455333f40624 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -9,6 +9,7 @@ const astNodeTypes = require("./lib/ast-node-types"), ts = require("typescript"), + convert = require("./lib/ast-converter"), semver = require("semver"); const SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.typescript; @@ -51,61 +52,6 @@ function resetExtra() { }; } -/** - * Converts a TypeScript comment to an Esprima comment. - * @param {boolean} block True if it's a block comment, false if not. - * @param {string} text The text of the comment. - * @param {int} start The index at which the comment starts. - * @param {int} end The index at which the comment ends. - * @param {Location} startLoc The location at which the comment starts. - * @param {Location} endLoc The location at which the comment ends. - * @returns {Object} The comment object. - * @private - */ -function convertTypeScriptCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { - const comment = { - type: block ? "Block" : "Line", - value: text - }; - - if (typeof start === "number") { - comment.range = [start, end]; - } - - if (typeof startLoc === "object") { - comment.loc = { - start: startLoc, - end: endLoc - }; - } - - return comment; -} - -/** - * Returns line and column data for the given start and end positions, - * for the given AST - * @param {Object} start start data - * @param {Object} end end data - * @param {Object} ast the AST object - * @returns {Object} the loc data - */ -function getLocFor(start, end, ast) { - const startLoc = ast.getLineAndCharacterOfPosition(start), - endLoc = ast.getLineAndCharacterOfPosition(end); - - return { - start: { - line: startLoc.line + 1, - column: startLoc.character - }, - end: { - line: endLoc.line + 1, - column: endLoc.character - } - }; -} - //------------------------------------------------------------------------------ // Parser //------------------------------------------------------------------------------ @@ -129,7 +75,6 @@ function parse(code, options) { if (typeof options !== "undefined") { extra.range = (typeof options.range === "boolean") && options.range; extra.loc = (typeof options.loc === "boolean") && options.loc; - extra.attachComment = (typeof options.attachComment === "boolean") && options.attachComment; if (extra.loc && options.source !== null && options.source !== undefined) { extra.source = toString(options.source); @@ -145,10 +90,6 @@ function parse(code, options) { if (typeof options.tolerant === "boolean" && options.tolerant) { extra.errors = []; } - if (extra.attachComment) { - extra.range = true; - extra.comments = []; - } if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { // pass through jsx option @@ -209,45 +150,8 @@ function parse(code, options) { const ast = program.getSourceFile(FILENAME); - if (extra.attachComment || extra.comment) { - /** - * Create a TypeScript Scanner, with skipTrivia set to false so that - * we can parse the comments - */ - const triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); - - let kind = triviaScanner.scan(); - - while (kind !== ts.SyntaxKind.EndOfFileToken) { - if (kind !== ts.SyntaxKind.SingleLineCommentTrivia && kind !== ts.SyntaxKind.MultiLineCommentTrivia) { - kind = triviaScanner.scan(); - continue; - } - - const isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); - const range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos(), - kind: triviaScanner.getToken() - }; - - const comment = code.substring(range.pos, range.end); - const text = comment.replace("//", "").replace("/*", "").replace("*/", ""); - const loc = getLocFor(range.pos, range.end, ast); - - const esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); - - extra.comments.push(esprimaComment); - - kind = triviaScanner.scan(); - } - - } - - const convert = require("./lib/ast-converter"); - + extra.code = code; return convert(ast, extra); - } //------------------------------------------------------------------------------ diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/block-trailing-comment.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/comment-within-condition.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/export-default-anonymous-class.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js new file mode 100644 index 000000000000..4e6b03823d4d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js @@ -0,0 +1,732 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 6, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "pure" + }, + "init": { + "type": "ArrowFunctionExpression", + "range": [ + 13, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "generator": false, + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 19, + 97 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 25, + 95 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 6, + "column": 6 + } + }, + "argument": { + "type": "JSXElement", + "range": [ + 42, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 42, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + }, + "selfClosing": false, + "name": { + "type": "JSXIdentifier", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "name": "Foo" + }, + "attributes": [] + }, + "closingElement": { + "type": "JSXClosingElement", + "range": [ + 82, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 13 + } + }, + "name": "Foo" + } + }, + "children": [ + { + "type": "Literal", + "range": [ + 47, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 47 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "value": "\n ", + "raw": "\n " + }, + { + "type": "JSXExpressionContainer", + "range": [ + 60, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "expression": { + "type": "JSXEmptyExpression", + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 24 + } + }, + "range": [ + 61, + 72 + ] + } + }, + { + "type": "Literal", + "range": [ + 73, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 73 + }, + "end": { + "line": 5, + "column": 8 + } + }, + "value": "\n ", + "raw": "\n " + } + ] + } + } + ] + }, + "async": false, + "expression": false + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "pure", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Foo", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "JSXText", + "value": "", + "range": [ + 60, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "JSXText", + "value": "", + "range": [ + 82, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Foo", + "range": [ + 84, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + } + ], + "comments": [ + { + "type": "Block", + "value": "COMMENT", + "range": [ + 61, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.src.js new file mode 100644 index 000000000000..5abfb88e92f2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.src.js @@ -0,0 +1,7 @@ +const pure = () => { + return ( + + {/*COMMENT*/} + + ); +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js new file mode 100644 index 000000000000..cddb4355c305 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js @@ -0,0 +1,644 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 127 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 127 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 6, + 127 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "pure" + }, + "init": { + "type": "ArrowFunctionExpression", + "range": [ + 13, + 127 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "generator": false, + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 19, + 127 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 25, + 125 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 8, + "column": 6 + } + }, + "argument": { + "type": "JSXElement", + "range": [ + 42, + 118 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 7, + "column": 14 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 42, + 103 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + }, + "selfClosing": false, + "name": { + "type": "JSXIdentifier", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "name": "Foo" + }, + "attributes": [] + }, + "closingElement": { + "type": "JSXClosingElement", + "range": [ + 112, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 14 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 114, + 117 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 13 + } + }, + "name": "Foo" + } + }, + "children": [ + { + "type": "Literal", + "range": [ + 103, + 112 + ], + "loc": { + "start": { + "line": 7, + "column": 103 + }, + "end": { + "line": 7, + "column": 8 + } + }, + "value": "\n ", + "raw": "\n " + } + ] + } + } + ] + }, + "async": false, + "expression": false + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "pure", + "range": [ + 6, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 16, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Foo", + "range": [ + 43, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "JSXText", + "value": "", + "range": [ + 112, + 112 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Foo", + "range": [ + 114, + 117 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + } + ], + "comments": [ + { + "type": "Line", + "value": " single", + "range": [ + 59, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Block", + "value": " block ", + "range": [ + 81, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 23 + } + } + } + ] +}; + diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.src.js new file mode 100644 index 000000000000..ef679a1ad20e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.src.js @@ -0,0 +1,10 @@ +const pure = () => { + return ( + + + ); +} + diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js new file mode 100644 index 000000000000..85be15e4fa2c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js @@ -0,0 +1,40 @@ +module.exports = { + "type": "Program", + "range": [ + 12, + 0 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 1, + "column": 0 + } + }, + "body": [], + "sourceType": "script", + "tokens": [], + "comments": [ + { + "type": "Line", + "value": " /*test*/", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.src.js new file mode 100644 index 000000000000..88994dd62b4a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.src.js @@ -0,0 +1 @@ +// /*test*/ diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/mix-line-and-block-comments.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js new file mode 100644 index 000000000000..519738014de6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js @@ -0,0 +1,195 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 6, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "regex" + }, + "init": { + "type": "Literal", + "range": [ + 14, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "value": null, + "raw": "/no comment\\/**foo/", + "regex": { + "pattern": "no comment\\/**foo", + "flags": "" + } + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "regex", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "RegularExpression", + "value": "/no comment\\/**foo/", + "range": [ + 14, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "regex": { + "pattern": "no comment\\/**foo", + "flags": "" + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "comments": [] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.src.js new file mode 100644 index 000000000000..c33c7617e144 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.src.js @@ -0,0 +1 @@ +const regex = /no comment\/**foo/; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js new file mode 100644 index 000000000000..fba63388208c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js @@ -0,0 +1,287 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 6, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "str" + }, + "init": { + "type": "TemplateLiteral", + "range": [ + 12, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "quasis": [ + { + "type": "TemplateElement", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "value": { + "raw": "", + "cooked": "" + }, + "tail": false + }, + { + "type": "TemplateElement", + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "value": { + "raw": "/test/*.js", + "cooked": "/test/*.js" + }, + "tail": true + } + ], + "expressions": [ + { + "type": "Identifier", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "__dirname" + } + ] + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "str", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Template", + "value": "`${", + "range": [ + 12, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "__dirname", + "range": [ + 15, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Template", + "value": "}/test/*.js`", + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + } + } + ], + "comments": [] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.src.js new file mode 100644 index 000000000000..f22e6f94cf4f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.src.js @@ -0,0 +1 @@ +const str = `${__dirname}/test/*.js`; diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-call-comments.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-debugger-comments.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-return-comments.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-throw-comments.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/surrounding-while-loop-comments.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment-in-function.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-fallthrough-comment.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-function.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment-in-nested-functions.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.result.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/attach-comments/switch-no-default-comment.src.js rename to packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js new file mode 100644 index 000000000000..a363db182a90 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js @@ -0,0 +1,414 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "expression": { + "type": "TemplateLiteral", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "quasis": [ + { + "type": "TemplateElement", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "value": { + "raw": "", + "cooked": "" + }, + "tail": false + }, + { + "type": "TemplateElement", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": { + "raw": "", + "cooked": "" + }, + "tail": true + } + ], + "expressions": [ + { + "type": "Identifier", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "name" + } + ] + } + }, + { + "type": "BlockStatement", + "range": [ + 11, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 56, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "expression": { + "type": "BinaryExpression", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "operator": "+", + "left": { + "type": "Literal", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "value": 1, + "raw": "1" + }, + "right": { + "type": "Literal", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + }, + "value": 1, + "raw": "1" + } + } + } + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Template", + "value": "`${", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "name", + "range": [ + 3, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Template", + "value": "}`", + "range": [ + 7, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ], + "comments": [ + { + "type": "Block", + "value": " TODO comment comment comment ", + "range": [ + 17, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 38 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.src.js new file mode 100644 index 000000000000..19351f45e710 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.src.js @@ -0,0 +1,5 @@ +`${name}`; +{ + /* TODO comment comment comment */ + 1 + 1; +} diff --git a/packages/typescript-eslint-parser/tests/lib/attach-comments.js b/packages/typescript-eslint-parser/tests/lib/comments.js similarity index 92% rename from packages/typescript-eslint-parser/tests/lib/attach-comments.js rename to packages/typescript-eslint-parser/tests/lib/comments.js index 28120a85f35c..178b7b639ec8 100644 --- a/packages/typescript-eslint-parser/tests/lib/attach-comments.js +++ b/packages/typescript-eslint-parser/tests/lib/comments.js @@ -41,7 +41,7 @@ const assert = require("chai").assert, // Setup //------------------------------------------------------------------------------ -const FIXTURES_DIR = "./tests/fixtures/attach-comments"; +const FIXTURES_DIR = "./tests/fixtures/comments"; const testFiles = shelljs.find(FIXTURES_DIR) .filter(filename => filename.indexOf(".src.js") > -1) @@ -52,7 +52,7 @@ const testFiles = shelljs.find(FIXTURES_DIR) // Tests //------------------------------------------------------------------------------ -describe("attachComment: true", () => { +describe("Comments", () => { let config; @@ -61,15 +61,17 @@ describe("attachComment: true", () => { loc: true, range: true, tokens: true, - attachComment: true, - ecmaFeatures: {} + comment: true, + ecmaFeatures: { + jsx: true + } }; }); leche.withData(testFiles, filename => { const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - it("should produce correct AST when parsed with attachComment", () => { + it("should produce correct AST when parsed with comment", () => { const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); let result; From a605fbecc9b37d8136a9aa2e25839ba8c1e2393e Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 15 May 2017 09:48:05 -0500 Subject: [PATCH 141/326] Fix: Use correct starting range and loc for JSXText tokens (fixes #227) (#271) --- .../typescript-eslint-parser/lib/node-utils.js | 11 ++++++----- .../comments/jsx-block-comment.result.js | 16 ++++++++-------- .../fixtures/comments/jsx-tag-comments.result.js | 8 ++++---- .../jsx/self-closing-tag-inside-tag.result.js | 16 ++++++++-------- .../tests/lib/ecma-features.js | 3 +-- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 3e7f0deb812a..aafa359bbbda 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -588,15 +588,16 @@ function getTokenType(token) { * @returns {ESTreeToken} the converted ESTreeToken */ function convertToken(token, ast) { - const start = token.getStart(), - value = ast.text.slice(start, token.end), + const start = (token.kind === SyntaxKind.JsxText) ? token.getFullStart() : token.getStart(), + end = token.getEnd(), + value = ast.text.slice(start, end), newToken = { type: getTokenType(token), value, start, - end: token.end, - range: [start, token.end], - loc: getLoc(token, ast) + end, + range: [start, end], + loc: getLocFor(start, end, ast) }; if (newToken.type === "RegularExpression") { diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js index 4e6b03823d4d..cee2a733a47e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js @@ -512,15 +512,15 @@ module.exports = { }, { "type": "JSXText", - "value": "", + "value": "\n ", "range": [ - 60, + 47, 60 ], "loc": { "start": { - "line": 4, - "column": 12 + "line": 3, + "column": 13 }, "end": { "line": 4, @@ -566,15 +566,15 @@ module.exports = { }, { "type": "JSXText", - "value": "", + "value": "\n ", "range": [ - 82, + 73, 82 ], "loc": { "start": { - "line": 5, - "column": 8 + "line": 4, + "column": 25 }, "end": { "line": 5, diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js index cddb4355c305..67c6527d4ae0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js @@ -459,15 +459,15 @@ module.exports = { }, { "type": "JSXText", - "value": "", + "value": "\n ", "range": [ - 112, + 103, 112 ], "loc": { "start": { - "line": 7, - "column": 8 + "line": 6, + "column": 9 }, "end": { "line": 7, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js index 450dcb77e11c..32ad8e46ddb3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js @@ -276,15 +276,15 @@ module.exports = { }, { "type": "JSXText", - "value": "", + "value": "\n ", "range": [ - 10, + 5, 10 ], "loc": { "start": { - "line": 2, - "column": 4 + "line": 1, + "column": 5 }, "end": { "line": 2, @@ -366,15 +366,15 @@ module.exports = { }, { "type": "JSXText", - "value": "", + "value": "\n", "range": [ - 18, + 17, 18 ], "loc": { "start": { - "line": 3, - "column": 0 + "line": 2, + "column": 11 }, "end": { "line": 3, diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index f7104aa9bfdf..8813690c03d1 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -29,8 +29,7 @@ const FIXTURES_DIR = "./tests/fixtures/ecma-features"; const filesWithOutsandingTSIssues = [ "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 - "jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411 - "jsx/multiple-blank-spaces" + "jsx/namespaced-name-and-attribute" // https://github.com/Microsoft/TypeScript/issues/7411 ]; const testFiles = shelljs.find(FIXTURES_DIR) From a9ad056603f90606cd1b8b07c04eb6378b22344c Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 17 May 2017 15:43:09 -0400 Subject: [PATCH 142/326] Build: changelog update for 3.0.0 --- .../typescript-eslint-parser/CHANGELOG.md | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 84074d2a04c4..3d36a4a2e977 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,29 @@ +v3.0.0 - May 17, 2017 + +* 6b56bfe Fix: Use correct starting range and loc for JSXText tokens (fixes #227) (#271) (Reyad Attiyat) +* f5fcc87 Breaking: Allow comment scanner to rescan tokens (fixes #216) (#219) (Reyad Attiyat) +* f836bb9 Chore: Refactor the codebase (fixes #220) (#261) (James Henry) +* aade6bd Chore: Update README with list of known issues (#247) (Reyad Attiyat) +* c8e881a Breaking: Normalize type parameters (fixes #197) (#196) (Rasmus Eneman) +* d37bf04 Fix: Type parameter start location calculation (fixes #260) (#259) (Igor Oleinikov) +* 1a97650 Fix: Handle case where class has extends but no super class (fixes #249) (#254) (Reyad Attiyat) +* 00ad71d Fix: add `instanceof` to ast-converter (fixes #252) (#251) (Danny Arnold) +* 2989f8b Upgrade: Update semver package (#246) (Simen Bekkhus) +* b1efe69 Breaking: Change how interface node gets converted (fixes #201) (#241) (Reyad Attiyat) +* e311620 Fix: Set await property on async iterators (for await) (fixes #236) (#239) (Reyad Attiyat) +* a294afa Fix: Set async on async FunctionExpressions (fixes #244) (#245) (Lucas Azzola) +* 7c00f16 Chore: Add tests for object spread and async generator (refs #236) (#237) (Reyad Attiyat) +* 7b69bc9 Fix: Label abstract class properties (fixes #234) (#238) (Reyad Attiyat) +* a330ec6 New: Add support for default type parameters (fixes #235) (#240) (Reyad Attiyat) +* e1ef800 Fix: Support superTypeParameters (fixes #242) (#243) (Lucas Azzola) +* 65c2e0a Breaking: Support TypeScript 2.3 (fixes #232) (#233) (Lucas Azzola) +* 15f1173 Fix: Use TSAbsractMethodDefinition for abstract constructor (fixes #228) (#229) (Lucas Azzola) +* 8fb71d2 Breaking: Add .body to TSModuleBlock nodes (fixes #217) (#218) (Philipp A) +* 471f403 Chore: Remove before_script from .travis.yml (fixes #231) (#230) (James Henry) +* 9397c5c Chore: Cleanup Makefile (#221) (Reyad Attiyat) +* dd57f81 Update: Open TS peerDependency, warn non-supported version (fixes #167) (#193) (James Henry) +* a37d5ed Fix: Wrap any parameter with modifiers, not just in constructors (#214) (Rasmus Eneman) + v2.1.0 - April 4, 2017 * d709fd8 Fix: Set root to true in eslintrc (fixes #211) (#212) (Reyad Attiyat) From 31533cae13a1b31b686819761ee52d9b66a56cff Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 17 May 2017 15:43:10 -0400 Subject: [PATCH 143/326] 3.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index d306bcbe4055..7cd6a5f79980 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "2.1.0", + "version": "3.0.0", "files": [ "lib", "parser.js" From 5b166d0e76d8997383bc98288d41763225b25499 Mon Sep 17 00:00:00 2001 From: Danny Martini Date: Sat, 20 May 2017 18:22:36 +0200 Subject: [PATCH 144/326] Fix: wrap interface in ExportNamedDeclaration if necessary (fixes #269) (#270) --- .../typescript-eslint-parser/lib/convert.js | 6 + .../basics/abstract-interface.result.js | 204 +++++++++++ .../basics/abstract-interface.src.ts | 2 + .../basics/class-with-mixin.result.js | 82 ++--- .../interface-extends-multiple.result.js | 3 +- .../basics/interface-extends.result.js | 3 +- .../interface-type-parameters.result.js | 3 +- ...ure-with-parameter-accessibility.result.js | 5 +- ...ace-with-extends-type-parameters.result.js | 3 +- .../basics/interface-with-generic.result.js | 331 +++++++++--------- .../basics/interface-with-jsdoc.result.js | 5 +- ...terface-with-optional-properties.result.js | 5 +- ...nterface-without-type-annotation.result.js | 3 +- .../typescript/basics/typed-this.result.js | 11 +- .../interface-empty-extends.result.js | 3 +- .../tools/update-typescript-tests.js | 9 +- 16 files changed, 452 insertions(+), 226 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index ce4ffa9dc56f..083c27861937 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1703,6 +1703,7 @@ module.exports = function convert(config) { } const hasImplementsClause = interfaceHeritageClauses.length > 0; + const hasAbstractKeyword = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node); const interfaceOpenBrace = nodeUtils.findNextToken(interfaceLastClassToken, ast); const interfaceBody = { @@ -1713,11 +1714,16 @@ module.exports = function convert(config) { }; Object.assign(result, { + abstract: hasAbstractKeyword, type: AST_NODE_TYPES.TSInterfaceDeclaration, body: interfaceBody, id: convertChild(node.name), heritage: hasImplementsClause ? interfaceHeritageClauses[0].types.map(convertInterfaceHeritageClause) : [] }); + + // check for exports + result = nodeUtils.fixExports(node, result, ast); + break; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js new file mode 100644 index 000000000000..e7576a7cfd6d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js @@ -0,0 +1,204 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "TSInterfaceDeclaration", + "range": [ + 16, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "abstract": true, + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 28, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "name": "I" + }, + "heritage": [] + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "specifiers": [], + "source": null + } + ], + "sourceType": "module", + "tokens": [ + { + "type": "Keyword", + "value": "export", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Keyword", + "value": "interface", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "I", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.src.ts new file mode 100644 index 000000000000..8fafeca6066c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.src.ts @@ -0,0 +1,2 @@ +export abstract interface I { +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js index c5864a639781..02b1f01d6bcd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js @@ -301,59 +301,59 @@ module.exports = { "name": "Constructor" }, "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 32, + 36 + ], "loc": { - "end": { - "column": 36, - "line": 1 - }, "start": { - "column": 32, - "line": 1 + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 36 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 35, - "line": 1 - }, - "start": { - "column": 33, - "line": 1 - } + "type": "GenericTypeAnnotation", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 }, - "members": [], + "end": { + "line": 1, + "column": 35 + } + }, + "id": { + "type": "TSTypeLiteral", "range": [ 33, 35 ], - "type": "TSTypeLiteral" - }, - "loc": { - "end": { - "column": 35, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } }, - "start": { - "column": 33, - "line": 1 - } + "members": [] }, - "range": [ - 33, - 35 - ], - "type": "GenericTypeAnnotation", "typeParameters": null } - ], - "range": [ - 32, - 36 - ], - "type": "TypeParameterInstantiation" + ] } } } @@ -633,6 +633,7 @@ module.exports = { "column": 15 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [], @@ -691,7 +692,6 @@ module.exports = { "declarations": [ { "type": "VariableDeclarator", - "typeParameters": null, "id": { "type": "Identifier", "range": [ @@ -726,6 +726,7 @@ module.exports = { "column": 47 } }, + "typeParameters": null, "parameters": [ { "type": "RestElement", @@ -814,7 +815,6 @@ module.exports = { } } ], - "typeParameters": null, "typeAnnotation": { "type": "TypeAnnotation", "loc": { @@ -2079,4 +2079,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js index ba61edaa0f6b..0ea4e1e2e8b8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [], @@ -288,4 +289,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js index b09ee67a3b3f..b89896899d28 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [], @@ -217,4 +218,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js index 0e29b4a687c3..fd51c55b8040 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js @@ -69,6 +69,7 @@ module.exports = { } ] }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [], @@ -237,4 +238,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js index 657caa55ddef..bbf54d58618e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -31,12 +31,12 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [ { "type": "TSConstructSignature", - "typeParameters": null, "range": [ 21, 47 @@ -51,6 +51,7 @@ module.exports = { "column": 30 } }, + "typeParameters": null, "parameters": [ { "type": "TSParameterProperty", @@ -402,4 +403,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js index 59505ce92ed4..6f098834322c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js @@ -69,6 +69,7 @@ module.exports = { } ] }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [], @@ -418,4 +419,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js index 55d39eb9e42f..ab72816c2983 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js @@ -1,240 +1,241 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, "body": [ { - "body": { - "body": [], - "loc": { - "end": { - "column": 1, - "line": 2 - }, - "start": { - "column": 18, - "line": 1 - } - }, - "range": [ - 18, - 21 - ], - "type": "TSInterfaceBody" - }, - "heritage": [], - "id": { - "loc": { - "end": { - "column": 14, - "line": 1 - }, - "start": { - "column": 10, - "line": 1 - } - }, - "name": "Test", - "range": [ - 10, - 14 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 1, - "line": 2 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "TSInterfaceDeclaration", "range": [ 0, 21 ], - "type": "TSInterfaceDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 14, + 17 + ], "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 } }, "params": [ { - "constraint": null, + "type": "TypeParameter", + "range": [ + 15, + 16 + ], "loc": { - "end": { - "column": 16, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 } }, "name": "T", - "range": [ - 15, - 16 - ], - "type": "TypeParameter" + "constraint": null } + ] + }, + "abstract": false, + "body": { + "type": "TSInterfaceBody", + "body": [], + "range": [ + 18, + 21 ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", "range": [ - 14, - 17 + 10, + 14 ], - "type": "TypeParameterDeclaration" - } - } - ], - "loc": { - "end": { - "column": 1, - "line": 2 - }, - "start": { - "column": 0, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "Test" + }, + "heritage": [] } - }, - "range": [ - 0, - 21 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 9, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "interface", "range": [ 0, 9 ], - "type": "Keyword", - "value": "interface" - }, - { "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "Test", "range": [ 10, 14 ], - "type": "Identifier", - "value": "Test" - }, - { "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 14 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 14, 15 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 16, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 } - }, + } + }, + { + "type": "Identifier", + "value": "T", "range": [ 15, 16 ], - "type": "Identifier", - "value": "T" - }, - { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 16, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 16, 17 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 19, - "line": 1 - }, "start": { - "column": 18, - "line": 1 + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 18, 19 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 1, - "line": 2 - }, "start": { - "column": 0, - "line": 2 + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 20, 21 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js index 0732fc50c080..b86ccc5eaafe 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js @@ -31,12 +31,12 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [ { "type": "TSMethodSignature", - "typeParameters": null, "range": [ 76, 85 @@ -69,6 +69,7 @@ module.exports = { }, "name": "foo" }, + "typeParameters": null, "parameters": [ { "type": "Identifier", @@ -670,4 +671,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js index 46c4fcf419dd..8944766982b1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [ @@ -177,7 +178,6 @@ module.exports = { }, { "type": "TSMethodSignature", - "typeParameters": null, "range": [ 49, 79 @@ -228,6 +228,7 @@ module.exports = { } } }, + "typeParameters": null, "parameters": [ { "type": "Identifier", @@ -829,4 +830,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js index 83f82dec1f43..1d4862542b0e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [ @@ -218,4 +219,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js index 74a7d177f0cb..4bfa9e8369b5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [ @@ -68,6 +69,7 @@ module.exports = { }, "name": "addClickListener" }, + "typeParameters": null, "parameters": [ { "type": "Identifier", @@ -118,6 +120,7 @@ module.exports = { "column": 57 } }, + "typeParameters": null, "parameters": [ { "type": "Identifier", @@ -275,8 +278,7 @@ module.exports = { } } } - }, - "typeParameters": null + } } } } @@ -314,8 +316,7 @@ module.exports = { } } } - }, - "typeParameters": null + } } ], "range": [ @@ -771,4 +772,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js index 2561f9ea41ec..9481511e7f84 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js @@ -31,6 +31,7 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [], @@ -163,4 +164,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tools/update-typescript-tests.js b/packages/typescript-eslint-parser/tools/update-typescript-tests.js index 618002a9cf39..e8c620f86f13 100644 --- a/packages/typescript-eslint-parser/tools/update-typescript-tests.js +++ b/packages/typescript-eslint-parser/tools/update-typescript-tests.js @@ -17,6 +17,7 @@ var shelljs = require("shelljs"), parser = require("../parser"), + tester = require("../tests/lib/tester"), path = require("path"); //------------------------------------------------------------------------------ @@ -35,7 +36,7 @@ function getRaw(ast) { function getExpectedResult(code, config) { try { - return getRaw(parser.parse(code, config)); + return tester.getRaw(parser.parse(code, config)); } catch (ex) { var raw = getRaw(ex); raw.message = ex.message; @@ -52,7 +53,7 @@ function getTestFilenames(directory) { } function outputResult(result, testResultFilename) { - ("module.exports = " + JSON.stringify(result, null, " ") + ";").to(testResultFilename); + shelljs.echo("module.exports = " + JSON.stringify(result, null, " ") + ";").to(testResultFilename); } //------------------------------------------------------------------------------ @@ -72,7 +73,9 @@ testFiles.forEach(function(filename) { config = { loc: true, range: true, - tokens: true + tokens: true, + ecmaFeatures: {}, + errorOnUnknownASTType: true }; var testResultFilename = path.resolve(__dirname, "..", FIXTURES_DIR, filename) + ".result.js"; From e084f9bb124a40174794c3f6b9374b9dfd0bcc1b Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 21 May 2017 05:53:42 -0500 Subject: [PATCH 145/326] Fix: Convert range and line number corretly in JSX literals (#277) --- packages/typescript-eslint-parser/lib/convert.js | 10 +++++++--- .../fixtures/comments/jsx-block-comment.result.js | 8 ++++---- .../tests/fixtures/comments/jsx-tag-comments.result.js | 4 ++-- .../jsx/self-closing-tag-inside-tag.result.js | 6 +++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 083c27861937..cca30f0a1d04 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1613,17 +1613,21 @@ module.exports = function convert(config) { } - case SyntaxKind.JsxText: + case SyntaxKind.JsxText: { Object.assign(result, { type: AST_NODE_TYPES.Literal, value: ast.text.slice(node.pos, node.end), raw: ast.text.slice(node.pos, node.end) }); - result.loc.start.column = node.pos; - result.range[0] = node.pos; + const start = node.getFullStart(); + const end = node.getEnd(); + + result.loc = nodeUtils.getLocFor(start, end, ast); + result.range = [start, end]; break; + } case SyntaxKind.JsxSpreadAttribute: Object.assign(result, { diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js index cee2a733a47e..0334ec36f196 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js @@ -215,8 +215,8 @@ module.exports = { ], "loc": { "start": { - "line": 4, - "column": 47 + "line": 3, + "column": 13 }, "end": { "line": 4, @@ -268,8 +268,8 @@ module.exports = { ], "loc": { "start": { - "line": 5, - "column": 73 + "line": 4, + "column": 25 }, "end": { "line": 5, diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js index 67c6527d4ae0..1f28bc32b813 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js @@ -215,8 +215,8 @@ module.exports = { ], "loc": { "start": { - "line": 7, - "column": 103 + "line": 6, + "column": 9 }, "end": { "line": 7, diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js index 32ad8e46ddb3..9cb593f48c32 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js @@ -128,7 +128,7 @@ module.exports = { ], "loc": { "start": { - "line": 2, + "line": 1, "column": 5 }, "end": { @@ -203,8 +203,8 @@ module.exports = { ], "loc": { "start": { - "line": 3, - "column": 17 + "line": 2, + "column": 11 }, "end": { "line": 3, From e431bb13bec51a782dfb0e09930bc234ba094564 Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Sun, 21 May 2017 20:59:57 +1000 Subject: [PATCH 146/326] Fix: Replace JSXMemberExpression with TSQualifiedName (fixes #257) (#258) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 14 +- .../basics/var-with-dotted-type.result.js | 362 ++++++++++++++++++ .../basics/var-with-dotted-type.src.ts | 1 + 4 files changed, 367 insertions(+), 11 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 90f9fa0e69f8..e7f5052dd28f 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -118,6 +118,7 @@ module.exports = { TSNumberKeyword: "TSNumberKeyword", TSParameterProperty: "TSParameterProperty", TSPropertySignature: "TSPropertySignature", + TSQualifiedName: "TSQualifiedName", TSQuestionToken: "TSQuestionToken", TSStringKeyword: "TSStringKeyword", TSTypeLiteral: "TSTypeLiteral", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index cca30f0a1d04..24f16fa6ad23 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1638,18 +1638,10 @@ module.exports = function convert(config) { break; case SyntaxKind.FirstNode: { - const jsxMemberExpressionObject = convertChild(node.left); - jsxMemberExpressionObject.type = AST_NODE_TYPES.JSXIdentifier; - delete jsxMemberExpressionObject.value; - - const jsxMemberExpressionProperty = convertChild(node.right); - jsxMemberExpressionProperty.type = AST_NODE_TYPES.JSXIdentifier; - delete jsxMemberExpressionObject.value; - Object.assign(result, { - type: AST_NODE_TYPES.JSXMemberExpression, - object: jsxMemberExpressionObject, - property: jsxMemberExpressionProperty + type: AST_NODE_TYPES.TSQualifiedName, + left: convertChild(node.left), + right: convertChild(node.right) }); break; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js new file mode 100644 index 000000000000..c6e2d7653909 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js @@ -0,0 +1,362 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "foo", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 9, + 14 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "typeName": { + "type": "TSQualifiedName", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "left": { + "type": "TSQualifiedName", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "A" + }, + "right": { + "type": "Identifier", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "name": "B" + } + }, + "right": { + "type": "Identifier", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "C" + } + } + } + } + }, + "init": null + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 4, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "B", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.src.ts new file mode 100644 index 000000000000..ff0a1885271c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.src.ts @@ -0,0 +1 @@ +var foo: A.B.C; From 54a42f48fe4ff6d81d2f0e779848902aa60dcdf4 Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Sun, 21 May 2017 22:53:45 +1000 Subject: [PATCH 147/326] Fix: Add exponentiation operators (fixes #280) (#281) --- .../lib/node-utils.js | 2 + .../fixtures/ast/Assignment-Operators.json | 74 +++- .../ast/Multiplicative-Operators.json | 73 +++- .../exponential-operators.result.js | 403 ++++++++++++++++++ .../exponential-operators.src.js | 2 + 5 files changed, 552 insertions(+), 2 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.src.js diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index aafa359bbbda..5550270d9ae2 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -64,6 +64,7 @@ TOKEN_TO_TEXT[SyntaxKind.EqualsGreaterThanToken] = "=>"; TOKEN_TO_TEXT[SyntaxKind.PlusToken] = "+"; TOKEN_TO_TEXT[SyntaxKind.MinusToken] = "-"; TOKEN_TO_TEXT[SyntaxKind.AsteriskToken] = "*"; +TOKEN_TO_TEXT[SyntaxKind.AsteriskAsteriskToken] = "**"; TOKEN_TO_TEXT[SyntaxKind.SlashToken] = "/"; TOKEN_TO_TEXT[SyntaxKind.PercentToken] = "%"; TOKEN_TO_TEXT[SyntaxKind.PlusPlusToken] = "++"; @@ -85,6 +86,7 @@ TOKEN_TO_TEXT[SyntaxKind.EqualsToken] = "="; TOKEN_TO_TEXT[SyntaxKind.PlusEqualsToken] = "+="; TOKEN_TO_TEXT[SyntaxKind.MinusEqualsToken] = "-="; TOKEN_TO_TEXT[SyntaxKind.AsteriskEqualsToken] = "*="; +TOKEN_TO_TEXT[SyntaxKind.AsteriskAsteriskEqualsToken] = "**="; TOKEN_TO_TEXT[SyntaxKind.SlashEqualsToken] = "/="; TOKEN_TO_TEXT[SyntaxKind.PercentEqualsToken] = "%="; TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanEqualsToken] = "<<="; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json index b03cfde17daa..928106763e1e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json @@ -575,6 +575,78 @@ } } }, + "x **= 42": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "**=", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Literal", + "value": 42, + "raw": "42", + "range": [ + 6, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, "x <<= 42": { "type": "ExpressionStatement", "expression": { @@ -1007,4 +1079,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json index 418f1f35ba3a..7b64264e748f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json +++ b/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json @@ -211,5 +211,76 @@ "column": 5 } } + }, + "x ** y": { + "type": "ExpressionStatement", + "expression": { + "type": "BinaryExpression", + "operator": "**", + "left": { + "type": "Identifier", + "name": "x", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "right": { + "type": "Identifier", + "name": "y", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } } -} \ No newline at end of file +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js new file mode 100644 index 000000000000..083e46e653c9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js @@ -0,0 +1,403 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 4, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "id": { + "type": "Identifier", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "name": "x" + }, + "init": { + "type": "BinaryExpression", + "range": [ + 8, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "operator": "**", + "left": { + "type": "Literal", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": 2, + "raw": "2" + }, + "right": { + "type": "Literal", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "value": 3, + "raw": "3" + } + } + } + ], + "kind": "var" + }, + { + "type": "ExpressionStatement", + "range": [ + 16, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "expression": { + "type": "BinaryExpression", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "operator": "**=", + "left": { + "type": "Identifier", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + }, + "name": "x" + }, + "right": { + "type": "Literal", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "value": 4, + "raw": "4" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "range": [ + 0, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Numeric", + "value": "2", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "**", + "range": [ + 10, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Numeric", + "value": "3", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "**=", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Numeric", + "value": "4", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + } + ] +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.src.js new file mode 100644 index 000000000000..b04a6f38a508 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.src.js @@ -0,0 +1,2 @@ +var x = 2 ** 3; +x **= 4; From 031433d853c4575058e8701f256bdc5d4a4af00f Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 21 May 2017 15:20:57 -0500 Subject: [PATCH 148/326] New: Create option to enable JSXText node type (fixes #266) (#272) --- .../lib/ast-converter.js | 3 +- .../typescript-eslint-parser/lib/convert.js | 21 +- packages/typescript-eslint-parser/parser.js | 7 +- .../self-closing-tag-inside-tag.result.js | 458 ++++++++++++++++++ .../self-closing-tag-inside-tag.src.js | 0 .../jsx-useJSXTextNode/test-content.result.js | 311 ++++++++++++ .../test-content.src.js | 0 .../jsx/attributes.result.js | 0 .../{ecma-features => }/jsx/attributes.src.js | 0 .../jsx/embedded-comment.result.js | 0 .../jsx/embedded-comment.src.js | 0 .../jsx/embedded-conditional.result.js | 0 .../jsx/embedded-conditional.src.js | 0 .../embedded-invalid-js-identifier.result.js | 0 .../jsx/embedded-invalid-js-identifier.src.js | 0 .../jsx/embedded-tags.result.js | 0 .../jsx/embedded-tags.src.js | 0 .../jsx/empty-placeholder.result.js | 0 .../jsx/empty-placeholder.src.js | 0 .../jsx/escape-patterns.result.js | 0 .../jsx/escape-patterns.src.js | 0 ...invalid-attribute-missing-equals.result.js | 0 .../invalid-attribute-missing-equals.src.js | 0 .../jsx/invalid-attribute.result.js | 0 .../jsx/invalid-attribute.src.js | 0 .../jsx/invalid-broken-tag.result.js | 0 .../jsx/invalid-broken-tag.src.js | 0 .../invalid-computed-end-tag-name.result.js | 0 .../jsx/invalid-computed-end-tag-name.src.js | 0 ...lid-computed-string-end-tag-name.result.js | 0 ...nvalid-computed-string-end-tag-name.src.js | 0 .../jsx/invalid-embedded-expression.result.js | 0 .../jsx/invalid-embedded-expression.src.js | 0 .../invalid-leading-dot-tag-name.result.js | 0 .../jsx/invalid-leading-dot-tag-name.src.js | 0 ...ching-placeholder-in-closing-tag.result.js | 0 ...matching-placeholder-in-closing-tag.src.js | 0 .../invalid-mismatched-closing-tag.result.js | 0 .../jsx/invalid-mismatched-closing-tag.src.js | 0 .../invalid-mismatched-closing-tags.result.js | 0 .../invalid-mismatched-closing-tags.src.js | 0 .../invalid-mismatched-dot-tag-name.result.js | 0 .../invalid-mismatched-dot-tag-name.src.js | 0 ...invalid-mismatched-namespace-tag.result.js | 0 .../invalid-mismatched-namespace-tag.src.js | 0 ...losing-tag-attribute-placeholder.result.js | 0 ...g-closing-tag-attribute-placeholder.src.js | 0 .../jsx/invalid-missing-closing-tag.result.js | 0 .../jsx/invalid-missing-closing-tag.src.js | 0 .../invalid-missing-namespace-name.result.js | 0 .../jsx/invalid-missing-namespace-name.src.js | 0 .../invalid-missing-namespace-value.result.js | 0 .../invalid-missing-namespace-value.src.js | 0 .../invalid-missing-spread-operator.result.js | 0 .../invalid-missing-spread-operator.src.js | 0 ...nvalid-namespace-name-with-docts.result.js | 0 .../invalid-namespace-name-with-docts.src.js | 0 ...nvalid-namespace-value-with-dots.result.js | 0 .../invalid-namespace-value-with-dots.src.js | 0 ...id-no-common-parent-with-comment.result.js | 0 ...valid-no-common-parent-with-comment.src.js | 0 .../jsx/invalid-no-common-parent.result.js | 0 .../jsx/invalid-no-common-parent.src.js | 0 .../jsx/invalid-no-tag-name.result.js | 0 .../jsx/invalid-no-tag-name.src.js | 0 ...valid-placeholder-in-closing-tag.result.js | 0 .../invalid-placeholder-in-closing-tag.src.js | 0 .../invalid-trailing-dot-tag-name.result.js | 0 .../jsx/invalid-trailing-dot-tag-name.src.js | 0 .../jsx/invalid-unexpected-comma.result.js | 0 .../jsx/invalid-unexpected-comma.src.js | 0 .../jsx/japanese-characters.result.js | 0 .../jsx/japanese-characters.src.js | 0 .../jsx/less-than-operator.result.js | 0 .../jsx/less-than-operator.src.js | 0 .../jsx/multiple-blank-spaces.result.js | 0 .../jsx/multiple-blank-spaces.src.js | 0 ...ced-attribute-and-value-inserted.result.js | 0 ...spaced-attribute-and-value-inserted.src.js | 0 .../namespaced-name-and-attribute.result.js | 0 .../jsx/namespaced-name-and-attribute.src.js | 0 .../jsx/newslines-and-entities.result.js | 0 .../jsx/newslines-and-entities.src.js | 0 .../jsx/self-closing-tag-inside-tag.result.js | 0 .../jsx/self-closing-tag-inside-tag.src.js | 3 + .../self-closing-tag-with-newline.result.js | 0 .../jsx/self-closing-tag-with-newline.src.js | 0 .../jsx/self-closing-tag.result.js | 0 .../jsx/self-closing-tag.src.js | 0 ...-attribute-and-regular-attribute.result.js | 0 ...tor-attribute-and-regular-attribute.src.js | 0 .../jsx/spread-operator-attributes.result.js | 0 .../jsx/spread-operator-attributes.src.js | 0 .../jsx/tag-names-with-dots.result.js | 0 .../jsx/tag-names-with-dots.src.js | 0 .../jsx/tag-names-with-multi-dots.result.js | 0 .../jsx/tag-names-with-multi-dots.src.js | 0 .../jsx/test-content.result.js | 0 .../tests/fixtures/jsx/test-content.src.js | 1 + ...ailing-spread-operator-attribute.result.js | 0 .../trailing-spread-operator-attribute.src.js | 0 .../jsx/unknown-escape-pattern.result.js | 0 .../jsx/unknown-escape-pattern.src.js | 0 .../tests/lib/ecma-features.js | 7 - .../typescript-eslint-parser/tests/lib/jsx.js | 109 +++++ 105 files changed, 905 insertions(+), 15 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features/jsx => jsx-useJSXTextNode}/self-closing-tag-inside-tag.src.js (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features/jsx => jsx-useJSXTextNode}/test-content.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/attributes.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/attributes.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-comment.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-comment.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-conditional.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-conditional.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-invalid-js-identifier.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-invalid-js-identifier.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-tags.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/embedded-tags.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/empty-placeholder.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/empty-placeholder.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/escape-patterns.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/escape-patterns.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-attribute-missing-equals.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-attribute-missing-equals.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-attribute.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-attribute.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-broken-tag.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-broken-tag.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-computed-end-tag-name.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-computed-end-tag-name.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-computed-string-end-tag-name.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-computed-string-end-tag-name.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-embedded-expression.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-embedded-expression.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-leading-dot-tag-name.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-leading-dot-tag-name.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-matching-placeholder-in-closing-tag.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-matching-placeholder-in-closing-tag.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-closing-tag.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-closing-tag.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-closing-tags.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-closing-tags.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-dot-tag-name.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-dot-tag-name.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-namespace-tag.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-mismatched-namespace-tag.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-closing-tag.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-closing-tag.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-namespace-name.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-namespace-name.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-namespace-value.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-namespace-value.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-spread-operator.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-missing-spread-operator.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-namespace-name-with-docts.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-namespace-name-with-docts.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-namespace-value-with-dots.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-namespace-value-with-dots.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-no-common-parent-with-comment.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-no-common-parent-with-comment.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-no-common-parent.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-no-common-parent.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-no-tag-name.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-no-tag-name.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-placeholder-in-closing-tag.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-placeholder-in-closing-tag.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-trailing-dot-tag-name.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-trailing-dot-tag-name.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-unexpected-comma.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/invalid-unexpected-comma.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/japanese-characters.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/japanese-characters.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/less-than-operator.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/less-than-operator.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/multiple-blank-spaces.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/multiple-blank-spaces.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/namespaced-attribute-and-value-inserted.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/namespaced-attribute-and-value-inserted.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/namespaced-name-and-attribute.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/namespaced-name-and-attribute.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/newslines-and-entities.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/newslines-and-entities.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/self-closing-tag-inside-tag.result.js (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.src.js rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/self-closing-tag-with-newline.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/self-closing-tag-with-newline.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/self-closing-tag.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/self-closing-tag.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/spread-operator-attribute-and-regular-attribute.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/spread-operator-attribute-and-regular-attribute.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/spread-operator-attributes.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/spread-operator-attributes.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/tag-names-with-dots.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/tag-names-with-dots.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/tag-names-with-multi-dots.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/tag-names-with-multi-dots.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/test-content.result.js (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.src.js rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/trailing-spread-operator-attribute.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/trailing-spread-operator-attribute.src.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/unknown-escape-pattern.result.js (100%) rename packages/typescript-eslint-parser/tests/fixtures/{ecma-features => }/jsx/unknown-escape-pattern.src.js (100%) create mode 100644 packages/typescript-eslint-parser/tests/lib/jsx.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 0ee75f64795b..066dc4797747 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -56,7 +56,8 @@ module.exports = (ast, extra) => { parent: null, ast, additionalOptions: { - errorOnUnknownASTType: extra.errorOnUnknownASTType || false + errorOnUnknownASTType: extra.errorOnUnknownASTType || false, + useJSXTextNode: extra.useJSXTextNode || false } }); diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 24f16fa6ad23..f86776303468 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1613,16 +1613,25 @@ module.exports = function convert(config) { } + /** + * The JSX AST changed the node type for string literals + * inside a JSX Element from `Literal` to `JSXText`. We + * provide a flag to support both types until `Literal` + * node type is deprecated in ESLint v5. + */ case SyntaxKind.JsxText: { - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - value: ast.text.slice(node.pos, node.end), - raw: ast.text.slice(node.pos, node.end) - }); - const start = node.getFullStart(); const end = node.getEnd(); + const type = (additionalOptions.useJSXTextNode) + ? AST_NODE_TYPES.JSXText : AST_NODE_TYPES.Literal; + + Object.assign(result, { + type, + value: ast.text.slice(start, end), + raw: ast.text.slice(start, end) + }); + result.loc = nodeUtils.getLocFor(start, end, ast); result.range = [start, end]; diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 455333f40624..0c38df51eac9 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -48,7 +48,8 @@ function resetExtra() { tolerant: false, errors: [], strict: false, - ecmaFeatures: {} + ecmaFeatures: {}, + useJSXTextNode: false }; } @@ -104,6 +105,10 @@ function parse(code, options) { extra.errorOnUnknownASTType = true; } + if (typeof options.useJSXTextNode === "boolean" && options.useJSXTextNode) { + extra.useJSXTextNode = true; + } + } // Even if jsx option is set in typescript compiler, filename still has to diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js new file mode 100644 index 000000000000..50f3a5235009 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js @@ -0,0 +1,458 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "expression": { + "type": "JSXElement", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "selfClosing": false, + "name": { + "type": "JSXIdentifier", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "div" + }, + "attributes": [] + }, + "closingElement": { + "type": "JSXClosingElement", + "range": [ + 18, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + }, + "name": { + "type": "JSXIdentifier", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + }, + "name": "div" + } + }, + "children": [ + { + "type": "JSXText", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n ", + "raw": "\n " + }, + { + "type": "JSXElement", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 10, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "selfClosing": true, + "name": { + "type": "JSXIdentifier", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "foo" + }, + "attributes": [] + }, + "closingElement": null, + "children": [] + }, + { + "type": "JSXText", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 3, + "column": 0 + } + }, + "value": "\n", + "raw": "\n" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "JSXText", + "value": "\n ", + "range": [ + 5, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "JSXIdentifier", + "value": "foo", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "JSXText", + "value": "\n", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 3, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "JSXIdentifier", + "value": "div", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js new file mode 100644 index 000000000000..d3dc1df9a3a4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js @@ -0,0 +1,311 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "expression": { + "type": "JSXElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "openingElement": { + "type": "JSXOpeningElement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ], + "attributes": [], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "name": "div" + }, + "selfClosing": false + }, + "closingElement": { + "type": "JSXClosingElement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 18, + 24 + ], + "name": { + "type": "JSXIdentifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ], + "name": "div" + } + }, + "children": [ + { + "type": "JSXText", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 5, + 18 + ], + "value": "@test content", + "raw": "@test content" + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "JSXText", + "value": "@test content", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 5, + 18 + ] + }, + { + "type": "Punctuator", + "value": "<", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "/", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "JSXIdentifier", + "value": "div", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 20, + 23 + ] + }, + { + "type": "Punctuator", + "value": ">", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/attributes.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-comment.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-conditional.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-invalid-js-identifier.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/embedded-tags.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/empty-placeholder.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/escape-patterns.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute-missing-equals.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-attribute.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-broken-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-end-tag-name.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-computed-string-end-tag-name.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-embedded-expression.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-leading-dot-tag-name.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-matching-placeholder-in-closing-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-closing-tags.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-dot-tag-name.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-mismatched-namespace-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-closing-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-name.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-namespace-value.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-missing-spread-operator.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-name-with-docts.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-namespace-value-with-dots.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent-with-comment.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-common-parent.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-no-tag-name.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-placeholder-in-closing-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-trailing-dot-tag-name.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/invalid-unexpected-comma.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/japanese-characters.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/less-than-operator.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/multiple-blank-spaces.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-attribute-and-value-inserted.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/namespaced-name-and-attribute.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/newslines-and-entities.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-inside-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.src.js new file mode 100644 index 000000000000..b1b254055e2e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.src.js @@ -0,0 +1,3 @@ +
+ +
diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag-with-newline.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/self-closing-tag.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attribute-and-regular-attribute.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/spread-operator-attributes.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-dots.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/tag-names-with-multi-dots.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/test-content.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.src.js new file mode 100644 index 000000000000..ffaed57254f4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.src.js @@ -0,0 +1 @@ +
@test content
; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/trailing-spread-operator-attribute.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.src.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.result.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.src.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/jsx/unknown-escape-pattern.src.js rename to packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.src.js diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 8813690c03d1..b698ac96d256 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -26,15 +26,8 @@ const FIXTURES_DIR = "./tests/fixtures/ecma-features"; // var FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix"; -const filesWithOutsandingTSIssues = [ - "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 - "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 - "jsx/namespaced-name-and-attribute" // https://github.com/Microsoft/TypeScript/issues/7411 -]; - const testFiles = shelljs.find(FIXTURES_DIR) .filter(filename => filename.indexOf(".src.js") > -1) - .filter(filename => filesWithOutsandingTSIssues.every(fileName => filename.indexOf(fileName) === -1)) // strip off ".src.js" .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)) .filter(filename => !(/error-|invalid-|globalReturn/.test(filename))); diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.js b/packages/typescript-eslint-parser/tests/lib/jsx.js new file mode 100644 index 000000000000..38f615ec4e7e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/jsx.js @@ -0,0 +1,109 @@ +/** + * @fileoverview Tests for ECMA feature flags + * @author Nicholas C. Zakas + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const assert = require("chai").assert, + leche = require("leche"), + path = require("path"), + parser = require("../../parser"), + shelljs = require("shelljs"), + tester = require("./tester"); + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +const JSX_FIXTURES_DIR = "./tests/fixtures/jsx"; + +const filesWithOutsandingTSIssues = [ + "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 + "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 + "jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411 + "jsx/invalid-namespace-value-with-dots" // https://github.com/Microsoft/TypeScript/issues/7411 +]; + +const jsxTestFiles = shelljs.find(JSX_FIXTURES_DIR) + .filter(filename => filename.indexOf(".src.js") > -1) + .filter(filename => filesWithOutsandingTSIssues.every(fileName => filename.indexOf(fileName) === -1)) + // strip off ".src.js" + .map(filename => filename.substring(JSX_FIXTURES_DIR.length - 1, filename.length - 7)); + +const JSX_JSXTEXT_FIXTURES_DIR = "./tests/fixtures/jsx-useJSXTextNode"; + +const jsxTextTestFiles = shelljs.find(JSX_JSXTEXT_FIXTURES_DIR) + .filter(filename => filename.indexOf(".src.js") > -1) + // strip off ".src.js" + .map(filename => filename.substring(JSX_JSXTEXT_FIXTURES_DIR.length - 1, filename.length - 7)); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("JSX", () => { + + let config; + + beforeEach(() => { + config = { + loc: true, + range: true, + tokens: true, + errorOnUnknownASTType: true, + ecmaFeatures: { + jsx: true + } + }; + }); + + /** + * Test each fixture file + * @param {string} fixturesDir Fixtures Directory + * @param {boolean} useJSXTextNode Use JSX Text Node + * @returns {void} + */ + function testFixture(fixturesDir, useJSXTextNode) { + + return filename => { + // Uncomment and fill in filename to focus on a single file + // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; + const code = shelljs.cat(`${path.resolve(fixturesDir, filename)}.src.js`); + + it(`should parse correctly when ${filename} is true`, () => { + config.useJSXTextNode = useJSXTextNode; + const expected = require(`${path.resolve(__dirname, "../../", fixturesDir, filename)}.result.js`); + let result; + + try { + result = parser.parse(code, config); + result = tester.getRaw(result); + } catch (ex) { + + // format of error isn't exactly the same, just check if it's expected + if (expected.message) { + return; + } + throw ex; + + + } + assert.deepEqual(result, expected); + }); + }; + } + + describe("useJSXTextNode: false", () => { + leche.withData(jsxTestFiles, testFixture(JSX_FIXTURES_DIR, false)); + }); + describe("useJSXTextNode: true", () => { + leche.withData(jsxTextTestFiles, testFixture(JSX_JSXTEXT_FIXTURES_DIR, true)); + }); +}); From a5892260c1bc19c2d70ef2457e787cb48725030b Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 21 May 2017 21:21:38 +0100 Subject: [PATCH 149/326] Fix: Convert type guards (fixes #282) (#283) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 8 + .../typescript/basics/type-guard.result.js | 627 ++++++++++++++++++ .../typescript/basics/type-guard.src.ts | 3 + 4 files changed, 639 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index e7f5052dd28f..37f2848361d8 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -122,6 +122,7 @@ module.exports = { TSQuestionToken: "TSQuestionToken", TSStringKeyword: "TSStringKeyword", TSTypeLiteral: "TSTypeLiteral", + TSTypePredicate: "TSTypePredicate", TSTypeReference: "TSTypeReference", TSUnionType: "TSUnionType", TSVoidKeyword: "TSVoidKeyword", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index f86776303468..d58774bd2d57 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1733,6 +1733,14 @@ module.exports = function convert(config) { } + case SyntaxKind.FirstTypeNode: + Object.assign(result, { + type: AST_NODE_TYPES.TSTypePredicate, + parameterName: convertChild(node.parameterName), + typeAnnotation: convertTypeAnnotation(node.type) + }); + break; + default: deeplyCopy(); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js new file mode 100644 index 000000000000..38131df1ef41 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js @@ -0,0 +1,627 @@ +module.exports = { + "body": [{ + "async": false, + "body": { + "body": [{ + "argument": { + "left": { + "argument": { + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 18, + "line": 2 + } + }, + "name": "x", + "range": [ + 59, + 60 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "operator": "typeof", + "prefix": true, + "range": [ + 52, + 60 + ], + "type": "UnaryExpression" + }, + "loc": { + "end": { + "column": 32, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "operator": "===", + "range": [ + 52, + 73 + ], + "right": { + "loc": { + "end": { + "column": 32, + "line": 2 + }, + "start": { + "column": 24, + "line": 2 + } + }, + "range": [ + 65, + 73 + ], + "raw": "'string'", + "type": "Literal", + "value": "string" + }, + "type": "BinaryExpression" + }, + "loc": { + "end": { + "column": 32, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 45, + 73 + ], + "type": "ReturnStatement" + }], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 39, + "line": 1 + } + }, + "range": [ + 39, + 75 + ], + "type": "BlockStatement" + }, + "expression": false, + "generator": false, + "id": { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "name": "isString", + "range": [ + 9, + 17 + ], + "type": "Identifier" + }, + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "params": [{ + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "name": "x", + "range": [ + 18, + 19 + ], + "type": "Identifier", + "typeAnnotation": { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 24 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 24 + ], + "type": "TSAnyKeyword" + } + } + }], + "range": [ + 0, + 75 + ], + "returnType": { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 27, + "line": 1 + } + }, + "range": [ + 27, + 38 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 27, + "line": 1 + } + }, + "parameterName": { + "loc": { + "end": { + "column": 28, + "line": 1 + }, + "start": { + "column": 27, + "line": 1 + } + }, + "name": "x", + "range": [ + 27, + 28 + ], + "type": "Identifier" + }, + "range": [ + 27, + 38 + ], + "type": "TSTypePredicate", + "typeAnnotation": { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 38 + ], + "type": "TypeAnnotation", + "typeAnnotation": { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 38 + ], + "type": "TSStringKeyword" + } + } + } + }, + "type": "FunctionDeclaration" + }], + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 75 + ], + "sourceType": "script", + "tokens": [{ + "loc": { + "end": { + "column": 8, + "line": 1 + }, + "start": { + "column": 0, + "line": 1 + } + }, + "range": [ + 0, + 8 + ], + "type": "Keyword", + "value": "function" + }, + { + "loc": { + "end": { + "column": 17, + "line": 1 + }, + "start": { + "column": 9, + "line": 1 + } + }, + "range": [ + 9, + 17 + ], + "type": "Identifier", + "value": "isString" + }, + { + "loc": { + "end": { + "column": 18, + "line": 1 + }, + "start": { + "column": 17, + "line": 1 + } + }, + "range": [ + 17, + 18 + ], + "type": "Punctuator", + "value": "(" + }, + { + "loc": { + "end": { + "column": 19, + "line": 1 + }, + "start": { + "column": 18, + "line": 1 + } + }, + "range": [ + 18, + 19 + ], + "type": "Identifier", + "value": "x" + }, + { + "loc": { + "end": { + "column": 20, + "line": 1 + }, + "start": { + "column": 19, + "line": 1 + } + }, + "range": [ + 19, + 20 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 24, + "line": 1 + }, + "start": { + "column": 21, + "line": 1 + } + }, + "range": [ + 21, + 24 + ], + "type": "Identifier", + "value": "any" + }, + { + "loc": { + "end": { + "column": 25, + "line": 1 + }, + "start": { + "column": 24, + "line": 1 + } + }, + "range": [ + 24, + 25 + ], + "type": "Punctuator", + "value": ")" + }, + { + "loc": { + "end": { + "column": 26, + "line": 1 + }, + "start": { + "column": 25, + "line": 1 + } + }, + "range": [ + 25, + 26 + ], + "type": "Punctuator", + "value": ":" + }, + { + "loc": { + "end": { + "column": 28, + "line": 1 + }, + "start": { + "column": 27, + "line": 1 + } + }, + "range": [ + 27, + 28 + ], + "type": "Identifier", + "value": "x" + }, + { + "loc": { + "end": { + "column": 31, + "line": 1 + }, + "start": { + "column": 29, + "line": 1 + } + }, + "range": [ + 29, + 31 + ], + "type": "Identifier", + "value": "is" + }, + { + "loc": { + "end": { + "column": 38, + "line": 1 + }, + "start": { + "column": 32, + "line": 1 + } + }, + "range": [ + 32, + 38 + ], + "type": "Identifier", + "value": "string" + }, + { + "loc": { + "end": { + "column": 40, + "line": 1 + }, + "start": { + "column": 39, + "line": 1 + } + }, + "range": [ + 39, + 40 + ], + "type": "Punctuator", + "value": "{" + }, + { + "loc": { + "end": { + "column": 10, + "line": 2 + }, + "start": { + "column": 4, + "line": 2 + } + }, + "range": [ + 45, + 51 + ], + "type": "Keyword", + "value": "return" + }, + { + "loc": { + "end": { + "column": 17, + "line": 2 + }, + "start": { + "column": 11, + "line": 2 + } + }, + "range": [ + 52, + 58 + ], + "type": "Keyword", + "value": "typeof" + }, + { + "loc": { + "end": { + "column": 19, + "line": 2 + }, + "start": { + "column": 18, + "line": 2 + } + }, + "range": [ + 59, + 60 + ], + "type": "Identifier", + "value": "x" + }, + { + "loc": { + "end": { + "column": 23, + "line": 2 + }, + "start": { + "column": 20, + "line": 2 + } + }, + "range": [ + 61, + 64 + ], + "type": "Punctuator", + "value": "===" + }, + { + "loc": { + "end": { + "column": 32, + "line": 2 + }, + "start": { + "column": 24, + "line": 2 + } + }, + "range": [ + 65, + 73 + ], + "type": "String", + "value": "'string'" + }, + { + "loc": { + "end": { + "column": 1, + "line": 3 + }, + "start": { + "column": 0, + "line": 3 + } + }, + "range": [ + 74, + 75 + ], + "type": "Punctuator", + "value": "}" + } + ], + "type": "Program" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.src.ts new file mode 100644 index 000000000000..cd0aad9a869c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.src.ts @@ -0,0 +1,3 @@ +function isString(x: any): x is string { + return typeof x === 'string' +} \ No newline at end of file From ce8a48bc313d2f5fab29ec0b7fba8e765da933e8 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Tue, 23 May 2017 08:09:31 -0500 Subject: [PATCH 150/326] Fix: Set node type to ExperimentalRestProperty (fixes #276) (#279) --- .../typescript-eslint-parser/lib/convert.js | 50 +- .../arg-spread.result.js | 409 ++++++++ .../arg-spread.src.js | 1 + .../destructuring-assign-mirror.result.js | 549 ++++++++++ .../destructuring-assign-mirror.src.js | 1 + ...function-parameter-object-spread.result.js | 316 ++++++ .../function-parameter-object-spread.src.js | 1 + .../invalid-rest-trailing-comma.result.js | 6 + .../invalid-rest-trailing-comma.src.js | 1 + .../invalid-rest.result.js | 6 + .../invalid-rest.src.js | 1 + .../object-rest.result.js | 984 ++++++++++++++++++ .../object-rest.src.js | 1 + .../property-spread.result.js | 4 +- .../shorthand-method-args.result.js | 629 +++++++++++ .../shorthand-method-args.src.js | 5 + .../shorthand-methods.result.js | 688 ++++++++++++ .../shorthand-methods.src.js | 5 + .../shorthand-properties.result.js | 715 +++++++++++++ .../shorthand-properties.src.js | 9 + .../single-spread.result.js | 4 +- .../spread-trailing-comma.result.js | 405 +++++++ .../spread-trailing-comma.src.js | 1 + .../two-spread.result.js | 6 +- 24 files changed, 4778 insertions(+), 19 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.src.js diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index d58774bd2d57..8bd3cf7f947f 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -930,17 +930,26 @@ module.exports = function convert(config) { } else { return arrayItem; } - } else { + } else if (parent.kind === SyntaxKind.ObjectBindingPattern) { - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.propertyName || node.name), - value: convertChild(node.name), - computed: false, - method: false, - shorthand: !node.propertyName, - kind: "init" - }); + if (node.dotDotDotToken) { + Object.assign(result, { + type: AST_NODE_TYPES.ExperimentalRestProperty, + argument: convertChild(node.propertyName || node.name), + computed: Boolean(node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName), + shorthand: !node.propertyName + }); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.propertyName || node.name), + value: convertChild(node.name), + computed: Boolean(node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName), + method: false, + shorthand: !node.propertyName, + kind: "init" + }); + } if (node.initializer) { result.value = { @@ -951,7 +960,6 @@ module.exports = function convert(config) { loc: nodeUtils.getLocFor(node.name.getStart(), node.initializer.end, ast) }; } - } break; @@ -1053,12 +1061,30 @@ module.exports = function convert(config) { // Patterns case SyntaxKind.SpreadElement: - case SyntaxKind.SpreadAssignment: Object.assign(result, { type: AST_NODE_TYPES.SpreadElement, argument: convertChild(node.expression) }); break; + case SyntaxKind.SpreadAssignment: { + let type = AST_NODE_TYPES.ExperimentalSpreadProperty; + + if (node.parent && + node.parent.parent.kind === SyntaxKind.BinaryExpression + ) { + if (node.parent.parent.right === node.parent) { + type = AST_NODE_TYPES.ExperimentalSpreadProperty; + } else if (node.parent.parent.left === node.parent) { + type = AST_NODE_TYPES.ExperimentalRestProperty; + } + } + + Object.assign(result, { + type, + argument: convertChild(node.expression) + }); + break; + } case SyntaxKind.Parameter: { let parameter; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js new file mode 100644 index 000000000000..ca29de665400 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js @@ -0,0 +1,409 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "c" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 11, + 20 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "a" + } + }, + { + "type": "ExperimentalRestProperty", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 15, + 19 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "b" + }, + "shorthand": true, + "computed": false, + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 22, + 24 + ], + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.src.js new file mode 100644 index 000000000000..99da0c5393ec --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.src.js @@ -0,0 +1 @@ +function c({a, ...b}) {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js new file mode 100644 index 000000000000..49acb2b8a96d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js @@ -0,0 +1,549 @@ +module.exports = { + "type": "Program", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ObjectPattern", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "ExperimentalRestProperty", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + } + ], + "range": [ + 1, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "value": { + "type": "Identifier", + "name": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "kind": "init", + "method": false, + "shorthand": true, + "computed": false, + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "ExperimentalSpreadProperty", + "argument": { + "type": "Identifier", + "name": "b", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 21 + } + } + } + ], + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 1, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ], + "sourceType": "script", + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 5, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 15, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.src.js new file mode 100644 index 000000000000..0caa3fab4a96 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.src.js @@ -0,0 +1 @@ +({a, ...b} = {a, ...b}) diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js new file mode 100644 index 000000000000..23c70b6e1de2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js @@ -0,0 +1,316 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "name": "foo" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "range": [ + 13, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "properties": [ + { + "type": "ExperimentalRestProperty", + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "argument": { + "type": "Identifier", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "name": "bar" + }, + "computed": false, + "shorthand": true + } + ] + } + ], + "body": { + "type": "BlockStatement", + "range": [ + 23, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 9, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "...", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.src.js new file mode 100644 index 000000000000..29fda8e4a120 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.src.js @@ -0,0 +1 @@ +function foo({...bar}) { } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js new file mode 100644 index 000000000000..741ae54b1a61 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js @@ -0,0 +1,6 @@ +module.exports = { + index: 16, + lineNumber: 1, + column: 17, + message: "Unexpected trailing comma after rest property" +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js new file mode 100644 index 000000000000..39ef542fe289 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js @@ -0,0 +1 @@ +var { x, y, ...z, } = foo; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js new file mode 100644 index 000000000000..c18a2de41f29 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 18, + "lineNumber": 1, + "column": 19, + "message": "Unexpected token ." +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.src.js new file mode 100644 index 000000000000..a38d92cf9298 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.src.js @@ -0,0 +1 @@ +var { x, y, ...foo.bar } = { x: 1, y: 2, a: 3, b: 4 }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js new file mode 100644 index 000000000000..8ee8eae3e9aa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js @@ -0,0 +1,984 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 0, + 48 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 0, + 48 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 4, + 47 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 4, + 18 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "x" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "y" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "y" + } + }, + { + "type": "ExperimentalRestProperty", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 12, + 16 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "z" + }, + "shorthand": true, + "computed": false, + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 21, + 47 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 23, + 27 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ], + "name": "x" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ], + "value": 1, + "raw": "1" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 29, + 33 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ], + "name": "y" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ], + "value": 2, + "raw": "2" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 35, + 39 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ], + "name": "a" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ], + "value": 3, + "raw": "3" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 41, + 45 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ], + "name": "b" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ], + "value": 4, + "raw": "4" + }, + "kind": "init" + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Numeric", + "value": "2", + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "range": [ + 35, + 36 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Numeric", + "value": "3", + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + }, + "range": [ + 38, + 39 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 39, + 40 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + }, + "range": [ + 41, + 42 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + }, + "range": [ + 42, + 43 + ] + }, + { + "type": "Numeric", + "value": "4", + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 + } + }, + "range": [ + 44, + 45 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 46 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "range": [ + 46, + 47 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "range": [ + 47, + 48 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.src.js new file mode 100644 index 000000000000..4d733791c65d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.src.js @@ -0,0 +1 @@ +var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js index 8895201efd2e..25637c84f674 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js @@ -326,7 +326,7 @@ module.exports = { "kind": "init" }, { - "type": "SpreadElement", + "type": "ExperimentalSpreadProperty", "loc": { "start": { "line": 8, @@ -856,4 +856,4 @@ module.exports = { ] } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js new file mode 100644 index 000000000000..35e97e3f2d09 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js @@ -0,0 +1,629 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [0, 108], + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "initialize", + "range": [ + 7, + 17 + ], + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "id": null, + "async": false, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 46 + } + }, + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "name": "someVar", + "range": [ + 19, + 26 + ], + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "name": "someVar", + "range": [ + 19, + 26 + ], + }, + "range": [ + 19, + 26 + ], + }, + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "name": "otherVar", + "range": [ + 28, + 36 + ], + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "name": "otherVar", + "range": [ + 28, + 36 + ], + }, + "range": [ + 28, + 36 + ], + }, + { + "type": "ExperimentalRestProperty", + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "name": "options", + "range": [ + 41, + 48 + ], + }, + "shorthand": true, + "computed": false, + "range": [ + 38, + 48 + ] + } + ], + "range": [ + 18, + 49 + ], + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [], + "range": [ + 51, + 104 + ], + }, + "range": [ + 17, + 104 + ], + }, + "range": [ + 7, + 104 + ], + } + ], + "range": [ + 1, + 106 + ], + }, + "range": [ + 0, + 108 + ], + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "initialize", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 7, + 17 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Identifier", + "value": "someVar", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 19, + 26 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Identifier", + "value": "otherVar", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "range": [ + 28, + 36 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "range": [ + 38, + 41 + ] + }, + { + "type": "Identifier", + "value": "options", + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "range": [ + 41, + 48 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 46 + } + }, + "range": [ + 48, + 49 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 47 + } + }, + "range": [ + 49, + 50 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + }, + "range": [ + 51, + 52 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 103, + 104 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 105, + 106 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 106, + 107 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 107, + 108 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.src.js new file mode 100644 index 000000000000..4247e4a5494d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.src.js @@ -0,0 +1,5 @@ +({ + initialize({someVar, otherVar, ...options}) { + // ... do some stuff with options ... + } +}); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js new file mode 100644 index 000000000000..ce598f4e7662 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js @@ -0,0 +1,688 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 114 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 0, + 114 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 4, + 113 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 8, + 113 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 14, + 111 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 14, + 24 + ], + "name": "initialize" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 24, + 111 + ], + "id": null, + "async": false, + "generator": false, + "expression": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 46 + } + }, + "range": [ + 25, + 56 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 26, + 33 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 26, + 33 + ], + "name": "someVar" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 26, + 33 + ], + "name": "someVar" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "range": [ + 35, + 43 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "range": [ + 35, + 43 + ], + "name": "otherVar" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "range": [ + 35, + 43 + ], + "name": "otherVar" + } + }, + { + "type": "ExperimentalRestProperty", + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "range": [ + 45, + 55 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "range": [ + 48, + 55 + ], + "name": "options" + }, + "shorthand": true, + "computed": false, + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 58, + 111 + ], + "body": [] + } + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "initialize", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "range": [ + 14, + 24 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Identifier", + "value": "someVar", + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "range": [ + 26, + 33 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Identifier", + "value": "otherVar", + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "range": [ + 35, + 43 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "range": [ + 43, + 44 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "range": [ + 45, + 48 + ] + }, + { + "type": "Identifier", + "value": "options", + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 45 + } + }, + "range": [ + 48, + 55 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 46 + } + }, + "range": [ + 55, + 56 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 2, + "column": 47 + } + }, + "range": [ + 56, + 57 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 49 + } + }, + "range": [ + 58, + 59 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "range": [ + 110, + 111 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "range": [ + 112, + 113 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "range": [ + 113, + 114 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.src.js new file mode 100644 index 000000000000..2eb0d18f575b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.src.js @@ -0,0 +1,5 @@ +var x = { + initialize({someVar, otherVar, ...options}) { + // ... do some stuff with options ... + } +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js new file mode 100644 index 000000000000..9b861afb8421 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js @@ -0,0 +1,715 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 0, + 69 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 0, + 26 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ], + "name": "get" + }, + "init": null + }, + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ], + "name": "set" + }, + "init": null + } + ], + "kind": "var" + }, + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 28, + 69 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 32, + 68 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ], + "name": "x" + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 36, + 68 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "name": "foo" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ], + "name": "foo" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ], + "name": "get" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ], + "name": "get" + } + }, + { + "type": "ExperimentalSpreadProperty", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 60, + 66 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 63, + 66 + ], + "name": "set" + } + } + ] + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "range": [ + 22, + 25 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "range": [ + 28, + 31 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 7 + } + }, + "range": [ + 34, + 35 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + }, + "range": [ + 36, + 37 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 7 + } + }, + "range": [ + 42, + 45 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + }, + "range": [ + 45, + 46 + ] + }, + { + "type": "Identifier", + "value": "get", + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 7 + } + }, + "range": [ + 51, + 54 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + }, + "range": [ + 54, + 55 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "range": [ + 60, + 63 + ] + }, + { + "type": "Identifier", + "value": "set", + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 10 + } + }, + "range": [ + 63, + 66 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "range": [ + 67, + 68 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + }, + "range": [ + 68, + 69 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.src.js new file mode 100644 index 000000000000..11d8c39bfa8b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.src.js @@ -0,0 +1,9 @@ +var foo, + get, + set; + +var x = { + foo, + get, + ...set +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js index 573b616a212f..f2afb48d3de8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js @@ -326,7 +326,7 @@ module.exports = { "kind": "init" }, { - "type": "SpreadElement", + "type": "ExperimentalSpreadProperty", "loc": { "start": { "line": 8, @@ -784,4 +784,4 @@ module.exports = { ] } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js new file mode 100644 index 000000000000..b882e2b5242e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js @@ -0,0 +1,405 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 1, + 16 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "a" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "b" + } + }, + { + "type": "ExperimentalSpreadProperty", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 9, + 13 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "c" + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 9, + 12 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.src.js new file mode 100644 index 000000000000..a2841df60224 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.src.js @@ -0,0 +1 @@ +({ a, b, ...c, }) diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js index 28044a0ee779..15a023481c19 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js @@ -269,7 +269,7 @@ module.exports = { "kind": "init" }, { - "type": "SpreadElement", + "type": "ExperimentalSpreadProperty", "loc": { "start": { "line": 7, @@ -304,7 +304,7 @@ module.exports = { } }, { - "type": "SpreadElement", + "type": "ExperimentalSpreadProperty", "loc": { "start": { "line": 8, @@ -744,4 +744,4 @@ module.exports = { ] } ] -}; +}; \ No newline at end of file From 6f4ced9325cefdf8f5a891b503bc9e61ae645766 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Thu, 25 May 2017 04:17:45 -0500 Subject: [PATCH 151/326] Fix: Create RegExp object for RegExp literals (fixes #287) (#291) --- .../typescript-eslint-parser/lib/convert.js | 19 +- .../regex/regexp-simple.result.js | 194 ++++++++++++++++++ .../ecma-features/regex/regexp-simple.src.js | 1 + ...egex-u-extended-escape.supported.result.js | 194 ++++++++++++++++++ ...x-u-extended-escape.unsupported.result.js} | 0 .../regex-u-simple.supported.result.js | 194 ++++++++++++++++++ ...s => regex-u-simple.unsupported.result.js} | 0 .../regexp-y-simple.supported.result.js | 194 ++++++++++++++++++ ... => regexp-y-simple.unsupported.result.js} | 0 .../tests/lib/ecma-features.js | 21 +- 10 files changed, 812 insertions(+), 5 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/{regex-u-extended-escape.result.js => regex-u-extended-escape.unsupported.result.js} (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/{regex-u-simple.result.js => regex-u-simple.unsupported.result.js} (100%) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js rename packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/{regexp-y-simple.result.js => regexp-y-simple.unsupported.result.js} (100%) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 8bd3cf7f947f..d9d76264b3a7 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1507,17 +1507,28 @@ module.exports = function convert(config) { }); break; - case SyntaxKind.RegularExpressionLiteral: + case SyntaxKind.RegularExpressionLiteral: { + const pattern = node.text.slice(1, node.text.lastIndexOf("/")); + const flags = node.text.slice(node.text.lastIndexOf("/") + 1); + + let regex = null; + try { + regex = new RegExp(pattern, flags); + } catch (exception) { + regex = null; + } + Object.assign(result, { type: AST_NODE_TYPES.Literal, - value: Number(node.text), + value: regex, raw: node.text, regex: { - pattern: node.text.slice(1, node.text.lastIndexOf("/")), - flags: node.text.slice(node.text.lastIndexOf("/") + 1) + pattern, + flags } }); break; + } case SyntaxKind.TrueKeyword: Object.assign(result, { diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js new file mode 100644 index 000000000000..e1d4f35dab99 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js @@ -0,0 +1,194 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "value": {}, + "raw": "/foo./", + "regex": { + "pattern": "foo.", + "flags": "" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "RegularExpression", + "value": "/foo./", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "regex": { + "flags": "", + "pattern": "foo." + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.src.js new file mode 100644 index 000000000000..68f882c4ed36 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.src.js @@ -0,0 +1 @@ +var foo = /foo./; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js new file mode 100644 index 000000000000..739842f0675a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js @@ -0,0 +1,194 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 0, + 41 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 0, + 41 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 4, + 40 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "x" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 8, + 40 + ], + "value": {}, + "raw": "/[\\u{0000000000000061}-\\u{7A}]/u", + "regex": { + "pattern": "[\\u{0000000000000061}-\\u{7A}]", + "flags": "u" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "RegularExpression", + "value": "/[\\u{0000000000000061}-\\u{7A}]/u", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "range": [ + 8, + 40 + ], + "regex": { + "flags": "u", + "pattern": "[\\u{0000000000000061}-\\u{7A}]" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + }, + "range": [ + 40, + 41 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.unsupported.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.result.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.unsupported.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js new file mode 100644 index 000000000000..8a2cb69f3120 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js @@ -0,0 +1,194 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "value": {}, + "raw": "/foo/u", + "regex": { + "pattern": "foo", + "flags": "u" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "RegularExpression", + "value": "/foo/u", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "regex": { + "flags": "u", + "pattern": "foo" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.unsupported.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.result.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.unsupported.result.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js new file mode 100644 index 000000000000..cf9a4251e2bc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js @@ -0,0 +1,194 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 4, + 16 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "name": "foo" + }, + "init": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "value": {}, + "raw": "/foo/y", + "regex": { + "pattern": "foo", + "flags": "y" + } + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "RegularExpression", + "value": "/foo/y", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 10, + 16 + ], + "regex": { + "flags": "y", + "pattern": "foo" + } + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.unsupported.result.js similarity index 100% rename from packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.result.js rename to packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.unsupported.result.js diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index b698ac96d256..51a1c65eac28 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -74,7 +74,26 @@ describe("ecmaFeatures", () => { it(`should parse correctly when ${feature} is true`, () => { config.ecmaFeatures[feature] = true; - const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); + let expected = null; + + const regexFilenames = [ + "regexYFlag/regexp-y-simple", + "regexUFlag/regex-u-simple", + "regexUFlag/regex-u-extended-escape" + ]; + if (regexFilenames.indexOf(filename) !== -1) { + const nodeVersions = process.versions; + const nodeVersionParts = nodeVersions.node.split("."); + const nodeMajorVersion = parseInt(nodeVersionParts[0], 10); + + if (nodeMajorVersion >= 6) { + expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.supported.result.js`); + } else { + expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.unsupported.result.js`); + } + } else { + expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); + } let result; try { From ba2af1069be9cedf67d3e889dca2c921516d6ec4 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 28 May 2017 05:35:16 -0500 Subject: [PATCH 152/326] Fix: Async generator method should be labeled (fixes #297) (#299) --- .../typescript-eslint-parser/lib/convert.js | 2 +- .../async-generator-function.result.js | 223 +++++++ .../async-generator-function.src.js | 4 + .../async-generator-method.result.js | 629 ++++++++++++++++++ .../generators/async-generator-method.src.js | 5 + 5 files changed, 862 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.src.js diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index d9d76264b3a7..88ebca96b0e5 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -704,7 +704,7 @@ module.exports = function convert(config) { method = { type: AST_NODE_TYPES.FunctionExpression, id: null, - generator: false, + generator: !!node.asteriskToken, expression: false, async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), body: convertChild(node.body), diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js new file mode 100644 index 000000000000..aca20ef842a1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js @@ -0,0 +1,223 @@ +module.exports = { + "type": "Program", + "range": [ + 1, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 1, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "foo" + }, + "generator": true, + "expression": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 4, + "column": 1 + } + }, + "body": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "async", + "range": [ + 1, + 6 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 7, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.src.js new file mode 100644 index 000000000000..59fbab7761a6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.src.js @@ -0,0 +1,4 @@ + +async function *foo() { + +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js new file mode 100644 index 000000000000..79bad53b1b71 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js @@ -0,0 +1,629 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "C" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 14, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "name": "f" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": true, + "expression": false, + "async": true, + "body": { + "type": "BlockStatement", + "range": [ + 26, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "range": [ + 36, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "range": [ + 42, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "name": "x" + }, + "init": { + "type": "YieldExpression", + "range": [ + 46, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "range": [ + 53, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 26 + } + }, + "name": "g" + }, + "arguments": [] + } + } + } + ], + "kind": "const" + } + ] + }, + "range": [ + 23, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 8, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "async", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "const", + "range": [ + 36, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "x", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Keyword", + "value": "yield", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "*", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.src.js new file mode 100644 index 000000000000..475794bf0c0b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.src.js @@ -0,0 +1,5 @@ +class C { + async * f() { + const x = yield* g(); + } +} From 30a2c05fa9a00a8eeacff99f46a5feeefb5312b9 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 28 May 2017 05:36:51 -0500 Subject: [PATCH 153/326] Fix: Unescape type parameter names (fixes #296) (#298) --- .../typescript-eslint-parser/lib/convert.js | 50 ++-- ...s-with-type-parameter-underscore.result.js | 242 ++++++++++++++++++ ...lass-with-type-parameter-underscore.src.ts | 1 + .../basics/nested-type-arguments.result.js | 8 +- 4 files changed, 264 insertions(+), 37 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 88ebca96b0e5..5564eae912db 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -108,27 +108,18 @@ module.exports = function convert(config) { lastTypeArgument.end + 1 ], loc: nodeUtils.getLocFor(firstTypeArgument.pos - 1, lastTypeArgument.end + 1, ast), - params: typeArguments.map(typeArgument => { - /** - * Have to manually calculate the start of the range, - * because TypeScript includes leading whitespace but Flow does not - */ - const typeArgumentStart = (typeArgument.typeName && typeArgument.typeName.text) - ? typeArgument.end - typeArgument.typeName.text.length - : typeArgument.pos; - return { - type: AST_NODE_TYPES.GenericTypeAnnotation, - range: [ - typeArgumentStart, - typeArgument.end - ], - loc: nodeUtils.getLocFor(typeArgumentStart, typeArgument.end, ast), - id: convertChild(typeArgument.typeName || typeArgument), - typeParameters: (typeArgument.typeArguments) - ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) - : null - }; - }) + params: typeArguments.map(typeArgument => ({ + type: AST_NODE_TYPES.GenericTypeAnnotation, + range: [ + typeArgument.getStart(), + typeArgument.getEnd() + ], + loc: nodeUtils.getLoc(typeArgument, ast), + id: convertChild(typeArgument.typeName || typeArgument), + typeParameters: (typeArgument.typeArguments) + ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) + : null + })) }; } @@ -148,14 +139,7 @@ module.exports = function convert(config) { ], loc: nodeUtils.getLocFor(firstTypeParameter.pos - 1, lastTypeParameter.end + 1, ast), params: typeParameters.map(typeParameter => { - - /** - * Have to manually calculate the start of the range, - * because TypeScript includes leading whitespace but Flow does not - */ - const typeParameterStart = (typeParameter.name && typeParameter.name.text) - ? typeParameter.name.end - typeParameter.name.text.length - : typeParameter.pos; + const name = nodeUtils.unescapeIdentifier(typeParameter.name.text); const defaultParameter = typeParameter.default ? convert({ node: typeParameter.default, parent: typeParameter, ast, additionalOptions }) @@ -164,11 +148,11 @@ module.exports = function convert(config) { return { type: AST_NODE_TYPES.TypeParameter, range: [ - typeParameterStart, - typeParameter.end + typeParameter.getStart(), + typeParameter.getEnd() ], - loc: nodeUtils.getLocFor(typeParameterStart, typeParameter.end, ast), - name: typeParameter.name.text, + loc: nodeUtils.getLoc(typeParameter, ast), + name, constraint: (typeParameter.constraint) ? convertTypeAnnotation(typeParameter.constraint) : null, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js new file mode 100644 index 000000000000..ca918b8497b1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js @@ -0,0 +1,242 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "__P", + "constraint": null + } + ] + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "A" + }, + "body": { + "type": "ClassBody", + "body": [], + "range": [ + 13, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "A", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "__P", + "range": [ + 8, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts new file mode 100644 index 000000000000..f68d76c805e6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.src.ts @@ -0,0 +1 @@ +class A<__P> {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js index 12a1a89a02d7..e8c62c8fd6fb 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js @@ -89,12 +89,12 @@ module.exports = { "line": 1 }, "start": { - "column": 38, + "column": 23, "line": 1 } }, "range": [ - 38, + 23, 43 ], "type": "GenericTypeAnnotation", @@ -135,12 +135,12 @@ module.exports = { "line": 1 }, "start": { - "column": 37, + "column": 29, "line": 1 } }, "range": [ - 37, + 29, 42 ], "type": "GenericTypeAnnotation", From bceb7c8e8a98f7764bd2121887a68c748f52e5e1 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 28 May 2017 11:47:56 -0500 Subject: [PATCH 154/326] Fix: Label static and export in TSParameterProperty (fixes #286) (#301) --- .../typescript-eslint-parser/lib/convert.js | 2 + ...with-export-parameter-properties.result.js | 467 ++++++++++++++++++ ...ss-with-export-parameter-properties.src.ts | 6 + ...ith-private-parameter-properties.result.js | 10 +- ...h-protected-parameter-properties.result.js | 10 +- ...with-public-parameter-properties.result.js | 10 +- ...th-readonly-parameter-properties.result.js | 6 +- ...with-static-parameter-properties.result.js | 467 ++++++++++++++++++ ...ss-with-static-parameter-properties.src.ts | 7 + ...ure-with-parameter-accessibility.result.js | 6 +- 10 files changed, 986 insertions(+), 5 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 5564eae912db..3eee332b3042 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1104,6 +1104,8 @@ module.exports = function convert(config) { loc: nodeUtils.getLoc(node, ast), accessibility: nodeUtils.getTSNodeAccessibility(node), isReadonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node), parameter: result }; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js new file mode 100644 index 000000000000..0bbff21b87c0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js @@ -0,0 +1,467 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 16, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "TSParameterProperty", + "range": [ + 28, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "accessibility": null, + "isReadonly": false, + "static": false, + "export": true, + "parameter": { + "type": "Identifier", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "range": [ + 38, + 44 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + } + } + } + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 46, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 27, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 10, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 28, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts new file mode 100644 index 000000000000..f1befb271eef --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.src.ts @@ -0,0 +1,6 @@ +class Foo { + constructor(export a: string) { + + } +} + diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js index 464b490d2ec0..2d64e5f9723f 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js @@ -114,6 +114,8 @@ module.exports = { "decorators": [], "accessibility": "private", "isReadonly": false, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -186,6 +188,8 @@ module.exports = { "decorators": [], "accessibility": "private", "isReadonly": true, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -258,6 +262,8 @@ module.exports = { "decorators": [], "accessibility": "private", "isReadonly": false, + "static": false, + "export": false, "parameter": { "left": { "type": "Identifier", @@ -366,6 +372,8 @@ module.exports = { "decorators": [], "accessibility": "private", "isReadonly": true, + "static": false, + "export": false, "parameter": { "left": { "type": "Identifier", @@ -1128,4 +1136,4 @@ module.exports = { "value": "}" } ], -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js index 412dc9ada2c4..31a388e5e173 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js @@ -144,6 +144,8 @@ module.exports = { "decorators": [], "accessibility": "protected", "isReadonly": false, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -216,6 +218,8 @@ module.exports = { "decorators": [], "accessibility": "protected", "isReadonly": true, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -288,6 +292,8 @@ module.exports = { "decorators": [], "accessibility": "protected", "isReadonly": false, + "static": false, + "export": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -396,6 +402,8 @@ module.exports = { "decorators": [], "accessibility": "protected", "isReadonly": true, + "static": false, + "export": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -1128,4 +1136,4 @@ module.exports = { "value": "}" } ], -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js index 777e252e6768..a29e488f0f06 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js @@ -144,6 +144,8 @@ module.exports = { "decorators": [], "accessibility": "public", "isReadonly": false, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -216,6 +218,8 @@ module.exports = { "decorators": [], "accessibility": "public", "isReadonly": true, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -288,6 +292,8 @@ module.exports = { "decorators": [], "accessibility": "public", "isReadonly": false, + "static": false, + "export": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -396,6 +402,8 @@ module.exports = { "decorators": [], "accessibility": "public", "isReadonly": true, + "static": false, + "export": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -1128,4 +1136,4 @@ module.exports = { "value": "}" } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js index 862b587daa08..9823df6264d2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js @@ -144,6 +144,8 @@ module.exports = { "decorators": [], "accessibility": null, "isReadonly": true, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -216,6 +218,8 @@ module.exports = { "decorators": [], "accessibility": null, "isReadonly": true, + "static": false, + "export": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -696,4 +700,4 @@ module.exports = { "value": "}" } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js new file mode 100644 index 000000000000..d5c7807827d3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js @@ -0,0 +1,467 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 16, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "TSParameterProperty", + "range": [ + 28, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "accessibility": null, + "isReadonly": false, + "static": true, + "export": false, + "parameter": { + "type": "Identifier", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "name": "a", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "range": [ + 38, + 44 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + } + } + } + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 46, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "body": [] + }, + "range": [ + 27, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" + } + ], + "range": [ + 10, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "constructor", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 28, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts new file mode 100644 index 000000000000..b11377560f8c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.src.ts @@ -0,0 +1,7 @@ +class Foo { + constructor(static a: string) { + + } +} + + diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js index bbf54d58618e..cd7f56c8e8c1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -71,6 +71,8 @@ module.exports = { }, "accessibility": "public", "isReadonly": false, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -108,6 +110,8 @@ module.exports = { }, "accessibility": "private", "isReadonly": false, + "static": false, + "export": false, "parameter": { "type": "Identifier", "range": [ @@ -403,4 +407,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; From 17c13917cc7cfc89a62dbd5aee8e3577051a7fca Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 28 May 2017 12:01:17 -0500 Subject: [PATCH 155/326] Fix: Only set optional property on certain node property (fixes #289) (#292) --- .../typescript-eslint-parser/lib/convert.js | 34 +- ...-with-optional-computed-property.result.js | 355 ++++++++++++++++++ ...ass-with-optional-computed-property.src.ts | 3 + ...with-optional-property-undefined.result.js | 319 ++++++++++++++++ ...ss-with-optional-property-undefined.src.ts | 4 + 5 files changed, 706 insertions(+), 9 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 3eee332b3042..52ad100283db 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -326,15 +326,6 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.Identifier, name: nodeUtils.unescapeIdentifier(node.text) }); - if (node.parent.questionToken && ( - SyntaxKind.Parameter === node.parent.kind || - SyntaxKind.PropertyDeclaration === node.parent.kind || - SyntaxKind.PropertySignature === node.parent.kind || - SyntaxKind.MethodDeclaration === node.parent.kind || - SyntaxKind.MethodSignature === node.parent.kind - )) { - result.optional = true; - } break; case SyntaxKind.WithStatement: @@ -675,6 +666,14 @@ module.exports = function convert(config) { decorators: convertDecorators(node.decorators), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null }); + + if (node.name.kind === SyntaxKind.Identifier && node.questionToken) { + result.key.optional = true; + } + + if (result.key.type === AST_NODE_TYPES.Literal && node.questionToken) { + result.optional = true; + } break; } @@ -753,6 +752,10 @@ module.exports = function convert(config) { } + if (result.key.type === AST_NODE_TYPES.Identifier && node.questionToken) { + result.key.optional = true; + } + if (node.kind === SyntaxKind.GetAccessor) { result.kind = "get"; } else if (node.kind === SyntaxKind.SetAccessor) { @@ -1097,6 +1100,10 @@ module.exports = function convert(config) { }); } + if (node.questionToken) { + parameter.optional = true; + } + if (node.modifiers) { return { type: AST_NODE_TYPES.TSParameterProperty, @@ -1764,6 +1771,15 @@ module.exports = function convert(config) { }); break; + case SyntaxKind.PropertySignature: + case SyntaxKind.MethodSignature: + deeplyCopy(); + + if (node.questionToken) { + result.name.optional = true; + } + break; + default: deeplyCopy(); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js new file mode 100644 index 000000000000..a679aefd43c5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js @@ -0,0 +1,355 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "X" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "ClassProperty", + "range": [ + 14, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "key": { + "type": "Literal", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "value": "foo", + "raw": "'foo'" + }, + "value": { + "type": "Identifier", + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "name": "undefined" + }, + "computed": true, + "static": false, + "accessibility": "private", + "decorators": [], + "typeAnnotation": null, + "optional": true + } + ], + "range": [ + 8, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "private", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "String", + "value": "'foo'", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "undefined", + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.src.ts new file mode 100644 index 000000000000..5dd15f31b2a1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.src.ts @@ -0,0 +1,3 @@ +class X { + private ['foo']? = undefined; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js new file mode 100644 index 000000000000..efbe4843c31e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js @@ -0,0 +1,319 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "X" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "ClassProperty", + "range": [ + 12, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "key": { + "type": "Identifier", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "name": "foo", + "optional": true + }, + "value": { + "type": "Identifier", + "range": [ + 27, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "name": "undefined" + }, + "computed": false, + "static": false, + "accessibility": "private", + "decorators": [], + "typeAnnotation": null + } + ], + "range": [ + 8, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "X", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Keyword", + "value": "private", + "range": [ + 12, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Keyword", + "value": "undefined", + "range": [ + 27, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; + diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts new file mode 100644 index 000000000000..126d595430f0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.src.ts @@ -0,0 +1,4 @@ +class X { + private foo? = undefined; +} + From 02a01fe3aa2757c870468e92d9d6c86ebb7d3834 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 28 May 2017 16:49:47 -0500 Subject: [PATCH 156/326] Breaking: Convert Signature types to be more ESTree like (fixes #262) (#264) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 87 +- .../lib/node-utils.js | 21 + .../export-type-class-declaration.result.js | 51 +- ...ct-type-with-optional-properties.result.js | 170 +- ...h-object-type-without-annotation.result.js | 22 +- ...nterface-with-all-property-types.result.js | 3338 ++++++++++++ .../interface-with-all-property-types.src.ts | 15 + ...ure-with-parameter-accessibility.result.js | 6 +- .../basics/interface-with-jsdoc.result.js | 16 +- ...terface-with-optional-properties.result.js | 98 +- ...nterface-without-type-annotation.result.js | 13 +- ...-alias-object-without-annotation.result.js | 22 +- .../typescript/basics/typed-this.result.js | 15 +- .../interface-property-modifiers.result.js | 4816 +++++++++++++++++ .../interface-property-modifiers.src.ts | 24 + 16 files changed, 8491 insertions(+), 224 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 37f2848361d8..5c8ef695ffb1 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -106,6 +106,7 @@ module.exports = { TSConstructorType: "TSConstructorType", TSConstructSignature: "TSConstructSignature", TSDeclareKeyword: "TSDeclareKeyword", + TSIndexSignature: "TSIndexSignature", TSInterfaceBody: "TSInterfaceBody", TSInterfaceDeclaration: "TSInterfaceDeclaration", TSInterfaceHeritage: "TSInterfaceHeritage", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 52ad100283db..093ef5c87cc9 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -618,7 +618,7 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.Property, key: convertChild(node.name), value: convertChild(node.initializer), - computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + computed: nodeUtils.isComputedProperty(node.name), method: false, shorthand: false, kind: "init" @@ -660,7 +660,7 @@ module.exports = function convert(config) { type: (isAbstract) ? AST_NODE_TYPES.TSAbstractClassProperty : AST_NODE_TYPES.ClassProperty, key: convertChild(node.name), value: convertChild(node.initializer), - computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + computed: nodeUtils.isComputedProperty(node.name), static: nodeUtils.hasStaticModifierFlag(node), accessibility: nodeUtils.getTSNodeAccessibility(node), decorators: convertDecorators(node.decorators), @@ -713,7 +713,7 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.Property, key: convertChild(node.name), value: method, - computed: (node.name.kind === SyntaxKind.ComputedPropertyName), + computed: nodeUtils.isComputedProperty(node.name), method: nodeIsMethod, shorthand: false, kind: "init" @@ -730,8 +730,6 @@ module.exports = function convert(config) { return convertedParam; }); - const isMethodNameComputed = (node.name.kind === SyntaxKind.ComputedPropertyName); - /** * TypeScript class methods can be defined as "abstract" */ @@ -743,7 +741,7 @@ module.exports = function convert(config) { type: methodDefinitionType, key: convertChild(node.name), value: method, - computed: isMethodNameComputed, + computed: nodeUtils.isComputedProperty(node.name), static: nodeUtils.hasStaticModifierFlag(node), kind: "method", accessibility: nodeUtils.getTSNodeAccessibility(node), @@ -805,7 +803,7 @@ module.exports = function convert(config) { }; const constructorIdentifierLoc = ast.getLineAndCharacterOfPosition(firstConstructorToken.getStart()), - constructorIsComputed = !!node.name && (node.name.kind === SyntaxKind.ComputedPropertyName); + constructorIsComputed = !!node.name && nodeUtils.isComputedProperty(node.name); let constructorKey; @@ -1723,6 +1721,72 @@ module.exports = function convert(config) { } + case SyntaxKind.MethodSignature: { + Object.assign(result, { + type: AST_NODE_TYPES.TSMethodSignature, + optional: nodeUtils.isOptional(node), + computed: nodeUtils.isComputedProperty(node.name), + key: convertChild(node.name), + params: node.parameters.map(parameter => convertChild(parameter)), + typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, + accessibility: nodeUtils.getTSNodeAccessibility(node), + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) + }); + + if (node.typeParameters) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + break; + } + + case SyntaxKind.PropertySignature: { + Object.assign(result, { + type: AST_NODE_TYPES.TSPropertySignature, + optional: nodeUtils.isOptional(node), + computed: nodeUtils.isComputedProperty(node.name), + key: convertChild(node.name), + typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, + initializer: convertChild(node.initializer), + accessibility: nodeUtils.getTSNodeAccessibility(node), + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) + }); + + break; + } + + case SyntaxKind.IndexSignature: { + Object.assign(result, { + type: AST_NODE_TYPES.TSIndexSignature, + index: convertChild(node.parameters[0]), + typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, + accessibility: nodeUtils.getTSNodeAccessibility(node), + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) + }); + + break; + } + + case SyntaxKind.ConstructSignature: { + Object.assign(result, { + type: AST_NODE_TYPES.TSConstructSignature, + params: node.parameters.map(parameter => convertChild(parameter)), + typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null + }); + + if (node.typeParameters) { + result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + + break; + } + case SyntaxKind.InterfaceDeclaration: { const interfaceHeritageClauses = node.heritageClauses || []; @@ -1771,15 +1835,6 @@ module.exports = function convert(config) { }); break; - case SyntaxKind.PropertySignature: - case SyntaxKind.MethodSignature: - deeplyCopy(); - - if (node.questionToken) { - result.name.optional = true; - } - break; - default: deeplyCopy(); } diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 5550270d9ae2..64d2551f9eeb 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -186,6 +186,8 @@ module.exports = { hasJSXAncestor, unescapeIdentifier, unescapeStringLiteralText, + isComputedProperty, + isOptional, fixExports, getTokenType, convertToken, @@ -446,6 +448,25 @@ function unescapeStringLiteralText(text) { return unescape(text); } +/** + * Returns true if a given TSNode is a computed property + * @param {TSNode} node TSNode to be checked + * @returns {boolean} is Computed Property + */ +function isComputedProperty(node) { + return node.kind === SyntaxKind.ComputedPropertyName; +} + +/** + * Returns true if a given TSNode is optional (has QuestionToken) + * @param {TSNode} node TSNode to be checked + * @returns {boolean} is Optional + */ +function isOptional(node) { + return (node.questionToken) + ? (node.questionToken.kind === SyntaxKind.QuestionToken) : false; +} + /** * Fixes the exports of the given TSNode * @param {TSNode} node the TSNode diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js index dc93d1d3874a..94b16ab700b6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js @@ -107,49 +107,51 @@ module.exports = { 48 ], "loc": { - "end": { - "line": 2, - "column": 17 - }, "start": { "line": 2, "column": 4 + }, + "end": { + "line": 2, + "column": 17 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 35, 40 ], "loc": { - "end": { - "line": 2, - "column": 9 - }, "start": { "line": 2, "column": 4 + }, + "end": { + "line": 2, + "column": 9 } }, "name": "count" }, "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 42, - 48 - ], "loc": { - "end": { - "line": 2, - "column": 17 - }, "start": { "line": 2, "column": 11 + }, + "end": { + "line": 2, + "column": 17 } }, + "range": [ + 42, + 48 + ], "typeAnnotation": { "type": "TSNumberKeyword", "range": [ @@ -157,17 +159,22 @@ module.exports = { 48 ], "loc": { - "end": { - "line": 2, - "column": 17 - }, "start": { "line": 2, "column": 11 + }, + "end": { + "line": 2, + "column": 17 } } } - } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js index ad9e5031023a..de960f1ca9e8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js @@ -212,145 +212,123 @@ module.exports = { }, "members": [ { + "type": "TSPropertySignature", + "range": [ + 26, + 39 + ], "loc": { - "end": { - "column": 39, - "line": 1 - }, "start": { - "column": 26, - "line": 1 + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 39 } }, - "name": { - "loc": { - "end": { - "column": 29, - "line": 1 - }, - "start": { - "column": 26, - "line": 1 - } - }, - "name": "bar", - "optional": true, + "optional": true, + "computed": false, + "key": { + "type": "Identifier", "range": [ 26, 29 ], - "type": "Identifier" - }, - "questionToken": { "loc": { - "end": { - "column": 30, - "line": 1 - }, "start": { - "column": 29, - "line": 1 + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 } }, - "range": [ - 29, - 30 - ], - "type": "TSQuestionToken" + "name": "bar" }, - "range": [ - 26, - 39 - ], - "type": "TSPropertySignature", "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 38, - "line": 1 - }, "start": { - "column": 32, - "line": 1 + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 } }, "range": [ 32, 38 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 38, - "line": 1 - }, - "start": { - "column": 32, - "line": 1 - } - }, + "type": "TSStringKeyword", "range": [ 32, 38 ], - "type": "TSStringKeyword" + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } } - } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false }, { + "type": "TSPropertySignature", + "range": [ + 40, + 44 + ], "loc": { - "end": { - "column": 44, - "line": 1 - }, "start": { - "column": 40, - "line": 1 + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 44 } }, - "name": { - "loc": { - "end": { - "column": 43, - "line": 1 - }, - "start": { - "column": 40, - "line": 1 - } - }, - "name": "baz", - "optional": true, + "optional": true, + "computed": false, + "key": { + "type": "Identifier", "range": [ 40, 43 ], - "type": "Identifier" - }, - "questionToken": { "loc": { - "end": { - "column": 44, - "line": 1 - }, "start": { - "column": 43, - "line": 1 + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 43 } }, - "range": [ - 43, - 44 - ], - "type": "TSQuestionToken" + "name": "baz" }, - "range": [ - 40, - 44 - ], - "type": "TSPropertySignature", - "typeAnnotation": null + "typeAnnotation": null, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ], "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js index 1cd0e17ad61c..a9644360c9a9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js @@ -234,7 +234,9 @@ module.exports = { "column": 38 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 26, @@ -285,7 +287,12 @@ module.exports = { } } } - } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false }, { "type": "TSPropertySignature", @@ -303,7 +310,9 @@ module.exports = { "column": 42 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 39, @@ -321,7 +330,12 @@ module.exports = { }, "name": "baz" }, - "typeAnnotation": null + "typeAnnotation": null, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js new file mode 100644 index 000000000000..bae2be7e256a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js @@ -0,0 +1,3338 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 295 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "abstract": false, + "range": [ + 0, + 295 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "TSPropertySignature", + "range": [ + 20, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "baa" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 25, + 31 + ], + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 37, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "optional": true, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + }, + "name": "bar" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "range": [ + 43, + 49 + ], + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 43, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 + } + } + } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 55, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "optional": false, + "computed": true, + "key": { + "type": "Identifier", + "range": [ + 56, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "name": "bax" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "range": [ + 62, + 68 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 74, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "optional": true, + "computed": true, + "key": { + "type": "Identifier", + "range": [ + 75, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + }, + "name": "baz" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 18 + } + }, + "range": [ + 82, + 88 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 82, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 18 + } + } + } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSIndexSignature", + "range": [ + 94, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 26 + } + }, + "index": { + "type": "Identifier", + "range": [ + 95, + 98 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + }, + "name": "eee", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + }, + "range": [ + 100, + 106 + ], + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 100, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 25 + } + }, + "range": [ + 109, + 115 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 109, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSIndexSignature", + "range": [ + 121, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 27 + } + }, + "index": { + "type": "Identifier", + "range": [ + 122, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + }, + "name": "fff", + "optional": true, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 17 + } + }, + "range": [ + 128, + 134 + ], + "typeAnnotation": { + "type": "TSNumberKeyword", + "range": [ + 128, + 134 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 17 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 26 + } + }, + "range": [ + 137, + 143 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 137, + 143 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 26 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 149, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 16 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 149, + 152 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + }, + "name": "doo" + }, + "params": [], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 15 + } + }, + "range": [ + 156, + 160 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 156, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 15 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 166, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 24 + } + }, + "optional": true, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 166, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 7 + } + }, + "name": "doo" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + }, + "name": "a" + }, + { + "type": "Identifier", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + }, + "name": "b" + }, + { + "type": "Identifier", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 16 + } + }, + "name": "c" + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 23 + } + }, + "range": [ + 181, + 185 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 181, + 185 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 23 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 191, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 26 + } + }, + "optional": true, + "computed": true, + "key": { + "type": "Identifier", + "range": [ + 192, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 8 + } + }, + "name": "loo" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 12 + } + }, + "name": "a" + }, + { + "type": "Identifier", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 15 + } + }, + "name": "b" + }, + { + "type": "Identifier", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + }, + "name": "c" + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 25 + } + }, + "range": [ + 208, + 212 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 208, + 212 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 25 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 218, + 240 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 26 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 218, + 221 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 7 + } + }, + "name": "boo" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 12 + } + }, + "name": "a" + }, + { + "type": "Identifier", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 14 + }, + "end": { + "line": 11, + "column": 15 + } + }, + "name": "b" + }, + { + "type": "Identifier", + "range": [ + 231, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + }, + "name": "c" + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 25 + } + }, + "range": [ + 235, + 239 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 235, + 239 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 25 + } + } + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 221, + 224 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 10 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 9 + } + }, + "name": "J", + "constraint": null + } + ] + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSConstructSignature", + "range": [ + 245, + 265 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 24 + } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 10 + } + }, + "name": "a" + }, + { + "type": "Identifier", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + }, + "name": "b", + "optional": true + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 23 + } + }, + "range": [ + 258, + 264 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 258, + 264 + ], + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 23 + } + } + } + } + }, + { + "type": "TSConstructSignature", + "range": [ + 270, + 293 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 27 + } + }, + "params": [ + { + "type": "Identifier", + "range": [ + 278, + 279 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + }, + "name": "a" + }, + { + "type": "Identifier", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + }, + "name": "b", + "optional": true + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 26 + } + }, + "range": [ + 286, + 292 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 286, + 292 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 26 + } + } + } + }, + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 274, + 277 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 11 + } + }, + "params": [ + { + "type": "TypeParameter", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 10 + } + }, + "name": "F", + "constraint": null + } + ] + } + } + ], + "range": [ + 14, + 295 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Foo" + }, + "heritage": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "baa", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 43, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "bax", + "range": [ + 56, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 75, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 82, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "eee", + "range": [ + 95, + 98 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 100, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 109, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "fff", + "range": [ + 122, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 125, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "number", + "range": [ + 128, + 134 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 137, + 143 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "doo", + "range": [ + 149, + 152 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 153, + 154 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 156, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "doo", + "range": [ + 166, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 181, + 185 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 191, + 192 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "loo", + "range": [ + 192, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 208, + 212 + ], + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "boo", + "range": [ + 218, + 221 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 221, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "J", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 225, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 11, + "column": 12 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 14 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 229, + 230 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 231, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 233, + 234 + ], + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 235, + 239 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 239, + 240 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 245, + 248 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 249, + 250 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 12, + "column": 9 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 255, + 256 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 256, + 257 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 258, + 264 + ], + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 264, + 265 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "new", + "range": [ + 270, + 273 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "F", + "range": [ + 275, + 276 + ], + "loc": { + "start": { + "line": 13, + "column": 9 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 278, + 279 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "?", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 284, + 285 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 286, + 292 + ], + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 294, + 295 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.src.ts new file mode 100644 index 000000000000..90f0c80ebc41 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.src.ts @@ -0,0 +1,15 @@ +interface Foo { + baa: number; + bar?: number; + [bax]: string; + [baz]?: string; + [eee: number]: string; + [fff?: number]: string; + doo(): void; + doo?(a, b, c): void; + [loo]?(a, b, c): void; + boo(a, b, c): void; + new (a, b?): string; + new (a, b?): string; +} + diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js index cd7f56c8e8c1..ea91b7e30b90 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -51,8 +51,7 @@ module.exports = { "column": 30 } }, - "typeParameters": null, - "parameters": [ + "params": [ { "type": "TSParameterProperty", "range": [ @@ -131,7 +130,8 @@ module.exports = { "name": "y" } } - ] + ], + "typeAnnotation": null } ], "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js index b86ccc5eaafe..a45c01b15f1a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js @@ -51,7 +51,9 @@ module.exports = { "column": 13 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 76, @@ -69,8 +71,7 @@ module.exports = { }, "name": "foo" }, - "typeParameters": null, - "parameters": [ + "params": [ { "type": "Identifier", "range": [ @@ -89,7 +90,12 @@ module.exports = { }, "name": "bar" } - ] + ], + "typeAnnotation": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ], "range": [ @@ -671,4 +677,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js index 8944766982b1..27d058c67970 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js @@ -51,7 +51,9 @@ module.exports = { "column": 9 } }, - "name": { + "optional": true, + "computed": false, + "key": { "type": "Identifier", "range": [ 21, @@ -67,27 +69,14 @@ module.exports = { "column": 7 } }, - "name": "foo", - "optional": true + "name": "foo" }, - "questionToken": { - "type": "TSQuestionToken", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "typeAnnotation": null + "typeAnnotation": null, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false }, { "type": "TSPropertySignature", @@ -105,7 +94,9 @@ module.exports = { "column": 17 } }, - "name": { + "optional": true, + "computed": false, + "key": { "type": "Identifier", "range": [ 31, @@ -121,25 +112,7 @@ module.exports = { "column": 7 } }, - "name": "bar", - "optional": true - }, - "questionToken": { - "type": "TSQuestionToken", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } + "name": "bar" }, "typeAnnotation": { "type": "TypeAnnotation", @@ -174,7 +147,12 @@ module.exports = { } } } - } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false }, { "type": "TSMethodSignature", @@ -192,7 +170,9 @@ module.exports = { "column": 34 } }, - "name": { + "optional": true, + "computed": false, + "key": { "type": "Identifier", "range": [ 49, @@ -208,28 +188,9 @@ module.exports = { "column": 7 } }, - "name": "baz", - "optional": true + "name": "baz" }, - "questionToken": { - "type": "TSQuestionToken", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "typeParameters": null, - "parameters": [ + "params": [ { "type": "Identifier", "range": [ @@ -320,7 +281,12 @@ module.exports = { "name": "baz", "optional": true } - ] + ], + "typeAnnotation": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ], "range": [ @@ -830,4 +796,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js index 1d4862542b0e..560bbb2637a8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js @@ -51,7 +51,9 @@ module.exports = { "column": 8 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 21, @@ -69,7 +71,12 @@ module.exports = { }, "name": "foo" }, - "typeAnnotation": null + "typeAnnotation": null, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ], "range": [ @@ -219,4 +226,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js index d3ab28505c34..46e51d845402 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js @@ -86,7 +86,9 @@ module.exports = { "column": 24 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 12, @@ -137,7 +139,12 @@ module.exports = { } } } - } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false }, { "type": "TSPropertySignature", @@ -155,7 +162,9 @@ module.exports = { "column": 28 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 25, @@ -173,7 +182,12 @@ module.exports = { }, "name": "baz" }, - "typeAnnotation": null + "typeAnnotation": null, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ] }, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js index 4bfa9e8369b5..d62448fb56e6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js @@ -51,7 +51,9 @@ module.exports = { "column": 65 } }, - "name": { + "optional": false, + "computed": false, + "key": { "type": "Identifier", "range": [ 23, @@ -69,8 +71,7 @@ module.exports = { }, "name": "addClickListener" }, - "typeParameters": null, - "parameters": [ + "params": [ { "type": "Identifier", "range": [ @@ -316,7 +317,11 @@ module.exports = { } } } - } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false } ], "range": [ @@ -772,4 +777,4 @@ module.exports = { } } ] -}; \ No newline at end of file +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js new file mode 100644 index 000000000000..6d0710f97e81 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js @@ -0,0 +1,4816 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 594 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "body": [ + { + "type": "TSInterfaceDeclaration", + "range": [ + 0, + 594 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + }, + "abstract": false, + "body": { + "type": "TSInterfaceBody", + "body": [ + { + "type": "TSPropertySignature", + "range": [ + 20, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + }, + "name": "bar" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "range": [ + 25, + 31 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + } + }, + "initializer": { + "type": "Literal", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": "a", + "raw": "'a'" + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 43, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "range": [ + 53, + 59 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + } + }, + "initializer": null, + "accessibility": "public", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 65, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 21 + } + }, + "range": [ + 76, + 82 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + }, + "initializer": null, + "accessibility": "private", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 88, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "name": "c" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 23 + } + }, + "range": [ + 101, + 107 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 101, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 23 + } + } + } + }, + "initializer": null, + "accessibility": "protected", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 113, + 130 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 21 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + }, + "name": "d" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 20 + } + }, + "range": [ + 123, + 129 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 123, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 20 + } + } + } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": true, + "export": false + }, + { + "type": "TSPropertySignature", + "range": [ + 135, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 21 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + }, + "name": "e" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + }, + "range": [ + 145, + 151 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 145, + 151 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + }, + "initializer": null, + "accessibility": null, + "readonly": false, + "static": false, + "export": true + }, + { + "type": "TSPropertySignature", + "range": [ + 157, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 23 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "name": "f" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 22 + } + }, + "range": [ + 169, + 175 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 169, + 175 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 22 + } + } + } + }, + "initializer": null, + "accessibility": null, + "readonly": true, + "static": false, + "export": false + }, + { + "type": "TSIndexSignature", + "range": [ + 182, + 211 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 33 + } + }, + "index": { + "type": "Identifier", + "range": [ + 190, + 193 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 15 + } + }, + "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 23 + } + }, + "range": [ + 195, + 201 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 195, + 201 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 23 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 10, + "column": 26 + }, + "end": { + "line": 10, + "column": 32 + } + }, + "range": [ + 204, + 210 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 204, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 26 + }, + "end": { + "line": 10, + "column": 32 + } + } + } + }, + "accessibility": "public", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSIndexSignature", + "range": [ + 216, + 246 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 34 + } + }, + "index": { + "type": "Identifier", + "range": [ + 225, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 16 + } + }, + "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 24 + } + }, + "range": [ + 230, + 236 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 230, + 236 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 24 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 33 + } + }, + "range": [ + 239, + 245 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 239, + 245 + ], + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 33 + } + } + } + }, + "accessibility": "private", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSIndexSignature", + "range": [ + 251, + 283 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 36 + } + }, + "index": { + "type": "Identifier", + "range": [ + 262, + 265 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 18 + } + }, + "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 26 + } + }, + "range": [ + 267, + 273 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 267, + 273 + ], + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 35 + } + }, + "range": [ + 276, + 282 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 276, + 282 + ], + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 35 + } + } + } + }, + "accessibility": "protected", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSIndexSignature", + "range": [ + 288, + 317 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 33 + } + }, + "index": { + "type": "Identifier", + "range": [ + 296, + 299 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 15 + } + }, + "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 23 + } + }, + "range": [ + 301, + 307 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 301, + 307 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 23 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + }, + "range": [ + 310, + 316 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 310, + 316 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": true, + "export": false + }, + { + "type": "TSIndexSignature", + "range": [ + 322, + 351 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 33 + } + }, + "index": { + "type": "Identifier", + "range": [ + 330, + 333 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 15 + } + }, + "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 23 + } + }, + "range": [ + 335, + 341 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 335, + 341 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 23 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 32 + } + }, + "range": [ + 344, + 350 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 344, + 350 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 32 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": true + }, + { + "type": "TSIndexSignature", + "range": [ + 356, + 387 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 35 + } + }, + "index": { + "type": "Identifier", + "range": [ + 366, + 369 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 17 + } + }, + "name": "baz", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "range": [ + 371, + 377 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 371, + 377 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 25 + } + } + } + } + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 34 + } + }, + "range": [ + 380, + 386 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 380, + 386 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 34 + } + } + } + }, + "accessibility": null, + "readonly": true, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 393, + 421 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 32 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 400, + 401 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 12 + } + }, + "name": "g" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 402, + 405 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 16 + } + }, + "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 17, + "column": 18 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "range": [ + 407, + 413 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 407, + 413 + ], + "loc": { + "start": { + "line": 17, + "column": 18 + }, + "end": { + "line": 17, + "column": 24 + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 31 + } + }, + "range": [ + 416, + 420 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 416, + 420 + ], + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 31 + } + } + } + }, + "accessibility": "public", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 426, + 455 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 434, + 435 + ], + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 13 + } + }, + "name": "h" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 436, + 439 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 17 + } + }, + "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "range": [ + 441, + 447 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 441, + 447 + ], + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 25 + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 18, + "column": 28 + }, + "end": { + "line": 18, + "column": 32 + } + }, + "range": [ + 450, + 454 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 450, + 454 + ], + "loc": { + "start": { + "line": 18, + "column": 28 + }, + "end": { + "line": 18, + "column": 32 + } + } + } + }, + "accessibility": "private", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 460, + 491 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 35 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 470, + 471 + ], + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "name": "i" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 472, + 475 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + }, + "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 27 + } + }, + "range": [ + 477, + 483 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 477, + 483 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 27 + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 19, + "column": 30 + }, + "end": { + "line": 19, + "column": 34 + } + }, + "range": [ + 486, + 490 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 486, + 490 + ], + "loc": { + "start": { + "line": 19, + "column": 30 + }, + "end": { + "line": 19, + "column": 34 + } + } + } + }, + "accessibility": "protected", + "readonly": false, + "static": false, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 496, + 524 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 32 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 503, + 504 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 12 + } + }, + "name": "j" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 505, + 508 + ], + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 16 + } + }, + "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 24 + } + }, + "range": [ + 510, + 516 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 510, + 516 + ], + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 24 + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 20, + "column": 27 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "range": [ + 519, + 523 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 519, + 523 + ], + "loc": { + "start": { + "line": 20, + "column": 27 + }, + "end": { + "line": 20, + "column": 31 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": true, + "export": false + }, + { + "type": "TSMethodSignature", + "range": [ + 529, + 557 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 32 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 536, + 537 + ], + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 12 + } + }, + "name": "k" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 538, + 541 + ], + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 21, + "column": 18 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "range": [ + 543, + 549 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 543, + 549 + ], + "loc": { + "start": { + "line": 21, + "column": 18 + }, + "end": { + "line": 21, + "column": 24 + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 21, + "column": 27 + }, + "end": { + "line": 21, + "column": 31 + } + }, + "range": [ + 552, + 556 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 552, + 556 + ], + "loc": { + "start": { + "line": 21, + "column": 27 + }, + "end": { + "line": 21, + "column": 31 + } + } + } + }, + "accessibility": null, + "readonly": false, + "static": false, + "export": true + }, + { + "type": "TSMethodSignature", + "range": [ + 562, + 592 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 34 + } + }, + "optional": false, + "computed": false, + "key": { + "type": "Identifier", + "range": [ + 571, + 572 + ], + "loc": { + "start": { + "line": 22, + "column": 13 + }, + "end": { + "line": 22, + "column": 14 + } + }, + "name": "l" + }, + "params": [ + { + "type": "Identifier", + "range": [ + 573, + 576 + ], + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 18 + } + }, + "name": "bar", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "range": [ + 578, + 584 + ], + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 578, + 584 + ], + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 26 + } + } + } + } + } + ], + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 33 + } + }, + "range": [ + 587, + 591 + ], + "typeAnnotation": { + "type": "TSVoidKeyword", + "range": [ + 587, + 591 + ], + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 33 + } + } + } + }, + "accessibility": null, + "readonly": true, + "static": false, + "export": false + } + ], + "range": [ + 14, + 594 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 23, + "column": 1 + } + } + }, + "id": { + "type": "Identifier", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "Foo" + }, + "heritage": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "interface", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 14, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 25, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "String", + "value": "'a'", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "public", + "range": [ + 43, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "a", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "private", + "range": [ + 65, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "b", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Keyword", + "value": "protected", + "range": [ + 88, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 101, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 113, + 119 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "d", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 123, + 129 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 135, + 141 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 145, + 151 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "readonly", + "range": [ + 157, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "f", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 169, + 175 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "public", + "range": [ + 182, + 188 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 190, + 193 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 193, + 194 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 195, + 201 + ], + "loc": { + "start": { + "line": 10, + "column": 17 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 23 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 204, + 210 + ], + "loc": { + "start": { + "line": 10, + "column": 26 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 10, + "column": 32 + }, + "end": { + "line": 10, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "private", + "range": [ + 216, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 11, + "column": 12 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 225, + 228 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 230, + 236 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 236, + 237 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 237, + 238 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 239, + 245 + ], + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + { + "type": "Keyword", + "value": "protected", + "range": [ + 251, + 260 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 261, + 262 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 262, + 265 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 267, + 273 + ], + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 273, + 274 + ], + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 274, + 275 + ], + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 276, + 282 + ], + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 282, + 283 + ], + "loc": { + "start": { + "line": 12, + "column": 35 + }, + "end": { + "line": 12, + "column": 36 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 288, + 294 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 295, + 296 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 296, + 299 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 301, + 307 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 307, + 308 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 310, + 316 + ], + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 316, + 317 + ], + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 322, + 328 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 329, + 330 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 330, + 333 + ], + "loc": { + "start": { + "line": 14, + "column": 12 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 333, + 334 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 335, + 341 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 341, + 342 + ], + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 342, + 343 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 344, + 350 + ], + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 350, + 351 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 33 + } + } + }, + { + "type": "Identifier", + "value": "readonly", + "range": [ + 356, + 364 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "[", + "range": [ + 365, + 366 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "baz", + "range": [ + 366, + 369 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 371, + 377 + ], + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "]", + "range": [ + 377, + 378 + ], + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 378, + 379 + ], + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 380, + 386 + ], + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 386, + 387 + ], + "loc": { + "start": { + "line": 15, + "column": 34 + }, + "end": { + "line": 15, + "column": 35 + } + } + }, + { + "type": "Keyword", + "value": "public", + "range": [ + 393, + 399 + ], + "loc": { + "start": { + "line": 17, + "column": 4 + }, + "end": { + "line": 17, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "g", + "range": [ + 400, + 401 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 401, + 402 + ], + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 402, + 405 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 405, + 406 + ], + "loc": { + "start": { + "line": 17, + "column": 16 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 407, + 413 + ], + "loc": { + "start": { + "line": 17, + "column": 18 + }, + "end": { + "line": 17, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 413, + 414 + ], + "loc": { + "start": { + "line": 17, + "column": 24 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 414, + 415 + ], + "loc": { + "start": { + "line": 17, + "column": 25 + }, + "end": { + "line": 17, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 416, + 420 + ], + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 420, + 421 + ], + "loc": { + "start": { + "line": 17, + "column": 31 + }, + "end": { + "line": 17, + "column": 32 + } + } + }, + { + "type": "Keyword", + "value": "private", + "range": [ + 426, + 433 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "h", + "range": [ + 434, + 435 + ], + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 435, + 436 + ], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 436, + 439 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 439, + 440 + ], + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 441, + 447 + ], + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 447, + 448 + ], + "loc": { + "start": { + "line": 18, + "column": 25 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 448, + 449 + ], + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 450, + 454 + ], + "loc": { + "start": { + "line": 18, + "column": 28 + }, + "end": { + "line": 18, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 454, + 455 + ], + "loc": { + "start": { + "line": 18, + "column": 32 + }, + "end": { + "line": 18, + "column": 33 + } + } + }, + { + "type": "Keyword", + "value": "protected", + "range": [ + 460, + 469 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "i", + "range": [ + 470, + 471 + ], + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 471, + 472 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 472, + 475 + ], + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 475, + 476 + ], + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 477, + 483 + ], + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 483, + 484 + ], + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 484, + 485 + ], + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 29 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 486, + 490 + ], + "loc": { + "start": { + "line": 19, + "column": 30 + }, + "end": { + "line": 19, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 490, + 491 + ], + "loc": { + "start": { + "line": 19, + "column": 34 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": "Keyword", + "value": "static", + "range": [ + 496, + 502 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "j", + "range": [ + 503, + 504 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 505, + 508 + ], + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 508, + 509 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 510, + 516 + ], + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 516, + 517 + ], + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 517, + 518 + ], + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 519, + 523 + ], + "loc": { + "start": { + "line": 20, + "column": 27 + }, + "end": { + "line": 20, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 523, + 524 + ], + "loc": { + "start": { + "line": 20, + "column": 31 + }, + "end": { + "line": 20, + "column": 32 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 529, + 535 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "k", + "range": [ + 536, + 537 + ], + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 537, + 538 + ], + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 538, + 541 + ], + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 541, + 542 + ], + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 543, + 549 + ], + "loc": { + "start": { + "line": 21, + "column": 18 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 549, + 550 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 550, + 551 + ], + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 552, + 556 + ], + "loc": { + "start": { + "line": 21, + "column": 27 + }, + "end": { + "line": 21, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 556, + 557 + ], + "loc": { + "start": { + "line": 21, + "column": 31 + }, + "end": { + "line": 21, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "readonly", + "range": [ + 562, + 570 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "l", + "range": [ + 571, + 572 + ], + "loc": { + "start": { + "line": 22, + "column": 13 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 572, + 573 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 573, + 576 + ], + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 576, + 577 + ], + "loc": { + "start": { + "line": 22, + "column": 18 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "string", + "range": [ + 578, + 584 + ], + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 584, + 585 + ], + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 585, + 586 + ], + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 28 + } + } + }, + { + "type": "Keyword", + "value": "void", + "range": [ + 587, + 591 + ], + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 591, + 592 + ], + "loc": { + "start": { + "line": 22, + "column": 33 + }, + "end": { + "line": 22, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 593, + 594 + ], + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.src.ts new file mode 100644 index 000000000000..02c0c9131844 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.src.ts @@ -0,0 +1,24 @@ +interface Foo { + bar: string = 'a'; + public a: string; + private b: string; + protected c: string; + static d: string; + export e: string; + readonly f: string; + + public [baz: string]: string; + private [baz: string]: string; + protected [baz: string]: string; + static [baz: string]: string; + export [baz: string]: string; + readonly [baz: string]: string; + + public g(bar: string): void; + private h(bar: string): void; + protected i(bar: string): void; + static j(bar: string): void; + export k(bar: string): void; + readonly l(bar: string): void; +} + From c3326d555b865a883a637f944304659db9ae1988 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 28 May 2017 23:05:11 +0100 Subject: [PATCH 157/326] Breaking: Decorator ESTree compliance, always convert (fixes #250) (#293) --- packages/typescript-eslint-parser/Makefile.js | 9 +- .../lib/ast-node-types.js | 2 + .../typescript-eslint-parser/lib/convert.js | 37 ++-- ...ecorator-factory-instance-member.result.js | 59 +++-- ...-decorator-factory-static-member.result.js | 143 ++++++------ ...cessor-decorator-instance-member.result.js | 27 ++- ...accessor-decorator-static-member.result.js | 25 ++- .../class-decorator-factory.result.js | 147 +++++++------ .../class-decorator.result.js | 25 ++- ...ecorator-factory-instance-member.result.js | 59 +++-- ...-decorator-factory-static-member.result.js | 57 +++-- ...method-decorator-instance-member.result.js | 27 ++- .../method-decorator-static-member.result.js | 25 ++- .../parameter-decorator-constructor.result.js | 53 +++-- ...orator-decorator-instance-member.result.js | 59 +++-- ...ecorator-decorator-static-member.result.js | 57 +++-- ...ameter-decorator-instance-member.result.js | 27 ++- ...arameter-decorator-static-member.result.js | 25 ++- ...ecorator-factory-instance-member.result.js | 76 +++++-- ...-decorator-factory-static-member.result.js | 116 ++++++---- ...operty-decorator-instance-member.result.js | 52 ++++- ...property-decorator-static-member.result.js | 52 ++++- .../decorator-on-enum-declaration.result.js | 203 ++++++++++++++++++ .../decorator-on-enum-declaration.src.ts | 1 + .../tools/update-typescript-tests.js | 71 +++--- 25 files changed, 1032 insertions(+), 402 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index 50d6cfa394ec..eca49edc0551 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -39,7 +39,8 @@ const NODE_MODULES = "./node_modules/", MAKEFILE = "./Makefile.js", /* eslint-disable no-use-before-define */ JS_FILES = `${find("lib/").filter(fileType("js")).join(" ")} parser.js`, - TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "); + TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), + TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); /* eslint-enable no-use-before-define */ //------------------------------------------------------------------------------ @@ -88,6 +89,12 @@ target.lint = function() { errors++; } + echo("Validating JavaScript tools files"); + lastReturn = nodeCLI.exec("eslint", TOOLS_FILES); + if (lastReturn.code !== 0) { + errors++; + } + if (errors) { exit(1); } diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 5c8ef695ffb1..10adc1cb4d22 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -38,6 +38,7 @@ module.exports = { ContinueStatement: "ContinueStatement", DebuggerStatement: "DebuggerStatement", DeclareFunction: "DeclareFunction", + Decorator: "Decorator", DoWhileStatement: "DoWhileStatement", EmptyStatement: "EmptyStatement", ExperimentalRestProperty: "ExperimentalRestProperty", @@ -106,6 +107,7 @@ module.exports = { TSConstructorType: "TSConstructorType", TSConstructSignature: "TSConstructSignature", TSDeclareKeyword: "TSDeclareKeyword", + TSEnumDeclaration: "TSEnumDeclaration", TSIndexSignature: "TSIndexSignature", TSInterfaceBody: "TSInterfaceBody", TSInterfaceDeclaration: "TSInterfaceDeclaration", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 093ef5c87cc9..cf71e7d1c5af 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -202,6 +202,26 @@ module.exports = function convert(config) { return classImplementsNode; } + /** + * Converts an array of TSNode decorators into an array of ESTreeNode decorators + * @param {TSNode[]} decorators An array of TSNode decorators to be converted + * @returns {ESTreeNode[]} an array of converted ESTreeNode decorators + */ + function convertDecorators(decorators) { + if (!decorators || !decorators.length) { + return []; + } + return decorators.map(decorator => { + const expression = convertChild(decorator.expression); + return { + type: AST_NODE_TYPES.Decorator, + range: [decorator.getStart(), decorator.end], + loc: nodeUtils.getLoc(decorator, ast), + expression + }; + }); + } + /** * For nodes that are copied directly from the TypeScript AST into * ESTree mostly as-is. The only difference is the addition of a type @@ -232,6 +252,11 @@ module.exports = function convert(config) { result.typeParameters = (node.typeParameters) ? convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters) : null; + } else if (key === "decorators") { + const decorators = convertDecorators(node.decorators); + if (decorators && decorators.length) { + result.decorators = decorators; + } } else { if (Array.isArray(node[key])) { result[key] = node[key].map(convertChild); @@ -276,18 +301,6 @@ module.exports = function convert(config) { return tagNameToken; } - /** - * Converts an array of TSNode decorators into an array of ESTreeNode decorators - * @param {TSNode[]} decorators An array of TSNode decorators to be converted - * @returns {ESTreeNode[]} an array of converted ESTreeNode decorators - */ - function convertDecorators(decorators) { - if (!decorators || !decorators.length) { - return []; - } - return decorators.map(decorator => convertChild(decorator.expression)); - } - /** * The core of the conervsion logic: * Identify and convert each relevant TypeScript SyntaxKind diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js index 990e66da1691..64514375e7e7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js @@ -203,26 +203,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 19, + 18, 38 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 24 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 19, - 31 + 38 ], "loc": { "start": { @@ -231,32 +231,49 @@ module.exports = { }, "end": { "line": 2, - "column": 17 + "column": 24 } }, - "name": "configurable" - }, - "arguments": [ - { - "type": "Literal", + "callee": { + "type": "Identifier", "range": [ - 32, - 37 + 19, + 31 ], "loc": { "start": { "line": 2, - "column": 18 + "column": 5 }, "end": { "line": 2, - "column": 23 + "column": 17 } }, - "value": false, - "raw": "false" - } - ] + "name": "configurable" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "value": false, + "raw": "false" + } + ] + } } ] } @@ -644,4 +661,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js index 6449044f6bf7..f70c4444ba7a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js @@ -203,26 +203,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 19, + 18, 37 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 23 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 19, - 22 + 37 ], "loc": { "start": { @@ -231,50 +231,50 @@ module.exports = { }, "end": { "line": 2, - "column": 8 + "column": 23 } }, - "name": "foo" - }, - "arguments": [ - { - "type": "ObjectExpression", + "callee": { + "type": "Identifier", "range": [ - 23, - 36 + 19, + 22 ], "loc": { "start": { "line": 2, - "column": 9 + "column": 5 }, "end": { "line": 2, - "column": 22 + "column": 8 } }, - "properties": [ - { - "type": "Property", - "range": [ - 25, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 20 - } + "name": "foo" + }, + "arguments": [ + { + "type": "ObjectExpression", + "range": [ + 23, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 9 }, - "key": { - "type": "Identifier", + "end": { + "line": 2, + "column": 22 + } + }, + "properties": [ + { + "type": "Property", "range": [ 25, - 28 + 34 ], "loc": { "start": { @@ -283,38 +283,55 @@ module.exports = { }, "end": { "line": 2, - "column": 14 + "column": 20 } }, - "name": "baz" - }, - "value": { - "type": "Literal", - "range": [ - 30, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 + "key": { + "type": "Identifier", + "range": [ + 25, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 14 + } }, - "end": { - "line": 2, - "column": 20 - } + "name": "baz" }, - "value": true, - "raw": "true" - }, - "computed": false, - "method": false, - "shorthand": false, - "kind": "init" - } - ] - } - ] + "value": { + "type": "Literal", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "value": true, + "raw": "true" + }, + "computed": false, + "method": false, + "shorthand": false, + "kind": "init" + } + ] + } + ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js index 8f15e94a377e..2ef1aefad54c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js @@ -203,22 +203,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 15, + 14, 21 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 11 } }, - "name": "hidden" + "expression": { + "type": "Identifier", + "range": [ + 15, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "name": "hidden" + } } ] } @@ -552,4 +569,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js index 301e980d011f..3dc323f46609 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js @@ -259,22 +259,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 18, + 17, 27 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 14 } }, - "name": "adminonly" + "expression": { + "type": "Identifier", + "range": [ + 18, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": "adminonly" + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js index af4fb3681d54..d1c7b207e7a9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js @@ -71,26 +71,26 @@ module.exports = { "implements": [], "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 1, + 0, 36 ], "loc": { "start": { "line": 1, - "column": 1 + "column": 0 }, "end": { "line": 3, "column": 2 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 1, - 10 + 36 ], "loc": { "start": { @@ -98,51 +98,51 @@ module.exports = { "column": 1 }, "end": { - "line": 1, - "column": 10 + "line": 3, + "column": 2 } }, - "name": "Component" - }, - "arguments": [ - { - "type": "ObjectExpression", + "callee": { + "type": "Identifier", "range": [ - 11, - 35 + 1, + 10 ], "loc": { "start": { "line": 1, - "column": 11 + "column": 1 }, "end": { - "line": 3, - "column": 1 + "line": 1, + "column": 10 } }, - "properties": [ - { - "type": "Property", - "range": [ - 17, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 19 - } + "name": "Component" + }, + "arguments": [ + { + "type": "ObjectExpression", + "range": [ + 11, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 11 }, - "key": { - "type": "Identifier", + "end": { + "line": 3, + "column": 1 + } + }, + "properties": [ + { + "type": "Property", "range": [ 17, - 25 + 32 ], "loc": { "start": { @@ -151,38 +151,55 @@ module.exports = { }, "end": { "line": 2, - "column": 12 + "column": 19 } }, - "name": "selector" - }, - "value": { - "type": "Literal", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 + "key": { + "type": "Identifier", + "range": [ + 17, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 12 + } }, - "end": { - "line": 2, - "column": 19 - } + "name": "selector" }, - "value": "foo", - "raw": "'foo'" - }, - "computed": false, - "method": false, - "shorthand": false, - "kind": "init" - } - ] - } - ] + "value": { + "type": "Literal", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "value": "foo", + "raw": "'foo'" + }, + "computed": false, + "method": false, + "shorthand": false, + "kind": "init" + } + ] + } + ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js index c05b767eb651..ae8c6fd208f3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js @@ -71,22 +71,39 @@ module.exports = { "implements": [], "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 1, + 0, 7 ], "loc": { "start": { "line": 1, - "column": 1 + "column": 0 }, "end": { "line": 1, "column": 7 } }, - "name": "sealed" + "expression": { + "type": "Identifier", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "sealed" + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js index 6bf94dfc9873..4edc70c3c59d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js @@ -132,26 +132,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 15, + 14, 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 20 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 15, - 23 + 30 ], "loc": { "start": { @@ -160,32 +160,49 @@ module.exports = { }, "end": { "line": 2, - "column": 13 + "column": 20 } }, - "name": "onlyRead" - }, - "arguments": [ - { - "type": "Literal", + "callee": { + "type": "Identifier", "range": [ - 24, - 29 + 15, + 23 ], "loc": { "start": { "line": 2, - "column": 14 + "column": 5 }, "end": { "line": 2, - "column": 19 + "column": 13 } }, - "value": false, - "raw": "false" - } - ] + "name": "onlyRead" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "value": false, + "raw": "false" + } + ] + } } ] } @@ -465,4 +482,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js index 00df8ea774ad..12b5e6918957 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js @@ -132,26 +132,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 15, + 14, 25 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 15 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 15, - 18 + 25 ], "loc": { "start": { @@ -160,32 +160,49 @@ module.exports = { }, "end": { "line": 2, - "column": 8 + "column": 15 } }, - "name": "Foo" - }, - "arguments": [ - { - "type": "Literal", + "callee": { + "type": "Identifier", "range": [ - 19, - 24 + 15, + 18 ], "loc": { "start": { "line": 2, - "column": 9 + "column": 5 }, "end": { "line": 2, - "column": 14 + "column": 8 } }, - "value": false, - "raw": "false" - } - ] + "name": "Foo" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 19, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "value": false, + "raw": "false" + } + ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js index 1e5ad094c0c1..ae988b28bd49 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js @@ -132,22 +132,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 15, + 14, 23 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 13 } }, - "name": "onlyRead" + "expression": { + "type": "Identifier", + "range": [ + 15, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "name": "onlyRead" + } } ] } @@ -373,4 +390,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js index 9e52d52bf89f..1910238b7c15 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js @@ -132,22 +132,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 15, + 14, 18 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 8 } }, - "name": "Foo" + "expression": { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "Foo" + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js index 768e3620409f..b3d7dbca4ae7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js @@ -161,26 +161,26 @@ module.exports = { }, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 33, + 32, 51 ], "loc": { "start": { "line": 2, - "column": 17 + "column": 16 }, "end": { "line": 2, "column": 35 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 33, - 39 + 51 ], "loc": { "start": { @@ -189,31 +189,48 @@ module.exports = { }, "end": { "line": 2, - "column": 23 + "column": 35 } }, - "name": "Inject" - }, - "arguments": [ - { + "callee": { "type": "Identifier", "range": [ - 40, - 50 + 33, + 39 ], "loc": { "start": { "line": 2, - "column": 24 + "column": 17 }, "end": { "line": 2, - "column": 34 + "column": 23 } }, - "name": "APP_CONFIG" - } - ] + "name": "Inject" + }, + "arguments": [ + { + "type": "Identifier", + "range": [ + 40, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "name": "APP_CONFIG" + } + ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js index 7f7a5158b8a8..63803ab73443 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js @@ -178,26 +178,26 @@ module.exports = { }, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 21, + 20, 34 ], "loc": { "start": { "line": 2, - "column": 9 + "column": 8 }, "end": { "line": 2, "column": 22 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 21, - 28 + 34 ], "loc": { "start": { @@ -206,32 +206,49 @@ module.exports = { }, "end": { "line": 2, - "column": 16 + "column": 22 } }, - "name": "special" - }, - "arguments": [ - { - "type": "Literal", + "callee": { + "type": "Identifier", "range": [ - 29, - 33 + 21, + 28 ], "loc": { "start": { "line": 2, - "column": 17 + "column": 9 }, "end": { "line": 2, - "column": 21 + "column": 16 } }, - "value": true, - "raw": "true" - } - ] + "name": "special" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": true, + "raw": "true" + } + ] + } } ] } @@ -573,4 +590,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js index 6d44940d33bb..dcb0c6d37db8 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js @@ -178,26 +178,26 @@ module.exports = { }, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 34, + 33, 47 ], "loc": { "start": { "line": 2, - "column": 16 + "column": 15 }, "end": { "line": 2, "column": 29 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 34, - 41 + 47 ], "loc": { "start": { @@ -206,32 +206,49 @@ module.exports = { }, "end": { "line": 2, - "column": 23 + "column": 29 } }, - "name": "special" - }, - "arguments": [ - { - "type": "Literal", + "callee": { + "type": "Identifier", "range": [ - 42, - 46 + 34, + 41 ], "loc": { "start": { "line": 2, - "column": 24 + "column": 16 }, "end": { "line": 2, - "column": 28 + "column": 23 } }, - "value": true, - "raw": "true" - } - ] + "name": "special" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 42, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "value": true, + "raw": "true" + } + ] + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js index a723cb8722fd..12a897c8d2d7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js @@ -288,22 +288,39 @@ module.exports = { }, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 27, + 26, 35 ], "loc": { "start": { "line": 2, - "column": 11 + "column": 10 }, "end": { "line": 2, "column": 19 } }, - "name": "required" + "expression": { + "type": "Identifier", + "range": [ + 27, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "required" + } } ] } @@ -717,4 +734,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js index 661c38f63fe9..fa9c94fe0750 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js @@ -288,22 +288,39 @@ module.exports = { }, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 40, + 39, 48 ], "loc": { "start": { "line": 2, - "column": 18 + "column": 17 }, "end": { "line": 2, "column": 26 } }, - "name": "required" + "expression": { + "type": "Identifier", + "range": [ + 40, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "name": "required" + } } ] } diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js index 51a1a55fc20d..5ab2db2a7a71 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js @@ -92,26 +92,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 27, + 26, 34 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 12 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 27, - 32 + 34 ], "loc": { "start": { @@ -120,12 +120,29 @@ module.exports = { }, "end": { "line": 2, - "column": 10 + "column": 12 } }, - "name": "Input" - }, - "arguments": [] + "callee": { + "type": "Identifier", + "range": [ + 27, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + }, + "name": "Input" + }, + "arguments": [] + } } ], "typeAnnotation": null @@ -205,26 +222,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 46, + 45, 54 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 4 }, "end": { "line": 3, "column": 13 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 46, - 52 + 54 ], "loc": { "start": { @@ -233,12 +250,29 @@ module.exports = { }, "end": { "line": 3, - "column": 11 + "column": 13 } }, - "name": "Output" - }, - "arguments": [] + "callee": { + "type": "Identifier", + "range": [ + 46, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "name": "Output" + }, + "arguments": [] + } } ], "typeAnnotation": null @@ -645,4 +679,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js index 9a4933fb5740..ed82988f5470 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js @@ -92,26 +92,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 15, + 14, 33 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 23 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 15, - 27 + 33 ], "loc": { "start": { @@ -120,32 +120,49 @@ module.exports = { }, "end": { "line": 2, - "column": 17 + "column": 23 } }, - "name": "configurable" - }, - "arguments": [ - { - "type": "Literal", + "callee": { + "type": "Identifier", "range": [ - 28, - 32 + 15, + 27 ], "loc": { "start": { "line": 2, - "column": 18 + "column": 5 }, "end": { "line": 2, - "column": 22 + "column": 17 } }, - "value": true, - "raw": "true" - } - ] + "name": "configurable" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "value": true, + "raw": "true" + } + ] + } } ], "typeAnnotation": null @@ -190,26 +207,26 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "CallExpression", + "type": "Decorator", "range": [ - 54, + 53, 73 ], "loc": { "start": { "line": 4, - "column": 5 + "column": 4 }, "end": { "line": 4, "column": 24 } }, - "callee": { - "type": "Identifier", + "expression": { + "type": "CallExpression", "range": [ 54, - 66 + 73 ], "loc": { "start": { @@ -218,32 +235,49 @@ module.exports = { }, "end": { "line": 4, - "column": 17 + "column": 24 } }, - "name": "configurable" - }, - "arguments": [ - { - "type": "Literal", + "callee": { + "type": "Identifier", "range": [ - 67, - 72 + 54, + 66 ], "loc": { "start": { "line": 4, - "column": 18 + "column": 5 }, "end": { "line": 4, - "column": 23 + "column": 17 } }, - "value": false, - "raw": "false" - } - ] + "name": "configurable" + }, + "arguments": [ + { + "type": "Literal", + "range": [ + 67, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + }, + "value": false, + "raw": "false" + } + ] + } } ], "typeAnnotation": null @@ -632,4 +666,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js index a00abaaa424f..0d6a7725d673 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js @@ -92,22 +92,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 15, + 14, 18 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 8 } }, - "name": "foo" + "expression": { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "foo" + } } ], "typeAnnotation": null @@ -152,22 +169,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 27, + 26, 30 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 4 }, "end": { "line": 3, "column": 8 } }, - "name": "bar" + "expression": { + "type": "Identifier", + "range": [ + 27, + 30 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "name": "bar" + } } ], "typeAnnotation": null @@ -412,4 +446,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js index 76c42c882c53..c03092e14d05 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js @@ -92,22 +92,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 15, + 14, 18 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 4 }, "end": { "line": 2, "column": 8 } }, - "name": "baz" + "expression": { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "name": "baz" + } } ], "typeAnnotation": null @@ -152,22 +169,39 @@ module.exports = { "accessibility": null, "decorators": [ { - "type": "Identifier", + "type": "Decorator", "range": [ - 34, + 33, 37 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 4 }, "end": { "line": 3, "column": 8 } }, - "name": "qux" + "expression": { + "type": "Identifier", + "range": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "name": "qux" + } } ], "typeAnnotation": null @@ -448,4 +482,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js new file mode 100644 index 000000000000..8db1d4d6f5e2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js @@ -0,0 +1,203 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "body": [ + { + "type": "TSEnumDeclaration", + "range": [ + 0, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "decorators": [ + { + "type": "Decorator", + "range": [ + 0, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "expression": { + "type": "Identifier", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "dec" + } + } + ], + "name": { + "type": "Identifier", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "E" + }, + "members": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "@", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Identifier", + "value": "dec", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Keyword", + "value": "enum", + "range": [ + 5, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "E", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts new file mode 100644 index 000000000000..c5d3bb05ffc8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.src.ts @@ -0,0 +1 @@ +@dec enum E {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tools/update-typescript-tests.js b/packages/typescript-eslint-parser/tools/update-typescript-tests.js index e8c620f86f13..9b1ca9f29971 100644 --- a/packages/typescript-eslint-parser/tools/update-typescript-tests.js +++ b/packages/typescript-eslint-parser/tools/update-typescript-tests.js @@ -1,21 +1,16 @@ /** * @fileoverview A simple script to update existing tests to reflect new - * parser changes. + * parser changes. * @author Nicholas C. Zakas - + */ "use strict"; -/* - * Usage: - * node tools/update-typescript-tests.js - * - */ //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ -var shelljs = require("shelljs"), +const shelljs = require("shelljs"), parser = require("../parser"), tester = require("../tests/lib/tester"), path = require("path"); @@ -26,50 +21,60 @@ var shelljs = require("shelljs"), /** * Returns a raw copy of the given AST - * @param {object} ast the AST object - * @returns {object} copy of the AST object + * @param {Object} ast the AST object + * @returns {Object} copy of the AST object */ function getRaw(ast) { return JSON.parse(JSON.stringify(ast)); } - +/** + * Returns the expected AST + * @param {string} code the source code + * @param {Object} config the parser config + * @returns {Object} the expected AST object + */ function getExpectedResult(code, config) { try { return tester.getRaw(parser.parse(code, config)); } catch (ex) { - var raw = getRaw(ex); + const raw = getRaw(ex); raw.message = ex.message; return raw; } } +/** + * Returns an array of relevant filenames within the directory + * @param {string} directory path of the directory to scan + * @returns {string[]} list of relevant filenames + */ function getTestFilenames(directory) { - return shelljs.find(directory).filter(function(filename) { - return filename.indexOf(".src.ts") > -1; - }).map(function(filename) { - return filename.substring(directory.length - 1, filename.length - 7); // strip off ".src.ts" - }); + return shelljs.find(directory).filter(filename => filename.indexOf(".src.ts") > -1).map(filename => filename.substring(directory.length - 1, filename.length - 7) // strip off ".src.ts" + ); } +/** + * Writes the given AST to the given filename + * @param {*} result the AST to write to a file + * @param {*} testResultFilename name of the file to write to + * @returns {void} + */ function outputResult(result, testResultFilename) { - shelljs.echo("module.exports = " + JSON.stringify(result, null, " ") + ";").to(testResultFilename); + shelljs.echo(`module.exports = ${JSON.stringify(result, null, " ")};`).to(testResultFilename); } //------------------------------------------------------------------------------ // Setup //------------------------------------------------------------------------------ -var FIXTURES_DIR = "./tests/fixtures/typescript"; - -var testFiles = getTestFilenames(FIXTURES_DIR); - +const FIXTURES_DIR = "./tests/fixtures/typescript"; +const testFiles = getTestFilenames(FIXTURES_DIR); +const assert = require("chai").assert; -// update all tests in ecma-features -testFiles.forEach(function(filename) { +testFiles.forEach(filename => { - var feature = path.dirname(filename), - code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.ts"), + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`), config = { loc: true, range: true, @@ -78,8 +83,16 @@ testFiles.forEach(function(filename) { errorOnUnknownASTType: true }; - var testResultFilename = path.resolve(__dirname, "..", FIXTURES_DIR, filename) + ".result.js"; - var result = getExpectedResult(code, config); + const testResultFilename = `${path.resolve(__dirname, "..", FIXTURES_DIR, filename)}.result.js`; + const result = getExpectedResult(code, config); + + const expected = require(testResultFilename); + + try { + assert.deepEqual(result, expected); + } catch (e) { + shelljs.echo("DIFFERENT", e); + outputResult(result, testResultFilename); + } - outputResult(result, testResultFilename); }); From 6d7f051dd92b0811fafbeda4d54552551bbdf53a Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 28 May 2017 23:19:42 +0100 Subject: [PATCH 158/326] Chore: Replace mocha (istanbul, chai, leche) with Jest (#300) --- packages/typescript-eslint-parser/Makefile.js | 4 ++-- packages/typescript-eslint-parser/package.json | 13 ++++++++----- .../tests/lib/.eslintrc.yml | 2 +- .../typescript-eslint-parser/tests/lib/basics.js | 12 +++++------- .../typescript-eslint-parser/tests/lib/comments.js | 12 +++++------- .../tests/lib/ecma-features.js | 12 +++++------- packages/typescript-eslint-parser/tests/lib/jsx.js | 14 ++++++-------- .../typescript-eslint-parser/tests/lib/parse.js | 13 ++++++------- .../tests/lib/typescript.js | 12 +++++------- .../{tests/lib/tester.js => tools/test-utils.js} | 0 .../tools/update-typescript-tests.js | 14 +++----------- 11 files changed, 46 insertions(+), 62 deletions(-) rename packages/typescript-eslint-parser/{tests/lib/tester.js => tools/test-utils.js} (100%) diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index eca49edc0551..a1cf6cdb8bae 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -33,7 +33,7 @@ const OPEN_SOURCE_LICENSES = [ const NODE_MODULES = "./node_modules/", // Utilities - intentional extra space at the end of each string - MOCHA = `${NODE_MODULES}mocha/bin/_mocha `, + JEST = `${NODE_MODULES}jest/bin/jest.js`, // Files MAKEFILE = "./Makefile.js", @@ -103,7 +103,7 @@ target.lint = function() { target.test = function() { target.lint(); - const lastReturn = nodeCLI.exec("istanbul", "cover", MOCHA, "-- -c", TEST_FILES); + const lastReturn = nodeCLI.exec(JEST); let errors = 0; if (lastReturn.code !== 0) { diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 7cd6a5f79980..790cfedf63ae 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -18,15 +18,11 @@ }, "license": "BSD-2-Clause", "devDependencies": { - "chai": "3.5.0", - "dateformat": "2.0.0", "eslint": "3.19.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "4.2.2", "eslint-release": "0.10.3", - "istanbul": "0.4.5", - "leche": "2.1.2", - "mocha": "3.3.0", + "jest": "20.0.4", "npm-license": "0.3.3", "shelljs": "0.7.7", "shelljs-nodecli": "0.1.1", @@ -43,6 +39,7 @@ ], "scripts": { "test": "node Makefile.js test", + "jest": "jest", "lint": "node Makefile.js lint", "release": "eslint-release", "ci-release": "eslint-ci-release", @@ -56,5 +53,11 @@ }, "peerDependencies": { "typescript": "*" + }, + "jest": { + "testRegex": "tests\/lib\/.+\\.js$", + "testPathIgnorePatterns": [], + "collectCoverage": true, + "coverageReporters": ["text-summary"] } } diff --git a/packages/typescript-eslint-parser/tests/lib/.eslintrc.yml b/packages/typescript-eslint-parser/tests/lib/.eslintrc.yml index 72b9c8cc7456..e19b2cfa824a 100644 --- a/packages/typescript-eslint-parser/tests/lib/.eslintrc.yml +++ b/packages/typescript-eslint-parser/tests/lib/.eslintrc.yml @@ -1,2 +1,2 @@ env: - mocha: true + jest: true diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index 7ac087f604ff..a5ab496744fe 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -11,12 +11,10 @@ // Requirements //------------------------------------------------------------------------------ -const assert = require("chai").assert, - leche = require("leche"), - path = require("path"), +const path = require("path"), parser = require("../../parser"), shelljs = require("shelljs"), - tester = require("./tester"); + testUtils = require("../../tools/test-utils"); //------------------------------------------------------------------------------ // Setup @@ -47,7 +45,7 @@ describe("basics", () => { }; }); - leche.withData(testFiles, filename => { + testFiles.forEach(filename => { // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; @@ -59,7 +57,7 @@ describe("basics", () => { try { result = parser.parse(code, config); - result = tester.getRaw(result); + result = testUtils.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected @@ -72,7 +70,7 @@ describe("basics", () => { } // console.log(JSON.stringify(result, null, 4)); - assert.deepEqual(result, expected); + expect(result).toEqual(expected); }); diff --git a/packages/typescript-eslint-parser/tests/lib/comments.js b/packages/typescript-eslint-parser/tests/lib/comments.js index 178b7b639ec8..eeac34fc84ed 100644 --- a/packages/typescript-eslint-parser/tests/lib/comments.js +++ b/packages/typescript-eslint-parser/tests/lib/comments.js @@ -30,12 +30,10 @@ // Requirements //------------------------------------------------------------------------------ -const assert = require("chai").assert, - leche = require("leche"), - path = require("path"), +const path = require("path"), parser = require("../../parser"), shelljs = require("shelljs"), - tester = require("./tester"); + testUtils = require("../../tools/test-utils"); //------------------------------------------------------------------------------ // Setup @@ -68,7 +66,7 @@ describe("Comments", () => { }; }); - leche.withData(testFiles, filename => { + testFiles.forEach(filename => { const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); it("should produce correct AST when parsed with comment", () => { @@ -77,7 +75,7 @@ describe("Comments", () => { try { result = parser.parse(code, config); - result = tester.getRaw(result); + result = testUtils.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected @@ -88,7 +86,7 @@ describe("Comments", () => { } - assert.deepEqual(result, expected); + expect(result).toEqual(expected); }); }); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 51a1c65eac28..eda18839532b 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -11,12 +11,10 @@ // Requirements //------------------------------------------------------------------------------ -const assert = require("chai").assert, - leche = require("leche"), - path = require("path"), +const path = require("path"), parser = require("../../parser"), shelljs = require("shelljs"), - tester = require("./tester"); + testUtils = require("../../tools/test-utils"); //------------------------------------------------------------------------------ // Setup @@ -65,7 +63,7 @@ describe("ecmaFeatures", () => { }; }); - leche.withData(testFiles, filename => { + testFiles.forEach(filename => { // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; @@ -98,7 +96,7 @@ describe("ecmaFeatures", () => { try { result = parser.parse(code, config); - result = tester.getRaw(result); + result = testUtils.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected @@ -109,7 +107,7 @@ describe("ecmaFeatures", () => { } - assert.deepEqual(result, expected); + expect(result).toEqual(expected); }); }); diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.js b/packages/typescript-eslint-parser/tests/lib/jsx.js index 38f615ec4e7e..44812c95c9d6 100644 --- a/packages/typescript-eslint-parser/tests/lib/jsx.js +++ b/packages/typescript-eslint-parser/tests/lib/jsx.js @@ -11,12 +11,10 @@ // Requirements //------------------------------------------------------------------------------ -const assert = require("chai").assert, - leche = require("leche"), - path = require("path"), +const path = require("path"), parser = require("../../parser"), shelljs = require("shelljs"), - tester = require("./tester"); + testUtils = require("../../tools/test-utils"); //------------------------------------------------------------------------------ // Setup @@ -84,7 +82,7 @@ describe("JSX", () => { try { result = parser.parse(code, config); - result = tester.getRaw(result); + result = testUtils.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected @@ -95,15 +93,15 @@ describe("JSX", () => { } - assert.deepEqual(result, expected); + expect(result).toEqual(expected); }); }; } describe("useJSXTextNode: false", () => { - leche.withData(jsxTestFiles, testFixture(JSX_FIXTURES_DIR, false)); + jsxTestFiles.forEach(testFixture(JSX_FIXTURES_DIR, false)); }); describe("useJSXTextNode: true", () => { - leche.withData(jsxTextTestFiles, testFixture(JSX_JSXTEXT_FIXTURES_DIR, true)); + jsxTextTestFiles.forEach(testFixture(JSX_JSXTEXT_FIXTURES_DIR, true)); }); }); diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index a6606cc15170..5b30bec1c74f 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -11,9 +11,8 @@ // Requirements //------------------------------------------------------------------------------ -const assert = require("chai").assert, - parser = require("../../parser"), - tester = require("./tester"); +const parser = require("../../parser"), + testUtils = require("../../tools/test-utils"); //------------------------------------------------------------------------------ // Tests @@ -25,8 +24,8 @@ describe("parse()", () => { describe("basic functionality", () => { it("should parse an empty string", () => { - assert.deepEqual(parser.parse("").body, []); - assert.deepEqual(parser.parse("", {}).body, []); + expect(parser.parse("").body).toEqual([]); + expect(parser.parse("", {}).body).toEqual([]); }); }); @@ -37,7 +36,7 @@ describe("parse()", () => { try { parser.parse("function fn(a, a) {\n}", { sourceType: "module" }); } catch (err) { - assert.equal(err.column, 16); + expect(err.column).toEqual(16); } }); @@ -56,7 +55,7 @@ describe("parse()", () => { loc: true }); - assert.deepEqual(tester.getRaw(ast), require("../fixtures/parse/all-pieces.json")); + expect(testUtils.getRaw(ast)).toEqual(require("../fixtures/parse/all-pieces.json")); }); }); diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index 8c0b12a61068..e0d30b05ad92 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -11,12 +11,10 @@ // Requirements //------------------------------------------------------------------------------ -const assert = require("chai").assert, - leche = require("leche"), - path = require("path"), +const path = require("path"), parser = require("../../parser"), shelljs = require("shelljs"), - tester = require("./tester"); + testUtils = require("../../tools/test-utils"); //------------------------------------------------------------------------------ // Setup @@ -47,7 +45,7 @@ describe("typescript", () => { }; }); - leche.withData(testFiles, filename => { + testFiles.forEach(filename => { // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; @@ -59,7 +57,7 @@ describe("typescript", () => { try { result = parser.parse(code, config); - result = tester.getRaw(result); + result = testUtils.getRaw(result); } catch (ex) { // format of error isn't exactly the same, just check if it's expected @@ -72,7 +70,7 @@ describe("typescript", () => { } // console.log(JSON.stringify(result, null, 4)); - assert.deepEqual(result, expected); + expect(result).toEqual(expected); }); diff --git a/packages/typescript-eslint-parser/tests/lib/tester.js b/packages/typescript-eslint-parser/tools/test-utils.js similarity index 100% rename from packages/typescript-eslint-parser/tests/lib/tester.js rename to packages/typescript-eslint-parser/tools/test-utils.js diff --git a/packages/typescript-eslint-parser/tools/update-typescript-tests.js b/packages/typescript-eslint-parser/tools/update-typescript-tests.js index 9b1ca9f29971..8f3b8b3e5914 100644 --- a/packages/typescript-eslint-parser/tools/update-typescript-tests.js +++ b/packages/typescript-eslint-parser/tools/update-typescript-tests.js @@ -12,7 +12,7 @@ const shelljs = require("shelljs"), parser = require("../parser"), - tester = require("../tests/lib/tester"), + testUtils = require("./test-utils"), path = require("path"); //------------------------------------------------------------------------------ @@ -36,7 +36,7 @@ function getRaw(ast) { */ function getExpectedResult(code, config) { try { - return tester.getRaw(parser.parse(code, config)); + return testUtils.getRaw(parser.parse(code, config)); } catch (ex) { const raw = getRaw(ex); raw.message = ex.message; @@ -70,7 +70,6 @@ function outputResult(result, testResultFilename) { const FIXTURES_DIR = "./tests/fixtures/typescript"; const testFiles = getTestFilenames(FIXTURES_DIR); -const assert = require("chai").assert; testFiles.forEach(filename => { @@ -86,13 +85,6 @@ testFiles.forEach(filename => { const testResultFilename = `${path.resolve(__dirname, "..", FIXTURES_DIR, filename)}.result.js`; const result = getExpectedResult(code, config); - const expected = require(testResultFilename); - - try { - assert.deepEqual(result, expected); - } catch (e) { - shelljs.echo("DIFFERENT", e); - outputResult(result, testResultFilename); - } + outputResult(result, testResultFilename); }); From b33e64a8ec0a8dfb88a672643ce2d062c7b61934 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 28 May 2017 23:29:47 +0100 Subject: [PATCH 159/326] Breaking: Change isReadonly to readonly (fixes #284) (#285) --- packages/typescript-eslint-parser/lib/convert.js | 2 +- .../class-with-export-parameter-properties.result.js | 2 +- .../class-with-private-parameter-properties.result.js | 8 ++++---- .../class-with-protected-parameter-properties.result.js | 8 ++++---- .../class-with-public-parameter-properties.result.js | 8 ++++---- .../class-with-readonly-parameter-properties.result.js | 4 ++-- .../class-with-static-parameter-properties.result.js | 2 +- ...truct-signature-with-parameter-accessibility.result.js | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index cf71e7d1c5af..124c42474efe 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1121,7 +1121,7 @@ module.exports = function convert(config) { range: [node.getStart(), node.end], loc: nodeUtils.getLoc(node, ast), accessibility: nodeUtils.getTSNodeAccessibility(node), - isReadonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node), parameter: result diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js index 0bbff21b87c0..a97ced040db5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js @@ -107,7 +107,7 @@ module.exports = { } }, "accessibility": null, - "isReadonly": false, + "readonly": false, "static": false, "export": true, "parameter": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js index 2d64e5f9723f..15ae8d8673fa 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js @@ -113,9 +113,9 @@ module.exports = { }, "decorators": [], "accessibility": "private", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -187,9 +187,9 @@ module.exports = { }, "decorators": [], "accessibility": "private", - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -261,9 +261,9 @@ module.exports = { }, "decorators": [], "accessibility": "private", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "left": { "type": "Identifier", @@ -371,9 +371,9 @@ module.exports = { }, "decorators": [], "accessibility": "private", - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "left": { "type": "Identifier", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js index 31a388e5e173..3ff625adf790 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js @@ -143,9 +143,9 @@ module.exports = { }, "decorators": [], "accessibility": "protected", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -217,9 +217,9 @@ module.exports = { }, "decorators": [], "accessibility": "protected", - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -291,9 +291,9 @@ module.exports = { }, "decorators": [], "accessibility": "protected", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -401,9 +401,9 @@ module.exports = { }, "decorators": [], "accessibility": "protected", - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "type": "AssignmentPattern", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js index a29e488f0f06..14de49a5b019 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js @@ -143,9 +143,9 @@ module.exports = { }, "decorators": [], "accessibility": "public", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -217,9 +217,9 @@ module.exports = { }, "decorators": [], "accessibility": "public", - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -291,9 +291,9 @@ module.exports = { }, "decorators": [], "accessibility": "public", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -401,9 +401,9 @@ module.exports = { }, "decorators": [], "accessibility": "public", - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "type": "AssignmentPattern", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js index 9823df6264d2..5ecb3416b78b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js @@ -143,9 +143,9 @@ module.exports = { }, "decorators": [], "accessibility": null, - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -217,9 +217,9 @@ module.exports = { }, "decorators": [], "accessibility": null, - "isReadonly": true, "static": false, "export": false, + "readonly": true, "parameter": { "type": "AssignmentPattern", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js index d5c7807827d3..840e5f5a7821 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js @@ -107,7 +107,7 @@ module.exports = { } }, "accessibility": null, - "isReadonly": false, + "readonly": false, "static": true, "export": false, "parameter": { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js index ea91b7e30b90..8e7e7b687faa 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -69,9 +69,9 @@ module.exports = { } }, "accessibility": "public", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -108,9 +108,9 @@ module.exports = { } }, "accessibility": "private", - "isReadonly": false, "static": false, "export": false, + "readonly": false, "parameter": { "type": "Identifier", "range": [ From 33f8afa2d2b37f6889aeaab26b78ff232d43a088 Mon Sep 17 00:00:00 2001 From: Jeremy Attali Date: Fri, 2 Jun 2017 13:58:27 +0200 Subject: [PATCH 160/326] Chore: Fix typo in comment (#305) Thanks! --- packages/typescript-eslint-parser/lib/convert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 124c42474efe..fe4bdb2f0e0e 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -302,7 +302,7 @@ module.exports = function convert(config) { } /** - * The core of the conervsion logic: + * The core of the conversion logic: * Identify and convert each relevant TypeScript SyntaxKind */ switch (node.kind) { From 901122b13176d8a32e550f0cadd97ca99a30e6cb Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 3 Jun 2017 06:13:35 -0500 Subject: [PATCH 161/326] Fix: Add more tests for destructuring and spread (fixes #306) (#308) --- .../typescript-eslint-parser/lib/convert.js | 28 +- .../lib/node-utils.js | 5 + .../arrow-param-array.result.js | 261 ++++++ .../arrow-param-array.src.js | 1 + .../arrow-param-nested-array.result.js | 370 +++++++++ .../arrow-param-nested-array.src.js | 1 + .../arrow-param-nested-object-named.result.js | 595 ++++++++++++++ .../arrow-param-nested-object-named.src.js | 1 + .../arrow-param-nested-object.result.js | 523 ++++++++++++ .../arrow-param-nested-object.src.js | 1 + .../arrow-param-object.result.js | 300 +++++++ .../arrow-param-object.src.js | 1 + .../param-defaults-array.result.js | 315 ++++++++ .../param-defaults-array.src.js | 1 + .../param-defaults-object-nested.result.js | 758 ++++++++++++++++++ .../param-defaults-object-nested.src.js | 1 + .../param-defaults-object.result.js | 354 ++++++++ .../param-defaults-object.src.js | 1 + .../array-const-undefined.result.js | 258 ++++++ .../array-const-undefined.src.js | 1 + .../array-let-undefined.result.js | 258 ++++++ .../array-let-undefined.src.js | 1 + .../object-const-named.result.js | 333 ++++++++ .../object-const-named.src.js | 1 + .../object-const-undefined.result.js | 297 +++++++ .../object-const-undefined.src.js | 1 + .../object-let-named.result.js | 333 ++++++++ .../object-let-named.src.js | 1 + .../object-let-undefined.result.js | 297 +++++++ .../object-let-undefined.src.js | 1 + .../param-array.result.js | 441 ++++++++++ .../param-array.src.js | 1 + .../param-object-short.result.js | 650 +++++++++++++++ .../param-object-short.src.js | 1 + .../param-object-wrapped.result.js | 141 ++++ .../param-object-wrapped.src.xjs | 1 + .../param-object.result.js | 592 ++++++++++++++ .../param-object.src.js | 1 + .../destructuring-and-forOf/loop.result.js | 273 +++++++ .../destructuring-and-forOf/loop.src.js | 1 + .../complex-destructured.result.js | 496 ++++++++++++ .../complex-destructured.src.js | 1 + .../destructured-array-literal.result.js | 418 ++++++++++ .../destructured-array-literal.src.js | 1 + .../destructuring-param.result.js | 512 ++++++++++++ .../destructuring-param.src.js | 1 + ...omplex-destructured-spread-first.result.js | 6 + ...r-complex-destructured-spread-first.src.js | 1 + .../invalid-not-final-array-empty.result.js | 6 + .../invalid-not-final-array-empty.src.xjs | 1 + .../multi-destructured.result.js | 309 +++++++ .../multi-destructured.src.js | 1 + .../not-final-array.result.js | 6 + .../not-final-array.src.xjs | 1 + .../single-destructured.result.js | 255 ++++++ .../single-destructured.src.js | 1 + .../var-complex-destructured.result.js | 516 ++++++++++++ .../var-complex-destructured.src.js | 1 + .../var-destructured-array-literal.result.js | 438 ++++++++++ .../var-destructured-array-literal.src.js | 1 + .../var-multi-destructured.result.js | 329 ++++++++ .../var-multi-destructured.src.js | 1 + .../var-single-destructured.result.js | 275 +++++++ .../var-single-destructured.src.js | 1 + .../tests/lib/ecma-features.js | 2 +- 65 files changed, 10977 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.src.xjs create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.src.xjs create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.src.xjs create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.src.js diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index fe4bdb2f0e0e..104c990238c2 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -570,6 +570,8 @@ module.exports = function convert(config) { case SyntaxKind.ArrayLiteralExpression: { const arrayAssignNode = nodeUtils.findAncestorOfKind(node, SyntaxKind.BinaryExpression); + const arrayIsInForOf = node.parent && node.parent.kind === SyntaxKind.ForOfStatement; + const arrayIsInForIn = node.parent && node.parent.kind === SyntaxKind.ForInStatement; let arrayIsInAssignment; if (arrayAssignNode) { @@ -581,7 +583,7 @@ module.exports = function convert(config) { } // TypeScript uses ArrayLiteralExpression in destructuring assignment, too - if (arrayIsInAssignment) { + if (arrayIsInAssignment || arrayIsInForOf || arrayIsInForIn) { Object.assign(result, { type: AST_NODE_TYPES.ArrayPattern, elements: node.elements.map(convertChild) @@ -925,6 +927,11 @@ module.exports = function convert(config) { left: arrayItem, right: convertChild(node.initializer) }); + } else if (node.dotDotDotToken) { + Object.assign(result, { + type: AST_NODE_TYPES.RestElement, + argument: arrayItem + }); } else { return arrayItem; } @@ -1058,16 +1065,31 @@ module.exports = function convert(config) { // Patterns - case SyntaxKind.SpreadElement: + case SyntaxKind.SpreadElement: { + let type = AST_NODE_TYPES.SpreadElement; + + if (node.parent && + node.parent.parent && + node.parent.parent.kind === SyntaxKind.BinaryExpression + ) { + if (node.parent.parent.left === node.parent) { + type = AST_NODE_TYPES.RestElement; + } else if (node.parent.parent.right === node.parent) { + type = AST_NODE_TYPES.SpreadElement; + } + } + Object.assign(result, { - type: AST_NODE_TYPES.SpreadElement, + type, argument: convertChild(node.expression) }); break; + } case SyntaxKind.SpreadAssignment: { let type = AST_NODE_TYPES.ExperimentalSpreadProperty; if (node.parent && + node.parent.parent && node.parent.parent.kind === SyntaxKind.BinaryExpression ) { if (node.parent.parent.right === node.parent) { diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 64d2551f9eeb..28f1e4aa550b 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -112,6 +112,11 @@ function findFirstMatchingChild(node, sourceFile, predicate) { if (child && predicate(child)) { return child; } + + const grandChild = findFirstMatchingChild(child, sourceFile, predicate); + if (grandChild) { + return grandChild; + } } return undefined; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js new file mode 100644 index 000000000000..d546423880f6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js @@ -0,0 +1,261 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "y" + } + ] + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.src.js new file mode 100644 index 000000000000..c2f38722e62b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.src.js @@ -0,0 +1 @@ +([y]) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js new file mode 100644 index 000000000000..c75245c2a872 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js @@ -0,0 +1,370 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "y" + }, + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "x" + } + ] + } + ] + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 11, + 13 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js new file mode 100644 index 000000000000..75bb19b495b8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js @@ -0,0 +1 @@ +([y, [x]]) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js new file mode 100644 index 000000000000..380c7ec73045 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js @@ -0,0 +1,595 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 0, + 28 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 0, + 27 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 1, + 21 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 2, + 8 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 2, + 5 + ], + "name": "foo" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "y" + }, + "kind": "init" + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 10, + 20 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "a" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 12, + 20 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 13, + 19 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "name": "bar" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "x" + }, + "kind": "init" + } + ] + }, + "kind": "init" + } + ] + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 2, + 5 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Identifier", + "value": "bar", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 27, + 28 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js new file mode 100644 index 000000000000..c2a809e04a22 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js @@ -0,0 +1 @@ +({foo: y, a:{bar: x}}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js new file mode 100644 index 000000000000..e1953238fc58 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js @@ -0,0 +1,523 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 1, + 11 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "y" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "y" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 5, + 10 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "x" + } + } + ] + }, + "kind": "init" + } + ] + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 13, + 15 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js new file mode 100644 index 000000000000..177cd72468dd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js @@ -0,0 +1 @@ +({y, a:{x}}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js new file mode 100644 index 000000000000..52e007591737 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js @@ -0,0 +1,300 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "y" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "y" + } + } + ] + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.src.js new file mode 100644 index 000000000000..7f6a1fb1436e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.src.js @@ -0,0 +1 @@ +({y}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js new file mode 100644 index 000000000000..914227a99056 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js @@ -0,0 +1,315 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ], + "elements": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 2, + 8 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ], + "value": 10, + "raw": "10" + } + } + ] + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 11, + 13 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.src.js new file mode 100644 index 000000000000..7fa2d1940626 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.src.js @@ -0,0 +1 @@ +([x = 10]) => x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js new file mode 100644 index 000000000000..e78410ae1c4f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js @@ -0,0 +1,758 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 0, + 35 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 1, + 24 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 2, + 8 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 2, + 8 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ], + "value": 10, + "raw": "10" + } + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 10, + 23 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "y" + }, + "value": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 13, + 23 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 15, + 21 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "z" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 15, + 21 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "z" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ], + "value": 10, + "raw": "10" + } + } + } + ] + }, + "kind": "init" + } + ] + } + ], + "body": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 29, + 35 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ], + "name": "x" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ], + "name": "z" + } + ] + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "y", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "range": [ + 26, + 28 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Identifier", + "value": "z", + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + }, + "range": [ + 33, + 34 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "range": [ + 34, + 35 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js new file mode 100644 index 000000000000..410eed8cc78f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js @@ -0,0 +1 @@ +({x = 10, y: { z = 10 }}) => [x, z] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js new file mode 100644 index 000000000000..136e0c348797 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js @@ -0,0 +1,354 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "expression": { + "type": "ArrowFunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 2, + 8 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 2, + 8 + ], + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "x" + }, + "right": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ], + "value": 10, + "raw": "10" + } + } + } + ] + } + ], + "body": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "x" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 6, + 8 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "=>", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 11, + 13 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.src.js new file mode 100644 index 000000000000..c6b403750620 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.src.js @@ -0,0 +1 @@ +({x = 10}) => x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js new file mode 100644 index 000000000000..91f931042f3e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js @@ -0,0 +1,258 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 6, + 14 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + } + ] + }, + "init": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "elements": [] + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.src.js new file mode 100644 index 000000000000..0ff51d044822 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.src.js @@ -0,0 +1 @@ +const [a] = []; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js new file mode 100644 index 000000000000..6fd4ac7144fa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js @@ -0,0 +1,258 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + } + ] + }, + "init": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ], + "elements": [] + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.src.js new file mode 100644 index 000000000000..c705f581d5a1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.src.js @@ -0,0 +1 @@ +let [a] = []; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js new file mode 100644 index 000000000000..d927cb064ea0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js @@ -0,0 +1,333 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 6, + 16 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 6, + 11 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 7, + 10 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "b" + }, + "kind": "init" + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "properties": [] + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.src.js new file mode 100644 index 000000000000..67a0d1a4e9c7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.src.js @@ -0,0 +1 @@ +const {a:b} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js new file mode 100644 index 000000000000..b28b4f18904f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js @@ -0,0 +1,297 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 6, + 14 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 6, + 9 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "properties": [] + } + } + ], + "kind": "const" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "const", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 0, + 5 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.src.js new file mode 100644 index 000000000000..80b78cb8d264 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.src.js @@ -0,0 +1 @@ +const {a} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js new file mode 100644 index 000000000000..4409bcd08ff8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js @@ -0,0 +1,333 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 4, + 14 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 4, + 9 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + }, + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "b" + }, + "kind": "init" + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 12, + 14 + ], + "properties": [] + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.src.js new file mode 100644 index 000000000000..53b1654cb828 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.src.js @@ -0,0 +1 @@ +let {a:b} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js new file mode 100644 index 000000000000..1b70558f8f2a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js @@ -0,0 +1,297 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ], + "id": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + } + } + ] + }, + "init": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 10, + 12 + ], + "properties": [] + } + } + ], + "kind": "let" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "let", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.src.js new file mode 100644 index 000000000000..51c02f8b6ed1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.src.js @@ -0,0 +1 @@ +let {a} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js new file mode 100644 index 000000000000..47a9f6bc190f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js @@ -0,0 +1,441 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "f" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 11, + 20 + ], + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "x" + } + ] + }, + "right": { + "type": "ArrayExpression", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 17, + 20 + ], + "elements": [ + { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "value": 1, + "raw": "1" + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 22, + 24 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Numeric", + "value": "1", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.src.js new file mode 100644 index 000000000000..b233ca5bd452 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.src.js @@ -0,0 +1 @@ +function f([x] = [1]) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js new file mode 100644 index 000000000000..648d9c7c1ae3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js @@ -0,0 +1,650 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 0, + 24 + ], + "expression": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 1, + 22 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 2, + 21 + ], + "method": true, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ], + "name": "f" + }, + "kind": "init", + "value": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 3, + 21 + ], + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 4, + 17 + ], + "left": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "x" + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 10, + 17 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 11, + 16 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "x" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ], + "value": 10, + "raw": "10" + }, + "kind": "init" + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 19, + 21 + ], + "body": [] + } + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 14, + 16 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.src.js new file mode 100644 index 000000000000..0821397f396c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.src.js @@ -0,0 +1 @@ +({f({x} = {x: 10}) {}}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js new file mode 100644 index 000000000000..f7e1f373c444 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js @@ -0,0 +1,141 @@ +module.exports = { + "type": "Program", + "body": [ + { + type: 'ExpressionStatement', + expression: { + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'f', + range: [2, 3], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 3 } + } + }, + value: { + type: 'FunctionExpression', + id: null, + params: [{ + type: 'ObjectPattern', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'x', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + value: { + type: 'Identifier', + name: 'x', + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }, + kind: 'init', + method: false, + shorthand: true, + computed: false, + range: [15, 16], + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + } + }], + range: [14, 17], + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 17 } + } + }], + defaults: [{ + type: 'ObjectExpression', + properties: [{ + type: 'Property', + key: { + type: 'Identifier', + name: 'x', + range: [21, 22], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + } + }, + value: { + type: 'Literal', + value: 10, + raw: '10', + range: [24, 26], + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 26 } + } + }, + kind: 'init', + method: false, + shorthand: false, + computed: false, + range: [21, 26], + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 26 } + } + }], + range: [20, 27], + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 27 } + } + }], + body: { + type: 'BlockStatement', + body: [], + range: [29, 31], + loc: { + start: { line: 1, column: 29 }, + end: { line: 1, column: 31 } + } + }, + rest: null, + generator: false, + expression: false, + async: false, + range: [5, 31], + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 31 } + } + }, + kind: 'init', + method: false, + shorthand: false, + computed: false, + range: [2, 31], + loc: { + start: { line: 1, column: 2 }, + end: { line: 1, column: 31 } + } + }], + range: [1, 32], + loc: { + start: { line: 1, column: 1 }, + end: { line: 1, column: 32 } + } + }, + range: [0, 33], + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 33 } + } + } + ] +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.src.xjs b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.src.xjs new file mode 100644 index 000000000000..1740302f8291 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.src.xjs @@ -0,0 +1 @@ +({f: function({x} = {x: 10}) {}}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js new file mode 100644 index 000000000000..be4e7abfff60 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js @@ -0,0 +1,592 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "operator": "=", + "left": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ], + "name": "f" + }, + "right": { + "type": "FunctionExpression", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 4, + 30 + ], + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "AssignmentPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 13, + 26 + ], + "left": { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 13, + 16 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "x" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "x" + } + } + ] + }, + "right": { + "type": "ObjectExpression", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 19, + 26 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 20, + 25 + ], + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ], + "name": "x" + }, + "value": { + "type": "Literal", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ], + "value": 10, + "raw": "10" + }, + "kind": "init" + } + ] + } + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 28, + 30 + ], + "body": [] + } + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "f", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 4, + 12 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Identifier", + "value": "x", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + }, + { + "type": "Punctuator", + "value": ":", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Numeric", + "value": "10", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 23, + 25 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.src.js new file mode 100644 index 000000000000..753d7b471310 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.src.js @@ -0,0 +1 @@ +f = function({x} = {x: 10}) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js new file mode 100644 index 000000000000..af1e17a5f770 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js @@ -0,0 +1,273 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "body": [ + { + "type": "ForOfStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 0, + 17 + ], + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "a" + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ], + "name": "foo" + }, + "body": { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "for", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "of", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 9, + 11 + ] + }, + { + "type": "Identifier", + "value": "foo", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 12, + 15 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.src.js new file mode 100644 index 000000000000..7751aeddd636 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.src.js @@ -0,0 +1 @@ +for ([a] of foo); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js new file mode 100644 index 000000000000..0e7696920c89 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js @@ -0,0 +1,496 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 0, + 21 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 0, + 20 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 0, + 16 + ], + "elements": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 1, + 9 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ], + "name": "a" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ], + "name": "b" + } + } + ] + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 11, + 15 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ], + "name": "c" + } + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ], + "name": "d" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 3, + 4 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 11, + 14 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Identifier", + "value": "d", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 20, + 21 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.src.js new file mode 100644 index 000000000000..a14d109bf05d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.src.js @@ -0,0 +1 @@ +[{ a, b }, ...c] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js new file mode 100644 index 000000000000..0a7da17db3f7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js @@ -0,0 +1,418 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 0, + 19 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 4, + 13 + ], + "argument": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 7, + 13 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "b" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "c" + } + ] + } + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ], + "name": "d" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Identifier", + "value": "d", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.src.js new file mode 100644 index 000000000000..aa3e6bed2221 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.src.js @@ -0,0 +1 @@ +[a, ...[b, c]] = d; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js new file mode 100644 index 000000000000..8b9c1f7ea974 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js @@ -0,0 +1,512 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 0, + 31 + ], + "body": [ + { + "type": "FunctionDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 0, + 30 + ], + "id": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "a" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 11, + 26 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "a" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "b" + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 18, + 25 + ], + "argument": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 21, + 25 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 22, + 24 + ], + "name": "ok" + } + ] + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 28, + 30 + ], + "body": [] + } + }, + { + "type": "EmptyStatement", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 0, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "(", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "range": [ + 18, + 21 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Identifier", + "value": "ok", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 22, + 24 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "range": [ + 25, + 26 + ] + }, + { + "type": "Punctuator", + "value": ")", + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "range": [ + 26, + 27 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "range": [ + 30, + 31 + ] + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.src.js new file mode 100644 index 000000000000..28bec5ed0b4e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.src.js @@ -0,0 +1 @@ +function a([a, b, ...[ok]]) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js new file mode 100644 index 000000000000..5c1edf702962 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Comma is not permitted after the rest element" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.src.js new file mode 100644 index 000000000000..eee98799d22b --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.src.js @@ -0,0 +1 @@ +[...c, { a, b }] = d; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js new file mode 100644 index 000000000000..5c1edf702962 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Comma is not permitted after the rest element" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.src.xjs b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.src.xjs new file mode 100644 index 000000000000..6154cfe049dd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.src.xjs @@ -0,0 +1 @@ +[...a, ] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js new file mode 100644 index 000000000000..e46fa0a227df --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js @@ -0,0 +1,309 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 0, + 14 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 0, + 13 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 0, + 9 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ], + "name": "a" + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 4, + 8 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "b" + } + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "c" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "range": [ + 1, + 2 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 2, + 3 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 4, + 7 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.src.js new file mode 100644 index 000000000000..c7f6aa97b292 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.src.js @@ -0,0 +1 @@ +[a, ...b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js new file mode 100644 index 000000000000..5c1edf702962 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js @@ -0,0 +1,6 @@ +module.exports = { + "index": 5, + "lineNumber": 1, + "column": 6, + "message": "Comma is not permitted after the rest element" +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.src.xjs b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.src.xjs new file mode 100644 index 000000000000..cb9a2a141cc8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.src.xjs @@ -0,0 +1 @@ +[...a, b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js new file mode 100644 index 000000000000..8d4b931447eb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js @@ -0,0 +1,255 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "body": [ + { + "type": "ExpressionStatement", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 0, + 11 + ], + "expression": { + "type": "AssignmentExpression", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 0, + 10 + ], + "operator": "=", + "left": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 0, + 6 + ], + "elements": [ + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 1, + 5 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ], + "name": "a" + } + } + ] + }, + "right": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ], + "name": "b" + } + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "range": [ + 0, + 1 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "range": [ + 1, + 4 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.src.js new file mode 100644 index 000000000000..0be6e5d967b2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.src.js @@ -0,0 +1 @@ +[...a] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js new file mode 100644 index 000000000000..085d47f4f9ab --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js @@ -0,0 +1,516 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 0, + 25 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 4, + 24 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 4, + 20 + ], + "elements": [ + { + "type": "ObjectPattern", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 5, + 13 + ], + "properties": [ + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ], + "name": "a" + } + }, + { + "type": "Property", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "b" + }, + "kind": "init", + "value": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ], + "name": "b" + } + } + ] + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 15, + 19 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ], + "name": "c" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ], + "name": "d" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "{", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 7, + 8 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 10, + 11 + ] + }, + { + "type": "Punctuator", + "value": "}", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 15, + 18 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "range": [ + 18, + 19 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Identifier", + "value": "d", + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 23, + 24 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "range": [ + 24, + 25 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.src.js new file mode 100644 index 000000000000..dabf00dc6ecb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.src.js @@ -0,0 +1 @@ +var [{ a, b }, ...c] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js new file mode 100644 index 000000000000..7610b6e98095 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js @@ -0,0 +1,438 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 0, + 23 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 4, + 22 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 4, + 18 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 8, + 17 + ], + "argument": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 11, + 17 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ], + "name": "b" + }, + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ], + "name": "c" + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ], + "name": "d" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "range": [ + 15, + 16 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "range": [ + 19, + 20 + ] + }, + { + "type": "Identifier", + "value": "d", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "range": [ + 21, + 22 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "range": [ + 22, + 23 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.src.js new file mode 100644 index 000000000000..ed56a2030533 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.src.js @@ -0,0 +1 @@ +var [a, ...[b, c]] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js new file mode 100644 index 000000000000..bf92133e4338 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js @@ -0,0 +1,329 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 0, + 18 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 4, + 17 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 4, + 13 + ], + "elements": [ + { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ], + "name": "a" + }, + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 8, + 12 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ], + "name": "b" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ], + "name": "c" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "range": [ + 5, + 6 + ] + }, + { + "type": "Punctuator", + "value": ",", + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "range": [ + 6, + 7 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "range": [ + 8, + 11 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "range": [ + 12, + 13 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + }, + { + "type": "Identifier", + "value": "c", + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "range": [ + 16, + 17 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "range": [ + 17, + 18 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.src.js new file mode 100644 index 000000000000..897bcba9d9b1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.src.js @@ -0,0 +1 @@ +var [a, ...b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js new file mode 100644 index 000000000000..cd58c3ae0e6e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js @@ -0,0 +1,275 @@ +module.exports = { + "type": "Program", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "body": [ + { + "type": "VariableDeclaration", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 0, + 15 + ], + "declarations": [ + { + "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 4, + 14 + ], + "id": { + "type": "ArrayPattern", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 4, + 10 + ], + "elements": [ + { + "type": "RestElement", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 5, + 9 + ], + "argument": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ], + "name": "a" + } + } + ] + }, + "init": { + "type": "Identifier", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ], + "name": "b" + } + } + ], + "kind": "var" + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "var", + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } + }, + "range": [ + 0, + 3 + ] + }, + { + "type": "Punctuator", + "value": "[", + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "range": [ + 4, + 5 + ] + }, + { + "type": "Punctuator", + "value": "...", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "range": [ + 5, + 8 + ] + }, + { + "type": "Identifier", + "value": "a", + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "range": [ + 8, + 9 + ] + }, + { + "type": "Punctuator", + "value": "]", + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "range": [ + 9, + 10 + ] + }, + { + "type": "Punctuator", + "value": "=", + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "range": [ + 11, + 12 + ] + }, + { + "type": "Identifier", + "value": "b", + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "range": [ + 13, + 14 + ] + }, + { + "type": "Punctuator", + "value": ";", + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } + }, + "range": [ + 14, + 15 + ] + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.src.js new file mode 100644 index 000000000000..e6dc8d642048 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.src.js @@ -0,0 +1 @@ +var [...a] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index eda18839532b..b5f9609c680e 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -70,7 +70,7 @@ describe("ecmaFeatures", () => { const feature = path.dirname(filename), code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - it(`should parse correctly when ${feature} is true`, () => { + it(`should parse correctly when ${feature} is true ${filename}`, () => { config.ecmaFeatures[feature] = true; let expected = null; From ce2688c644aab46431ad2a2f398a417e7c401a78 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 3 Jun 2017 06:22:44 -0500 Subject: [PATCH 162/326] Fix: Label readonly class properties (fixes #302) (#303) --- .../typescript-eslint-parser/lib/convert.js | 1 + ...tract-class-with-abstract-method.result.js | 76 +- ...t-class-with-abstract-properties.result.js | 4 +- ...-with-abstract-readonly-property.result.js | 355 ++++++ ...ass-with-abstract-readonly-property.src.ts | 3 + ...tract-class-with-optional-method.result.js | 726 +++++------ ...ow-function-with-type-parameters.result.js | 4 +- ...nc-function-with-var-declaration.result.js | 2 +- ...ass-with-accessibility-modifiers.result.js | 77 +- ...with-export-parameter-properties.result.js | 2 +- ...lass-with-generic-method-default.result.js | 2 +- .../class-with-generic-method.result.js | 548 ++++----- ...with-implements-generic-multiple.result.js | 2 +- .../class-with-implements-generic.result.js | 2 +- ...-with-optional-computed-property.result.js | 3 +- .../class-with-optional-methods.result.js | 1006 +++++++-------- .../class-with-optional-properties.result.js | 781 ++++++------ ...with-optional-property-undefined.result.js | 4 +- ...ith-private-parameter-properties.result.js | 880 ++++++------- ...h-protected-parameter-properties.result.js | 810 ++++++------ ...with-public-parameter-properties.result.js | 792 ++++++------ ...th-readonly-parameter-properties.result.js | 520 ++++---- .../class-with-readonly-property.result.js | 319 +++++ .../class-with-readonly-property.src.ts | 3 + ...with-static-parameter-properties.result.js | 2 +- ...lass-with-type-parameter-default.result.js | 2 +- ...s-with-type-parameter-underscore.result.js | 2 +- .../class-with-type-parameter.result.js | 2 +- ...clare-class-with-optional-method.result.js | 516 ++++---- ...xport-default-class-with-generic.result.js | 50 +- ...ult-class-with-multiple-generics.result.js | 72 +- .../export-named-class-with-generic.result.js | 70 +- ...med-class-with-multiple-generics.result.js | 92 +- .../export-type-alias-declaration.result.js | 214 ++-- .../export-type-class-declaration.result.js | 214 ++-- ...export-type-function-declaration.result.js | 294 ++--- .../basics/function-with-await.result.js | 462 +++---- ...ct-type-with-optional-properties.result.js | 810 ++++++------ ...h-object-type-without-annotation.result.js | 2 +- ...pe-parameters-that-have-comments.result.js | 412 ++++--- ...-type-parameters-with-constraint.result.js | 876 ++++++------- .../function-with-type-parameters.result.js | 2 +- .../function-with-types-assignation.result.js | 781 ++++++------ ...nterface-with-all-property-types.result.js | 18 +- ...ure-with-parameter-accessibility.result.js | 6 +- .../basics/interface-with-jsdoc.result.js | 2 +- ...terface-with-optional-properties.result.js | 6 +- ...nterface-without-type-annotation.result.js | 2 +- .../basics/nested-type-arguments.result.js | 706 +++++------ .../non-null-assertion-operator.result.js | 6 +- ...-with-constrained-type-parameter.result.js | 710 +++++------ .../basics/type-alias-declaration.result.js | 72 +- ...-alias-object-without-annotation.result.js | 2 +- .../typescript/basics/type-guard.result.js | 1089 +++++++++-------- .../typescript/basics/typed-this.result.js | 2 +- .../basics/var-with-dotted-type.result.js | 2 +- ...ecorator-factory-instance-member.result.js | 2 + ...-decorator-factory-static-member.result.js | 2 + ...operty-decorator-instance-member.result.js | 2 + ...property-decorator-static-member.result.js | 2 + .../class-empty-extends-implements.result.js | 2 +- .../class-empty-extends.result.js | 2 +- .../class-extends-empty-implements.result.js | 2 +- .../interface-property-modifiers.result.js | 2 +- .../call-expression-type-arguments.result.js | 634 +++++----- .../new-expression-type-arguments.result.js | 498 ++++---- ...t-module-declaration-with-import.result.js | 494 ++++---- ...namespace-with-exported-function.result.js | 77 +- 68 files changed, 8445 insertions(+), 7694 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 104c990238c2..564cd018c85c 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -678,6 +678,7 @@ module.exports = function convert(config) { computed: nodeUtils.isComputedProperty(node.name), static: nodeUtils.hasStaticModifierFlag(node), accessibility: nodeUtils.getTSNodeAccessibility(node), + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), decorators: convertDecorators(node.decorators), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js index ff0f61f06671..15450fe68ec5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js @@ -160,58 +160,58 @@ module.exports = { "name": "Promise" }, "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 75, + 83 + ], "loc": { - "end": { - "column": 44, - "line": 2 - }, "start": { - "column": 36, - "line": 2 + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 44 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 43, - "line": 2 - }, - "start": { - "column": 37, - "line": 2 - } + "type": "GenericTypeAnnotation", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 2, + "column": 37 }, + "end": { + "line": 2, + "column": 43 + } + }, + "id": { + "type": "TSStringKeyword", "range": [ 76, 82 ], - "type": "TSStringKeyword" - }, - "loc": { - "end": { - "column": 43, - "line": 2 - }, - "start": { - "column": 37, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 43 + } } }, - "range": [ - 76, - 82 - ], - "type": "GenericTypeAnnotation", "typeParameters": null } - ], - "range": [ - 75, - 83 - ], - "type": "TypeParameterInstantiation" + ] } } }, @@ -552,4 +552,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js index d5b3cbc34cfd..f79e2ef90c0e 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js @@ -90,6 +90,7 @@ module.exports = { "computed": false, "static": false, "accessibility": null, + "readonly": false, "decorators": [], "typeAnnotation": null }, @@ -149,6 +150,7 @@ module.exports = { "computed": false, "static": false, "accessibility": null, + "readonly": false, "decorators": [], "typeAnnotation": null } @@ -410,4 +412,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js new file mode 100644 index 000000000000..0c7160a845cc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js @@ -0,0 +1,355 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "TSAbstractClassDeclaration", + "range": [ + 0, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "TSAbstractClassProperty", + "range": [ + 23, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 42 + } + }, + "key": { + "type": "Identifier", + "range": [ + 48, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "name": "foo" + }, + "value": { + "type": "Literal", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 41 + } + }, + "value": "string", + "raw": "'string'" + }, + "computed": false, + "static": false, + "accessibility": "public", + "readonly": true, + "decorators": [], + "typeAnnotation": null + } + ], + "range": [ + 19, + 65 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "abstract", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "Keyword", + "value": "public", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "abstract", + "range": [ + 30, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "readonly", + "range": [ + 39, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 48, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "String", + "value": "'string'", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts new file mode 100644 index 000000000000..8c28567ce8e7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts @@ -0,0 +1,3 @@ +abstract class Foo { + public abstract readonly foo = 'string'; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js index 39abec7b375c..96da715c9704 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js @@ -1,556 +1,556 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 78 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { + "type": "ExportNamedDeclaration", "declaration": { + "type": "TSAbstractClassDeclaration", + "range": [ + 16, + 78 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 22, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "name": "AbstractSocket" + }, "body": { + "type": "ClassBody", "body": [ { - "accessibility": null, - "computed": false, - "decorators": [], - "key": { - "loc": { - "end": { - "column": 16, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } + "type": "MethodDefinition", + "range": [ + 43, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 4 }, - "name": "createSocket", - "optional": true, + "end": { + "line": 2, + "column": 37 + } + }, + "key": { + "type": "Identifier", "range": [ 43, 55 ], - "type": "Identifier" - }, - "kind": "method", - "loc": { - "end": { - "column": 37, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } }, - "start": { - "column": 4, - "line": 2 - } + "name": "createSocket", + "optional": true }, - "range": [ - 43, - 76 - ], - "static": false, - "type": "MethodDefinition", "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, "async": false, "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": { - "end": { - "column": 37, - "line": 2 - }, - "start": { - "column": 16, - "line": 2 - } - }, - "params": [], "range": [ 56, 76 ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 37 + } + }, "returnType": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 36, - "line": 2 - }, "start": { - "column": 21, - "line": 2 + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 36 } }, "range": [ 60, 75 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 36, - "line": 2 - }, - "start": { - "column": 21, - "line": 2 - } - }, + "type": "TSTypeReference", "range": [ 60, 75 ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 28, - "line": 2 - }, - "start": { - "column": 21, - "line": 2 - } + "loc": { + "start": { + "line": 2, + "column": 21 }, - "name": "Promise", + "end": { + "line": 2, + "column": 36 + } + }, + "typeName": { + "type": "Identifier", "range": [ 60, 67 ], - "type": "Identifier" + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "name": "Promise" }, "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 67, + 75 + ], "loc": { - "end": { - "column": 36, - "line": 2 - }, "start": { - "column": 28, - "line": 2 + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 36 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 35, - "line": 2 - }, - "start": { - "column": 29, - "line": 2 - } + "type": "GenericTypeAnnotation", + "range": [ + 68, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 29 }, + "end": { + "line": 2, + "column": 35 + } + }, + "id": { + "type": "TSStringKeyword", "range": [ 68, 74 ], - "type": "TSStringKeyword" - }, - "loc": { - "end": { - "column": 35, - "line": 2 - }, - "start": { - "column": 29, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 35 + } } }, - "range": [ - 68, - 74 - ], - "type": "GenericTypeAnnotation", "typeParameters": null } - ], - "range": [ - 67, - 75 - ], - "type": "TypeParameterInstantiation" + ] } } }, - "type": "FunctionExpression" - } + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 37, - "line": 1 - } - }, "range": [ 37, 78 ], - "type": "ClassBody" - }, - "decorators": [], - "id": { "loc": { - "end": { - "column": 36, - "line": 1 - }, "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 37 + }, + "end": { + "line": 3, + "column": 1 } - }, - "name": "AbstractSocket", - "range": [ - 22, - 36 - ], - "type": "Identifier" - }, - "implements": [], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 16, - "line": 1 } }, - "range": [ - 16, - 78 - ], "superClass": null, - "type": "TSAbstractClassDeclaration" - }, - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } + "implements": [], + "decorators": [] }, "range": [ 0, 78 ], - "source": null, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "specifiers": [], - "type": "ExportNamedDeclaration" + "source": null } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 78 - ], "sourceType": "module", "tokens": [ { - "loc": { - "end": { - "column": 6, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "export", "range": [ 0, 6 ], - "type": "Keyword", - "value": "export" - }, - { "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 7, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 } - }, + } + }, + { + "type": "Identifier", + "value": "abstract", "range": [ 7, 15 ], - "type": "Identifier", - "value": "abstract" - }, - { "loc": { - "end": { - "column": 21, - "line": 1 - }, "start": { - "column": 16, - "line": 1 + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 15 } - }, + } + }, + { + "type": "Keyword", + "value": "class", "range": [ 16, 21 ], - "type": "Keyword", - "value": "class" - }, - { "loc": { - "end": { - "column": 36, - "line": 1 - }, "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 21 } - }, + } + }, + { + "type": "Identifier", + "value": "AbstractSocket", "range": [ 22, 36 ], - "type": "Identifier", - "value": "AbstractSocket" - }, - { "loc": { - "end": { - "column": 38, - "line": 1 - }, "start": { - "column": 37, - "line": 1 + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 36 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 37, 38 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 16, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 } - }, + } + }, + { + "type": "Identifier", + "value": "createSocket", "range": [ 43, 55 ], - "type": "Identifier", - "value": "createSocket" - }, - { "loc": { - "end": { - "column": 17, - "line": 2 - }, "start": { - "column": 16, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 55, 56 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 18, - "line": 2 - }, "start": { - "column": 17, - "line": 2 + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 56, 57 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 19, - "line": 2 - }, "start": { - "column": 18, - "line": 2 + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 57, 58 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 20, - "line": 2 - }, "start": { - "column": 19, - "line": 2 + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 58, 59 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 28, - "line": 2 - }, "start": { - "column": 21, - "line": 2 + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 } - }, + } + }, + { + "type": "Identifier", + "value": "Promise", "range": [ 60, 67 ], - "type": "Identifier", - "value": "Promise" - }, - { "loc": { - "end": { - "column": 29, - "line": 2 - }, "start": { - "column": 28, - "line": 2 + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 28 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 67, 68 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 35, - "line": 2 - }, "start": { - "column": 29, - "line": 2 + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 68, 74 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 36, - "line": 2 - }, "start": { - "column": 35, - "line": 2 + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 35 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 74, 75 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 37, - "line": 2 - }, "start": { - "column": 36, - "line": 2 + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 75, 76 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 37 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 77, 78 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js index b000ecfbcf4f..1780343c1efc 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js @@ -175,8 +175,8 @@ module.exports = { } ] }, - "expression": false, "async": false, + "expression": false, "returnType": { "type": "TypeAnnotation", "loc": { @@ -561,4 +561,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js index 65bee37c8907..6f08a71a34e5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js @@ -695,4 +695,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js index 45c030fed010..8ab949f5e88d 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js @@ -90,39 +90,40 @@ module.exports = { "computed": false, "static": false, "accessibility": "private", + "readonly": false, "decorators": [], "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 22, - "line": 2 - }, "start": { - "column": 16, - "line": 2 + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 } }, "range": [ 28, 34 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 22, - "line": 2 - }, - "start": { - "column": 16, - "line": 2 - } - }, + "type": "TSStringKeyword", "range": [ 28, 34 ], - "type": "TSStringKeyword" + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } } } }, @@ -164,42 +165,42 @@ module.exports = { "computed": false, "static": true, "accessibility": "public", + "readonly": false, "decorators": [], "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 28, - "line": 3 - }, "start": { - "column": 22, - "line": 3 + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 28 } }, "range": [ 58, 64 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 28, - "line": 3 - }, - "start": { - "column": 22, - "line": 3 - } - }, + "type": "TSNumberKeyword", "range": [ 58, 64 ], - "type": "TSNumberKeyword" + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 28 + } + } } } - }, { "type": "MethodDefinition", @@ -1355,4 +1356,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js index a97ced040db5..c531a48ef050 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js @@ -464,4 +464,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js index a93d92694992..dc79f2d6f717 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js @@ -481,4 +481,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js index fcdcbb2a7ab2..82cb9077f6a7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js @@ -1,413 +1,413 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { + "type": "ClassDeclaration", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, "body": { + "type": "ClassBody", "body": [ { - "accessibility": null, - "computed": false, - "decorators": [], - "key": { - "loc": { - "end": { - "column": 8, - "line": 2 - }, - "start": { - "column": 2, - "line": 2 - } + "type": "MethodDefinition", + "range": [ + 14, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 2 }, - "name": "getBar", + "end": { + "line": 2, + "column": 16 + } + }, + "key": { + "type": "Identifier", "range": [ 14, 20 ], - "type": "Identifier" - }, - "kind": "method", - "loc": { - "end": { - "column": 16, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 + } }, - "start": { - "column": 2, - "line": 2 - } + "name": "getBar" }, - "range": [ - 14, - 28 - ], - "static": false, - "type": "MethodDefinition", "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, "async": false, "body": { - "body": [], - "loc": { - "end": { - "column": 16, - "line": 2 - }, - "start": { - "column": 14, - "line": 2 - } - }, + "type": "BlockStatement", "range": [ 26, 28 ], - "type": "BlockStatement" - }, - "expression": false, - "generator": false, - "id": null, - "loc": { - "end": { - "column": 16, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 16 + } }, - "start": { - "column": 8, - "line": 2 - } + "body": [] }, - "params": [], "range": [ 23, 28 ], - "type": "FunctionExpression", + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "params": [], "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 20, + 23 + ], "loc": { - "end": { - "column": 11, - "line": 2 - }, "start": { - "column": 8, - "line": 2 + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 11 } }, "params": [ { - "constraint": null, + "type": "TypeParameter", + "range": [ + 21, + 22 + ], "loc": { - "end": { - "column": 10, - "line": 2 - }, "start": { - "column": 9, - "line": 2 + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 } }, "name": "T", - "range": [ - 21, - 22 - ], - "type": "TypeParameter" + "constraint": null } - ], - "range": [ - 20, - 23 - ], - "type": "TypeParameterDeclaration" + ] } - } + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 10, - "line": 1 - } - }, "range": [ 10, 30 ], - "type": "ClassBody" - }, - "decorators": [], - "id": { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 } - }, - "name": "Foo", - "range": [ - 6, - 9 - ], - "type": "Identifier" - }, - "implements": [], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 } }, - "range": [ - 0, - 30 - ], "superClass": null, - "type": "ClassDeclaration" - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 + "implements": [], + "decorators": [] } - }, - "range": [ - 0, - 30 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "class", "range": [ 0, 5 ], - "type": "Keyword", - "value": "class" - }, - { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, + } + }, + { + "type": "Identifier", + "value": "Foo", "range": [ 6, 9 ], - "type": "Identifier", - "value": "Foo" - }, - { "loc": { - "end": { - "column": 11, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 10, 11 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 8, - "line": 2 - }, "start": { - "column": 2, - "line": 2 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, + } + }, + { + "type": "Identifier", + "value": "getBar", "range": [ 14, 20 ], - "type": "Identifier", - "value": "getBar" - }, - { "loc": { - "end": { - "column": 9, - "line": 2 - }, "start": { - "column": 8, - "line": 2 + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 20, 21 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 10, - "line": 2 - }, "start": { - "column": 9, - "line": 2 + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "T", "range": [ 21, 22 ], - "type": "Identifier", - "value": "T" - }, - { "loc": { - "end": { - "column": 11, - "line": 2 - }, "start": { - "column": 10, - "line": 2 + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 22, 23 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 12, - "line": 2 - }, "start": { - "column": 11, - "line": 2 + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 23, 24 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 13, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 24, 25 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 15, - "line": 2 - }, "start": { - "column": 14, - "line": 2 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 26, 27 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 16, - "line": 2 - }, "start": { - "column": 15, - "line": 2 + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 27, 28 ], - "type": "Punctuator", - "value": "}" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 29, 30 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js index aa81d2e15a57..af2a4722ed62 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js @@ -400,4 +400,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js index ac8fd325bae2..2a5f27c831ce 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js @@ -328,4 +328,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js index a679aefd43c5..2c07fbe305ca 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js @@ -108,6 +108,7 @@ module.exports = { "computed": true, "static": false, "accessibility": "private", + "readonly": false, "decorators": [], "typeAnnotation": null, "optional": true @@ -352,4 +353,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js index 13b27ea6ae96..01de5727e4dd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js @@ -1,771 +1,771 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, "body": [ { + "type": "ClassDeclaration", + "range": [ + 0, + 67 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, "body": { + "type": "ClassBody", "body": [ { - "accessibility": null, - "computed": false, - "decorators": [], - "key": { - "loc": { - "end": { - "column": 5, - "line": 2 - }, - "start": { - "column": 2, - "line": 2 - } + "type": "MethodDefinition", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 2 }, - "name": "foo", - "optional": true, + "end": { + "line": 2, + "column": 9 + } + }, + "key": { + "type": "Identifier", "range": [ 14, 17 ], - "type": "Identifier" - }, - "kind": "method", - "loc": { - "end": { - "column": 9, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } }, - "start": { - "column": 2, - "line": 2 - } + "name": "foo", + "optional": true }, - "range": [ - 14, - 21 - ], - "static": false, - "type": "MethodDefinition", "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, "async": false, "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": { - "end": { - "column": 9, - "line": 2 - }, - "start": { - "column": 5, - "line": 2 - } - }, - "params": [], "range": [ 18, 21 ], - "type": "FunctionExpression" - } - }, - { - "accessibility": null, - "computed": false, - "decorators": [], - "key": { "loc": { - "end": { - "column": 5, - "line": 3 - }, "start": { - "column": 2, - "line": 3 + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 9 } }, - "name": "bar", - "optional": true, - "range": [ - 24, - 27 - ], - "type": "Identifier" + "params": [] }, + "computed": false, + "static": false, "kind": "method", - "loc": { - "end": { - "column": 17, - "line": 3 - }, - "start": { - "column": 2, - "line": 3 - } - }, + "accessibility": null, + "decorators": [] + }, + { + "type": "MethodDefinition", "range": [ 24, 39 ], - "static": false, - "type": "MethodDefinition", - "value": { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "key": { + "type": "Identifier", + "range": [ + 24, + 27 + ], "loc": { - "end": { - "column": 17, - "line": 3 - }, "start": { - "column": 5, - "line": 3 + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 } }, - "params": [], + "name": "bar", + "optional": true + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": null, "range": [ 28, 39 ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 17 + } + }, "returnType": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 16, - "line": 3 - }, "start": { - "column": 10, - "line": 3 + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 } }, "range": [ 32, 38 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 16, - "line": 3 - }, - "start": { - "column": 10, - "line": 3 - } - }, + "type": "TSStringKeyword", "range": [ 32, 38 ], - "type": "TSStringKeyword" + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 + } + } } }, - "type": "FunctionExpression" - } + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] }, { - "accessibility": "private", - "computed": false, - "decorators": [], - "key": { - "loc": { - "end": { - "column": 13, - "line": 4 - }, - "start": { - "column": 10, - "line": 4 - } + "type": "MethodDefinition", + "range": [ + 42, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 2 }, - "name": "baz", - "optional": true, + "end": { + "line": 4, + "column": 25 + } + }, + "key": { + "type": "Identifier", "range": [ 50, 53 ], - "type": "Identifier" - }, - "kind": "method", - "loc": { - "end": { - "column": 25, - "line": 4 + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 13 + } }, - "start": { - "column": 2, - "line": 4 - } + "name": "baz", + "optional": true }, - "range": [ - 42, - 65 - ], - "static": false, - "type": "MethodDefinition", "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, "async": false, "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": { - "end": { - "column": 25, - "line": 4 - }, - "start": { - "column": 13, - "line": 4 - } - }, - "params": [], "range": [ 54, 65 ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 25 + } + }, "returnType": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 24, - "line": 4 - }, "start": { - "column": 18, - "line": 4 + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 24 } }, "range": [ 58, 64 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 24, - "line": 4 - }, - "start": { - "column": 18, - "line": 4 - } - }, + "type": "TSStringKeyword", "range": [ 58, 64 ], - "type": "TSStringKeyword" + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 24 + } + } } }, - "type": "FunctionExpression" - } + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": "private", + "decorators": [] } ], - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 10, - "line": 1 - } - }, "range": [ 10, 67 ], - "type": "ClassBody" - }, - "decorators": [], - "id": { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 } - }, - "name": "Foo", - "range": [ - 6, - 9 - ], - "type": "Identifier" - }, - "implements": [], - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 0, - "line": 1 } }, - "range": [ - 0, - 67 - ], "superClass": null, - "type": "ClassDeclaration" - } - ], - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 0, - "line": 1 + "implements": [], + "decorators": [] } - }, - "range": [ - 0, - 67 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "class", "range": [ 0, 5 ], - "type": "Keyword", - "value": "class" - }, - { - "loc": { - "end": { - "column": 9, - "line": 1 - }, + "loc": { "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, + } + }, + { + "type": "Identifier", + "value": "Foo", "range": [ 6, 9 ], - "type": "Identifier", - "value": "Foo" - }, - { "loc": { - "end": { - "column": 11, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 10, 11 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 5, - "line": 2 - }, "start": { - "column": 2, - "line": 2 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, + } + }, + { + "type": "Identifier", + "value": "foo", "range": [ 14, 17 ], - "type": "Identifier", - "value": "foo" - }, - { "loc": { - "end": { - "column": 6, - "line": 2 - }, "start": { - "column": 5, - "line": 2 + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 17, 18 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 7, - "line": 2 - }, "start": { - "column": 6, - "line": 2 + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 18, 19 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 8, - "line": 2 - }, "start": { - "column": 7, - "line": 2 + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 19, 20 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 9, - "line": 2 - }, "start": { - "column": 8, - "line": 2 + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 20, 21 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 5, - "line": 3 - }, "start": { - "column": 2, - "line": 3 + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "bar", "range": [ 24, 27 ], - "type": "Identifier", - "value": "bar" - }, - { "loc": { - "end": { - "column": 6, - "line": 3 - }, "start": { - "column": 5, - "line": 3 + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 27, 28 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 7, - "line": 3 - }, "start": { - "column": 6, - "line": 3 + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 28, 29 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 8, - "line": 3 - }, "start": { - "column": 7, - "line": 3 + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 29, 30 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 9, - "line": 3 - }, "start": { - "column": 8, - "line": 3 + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 30, 31 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 16, - "line": 3 - }, "start": { - "column": 10, - "line": 3 + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 32, 38 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 17, - "line": 3 - }, "start": { - "column": 16, - "line": 3 + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 16 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 38, 39 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 9, - "line": 4 - }, "start": { - "column": 2, - "line": 4 + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 } - }, + } + }, + { + "type": "Keyword", + "value": "private", "range": [ 42, 49 ], - "type": "Keyword", - "value": "private" - }, - { "loc": { - "end": { - "column": 13, - "line": 4 - }, "start": { - "column": 10, - "line": 4 + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "baz", "range": [ 50, 53 ], - "type": "Identifier", - "value": "baz" - }, - { "loc": { - "end": { - "column": 14, - "line": 4 - }, "start": { - "column": 13, - "line": 4 + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 53, 54 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 15, - "line": 4 - }, "start": { - "column": 14, - "line": 4 + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 54, 55 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 16, - "line": 4 - }, "start": { - "column": 15, - "line": 4 + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 55, 56 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 17, - "line": 4 - }, "start": { - "column": 16, - "line": 4 + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 56, 57 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 24, - "line": 4 - }, "start": { - "column": 18, - "line": 4 + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 58, 64 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 25, - "line": 4 - }, "start": { - "column": 24, - "line": 4 + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 24 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 64, 65 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 5 - }, "start": { - "column": 0, - "line": 5 + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 66, 67 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js index 54b35443fe7a..f2196145d9d5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js @@ -1,595 +1,598 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, "body": [ { + "type": "ClassDeclaration", + "range": [ + 0, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, "body": { + "type": "ClassBody", "body": [ { - "accessibility": null, - "computed": false, - "decorators": [], + "type": "ClassProperty", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 7 + } + }, "key": { + "type": "Identifier", + "range": [ + 14, + 17 + ], "loc": { - "end": { - "column": 5, - "line": 2 - }, "start": { - "column": 2, - "line": 2 + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 } }, "name": "foo", - "optional": true, - "range": [ - 14, - 17 - ], - "type": "Identifier" + "optional": true }, + "value": null, + "computed": false, + "static": false, + "accessibility": null, + "readonly": false, + "decorators": [], + "typeAnnotation": null + }, + { + "type": "ClassProperty", + "range": [ + 22, + 36 + ], "loc": { - "end": { - "column": 7, - "line": 2 - }, "start": { - "column": 2, - "line": 2 + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 16 } }, - "range": [ - 14, - 19 - ], - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null - }, - { - "accessibility": null, - "computed": false, - "decorators": [], "key": { - "loc": { - "end": { - "column": 5, - "line": 3 - }, - "start": { - "column": 2, - "line": 3 - } - }, - "name": "bar", - "optional": true, + "type": "Identifier", "range": [ 22, 25 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 16, - "line": 3 + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } }, - "start": { - "column": 2, - "line": 3 - } + "name": "bar", + "optional": true }, - "range": [ - 22, - 36 - ], + "value": null, + "computed": false, "static": false, - "type": "ClassProperty", + "accessibility": null, + "readonly": false, + "decorators": [], "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 15, - "line": 3 - }, "start": { - "column": 9, - "line": 3 + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 } }, "range": [ 29, 35 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 15, - "line": 3 - }, - "start": { - "column": 9, - "line": 3 - } - }, + "type": "TSStringKeyword", "range": [ 29, 35 ], - "type": "TSStringKeyword" + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 + } + } } - }, - "value": null + } }, { - "accessibility": "private", - "computed": false, - "decorators": [], - "key": { - "loc": { - "end": { - "column": 13, - "line": 4 - }, - "start": { - "column": 10, - "line": 4 - } + "type": "ClassProperty", + "range": [ + 39, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 2 }, - "name": "baz", - "optional": true, + "end": { + "line": 4, + "column": 24 + } + }, + "key": { + "type": "Identifier", "range": [ 47, 50 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 24, - "line": 4 + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 13 + } }, - "start": { - "column": 2, - "line": 4 - } + "name": "baz", + "optional": true }, - "range": [ - 39, - 61 - ], + "value": null, + "computed": false, "static": false, - "type": "ClassProperty", + "accessibility": "private", + "readonly": false, + "decorators": [], "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 23, - "line": 4 - }, "start": { - "column": 17, - "line": 4 + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 23 } }, "range": [ 54, 60 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 23, - "line": 4 - }, - "start": { - "column": 17, - "line": 4 - } - }, + "type": "TSStringKeyword", "range": [ 54, 60 ], - "type": "TSStringKeyword" + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 23 + } + } } - }, - "value": null + } } ], - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 10, - "line": 1 - } - }, "range": [ 10, 63 ], - "type": "ClassBody" - }, - "decorators": [], - "id": { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 5, + "column": 1 } - }, - "name": "Foo", - "range": [ - 6, - 9 - ], - "type": "Identifier" - }, - "implements": [], - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 0, - "line": 1 } }, - "range": [ - 0, - 63 - ], "superClass": null, - "type": "ClassDeclaration" - } - ], - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 0, - "line": 1 + "implements": [], + "decorators": [] } - }, - "range": [ - 0, - 63 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "class", "range": [ 0, 5 ], - "type": "Keyword", - "value": "class" - }, - { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, + } + }, + { + "type": "Identifier", + "value": "Foo", "range": [ 6, 9 ], - "type": "Identifier", - "value": "Foo" - }, - { "loc": { - "end": { - "column": 11, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 10, 11 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 5, - "line": 2 - }, "start": { - "column": 2, - "line": 2 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, + } + }, + { + "type": "Identifier", + "value": "foo", "range": [ 14, 17 ], - "type": "Identifier", - "value": "foo" - }, - { "loc": { - "end": { - "column": 6, - "line": 2 - }, "start": { - "column": 5, - "line": 2 + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 17, 18 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 7, - "line": 2 - }, "start": { - "column": 6, - "line": 2 + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 6 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 18, 19 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 5, - "line": 3 - }, "start": { - "column": 2, - "line": 3 + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 } - }, + } + }, + { + "type": "Identifier", + "value": "bar", "range": [ 22, 25 ], - "type": "Identifier", - "value": "bar" - }, - { "loc": { - "end": { - "column": 6, - "line": 3 - }, "start": { - "column": 5, - "line": 3 + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 25, 26 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 8, - "line": 3 - }, "start": { - "column": 7, - "line": 3 + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 6 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 27, 28 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 15, - "line": 3 - }, "start": { - "column": 9, - "line": 3 + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 29, 35 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 16, - "line": 3 - }, "start": { - "column": 15, - "line": 3 + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 35, 36 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 9, - "line": 4 - }, "start": { - "column": 2, - "line": 4 + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 } - }, + } + }, + { + "type": "Keyword", + "value": "private", "range": [ 39, 46 ], - "type": "Keyword", - "value": "private" - }, - { "loc": { - "end": { - "column": 13, - "line": 4 - }, "start": { - "column": 10, - "line": 4 + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "baz", "range": [ 47, 50 ], - "type": "Identifier", - "value": "baz" - }, - { "loc": { - "end": { - "column": 14, - "line": 4 - }, "start": { - "column": 13, - "line": 4 + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 50, 51 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 16, - "line": 4 - }, "start": { - "column": 15, - "line": 4 + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 14 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 52, 53 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 23, - "line": 4 - }, "start": { - "column": 17, - "line": 4 + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 54, 60 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 24, - "line": 4 - }, "start": { - "column": 23, - "line": 4 + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 23 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 60, 61 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 5 - }, "start": { - "column": 0, - "line": 5 + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 62, 63 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js index efbe4843c31e..029d97d093d0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js @@ -108,6 +108,7 @@ module.exports = { "computed": false, "static": false, "accessibility": "private", + "readonly": false, "decorators": [], "typeAnnotation": null } @@ -315,5 +316,4 @@ module.exports = { } } ] -}; - +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js index 15ae8d8673fa..6239f463a464 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js @@ -5,94 +5,89 @@ module.exports = { 203 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } }, "body": [ { + "type": "ClassDeclaration", + "range": [ + 0, + 203 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, "body": { + "type": "ClassBody", "body": [ { "type": "MethodDefinition", - "kind": "constructor", "range": [ 14, 201 ], "loc": { - "end": { - "line": 5, - "column": 59 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 5, + "column": 59 } }, - "accessibility": null, - "computed": false, "key": { "type": "Identifier", + "name": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 - } - }, - "name": "constructor" - }, - "static": false, - "value": { - "type": "FunctionExpression", - "range": [ - 25, - 201 - ], - "loc": { - "end": { - "line": 5, - "column": 59 }, - "start": { + "end": { "line": 2, "column": 13 } - }, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 199, - 201 - ], - "loc": { - "end": { - "line": 5, - "column": 59 - }, - "start": { - "line": 5, - "column": 57 - } - }, - "body": [] - }, - "expression": false, - "generator": false, + } + }, + "value": { + "type": "FunctionExpression", "id": null, "params": [ { @@ -102,20 +97,19 @@ module.exports = { 51 ], "loc": { - "end": { - "line": 2, - "column": 39 - }, "start": { "line": 2, "column": 14 + }, + "end": { + "line": 2, + "column": 39 } }, - "decorators": [], "accessibility": "private", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -123,32 +117,32 @@ module.exports = { 43 ], "loc": { - "end": { - "line": 2, - "column": 31 - }, "start": { "line": 2, "column": 22 + }, + "end": { + "line": 2, + "column": 31 } }, "name": "firstName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 45, - 51 - ], "loc": { - "end": { - "line": 2, - "column": 39 - }, "start": { "line": 2, "column": 33 + }, + "end": { + "line": 2, + "column": 39 } }, + "range": [ + 45, + 51 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -156,18 +150,19 @@ module.exports = { 51 ], "loc": { - "end": { - "line": 2, - "column": 39 - }, "start": { "line": 2, "column": 33 + }, + "end": { + "line": 2, + "column": 39 } } } } - } + }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -176,20 +171,19 @@ module.exports = { 100 ], "loc": { - "end": { - "line": 3, - "column": 47 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 47 } }, - "decorators": [], "accessibility": "private", + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -197,32 +191,32 @@ module.exports = { 92 ], "loc": { - "end": { - "line": 3, - "column": 39 - }, "start": { "line": 3, "column": 31 + }, + "end": { + "line": 3, + "column": 39 } }, "name": "lastName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 94, - 100 - ], "loc": { - "end": { - "line": 3, - "column": 47 - }, "start": { "line": 3, "column": 41 + }, + "end": { + "line": 3, + "column": 47 } }, + "range": [ + 94, + 100 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -230,18 +224,19 @@ module.exports = { 100 ], "loc": { - "end": { - "line": 3, - "column": 47 - }, "start": { "line": 3, "column": 41 + }, + "end": { + "line": 3, + "column": 47 } } } } - } + }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -250,21 +245,35 @@ module.exports = { 140 ], "loc": { - "end": { - "line": 4, - "column": 38 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 38 } }, - "decorators": [], "accessibility": "private", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { + "type": "AssignmentPattern", + "range": [ + 116, + 140 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 38 + } + }, "left": { "type": "Identifier", "range": [ @@ -272,32 +281,32 @@ module.exports = { 127 ], "loc": { - "end": { - "line": 4, - "column": 25 - }, "start": { "line": 4, "column": 22 + }, + "end": { + "line": 4, + "column": 25 } }, "name": "age", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 129, - 135 - ], "loc": { - "end": { - "line": 4, - "column": 33 - }, "start": { "line": 4, "column": 27 + }, + "end": { + "line": 4, + "column": 33 } }, + "range": [ + 129, + 135 + ], "typeAnnotation": { "type": "TSNumberKeyword", "range": [ @@ -305,53 +314,39 @@ module.exports = { 135 ], "loc": { - "end": { - "line": 4, - "column": 33 - }, "start": { "line": 4, "column": 27 + }, + "end": { + "line": 4, + "column": 33 } } } } }, - "type": "AssignmentPattern", - "range": [ - 116, - 140 - ], - "loc": { - "end": { - "line": 4, - "column": 38 - }, - "start": { - "line": 4, - "column": 14 - } - }, "right": { + "type": "Literal", + "range": [ + 138, + 140 + ], "loc": { - "end": { - "line": 4, - "column": 38 - }, "start": { "line": 4, "column": 36 + }, + "end": { + "line": 4, + "column": 38 } }, - "range": [ - 138, - 140 - ], - "raw": "30", - "type": "Literal", - "value": 30 + "value": 30, + "raw": "30" } - } + }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -360,21 +355,35 @@ module.exports = { 197 ], "loc": { - "end": { - "line": 5, - "column": 55 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 55 } }, - "decorators": [], "accessibility": "private", + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { + "type": "AssignmentPattern", + "range": [ + 156, + 197 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 55 + } + }, "left": { "type": "Identifier", "range": [ @@ -382,32 +391,32 @@ module.exports = { 180 ], "loc": { - "end": { - "line": 5, - "column": 38 - }, "start": { "line": 5, "column": 31 + }, + "end": { + "line": 5, + "column": 38 } }, "name": "student", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 182, - 189 - ], "loc": { - "end": { - "line": 5, - "column": 47 - }, "start": { "line": 5, "column": 40 + }, + "end": { + "line": 5, + "column": 47 } }, + "range": [ + 182, + 189 + ], "typeAnnotation": { "type": "TSBooleanKeyword", "range": [ @@ -415,33 +424,18 @@ module.exports = { 189 ], "loc": { - "end": { - "line": 5, - "column": 47 - }, "start": { "line": 5, "column": 40 + }, + "end": { + "line": 5, + "column": 47 } } } } }, - "type": "AssignmentPattern", - "range": [ - 156, - 197 - ], - "loc": { - "end": { - "line": 5, - "column": 55 - }, - "start": { - "line": 5, - "column": 14 - } - }, "right": { "type": "Literal", "range": [ @@ -449,691 +443,697 @@ module.exports = { 197 ], "loc": { - "end": { - "line": 5, - "column": 55 - }, "start": { "line": 5, "column": 50 + }, + "end": { + "line": 5, + "column": 55 } }, - "raw": "false", - "value": false + "value": false, + "raw": "false" } + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 199, + 201 + ], + "loc": { + "start": { + "line": 5, + "column": 57 + }, + "end": { + "line": 5, + "column": 59 } + }, + "body": [] + }, + "range": [ + 25, + 201 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 5, + "column": 59 } - ] - } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" } ], - "loc": { - "end": { - "line": 6, - "column": 1 - }, - "start": { - "line": 1, - "column": 10 - } - }, "range": [ 10, 203 ], - "type": "ClassBody" - }, - "decorators": [], - "id": { "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, - "column": 6 + "column": 10 + }, + "end": { + "line": 6, + "column": 1 } - }, - "name": "Foo", - "range": [ - 6, - 9 - ], - "type": "Identifier" - }, - "implements": [], - "loc": { - "end": { - "line": 6, - "column": 1 - }, - "start": { - "line": 1, - "column": 0 } }, - "range": [ - 0, - 203 - ], "superClass": null, - "type": "ClassDeclaration" + "implements": [], + "decorators": [] } ], "sourceType": "script", "tokens": [ { "type": "Keyword", + "value": "class", "range": [ 0, 5 ], "loc": { - "end": { - "line": 1, - "column": 5 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, - "value": "class" + } }, { "type": "Identifier", + "value": "Foo", "range": [ 6, 9 ], "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, "column": 6 + }, + "end": { + "line": 1, + "column": 9 } - }, - "value": "Foo" + } }, { "type": "Punctuator", + "value": "{", "range": [ 10, 11 ], "loc": { - "end": { - "line": 1, - "column": 11 - }, "start": { "line": 1, "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, - "value": "{" + } }, { "type": "Identifier", + "value": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 2, + "column": 13 } - }, - "value": "constructor" + } }, { "type": "Punctuator", + "value": "(", "range": [ 25, 26 ], "loc": { - "end": { - "line": 2, - "column": 14 - }, "start": { "line": 2, "column": 13 + }, + "end": { + "line": 2, + "column": 14 } - }, - "value": "(" + } }, { "type": "Keyword", + "value": "private", "range": [ 26, 33 ], "loc": { - "end": { + "start": { "line": 2, - "column": 21 + "column": 14 }, - "start": { + "end": { "line": 2, - "column": 14 + "column": 21 } - }, - "value": "private" + } }, { "type": "Identifier", + "value": "firstName", "range": [ 34, 43 ], "loc": { - "end": { - "line": 2, - "column": 31 - }, "start": { "line": 2, "column": 22 + }, + "end": { + "line": 2, + "column": 31 } - }, - "value": "firstName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 43, 44 ], "loc": { - "end": { - "line": 2, - "column": 32 - }, "start": { "line": 2, "column": 31 + }, + "end": { + "line": 2, + "column": 32 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 45, 51 ], "loc": { - "end": { - "line": 2, - "column": 39 - }, "start": { "line": 2, "column": 33 + }, + "end": { + "line": 2, + "column": 39 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 51, 52 ], "loc": { - "end": { - "line": 2, - "column": 40 - }, "start": { "line": 2, "column": 39 + }, + "end": { + "line": 2, + "column": 40 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "private", "range": [ 67, 74 ], "loc": { - "end": { - "line": 3, - "column": 21 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 21 } - }, - "value": "private" + } }, { "type": "Identifier", + "value": "readonly", "range": [ 75, 83 ], "loc": { - "end": { - "line": 3, - "column": 30 - }, "start": { "line": 3, "column": 22 + }, + "end": { + "line": 3, + "column": 30 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "lastName", "range": [ 84, 92 ], "loc": { - "end": { - "line": 3, - "column": 39 - }, "start": { "line": 3, "column": 31 + }, + "end": { + "line": 3, + "column": 39 } - }, - "value": "lastName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 92, 93 ], "loc": { - "end": { - "line": 3, - "column": 40 - }, "start": { "line": 3, "column": 39 + }, + "end": { + "line": 3, + "column": 40 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 94, 100 ], "loc": { - "end": { - "line": 3, - "column": 47 - }, "start": { "line": 3, "column": 41 + }, + "end": { + "line": 3, + "column": 47 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 100, 101 ], "loc": { - "end": { - "line": 3, - "column": 48 - }, "start": { "line": 3, "column": 47 + }, + "end": { + "line": 3, + "column": 48 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "private", "range": [ 116, 123 ], "loc": { - "end": { - "line": 4, - "column": 21 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 21 } - }, - "value": "private" + } }, { "type": "Identifier", + "value": "age", "range": [ 124, 127 ], "loc": { - "end": { - "line": 4, - "column": 25 - }, "start": { "line": 4, "column": 22 + }, + "end": { + "line": 4, + "column": 25 } - }, - "value": "age" + } }, { "type": "Punctuator", + "value": ":", "range": [ 127, 128 ], "loc": { - "end": { - "line": 4, - "column": 26 - }, "start": { "line": 4, "column": 25 + }, + "end": { + "line": 4, + "column": 26 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "number", "range": [ 129, 135 ], "loc": { - "end": { - "line": 4, - "column": 33 - }, "start": { "line": 4, "column": 27 + }, + "end": { + "line": 4, + "column": 33 } - }, - "value": "number" + } }, { "type": "Punctuator", + "value": "=", "range": [ 136, 137 ], "loc": { - "end": { - "line": 4, - "column": 35 - }, "start": { "line": 4, "column": 34 + }, + "end": { + "line": 4, + "column": 35 } - }, - "value": "=" + } }, { "type": "Numeric", + "value": "30", "range": [ 138, 140 ], "loc": { - "end": { - "line": 4, - "column": 38 - }, "start": { "line": 4, "column": 36 + }, + "end": { + "line": 4, + "column": 38 } - }, - "value": "30" + } }, { "type": "Punctuator", + "value": ",", "range": [ 140, 141 ], "loc": { - "end": { - "line": 4, - "column": 39 - }, "start": { "line": 4, "column": 38 + }, + "end": { + "line": 4, + "column": 39 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "private", "range": [ 156, 163 ], "loc": { - "end": { - "line": 5, - "column": 21 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 21 } - }, - "value": "private" + } }, { "type": "Identifier", + "value": "readonly", "range": [ 164, 172 ], "loc": { - "end": { - "line": 5, - "column": 30 - }, "start": { "line": 5, "column": 22 + }, + "end": { + "line": 5, + "column": 30 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "student", "range": [ 173, 180 ], "loc": { - "end": { - "line": 5, - "column": 38 - }, "start": { "line": 5, "column": 31 + }, + "end": { + "line": 5, + "column": 38 } - }, - "value": "student" + } }, { "type": "Punctuator", + "value": ":", "range": [ 180, 181 ], "loc": { - "end": { - "line": 5, - "column": 39 - }, "start": { "line": 5, "column": 38 + }, + "end": { + "line": 5, + "column": 39 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "boolean", "range": [ 182, 189 ], "loc": { - "end": { - "line": 5, - "column": 47 - }, "start": { "line": 5, "column": 40 + }, + "end": { + "line": 5, + "column": 47 } - }, - "value": "boolean" + } }, { "type": "Punctuator", + "value": "=", "range": [ 190, 191 ], "loc": { - "end": { - "line": 5, - "column": 49 - }, "start": { "line": 5, "column": 48 + }, + "end": { + "line": 5, + "column": 49 } - }, - "value": "=" + } }, { "type": "Boolean", + "value": "false", "range": [ 192, 197 ], "loc": { - "end": { - "line": 5, - "column": 55 - }, "start": { "line": 5, "column": 50 + }, + "end": { + "line": 5, + "column": 55 } - }, - "value": "false" + } }, { "type": "Punctuator", + "value": ")", "range": [ 197, 198 ], "loc": { - "end": { - "line": 5, - "column": 56 - }, "start": { "line": 5, "column": 55 + }, + "end": { + "line": 5, + "column": 56 } - }, - "value": ")" + } }, { "type": "Punctuator", + "value": "{", "range": [ 199, 200 ], "loc": { - "end": { - "line": 5, - "column": 58 - }, "start": { "line": 5, "column": 57 + }, + "end": { + "line": 5, + "column": 58 } - }, - "value": "{" + } }, { "type": "Punctuator", + "value": "}", "range": [ 200, 201 ], "loc": { - "end": { - "line": 5, - "column": 59 - }, "start": { "line": 5, "column": 58 + }, + "end": { + "line": 5, + "column": 59 } - }, - "value": "}" + } }, { "type": "Punctuator", + "value": "}", "range": [ 202, 203 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 6, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } - }, - "value": "}" + } } - ], -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js index 3ff625adf790..0d44bed7a09c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js @@ -5,13 +5,13 @@ module.exports = { 211 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } }, "body": [ @@ -22,31 +22,35 @@ module.exports = { 211 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } }, - "body": { - "type": "ClassBody", + "id": { + "type": "Identifier", "range": [ - 10, - 211 + 6, + 9 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 1, - "column": 10 + "column": 6 + }, + "end": { + "line": 1, + "column": 9 } }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", "body": [ { "type": "MethodDefinition", @@ -55,74 +59,35 @@ module.exports = { 209 ], "loc": { - "end": { - "line": 5, - "column": 61 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 5, + "column": 61 } }, - "kind": "constructor", - "accessibility": null, - "computed": false, "key": { "type": "Identifier", + "name": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 - } - }, - "name": "constructor" - }, - "static": false, - "value": { - "type": "FunctionExpression", - "range": [ - 25, - 209 - ], - "loc": { - "end": { - "line": 5, - "column": 61 }, - "start": { + "end": { "line": 2, "column": 13 } - }, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 207, - 209 - ], - "loc": { - "end": { - "line": 5, - "column": 61 - }, - "start": { - "line": 5, - "column": 59 - } - }, - "body": [] - }, - "expression": false, - "generator": false, + } + }, + "value": { + "type": "FunctionExpression", "id": null, "params": [ { @@ -132,20 +97,19 @@ module.exports = { 53 ], "loc": { - "end": { - "line": 2, - "column": 41 - }, "start": { "line": 2, "column": 14 + }, + "end": { + "line": 2, + "column": 41 } }, - "decorators": [], "accessibility": "protected", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -153,32 +117,32 @@ module.exports = { 45 ], "loc": { - "end": { - "line": 2, - "column": 33 - }, "start": { "line": 2, "column": 24 + }, + "end": { + "line": 2, + "column": 33 } }, "name": "firstName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 47, - 53 - ], "loc": { - "end": { - "line": 2, - "column": 41 - }, "start": { "line": 2, "column": 35 + }, + "end": { + "line": 2, + "column": 41 } }, + "range": [ + 47, + 53 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -186,18 +150,19 @@ module.exports = { 53 ], "loc": { - "end": { - "line": 2, - "column": 41 - }, "start": { "line": 2, "column": 35 + }, + "end": { + "line": 2, + "column": 41 } } } } - } + }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -206,20 +171,19 @@ module.exports = { 104 ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 49 } }, - "decorators": [], "accessibility": "protected", + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -227,32 +191,32 @@ module.exports = { 96 ], "loc": { - "end": { - "line": 3, - "column": 41 - }, "start": { "line": 3, "column": 33 + }, + "end": { + "line": 3, + "column": 41 } }, "name": "lastName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 98, - 104 - ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 43 + }, + "end": { + "line": 3, + "column": 49 } }, + "range": [ + 98, + 104 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -260,18 +224,19 @@ module.exports = { 104 ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 43 + }, + "end": { + "line": 3, + "column": 49 } } } } - } + }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -280,20 +245,19 @@ module.exports = { 146 ], "loc": { - "end": { - "line": 4, - "column": 40 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 40 } }, - "decorators": [], "accessibility": "protected", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -301,13 +265,13 @@ module.exports = { 146 ], "loc": { - "end": { - "line": 4, - "column": 40 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 40 } }, "left": { @@ -317,32 +281,32 @@ module.exports = { 133 ], "loc": { - "end": { - "line": 4, - "column": 27 - }, "start": { "line": 4, "column": 24 + }, + "end": { + "line": 4, + "column": 27 } }, "name": "age", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 135, - 141 - ], "loc": { - "end": { - "line": 4, - "column": 35 - }, "start": { "line": 4, "column": 29 + }, + "end": { + "line": 4, + "column": 35 } }, + "range": [ + 135, + 141 + ], "typeAnnotation": { "type": "TSNumberKeyword", "range": [ @@ -350,13 +314,13 @@ module.exports = { 141 ], "loc": { - "end": { - "line": 4, - "column": 35 - }, "start": { "line": 4, "column": 29 + }, + "end": { + "line": 4, + "column": 35 } } } @@ -369,19 +333,20 @@ module.exports = { 146 ], "loc": { - "end": { - "line": 4, - "column": 40 - }, "start": { "line": 4, "column": 38 + }, + "end": { + "line": 4, + "column": 40 } }, - "raw": "30", - "value": 30 + "value": 30, + "raw": "30" } - } + }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -390,20 +355,19 @@ module.exports = { 205 ], "loc": { - "end": { - "line": 5, - "column": 57 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 57 } }, - "decorators": [], "accessibility": "protected", + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { "type": "AssignmentPattern", "range": [ @@ -411,13 +375,13 @@ module.exports = { 205 ], "loc": { - "end": { - "line": 5, - "column": 57 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 57 } }, "left": { @@ -427,32 +391,32 @@ module.exports = { 188 ], "loc": { - "end": { - "line": 5, - "column": 40 - }, "start": { "line": 5, "column": 33 + }, + "end": { + "line": 5, + "column": 40 } }, "name": "student", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 190, - 197 - ], "loc": { - "end": { - "line": 5, - "column": 49 - }, "start": { "line": 5, "column": 42 + }, + "end": { + "line": 5, + "column": 49 } }, + "range": [ + 190, + 197 + ], "typeAnnotation": { "type": "TSBooleanKeyword", "range": [ @@ -460,13 +424,13 @@ module.exports = { 197 ], "loc": { - "end": { - "line": 5, - "column": 49 - }, "start": { "line": 5, "column": 42 + }, + "end": { + "line": 5, + "column": 49 } } } @@ -479,661 +443,697 @@ module.exports = { 205 ], "loc": { - "end": { - "line": 5, - "column": 57 - }, "start": { "line": 5, "column": 52 + }, + "end": { + "line": 5, + "column": 57 } }, - "raw": "false", - "value": false + "value": false, + "raw": "false" } + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 207, + 209 + ], + "loc": { + "start": { + "line": 5, + "column": 59 + }, + "end": { + "line": 5, + "column": 61 } + }, + "body": [] + }, + "range": [ + 25, + 209 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 5, + "column": 61 } - ] - } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" } - ] - }, - "decorators": [], - "id": { - "type": "Identifier", + ], "range": [ - 6, - 9 + 10, + 211 ], "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, - "column": 6 + "column": 10 + }, + "end": { + "line": 6, + "column": 1 } - }, - "name": "Foo", + } }, - "implements": [], "superClass": null, + "implements": [], + "decorators": [] } ], "sourceType": "script", "tokens": [ { "type": "Keyword", + "value": "class", "range": [ 0, 5 ], "loc": { - "end": { - "line": 1, - "column": 5 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, - "value": "class" + } }, { "type": "Identifier", + "value": "Foo", "range": [ 6, 9 ], "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, "column": 6 + }, + "end": { + "line": 1, + "column": 9 } - }, - "value": "Foo" + } }, { "type": "Punctuator", + "value": "{", "range": [ 10, 11 ], "loc": { - "end": { - "line": 1, - "column": 11 - }, "start": { "line": 1, "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, - "value": "{" + } }, { "type": "Identifier", + "value": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 2, + "column": 13 } - }, - "value": "constructor" + } }, { "type": "Punctuator", + "value": "(", "range": [ 25, 26 ], "loc": { - "end": { - "line": 2, - "column": 14 - }, "start": { "line": 2, "column": 13 + }, + "end": { + "line": 2, + "column": 14 } - }, - "value": "(" + } }, { "type": "Keyword", + "value": "protected", "range": [ 26, 35 ], "loc": { - "end": { - "line": 2, - "column": 23 - }, "start": { "line": 2, "column": 14 + }, + "end": { + "line": 2, + "column": 23 } - }, - "value": "protected" + } }, { "type": "Identifier", + "value": "firstName", "range": [ 36, 45 ], "loc": { - "end": { - "line": 2, - "column": 33 - }, "start": { "line": 2, "column": 24 + }, + "end": { + "line": 2, + "column": 33 } - }, - "value": "firstName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 45, 46 ], "loc": { - "end": { - "line": 2, - "column": 34 - }, "start": { "line": 2, "column": 33 + }, + "end": { + "line": 2, + "column": 34 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 47, 53 ], "loc": { - "end": { - "line": 2, - "column": 41 - }, "start": { "line": 2, "column": 35 + }, + "end": { + "line": 2, + "column": 41 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 53, 54 ], "loc": { - "end": { - "line": 2, - "column": 42 - }, "start": { "line": 2, "column": 41 + }, + "end": { + "line": 2, + "column": 42 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "protected", "range": [ 69, 78 ], "loc": { - "end": { - "line": 3, - "column": 23 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 23 } - }, - "value": "protected" + } }, { "type": "Identifier", + "value": "readonly", "range": [ 79, 87 ], "loc": { - "end": { - "line": 3, - "column": 32 - }, "start": { "line": 3, "column": 24 + }, + "end": { + "line": 3, + "column": 32 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "lastName", "range": [ 88, 96 ], "loc": { - "end": { - "line": 3, - "column": 41 - }, "start": { "line": 3, "column": 33 + }, + "end": { + "line": 3, + "column": 41 } - }, - "value": "lastName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 96, 97 ], "loc": { - "end": { - "line": 3, - "column": 42 - }, "start": { "line": 3, "column": 41 + }, + "end": { + "line": 3, + "column": 42 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 98, 104 ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 43 + }, + "end": { + "line": 3, + "column": 49 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 104, 105 ], "loc": { - "end": { - "line": 3, - "column": 50 - }, "start": { "line": 3, "column": 49 + }, + "end": { + "line": 3, + "column": 50 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "protected", "range": [ 120, 129 ], "loc": { - "end": { - "line": 4, - "column": 23 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 23 } - }, - "value": "protected" + } }, { "type": "Identifier", + "value": "age", "range": [ 130, 133 ], "loc": { - "end": { - "line": 4, - "column": 27 - }, "start": { "line": 4, "column": 24 - } - }, - "value": "age" - }, - { - "loc": { - "end": { - "line": 4, - "column": 28 }, - "start": { + "end": { "line": 4, "column": 27 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 133, 134 ], - "type": "Punctuator", - "value": ":" + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 28 + } + } }, { "type": "Identifier", + "value": "number", "range": [ 135, 141 ], "loc": { - "end": { - "line": 4, - "column": 35 - }, "start": { "line": 4, "column": 29 + }, + "end": { + "line": 4, + "column": 35 } - }, - "value": "number" + } }, { "type": "Punctuator", + "value": "=", "range": [ 142, 143 ], "loc": { - "end": { - "line": 4, - "column": 37 - }, "start": { "line": 4, "column": 36 + }, + "end": { + "line": 4, + "column": 37 } - }, - "value": "=" + } }, { "type": "Numeric", + "value": "30", "range": [ 144, 146 ], "loc": { - "end": { - "line": 4, - "column": 40 - }, "start": { "line": 4, "column": 38 + }, + "end": { + "line": 4, + "column": 40 } - }, - "value": "30" + } }, { "type": "Punctuator", + "value": ",", "range": [ 146, 147 ], "loc": { - "end": { - "line": 4, - "column": 41 - }, "start": { "line": 4, "column": 40 + }, + "end": { + "line": 4, + "column": 41 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "protected", "range": [ 162, 171 ], "loc": { - "end": { - "line": 5, - "column": 23 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 23 } - }, - "value": "protected" + } }, { "type": "Identifier", + "value": "readonly", "range": [ 172, 180 ], "loc": { - "end": { - "line": 5, - "column": 32 - }, "start": { "line": 5, "column": 24 + }, + "end": { + "line": 5, + "column": 32 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "student", "range": [ 181, 188 ], "loc": { - "end": { - "line": 5, - "column": 40 - }, "start": { "line": 5, "column": 33 + }, + "end": { + "line": 5, + "column": 40 } - }, - "value": "student" + } }, { "type": "Punctuator", + "value": ":", "range": [ 188, 189 ], "loc": { - "end": { - "line": 5, - "column": 41 - }, "start": { "line": 5, "column": 40 + }, + "end": { + "line": 5, + "column": 41 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "boolean", "range": [ 190, 197 ], "loc": { - "end": { - "line": 5, - "column": 49 - }, "start": { "line": 5, "column": 42 + }, + "end": { + "line": 5, + "column": 49 } - }, - "value": "boolean" + } }, { "type": "Punctuator", + "value": "=", "range": [ 198, 199 ], "loc": { - "end": { - "line": 5, - "column": 51 - }, "start": { "line": 5, "column": 50 + }, + "end": { + "line": 5, + "column": 51 } - }, - "value": "=" + } }, { "type": "Boolean", + "value": "false", "range": [ 200, 205 ], "loc": { - "end": { - "line": 5, - "column": 57 - }, "start": { "line": 5, "column": 52 + }, + "end": { + "line": 5, + "column": 57 } - }, - "value": "false" + } }, { "type": "Punctuator", + "value": ")", "range": [ 205, 206 ], "loc": { - "end": { - "line": 5, - "column": 58 - }, "start": { "line": 5, "column": 57 + }, + "end": { + "line": 5, + "column": 58 } - }, - "value": ")" + } }, { "type": "Punctuator", + "value": "{", "range": [ 207, 208 ], "loc": { - "end": { - "line": 5, - "column": 60 - }, "start": { "line": 5, "column": 59 + }, + "end": { + "line": 5, + "column": 60 } - }, - "value": "{" + } }, { "type": "Punctuator", + "value": "}", "range": [ 208, 209 ], "loc": { - "end": { - "line": 5, - "column": 61 - }, "start": { "line": 5, "column": 60 + }, + "end": { + "line": 5, + "column": 61 } - }, - "value": "}" + } }, { "type": "Punctuator", + "value": "}", "range": [ 210, 211 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 6, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } - }, - "value": "}" + } } - ], -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js index 14de49a5b019..8c8c738c7477 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js @@ -5,13 +5,13 @@ module.exports = { 199 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } }, "body": [ @@ -22,31 +22,35 @@ module.exports = { 199 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } }, - "body": { - "type": "ClassBody", + "id": { + "type": "Identifier", "range": [ - 10, - 199 + 6, + 9 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 1, - "column": 10 + "column": 6 + }, + "end": { + "line": 1, + "column": 9 } }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", "body": [ { "type": "MethodDefinition", @@ -55,74 +59,35 @@ module.exports = { 197 ], "loc": { - "end": { - "line": 5, - "column": 58 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 5, + "column": 58 } }, - "kind": "constructor", - "accessibility": null, - "computed": false, "key": { "type": "Identifier", + "name": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 - } - }, - "name": "constructor" - }, - "static": false, - "value": { - "type": "FunctionExpression", - "range": [ - 25, - 197 - ], - "loc": { - "end": { - "line": 5, - "column": 58 }, - "start": { + "end": { "line": 2, "column": 13 } - }, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 195, - 197 - ], - "loc": { - "end": { - "line": 5, - "column": 58 - }, - "start": { - "line": 5, - "column": 56 - } - }, - "body": [] - }, - "expression": false, - "generator": false, + } + }, + "value": { + "type": "FunctionExpression", "id": null, "params": [ { @@ -132,20 +97,19 @@ module.exports = { 50 ], "loc": { - "end": { - "line": 2, - "column": 38 - }, "start": { "line": 2, "column": 14 + }, + "end": { + "line": 2, + "column": 38 } }, - "decorators": [], "accessibility": "public", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -153,32 +117,32 @@ module.exports = { 42 ], "loc": { - "end": { - "line": 2, - "column": 30 - }, "start": { "line": 2, "column": 21 + }, + "end": { + "line": 2, + "column": 30 } }, "name": "firstName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 44, - 50 - ], "loc": { - "end": { - "line": 2, - "column": 38 - }, "start": { "line": 2, "column": 32 + }, + "end": { + "line": 2, + "column": 38 } }, + "range": [ + 44, + 50 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -186,18 +150,19 @@ module.exports = { 50 ], "loc": { - "end": { - "line": 2, - "column": 38 - }, "start": { "line": 2, "column": 32 + }, + "end": { + "line": 2, + "column": 38 } } } } }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -206,20 +171,19 @@ module.exports = { 98 ], "loc": { - "end": { - "line": 3, - "column": 46 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 46 } }, - "decorators": [], "accessibility": "public", + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -227,32 +191,32 @@ module.exports = { 90 ], "loc": { - "end": { - "line": 3, - "column": 38 - }, "start": { "line": 3, "column": 30 + }, + "end": { + "line": 3, + "column": 38 } }, "name": "lastName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 92, - 98 - ], "loc": { - "end": { - "line": 3, - "column": 46 - }, "start": { "line": 3, "column": 40 + }, + "end": { + "line": 3, + "column": 46 } }, + "range": [ + 92, + 98 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -260,18 +224,19 @@ module.exports = { 98 ], "loc": { - "end": { - "line": 3, - "column": 46 - }, "start": { "line": 3, "column": 40 + }, + "end": { + "line": 3, + "column": 46 } } } } }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -280,20 +245,19 @@ module.exports = { 137 ], "loc": { - "end": { - "line": 4, - "column": 37 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 37 } }, - "decorators": [], "accessibility": "public", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { "type": "AssignmentPattern", "range": [ @@ -301,13 +265,13 @@ module.exports = { 137 ], "loc": { - "end": { - "line": 4, - "column": 37 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 37 } }, "left": { @@ -317,32 +281,32 @@ module.exports = { 124 ], "loc": { - "end": { - "line": 4, - "column": 24 - }, "start": { "line": 4, "column": 21 + }, + "end": { + "line": 4, + "column": 24 } }, "name": "age", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 126, - 132 - ], "loc": { - "end": { - "line": 4, - "column": 32 - }, "start": { "line": 4, "column": 26 + }, + "end": { + "line": 4, + "column": 32 } }, + "range": [ + 126, + 132 + ], "typeAnnotation": { "type": "TSNumberKeyword", "range": [ @@ -350,13 +314,13 @@ module.exports = { 132 ], "loc": { - "end": { - "line": 4, - "column": 32 - }, "start": { "line": 4, "column": 26 + }, + "end": { + "line": 4, + "column": 32 } } } @@ -369,19 +333,20 @@ module.exports = { 137 ], "loc": { - "end": { - "line": 4, - "column": 37 - }, "start": { "line": 4, "column": 35 + }, + "end": { + "line": 4, + "column": 37 } }, - "raw": "30", - "value": 30 + "value": 30, + "raw": "30" } }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -390,20 +355,19 @@ module.exports = { 193 ], "loc": { - "end": { - "line": 5, - "column": 54 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 54 } }, - "decorators": [], "accessibility": "public", + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { "type": "AssignmentPattern", "range": [ @@ -411,13 +375,13 @@ module.exports = { 193 ], "loc": { - "end": { - "line": 5, - "column": 54 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 54 } }, "left": { @@ -427,32 +391,32 @@ module.exports = { 176 ], "loc": { - "end": { - "line": 5, - "column": 37 - }, "start": { "line": 5, "column": 30 + }, + "end": { + "line": 5, + "column": 37 } }, "name": "student", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 178, - 185 - ], "loc": { - "end": { - "line": 5, - "column": 46 - }, "start": { "line": 5, "column": 39 + }, + "end": { + "line": 5, + "column": 46 } }, + "range": [ + 178, + 185 + ], "typeAnnotation": { "type": "TSBooleanKeyword", "range": [ @@ -460,13 +424,13 @@ module.exports = { 185 ], "loc": { - "end": { - "line": 5, - "column": 46 - }, "start": { "line": 5, "column": 39 + }, + "end": { + "line": 5, + "column": 46 } } } @@ -479,661 +443,697 @@ module.exports = { 193 ], "loc": { - "end": { - "line": 5, - "column": 54 - }, "start": { "line": 5, "column": 49 + }, + "end": { + "line": 5, + "column": 54 } }, - "raw": "false", - "value": false + "value": false, + "raw": "false" } + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 195, + 197 + ], + "loc": { + "start": { + "line": 5, + "column": 56 + }, + "end": { + "line": 5, + "column": 58 } + }, + "body": [] + }, + "range": [ + 25, + 197 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 5, + "column": 58 } - ] - } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" } - ] - }, - "decorators": [], - "id": { - "type": "Identifier", + ], "range": [ - 6, - 9 + 10, + 199 ], "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, - "column": 6 + "column": 10 + }, + "end": { + "line": 6, + "column": 1 } - }, - "name": "Foo" + } }, + "superClass": null, "implements": [], - "superClass": null + "decorators": [] } ], "sourceType": "script", "tokens": [ { "type": "Keyword", + "value": "class", "range": [ 0, 5 ], "loc": { - "end": { - "line": 1, - "column": 5 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, - "value": "class" + } }, { "type": "Identifier", + "value": "Foo", "range": [ 6, 9 ], "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, "column": 6 + }, + "end": { + "line": 1, + "column": 9 } - }, - "value": "Foo" + } }, { "type": "Punctuator", + "value": "{", "range": [ 10, 11 ], "loc": { - "end": { - "line": 1, - "column": 11 - }, "start": { "line": 1, "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, - "value": "{" + } }, { "type": "Identifier", + "value": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 2, + "column": 13 } - }, - "value": "constructor" + } }, { "type": "Punctuator", + "value": "(", "range": [ 25, 26 ], "loc": { - "end": { - "line": 2, - "column": 14 - }, "start": { "line": 2, "column": 13 + }, + "end": { + "line": 2, + "column": 14 } - }, - "value": "(" + } }, { "type": "Keyword", + "value": "public", "range": [ 26, 32 ], "loc": { - "end": { + "start": { "line": 2, - "column": 20 + "column": 14 }, - "start": { + "end": { "line": 2, - "column": 14 + "column": 20 } - }, - "value": "public" + } }, { "type": "Identifier", + "value": "firstName", "range": [ 33, 42 ], "loc": { - "end": { - "line": 2, - "column": 30 - }, "start": { "line": 2, "column": 21 + }, + "end": { + "line": 2, + "column": 30 } - }, - "value": "firstName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 42, 43 ], "loc": { - "end": { - "line": 2, - "column": 31 - }, "start": { "line": 2, "column": 30 + }, + "end": { + "line": 2, + "column": 31 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 44, 50 ], "loc": { - "end": { - "line": 2, - "column": 38 - }, "start": { "line": 2, "column": 32 + }, + "end": { + "line": 2, + "column": 38 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 50, 51 ], "loc": { - "end": { - "line": 2, - "column": 39 - }, "start": { "line": 2, "column": 38 + }, + "end": { + "line": 2, + "column": 39 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "public", "range": [ 66, 72 ], "loc": { - "end": { - "line": 3, - "column": 20 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 20 } - }, - "value": "public" + } }, { "type": "Identifier", + "value": "readonly", "range": [ 73, 81 ], "loc": { - "end": { - "line": 3, - "column": 29 - }, "start": { "line": 3, "column": 21 + }, + "end": { + "line": 3, + "column": 29 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "lastName", "range": [ 82, 90 ], "loc": { - "end": { - "line": 3, - "column": 38 - }, "start": { "line": 3, "column": 30 + }, + "end": { + "line": 3, + "column": 38 } - }, - "value": "lastName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 90, 91 ], "loc": { - "end": { - "line": 3, - "column": 39 - }, "start": { "line": 3, "column": 38 + }, + "end": { + "line": 3, + "column": 39 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 92, 98 ], "loc": { - "end": { - "line": 3, - "column": 46 - }, "start": { "line": 3, "column": 40 + }, + "end": { + "line": 3, + "column": 46 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 98, 99 ], "loc": { - "end": { - "line": 3, - "column": 47 - }, "start": { "line": 3, "column": 46 + }, + "end": { + "line": 3, + "column": 47 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "public", "range": [ 114, 120 ], "loc": { - "end": { - "line": 4, - "column": 20 - }, "start": { "line": 4, "column": 14 + }, + "end": { + "line": 4, + "column": 20 } - }, - "value": "public" + } }, { "type": "Identifier", + "value": "age", "range": [ 121, 124 ], "loc": { - "end": { - "line": 4, - "column": 24 - }, "start": { "line": 4, "column": 21 + }, + "end": { + "line": 4, + "column": 24 } - }, - "value": "age" + } }, { "type": "Punctuator", + "value": ":", "range": [ 124, 125 ], "loc": { - "end": { - "line": 4, - "column": 25 - }, "start": { "line": 4, "column": 24 + }, + "end": { + "line": 4, + "column": 25 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "number", "range": [ 126, 132 ], "loc": { - "end": { - "line": 4, - "column": 32 - }, "start": { "line": 4, "column": 26 + }, + "end": { + "line": 4, + "column": 32 } - }, - "value": "number" + } }, { "type": "Punctuator", + "value": "=", "range": [ 133, 134 ], "loc": { - "end": { - "line": 4, - "column": 34 - }, "start": { "line": 4, "column": 33 + }, + "end": { + "line": 4, + "column": 34 } - }, - "value": "=" + } }, { "type": "Numeric", + "value": "30", "range": [ 135, 137 ], "loc": { - "end": { - "line": 4, - "column": 37 - }, "start": { "line": 4, "column": 35 + }, + "end": { + "line": 4, + "column": 37 } - }, - "value": "30" + } }, { "type": "Punctuator", + "value": ",", "range": [ 137, 138 ], "loc": { - "end": { - "line": 4, - "column": 38 - }, "start": { "line": 4, "column": 37 + }, + "end": { + "line": 4, + "column": 38 } - }, - "value": "," + } }, { "type": "Keyword", + "value": "public", "range": [ 153, 159 ], "loc": { - "end": { - "line": 5, - "column": 20 - }, "start": { "line": 5, "column": 14 + }, + "end": { + "line": 5, + "column": 20 } - }, - "value": "public" + } }, { "type": "Identifier", + "value": "readonly", "range": [ 160, 168 ], "loc": { - "end": { - "line": 5, - "column": 29 - }, "start": { "line": 5, "column": 21 + }, + "end": { + "line": 5, + "column": 29 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "student", "range": [ 169, 176 ], "loc": { - "end": { - "line": 5, - "column": 37 - }, "start": { "line": 5, "column": 30 + }, + "end": { + "line": 5, + "column": 37 } - }, - "value": "student" + } }, { "type": "Punctuator", + "value": ":", "range": [ 176, 177 ], "loc": { - "end": { - "line": 5, - "column": 38 - }, "start": { "line": 5, "column": 37 + }, + "end": { + "line": 5, + "column": 38 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "boolean", "range": [ 178, 185 ], "loc": { - "end": { - "line": 5, - "column": 46 - }, "start": { "line": 5, "column": 39 + }, + "end": { + "line": 5, + "column": 46 } - }, - "value": "boolean" + } }, { "type": "Punctuator", + "value": "=", "range": [ 186, 187 ], "loc": { - "end": { - "line": 5, - "column": 48 - }, "start": { "line": 5, "column": 47 + }, + "end": { + "line": 5, + "column": 48 } - }, - "value": "=" + } }, { "type": "Boolean", + "value": "false", "range": [ 188, 193 ], "loc": { - "end": { - "line": 5, - "column": 54 - }, "start": { "line": 5, "column": 49 + }, + "end": { + "line": 5, + "column": 54 } - }, - "value": "false" + } }, { "type": "Punctuator", + "value": ")", "range": [ 193, 194 ], "loc": { - "end": { - "line": 5, - "column": 55 - }, "start": { "line": 5, "column": 54 + }, + "end": { + "line": 5, + "column": 55 } - }, - "value": ")" + } }, { "type": "Punctuator", + "value": "{", "range": [ 195, 196 ], "loc": { - "end": { - "line": 5, - "column": 57 - }, "start": { "line": 5, "column": 56 + }, + "end": { + "line": 5, + "column": 57 } - }, - "value": "{" + } }, { "type": "Punctuator", + "value": "}", "range": [ 196, 197 ], "loc": { - "end": { - "line": 5, - "column": 58 - }, "start": { "line": 5, "column": 57 + }, + "end": { + "line": 5, + "column": 58 } - }, - "value": "}" + } }, { "type": "Punctuator", + "value": "}", "range": [ 198, 199 ], "loc": { - "end": { - "line": 6, - "column": 1 - }, "start": { "line": 6, "column": 0 + }, + "end": { + "line": 6, + "column": 1 } - }, - "value": "}" + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js index 5ecb3416b78b..33c39799dd33 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js @@ -5,13 +5,13 @@ module.exports = { 109 ], "loc": { - "end": { - "line": 4, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 4, + "column": 1 } }, "body": [ @@ -22,31 +22,35 @@ module.exports = { 109 ], "loc": { - "end": { - "line": 4, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 4, + "column": 1 } }, - "body": { - "type": "ClassBody", + "id": { + "type": "Identifier", "range": [ - 10, - 109 + 6, + 9 ], "loc": { - "end": { - "line": 4, - "column": 1 - }, "start": { "line": 1, - "column": 10 + "column": 6 + }, + "end": { + "line": 1, + "column": 9 } }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", "body": [ { "type": "MethodDefinition", @@ -55,74 +59,35 @@ module.exports = { 107 ], "loc": { - "end": { - "line": 3, - "column": 53 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 3, + "column": 53 } }, - "kind": "constructor", - "accessibility": null, - "computed": false, "key": { "type": "Identifier", + "name": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 - } - }, - "name": "constructor" - }, - "static": false, - "value": { - "type": "FunctionExpression", - "range": [ - 25, - 107 - ], - "loc": { - "end": { - "line": 3, - "column": 53 }, - "start": { + "end": { "line": 2, "column": 13 } - }, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 105, - 107 - ], - "loc": { - "end": { - "line": 3, - "column": 53 - }, - "start": { - "line": 3, - "column": 51 - } - }, - "body": [] - }, - "expression": false, - "generator": false, + } + }, + "value": { + "type": "FunctionExpression", "id": null, "params": [ { @@ -132,20 +97,19 @@ module.exports = { 52 ], "loc": { - "end": { - "line": 2, - "column": 40 - }, "start": { "line": 2, "column": 14 + }, + "end": { + "line": 2, + "column": 40 } }, - "decorators": [], "accessibility": null, + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { "type": "Identifier", "range": [ @@ -153,32 +117,32 @@ module.exports = { 44 ], "loc": { - "end": { - "line": 2, - "column": 32 - }, "start": { "line": 2, "column": 23 + }, + "end": { + "line": 2, + "column": 32 } }, "name": "firstName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 46, - 52 - ], "loc": { - "end": { - "line": 2, - "column": 40 - }, "start": { "line": 2, "column": 34 + }, + "end": { + "line": 2, + "column": 40 } }, + "range": [ + 46, + 52 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -186,18 +150,19 @@ module.exports = { 52 ], "loc": { - "end": { - "line": 2, - "column": 40 - }, "start": { "line": 2, "column": 34 + }, + "end": { + "line": 2, + "column": 40 } } } } - } + }, + "decorators": [] }, { "type": "TSParameterProperty", @@ -206,20 +171,19 @@ module.exports = { 103 ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 49 } }, - "decorators": [], "accessibility": null, + "readonly": true, "static": false, "export": false, - "readonly": true, "parameter": { "type": "AssignmentPattern", "range": [ @@ -227,13 +191,13 @@ module.exports = { 103 ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 49 } }, "left": { @@ -243,32 +207,32 @@ module.exports = { 85 ], "loc": { - "end": { - "line": 3, - "column": 31 - }, "start": { "line": 3, "column": 23 + }, + "end": { + "line": 3, + "column": 31 } }, "name": "lastName", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 87, - 93 - ], "loc": { - "end": { - "line": 3, - "column": 39 - }, "start": { "line": 3, "column": 33 + }, + "end": { + "line": 3, + "column": 39 } }, + "range": [ + 87, + 93 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -276,13 +240,13 @@ module.exports = { 93 ], "loc": { - "end": { - "line": 3, - "column": 39 - }, "start": { "line": 3, "column": 33 + }, + "end": { + "line": 3, + "column": 39 } } } @@ -295,409 +259,445 @@ module.exports = { 103 ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 42 + }, + "end": { + "line": 3, + "column": 49 } }, - "raw": "'Smith'", - "value": "Smith" - }, + "value": "Smith", + "raw": "'Smith'" + } + }, + "decorators": [] + } + ], + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 105, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 51 + }, + "end": { + "line": 3, + "column": 53 } + }, + "body": [] + }, + "range": [ + 25, + 107 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 3, + "column": 53 } - ] - } + } + }, + "computed": false, + "accessibility": null, + "static": false, + "kind": "constructor" } - ] - }, - "decorators": [], - "id": { - "type": "Identifier", + ], "range": [ - 6, - 9 + 10, + 109 ], "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, - "column": 6 + "column": 10 + }, + "end": { + "line": 4, + "column": 1 } - }, - "name": "Foo" + } }, + "superClass": null, "implements": [], - "superClass": null + "decorators": [] } ], "sourceType": "script", "tokens": [ { "type": "Keyword", + "value": "class", "range": [ 0, 5 ], "loc": { - "end": { - "line": 1, - "column": 5 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, - "value": "class" + } }, { "type": "Identifier", + "value": "Foo", "range": [ 6, 9 ], "loc": { - "end": { - "line": 1, - "column": 9 - }, "start": { "line": 1, "column": 6 + }, + "end": { + "line": 1, + "column": 9 } - }, - "value": "Foo" + } }, { "type": "Punctuator", + "value": "{", "range": [ 10, 11 ], "loc": { - "end": { - "line": 1, - "column": 11 - }, "start": { "line": 1, "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, - "value": "{" + } }, { "type": "Identifier", + "value": "constructor", "range": [ 14, 25 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 2, + "column": 13 } - }, - "value": "constructor" + } }, { "type": "Punctuator", + "value": "(", "range": [ 25, 26 ], "loc": { - "end": { - "line": 2, - "column": 14 - }, "start": { "line": 2, "column": 13 + }, + "end": { + "line": 2, + "column": 14 } - }, - "value": "(" + } }, { "type": "Identifier", + "value": "readonly", "range": [ 26, 34 ], "loc": { - "end": { - "line": 2, - "column": 22 - }, "start": { "line": 2, "column": 14 + }, + "end": { + "line": 2, + "column": 22 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "firstName", "range": [ 35, 44 ], "loc": { - "end": { - "line": 2, - "column": 32 - }, "start": { "line": 2, "column": 23 + }, + "end": { + "line": 2, + "column": 32 } - }, - "value": "firstName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 44, 45 ], "loc": { - "end": { - "line": 2, - "column": 33 - }, "start": { "line": 2, "column": 32 + }, + "end": { + "line": 2, + "column": 33 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 46, 52 ], "loc": { - "end": { - "line": 2, - "column": 40 - }, "start": { "line": 2, "column": 34 + }, + "end": { + "line": 2, + "column": 40 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 52, 53 ], "loc": { - "end": { - "line": 2, - "column": 41 - }, "start": { "line": 2, "column": 40 + }, + "end": { + "line": 2, + "column": 41 } - }, - "value": "," + } }, { "type": "Identifier", + "value": "readonly", "range": [ 68, 76 ], "loc": { - "end": { - "line": 3, - "column": 22 - }, "start": { "line": 3, "column": 14 + }, + "end": { + "line": 3, + "column": 22 } - }, - "value": "readonly" + } }, { "type": "Identifier", + "value": "lastName", "range": [ 77, 85 ], "loc": { - "end": { - "line": 3, - "column": 31 - }, "start": { "line": 3, "column": 23 + }, + "end": { + "line": 3, + "column": 31 } - }, - "value": "lastName" + } }, { "type": "Punctuator", + "value": ":", "range": [ 85, 86 ], "loc": { - "end": { - "line": 3, - "column": 32 - }, "start": { "line": 3, "column": 31 + }, + "end": { + "line": 3, + "column": 32 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 87, 93 ], "loc": { - "end": { - "line": 3, - "column": 39 - }, "start": { "line": 3, "column": 33 + }, + "end": { + "line": 3, + "column": 39 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": "=", "range": [ 94, 95 ], "loc": { - "end": { - "line": 3, - "column": 41 - }, "start": { "line": 3, "column": 40 + }, + "end": { + "line": 3, + "column": 41 } - }, - "value": "=" + } }, { "type": "String", + "value": "'Smith'", "range": [ 96, 103 ], "loc": { - "end": { - "line": 3, - "column": 49 - }, "start": { "line": 3, "column": 42 + }, + "end": { + "line": 3, + "column": 49 } - }, - "value": "'Smith'" + } }, { "type": "Punctuator", + "value": ")", "range": [ 103, 104 ], "loc": { - "end": { - "line": 3, - "column": 50 - }, "start": { "line": 3, "column": 49 + }, + "end": { + "line": 3, + "column": 50 } - }, - "value": ")" + } }, { "type": "Punctuator", + "value": "{", "range": [ 105, 106 ], "loc": { - "end": { - "line": 3, - "column": 52 - }, "start": { "line": 3, "column": 51 + }, + "end": { + "line": 3, + "column": 52 } - }, - "value": "{" + } }, { "type": "Punctuator", + "value": "}", "range": [ 106, 107 ], "loc": { - "end": { - "line": 3, - "column": 53 - }, "start": { "line": 3, "column": 52 + }, + "end": { + "line": 3, + "column": 53 } - }, - "value": "}" + } }, { "type": "Punctuator", + "value": "}", "range": [ 108, 109 ], "loc": { - "end": { - "line": 4, - "column": 1 - }, "start": { "line": 4, "column": 0 + }, + "end": { + "line": 4, + "column": 1 } - }, - "value": "}" + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js new file mode 100644 index 000000000000..0776637a1bf8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js @@ -0,0 +1,319 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "name": "Foo" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "ClassProperty", + "range": [ + 16, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "key": { + "type": "Identifier", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "name": "foo" + }, + "value": { + "type": "Literal", + "range": [ + 38, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 34 + } + }, + "value": "string", + "raw": "'string'" + }, + "computed": false, + "static": false, + "accessibility": "public", + "readonly": true, + "decorators": [], + "typeAnnotation": null + } + ], + "range": [ + 10, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "class", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "Foo", + "range": [ + 6, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Keyword", + "value": "public", + "range": [ + 16, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "readonly", + "range": [ + 23, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 32, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "String", + "value": "'string'", + "range": [ + 38, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.src.ts new file mode 100644 index 000000000000..feb96572fa88 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.src.ts @@ -0,0 +1,3 @@ +class Foo { + public readonly foo = 'string'; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js index 840e5f5a7821..5ebfa84546d7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js @@ -464,4 +464,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js index a86cefb1a9ef..3e17f6d5c471 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js @@ -310,4 +310,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js index ca918b8497b1..1de1663afee2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js @@ -239,4 +239,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js index dac497379c96..d7bee944cff7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js @@ -239,4 +239,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js index d834af49e0d7..a31dfd9a1724 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js @@ -1,393 +1,393 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { + "type": "ClassDeclaration", + "range": [ + 0, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "name": "Foo" + }, "body": { + "type": "ClassBody", "body": [ { - "accessibility": null, - "computed": false, - "decorators": [], - "key": { - "loc": { - "end": { - "column": 7, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } + "type": "MethodDefinition", + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 4 }, - "name": "bar", - "optional": true, + "end": { + "line": 2, + "column": 16 + } + }, + "key": { + "type": "Identifier", "range": [ 24, 27 ], - "type": "Identifier" - }, - "kind": "method", - "loc": { - "end": { - "column": 16, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 + } }, - "start": { - "column": 4, - "line": 2 - } + "name": "bar", + "optional": true }, - "range": [ - 24, - 36 - ], - "static": false, - "type": "MethodDefinition", "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, "async": false, "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": { - "end": { - "column": 16, - "line": 2 - }, - "start": { - "column": 7, - "line": 2 - } - }, - "params": [], "range": [ 28, 36 ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 16 + } + }, "returnType": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 15, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 } }, "range": [ 32, 35 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 15, - "line": 2 - }, - "start": { - "column": 12, - "line": 2 - } - }, + "type": "TSAnyKeyword", "range": [ 32, 35 ], - "type": "TSAnyKeyword" + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 + } + } } }, - "type": "FunctionExpression" - } + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 18, - "line": 1 - } - }, "range": [ 18, 38 ], - "type": "ClassBody" - }, - "decorators": [], - "id": { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 } - }, - "name": "Foo", - "range": [ - 14, - 17 - ], - "type": "Identifier" - }, - "implements": [], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 } }, - "range": [ - 0, - 38 - ], "superClass": null, - "type": "ClassDeclaration" - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 + "implements": [], + "decorators": [] } - }, - "range": [ - 0, - 38 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 7, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Identifier", + "value": "declare", "range": [ 0, 7 ], - "type": "Identifier", - "value": "declare" - }, - { "loc": { - "end": { - "column": 13, - "line": 1 - }, "start": { - "column": 8, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 } - }, + } + }, + { + "type": "Keyword", + "value": "class", "range": [ 8, 13 ], - "type": "Keyword", - "value": "class" - }, - { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 13 } - }, + } + }, + { + "type": "Identifier", + "value": "Foo", "range": [ 14, 17 ], - "type": "Identifier", - "value": "Foo" - }, - { "loc": { - "end": { - "column": 19, - "line": 1 - }, "start": { - "column": 18, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 18, 19 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 7, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 } - }, + } + }, + { + "type": "Identifier", + "value": "bar", "range": [ 24, 27 ], - "type": "Identifier", - "value": "bar" - }, - { "loc": { - "end": { - "column": 8, - "line": 2 - }, "start": { - "column": 7, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 27, 28 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 9, - "line": 2 - }, "start": { - "column": 8, - "line": 2 + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 28, 29 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 10, - "line": 2 - }, "start": { - "column": 9, - "line": 2 + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 29, 30 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 11, - "line": 2 - }, "start": { - "column": 10, - "line": 2 + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 30, 31 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 15, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 } - }, + } + }, + { + "type": "Identifier", + "value": "any", "range": [ 32, 35 ], - "type": "Identifier", - "value": "any" - }, - { "loc": { - "end": { - "column": 16, - "line": 2 - }, "start": { - "column": 15, - "line": 2 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 35, 36 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 37, 38 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js index 6b048df8ee6b..d0c567253c04 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js @@ -33,45 +33,45 @@ module.exports = { "column": 1 } }, - "id": null, "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 20, + 23 + ], "loc": { - "end": { - "column": 23, - "line": 1 - }, "start": { - "column": 20, - "line": 1 + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 23 } }, "params": [ { + "type": "TypeParameter", + "range": [ + 21, + 22 + ], "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 } }, "name": "T", - "range": [ - 21, - 22 - ], - "type": "TypeParameter", "constraint": null } - ], - "range": [ - 20, - 23 - ], - "type": "TypeParameterDeclaration" + ] }, + "id": null, "body": { "type": "ClassBody", "body": [], @@ -257,4 +257,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js index e89d71549c99..837c99f7a05b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js @@ -33,64 +33,64 @@ module.exports = { "column": 1 } }, - "id": null, "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 20, + 26 + ], "loc": { - "end": { - "column": 26, - "line": 1 - }, "start": { - "column": 20, - "line": 1 + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 } }, "params": [ { + "type": "TypeParameter", + "range": [ + 21, + 22 + ], "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 } }, "name": "T", - "range": [ - 21, - 22 - ], - "type": "TypeParameter", "constraint": null }, { + "type": "TypeParameter", + "range": [ + 24, + 25 + ], "loc": { - "end": { - "column": 25, - "line": 1 - }, "start": { - "column": 24, - "line": 1 + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 } }, "name": "U", - "range": [ - 24, - 25 - ], - "type": "TypeParameter", "constraint": null } - ], - "range": [ - 20, - 26 - ], - "type": "TypeParameterDeclaration" + ] }, + "id": null, "body": { "type": "ClassBody", "body": [], @@ -312,4 +312,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js index cfbd48538b33..a8d41197ad74 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js @@ -33,61 +33,61 @@ module.exports = { "column": 1 } }, - "id": { - "type": "Identifier", + "typeParameters": { + "type": "TypeParameterDeclaration", "range": [ - 13, - 16 + 16, + 19 ], "loc": { "start": { "line": 1, - "column": 13 + "column": 16 }, "end": { "line": 1, - "column": 16 - } - }, - "name": "Foo" - }, - "typeParameters": { - "loc": { - "end": { - "column": 19, - "line": 1 - }, - "start": { - "column": 16, - "line": 1 + "column": 19 } }, "params": [ { + "type": "TypeParameter", + "range": [ + 17, + 18 + ], "loc": { - "end": { - "column": 18, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 } }, "name": "T", - "range": [ - 17, - 18 - ], - "type": "TypeParameter", "constraint": null } - ], + ] + }, + "id": { + "type": "Identifier", "range": [ - 16, - 19 + 13, + 16 ], - "type": "TypeParameterDeclaration" + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "name": "Foo" }, "body": { "type": "ClassBody", @@ -276,4 +276,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js index 046761743815..ae3b317cae75 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js @@ -33,80 +33,80 @@ module.exports = { "column": 1 } }, - "id": { - "type": "Identifier", + "typeParameters": { + "type": "TypeParameterDeclaration", "range": [ - 13, - 16 + 16, + 22 ], "loc": { "start": { "line": 1, - "column": 13 + "column": 16 }, "end": { "line": 1, - "column": 16 - } - }, - "name": "Foo" - }, - "typeParameters": { - "loc": { - "end": { - "column": 22, - "line": 1 - }, - "start": { - "column": 16, - "line": 1 + "column": 22 } }, "params": [ { + "type": "TypeParameter", + "range": [ + 17, + 18 + ], "loc": { - "end": { - "column": 18, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 } }, "name": "T", - "range": [ - 17, - 18 - ], - "type": "TypeParameter", "constraint": null }, { + "type": "TypeParameter", + "range": [ + 20, + 21 + ], "loc": { - "end": { - "column": 21, - "line": 1 - }, "start": { - "column": 20, - "line": 1 + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 } }, "name": "U", - "range": [ - 20, - 21 - ], - "type": "TypeParameter", "constraint": null } - ], + ] + }, + "id": { + "type": "Identifier", "range": [ - 16, - 22 + 13, + 16 ], - "type": "TypeParameterDeclaration" + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "name": "Foo" }, "body": { "type": "ClassBody", @@ -331,4 +331,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js index 272c62c2cf0e..cc0f111c26d5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js @@ -5,32 +5,18 @@ module.exports = { 40 ], "loc": { - "end": { - "line": 1, - "column": 40 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 40 } }, "body": [ { "type": "ExportNamedDeclaration", - "range": [ - 0, - 40 - ], - "loc": { - "end": { - "line": 1, - "column": 40 - }, - "start": { - "line": 1, - "column": 0 - } - }, "declaration": { "type": "VariableDeclaration", "range": [ @@ -38,33 +24,19 @@ module.exports = { 40 ], "loc": { - "end": { - "line": 1, - "column": 40 - }, "start": { "line": 1, "column": 7 + }, + "end": { + "line": 1, + "column": 40 } }, "kind": "type", "declarations": [ { "type": "VariableDeclarator", - "range": [ - 12, - 40 - ], - "loc": { - "end": { - "line": 1, - "column": 40 - }, - "start": { - "line": 1, - "column": 12 - } - }, "id": { "type": "Identifier", "range": [ @@ -72,33 +44,33 @@ module.exports = { 21 ], "loc": { - "end": { - "line": 1, - "column": 21 - }, "start": { "line": 1, "column": 12 + }, + "end": { + "line": 1, + "column": 21 } }, "name": "TestAlias" }, "init": { "type": "TSUnionType", + "range": [ + 24, + 39 + ], "loc": { - "end": { - "line": 1, - "column": 39 - }, "start": { "line": 1, "column": 24 + }, + "end": { + "line": 1, + "column": 39 } }, - "range": [ - 24, - 39 - ], "types": [ { "type": "TSStringKeyword", @@ -107,13 +79,13 @@ module.exports = { 30 ], "loc": { - "end": { - "line": 1, - "column": 30 - }, "start": { "line": 1, "column": 24 + }, + "end": { + "line": 1, + "column": 30 } } }, @@ -124,170 +96,198 @@ module.exports = { 39 ], "loc": { - "end": { - "line": 1, - "column": 39 - }, "start": { "line": 1, "column": 33 + }, + "end": { + "line": 1, + "column": 39 } } } ] + }, + "range": [ + 12, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 40 + } } } ] }, - "source": null, - "specifiers": [] + "range": [ + 0, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 40 + } + }, + "specifiers": [], + "source": null } ], "sourceType": "module", "tokens": [ { "type": "Keyword", + "value": "export", "range": [ 0, 6 ], "loc": { - "end": { - "line": 1, - "column": 6 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 6 } - }, - "value": "export" + } }, { "type": "Identifier", + "value": "type", "range": [ 7, 11 ], "loc": { - "end": { - "line": 1, - "column": 11 - }, "start": { "line": 1, "column": 7 + }, + "end": { + "line": 1, + "column": 11 } - }, - "value": "type" + } }, { "type": "Identifier", + "value": "TestAlias", "range": [ 12, 21 ], "loc": { - "end": { - "line": 1, - "column": 21 - }, "start": { "line": 1, "column": 12 + }, + "end": { + "line": 1, + "column": 21 } - }, - "value": "TestAlias" + } }, { "type": "Punctuator", + "value": "=", "range": [ 22, 23 ], "loc": { - "end": { - "line": 1, - "column": 23 - }, "start": { "line": 1, "column": 22 + }, + "end": { + "line": 1, + "column": 23 } - }, - "value": "=" + } }, { "type": "Identifier", + "value": "string", "range": [ 24, 30 ], "loc": { - "end": { - "line": 1, - "column": 30 - }, "start": { "line": 1, "column": 24 + }, + "end": { + "line": 1, + "column": 30 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": "|", "range": [ 31, 32 ], "loc": { - "end": { - "line": 1, - "column": 32 - }, "start": { "line": 1, "column": 31 + }, + "end": { + "line": 1, + "column": 32 } - }, - "value": "|" + } }, { "type": "Identifier", + "value": "number", "range": [ 33, 39 ], "loc": { - "end": { - "line": 1, - "column": 39 - }, "start": { "line": 1, "column": 33 + }, + "end": { + "line": 1, + "column": 39 } - }, - "value": "number" + } }, { "type": "Punctuator", + "value": ";", "range": [ 39, 40 ], "loc": { - "end": { - "line": 1, - "column": 40 - }, "start": { "line": 1, "column": 39 + }, + "end": { + "line": 1, + "column": 40 } - }, - "value": ";" + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js index 94b16ab700b6..1aea65ba4e10 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js @@ -5,32 +5,18 @@ module.exports = { 51 ], "loc": { - "end": { - "line": 3, - "column": 2 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 3, + "column": 2 } }, "body": [ { "type": "ExportNamedDeclaration", - "range": [ - 0, - 51 - ], - "loc": { - "end": { - "line": 3, - "column": 2 - }, - "start": { - "line": 1, - "column": 0 - } - }, "declaration": { "type": "VariableDeclaration", "range": [ @@ -38,33 +24,19 @@ module.exports = { 51 ], "loc": { - "end": { - "line": 3, - "column": 2 - }, "start": { "line": 1, "column": 7 + }, + "end": { + "line": 3, + "column": 2 } }, "kind": "type", "declarations": [ { "type": "VariableDeclarator", - "range": [ - 12, - 51 - ], - "loc": { - "end": { - "line": 3, - "column": 2 - }, - "start": { - "line": 1, - "column": 12 - } - }, "id": { "type": "Identifier", "range": [ @@ -72,13 +44,13 @@ module.exports = { 26 ], "loc": { - "end": { - "line": 1, - "column": 26 - }, "start": { "line": 1, "column": 12 + }, + "end": { + "line": 1, + "column": 26 } }, "name": "TestClassProps" @@ -90,13 +62,13 @@ module.exports = { 50 ], "loc": { - "end": { - "line": 3, - "column": 1 - }, "start": { "line": 1, "column": 29 + }, + "end": { + "line": 3, + "column": 1 } }, "members": [ @@ -177,195 +149,223 @@ module.exports = { "export": false } ] + }, + "range": [ + 12, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 2 + } } } ] }, - "source": null, - "specifiers": [] + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 2 + } + }, + "specifiers": [], + "source": null } ], "sourceType": "module", "tokens": [ { "type": "Keyword", + "value": "export", "range": [ 0, 6 ], "loc": { - "end": { - "line": 1, - "column": 6 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 6 } - }, - "value": "export" + } }, { "type": "Identifier", + "value": "type", "range": [ 7, 11 ], "loc": { - "end": { - "line": 1, - "column": 11 - }, "start": { "line": 1, "column": 7 + }, + "end": { + "line": 1, + "column": 11 } - }, - "value": "type" + } }, { "type": "Identifier", + "value": "TestClassProps", "range": [ 12, 26 ], "loc": { - "end": { - "line": 1, - "column": 26 - }, "start": { "line": 1, "column": 12 + }, + "end": { + "line": 1, + "column": 26 } - }, - "value": "TestClassProps" + } }, { "type": "Punctuator", + "value": "=", "range": [ 27, 28 ], "loc": { - "end": { - "line": 1, - "column": 28 - }, "start": { "line": 1, "column": 27 + }, + "end": { + "line": 1, + "column": 28 } - }, - "value": "=" + } }, { "type": "Punctuator", + "value": "{", "range": [ 29, 30 ], "loc": { - "end": { - "line": 1, - "column": 30 - }, "start": { "line": 1, "column": 29 + }, + "end": { + "line": 1, + "column": 30 } - }, - "value": "{" + } }, { "type": "Identifier", + "value": "count", "range": [ 35, 40 ], "loc": { - "end": { - "line": 2, - "column": 9 - }, "start": { "line": 2, "column": 4 + }, + "end": { + "line": 2, + "column": 9 } - }, - "value": "count" + } }, { "type": "Punctuator", + "value": ":", "range": [ 40, 41 ], "loc": { - "end": { - "line": 2, - "column": 10 - }, "start": { "line": 2, "column": 9 + }, + "end": { + "line": 2, + "column": 10 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "number", "range": [ 42, 48 ], "loc": { - "end": { - "line": 2, - "column": 17 - }, "start": { "line": 2, "column": 11 + }, + "end": { + "line": 2, + "column": 17 } - }, - "value": "number" + } }, { "type": "Punctuator", + "value": "}", "range": [ 49, 50 ], "loc": { - "end": { - "line": 3, - "column": 1 - }, "start": { "line": 3, "column": 0 + }, + "end": { + "line": 3, + "column": 1 } - }, - "value": "}" + } }, { "type": "Punctuator", + "value": ";", "range": [ 50, 51 ], "loc": { - "end": { - "line": 3, - "column": 2 - }, "start": { "line": 3, "column": 1 + }, + "end": { + "line": 3, + "column": 2 } - }, - "value": ";" + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js index 92f182993a0e..cbae7e5b8ad1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js @@ -5,32 +5,18 @@ module.exports = { 47 ], "loc": { - "end": { - "line": 1, - "column": 47 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 47 } }, "body": [ { "type": "ExportNamedDeclaration", - "range": [ - 0, - 47 - ], - "loc": { - "end": { - "line": 1, - "column": 47 - }, - "start": { - "line": 1, - "column": 0 - } - }, "declaration": { "type": "VariableDeclaration", "range": [ @@ -38,33 +24,19 @@ module.exports = { 47 ], "loc": { - "end": { - "line": 1, - "column": 47 - }, "start": { "line": 1, "column": 7 + }, + "end": { + "line": 1, + "column": 47 } }, "kind": "type", "declarations": [ { "type": "VariableDeclarator", - "range": [ - 12, - 47 - ], - "loc": { - "end": { - "line": 1, - "column": 47 - }, - "start": { - "line": 1, - "column": 12 - } - }, "id": { "type": "Identifier", "range": [ @@ -72,13 +44,13 @@ module.exports = { 24 ], "loc": { - "end": { - "line": 1, - "column": 24 - }, "start": { "line": 1, "column": 12 + }, + "end": { + "line": 1, + "column": 24 } }, "name": "TestCallback" @@ -90,13 +62,13 @@ module.exports = { 46 ], "loc": { - "end": { - "line": 1, - "column": 46 - }, "start": { "line": 1, "column": 27 + }, + "end": { + "line": 1, + "column": 46 } }, "typeParameters": null, @@ -108,32 +80,32 @@ module.exports = { 29 ], "loc": { - "end": { - "line": 1, - "column": 29 - }, "start": { "line": 1, "column": 28 + }, + "end": { + "line": 1, + "column": 29 } }, "name": "a", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 31, - 37 - ], "loc": { - "end": { - "line": 1, - "column": 37 - }, "start": { "line": 1, "column": 31 + }, + "end": { + "line": 1, + "column": 37 } }, + "range": [ + 31, + 37 + ], "typeAnnotation": { "type": "TSNumberKeyword", "range": [ @@ -141,13 +113,13 @@ module.exports = { 37 ], "loc": { - "end": { - "line": 1, - "column": 37 - }, "start": { "line": 1, "column": 31 + }, + "end": { + "line": 1, + "column": 37 } } } @@ -156,20 +128,20 @@ module.exports = { ], "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 42, - 46 - ], "loc": { - "end": { - "line": 1, - "column": 46 - }, "start": { "line": 1, "column": 42 + }, + "end": { + "line": 1, + "column": 46 } }, + "range": [ + 42, + 46 + ], "typeAnnotation": { "type": "TSVoidKeyword", "range": [ @@ -177,242 +149,270 @@ module.exports = { 46 ], "loc": { - "end": { - "line": 1, - "column": 46 - }, "start": { "line": 1, "column": 42 + }, + "end": { + "line": 1, + "column": 46 } } } } + }, + "range": [ + 12, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 47 + } } } ] }, - "source": null, - "specifiers": [] + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 47 + } + }, + "specifiers": [], + "source": null } ], "sourceType": "module", "tokens": [ { "type": "Keyword", + "value": "export", "range": [ 0, 6 ], "loc": { - "end": { - "line": 1, - "column": 6 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 6 } - }, - "value": "export" + } }, { "type": "Identifier", + "value": "type", "range": [ 7, 11 ], "loc": { - "end": { - "line": 1, - "column": 11 - }, "start": { "line": 1, "column": 7 + }, + "end": { + "line": 1, + "column": 11 } - }, - "value": "type" + } }, { "type": "Identifier", + "value": "TestCallback", "range": [ 12, 24 ], "loc": { - "end": { - "line": 1, - "column": 24 - }, "start": { "line": 1, "column": 12 + }, + "end": { + "line": 1, + "column": 24 } - }, - "value": "TestCallback" + } }, { "type": "Punctuator", + "value": "=", "range": [ 25, 26 ], "loc": { - "end": { - "line": 1, - "column": 26 - }, "start": { "line": 1, "column": 25 + }, + "end": { + "line": 1, + "column": 26 } - }, - "value": "=" + } }, { "type": "Punctuator", + "value": "(", "range": [ 27, 28 ], "loc": { - "end": { - "line": 1, - "column": 28 - }, "start": { "line": 1, "column": 27 + }, + "end": { + "line": 1, + "column": 28 } - }, - "value": "(" + } }, { "type": "Identifier", + "value": "a", "range": [ 28, 29 ], "loc": { - "end": { - "line": 1, - "column": 29 - }, "start": { "line": 1, "column": 28 + }, + "end": { + "line": 1, + "column": 29 } - }, - "value": "a" + } }, { "type": "Punctuator", + "value": ":", "range": [ 29, 30 ], "loc": { - "end": { - "line": 1, - "column": 30 - }, "start": { "line": 1, "column": 29 + }, + "end": { + "line": 1, + "column": 30 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "number", "range": [ 31, 37 ], "loc": { - "end": { - "line": 1, - "column": 37 - }, "start": { "line": 1, "column": 31 + }, + "end": { + "line": 1, + "column": 37 } - }, - "value": "number" + } }, { "type": "Punctuator", + "value": ")", "range": [ 37, 38 ], "loc": { - "end": { - "line": 1, - "column": 38 - }, "start": { "line": 1, "column": 37 + }, + "end": { + "line": 1, + "column": 38 } - }, - "value": ")" + } }, { "type": "Punctuator", + "value": "=>", "range": [ 39, 41 ], "loc": { - "end": { - "line": 1, - "column": 41 - }, "start": { "line": 1, "column": 39 + }, + "end": { + "line": 1, + "column": 41 } - }, - "value": "=>" + } }, { "type": "Keyword", + "value": "void", "range": [ 42, 46 ], "loc": { - "end": { - "line": 1, - "column": 46 - }, "start": { "line": 1, "column": 42 + }, + "end": { + "line": 1, + "column": 46 } - }, - "value": "void" + } }, { "type": "Punctuator", + "value": ";", "range": [ 46, 47 ], "loc": { - "end": { - "line": 1, - "column": 47 - }, "start": { "line": 1, "column": 46 + }, + "end": { + "line": 1, + "column": 47 } - }, - "value": ";" + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js index f9e54eaffee9..a4f575c241bf 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js @@ -1,349 +1,349 @@ module.exports = { "type": "Program", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { "type": "FunctionDeclaration", - "expression": false, - "generator": false, - "async": true, + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "id": { "type": "Identifier", - "name": "hope", + "range": [ + 15, + 19 + ], "loc": { - "end": { - "column": 19, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 } }, - "range": [ - 15, - 19 - ] + "name": "hope" }, + "generator": false, + "expression": false, + "async": true, "params": [ { - "loc": { - "end": { - "column": 26, - "line": 1 - }, - "start": { - "column": 20, - "line": 1 - } - }, - "name": "future", + "type": "Identifier", "range": [ 20, 26 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "future" } ], "body": { "type": "BlockStatement", + "range": [ + 28, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { "type": "ExpressionStatement", + "range": [ + 34, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 17 + } + }, "expression": { "type": "AwaitExpression", + "range": [ + 34, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 16 + } + }, "argument": { "type": "Identifier", - "loc": { - "end": { - "column": 16, - "line": 2 - }, - "start": { - "column": 10, - "line": 2 - } - }, - "name": "future", "range": [ 40, 46 - ] - }, - "loc": { - "end": { - "column": 16, - "line": 2 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } }, - "start": { - "column": 4, - "line": 2 - } - }, - "range": [ - 34, - 46 - ] - }, - "loc": { - "end": { - "column": 17, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 + "name": "future" } - }, - "range": [ - 34, - 47 - ] - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 28, - "line": 1 + } } - }, - "range": [ - 28, - 49 ] - }, - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 49 - ] - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 + } } - }, - "range": [ - 0, - 49 ], "sourceType": "script", "tokens": [ { "type": "Identifier", "value": "async", - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, "range": [ 0, 5 - ] + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + } }, { "type": "Keyword", "value": "function", - "loc": { - "end": { - "column": 14, - "line": 1 - }, - "start": { - "column": 6, - "line": 1 - } - }, "range": [ 6, 14 - ] + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 14 + } + } }, { "type": "Identifier", "value": "hope", - "loc": { - "end": { - "column": 19, - "line": 1 - }, - "start": { - "column": 15, - "line": 1 - } - }, "range": [ 15, 19 - ] + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 19 + } + } }, { "type": "Punctuator", "value": "(", - "loc": { - "end": { - "column": 20, - "line": 1 - }, - "start": { - "column": 19, - "line": 1 - } - }, "range": [ 19, 20 - ] + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } }, { "type": "Identifier", "value": "future", - "loc": { - "end": { - "column": 26, - "line": 1 - }, - "start": { - "column": 20, - "line": 1 - } - }, "range": [ 20, 26 - ] + ], + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 26 + } + } }, { "type": "Punctuator", "value": ")", - "loc": { - "end": { - "column": 27, - "line": 1 - }, - "start": { - "column": 26, - "line": 1 - } - }, "range": [ 26, 27 - ] + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } }, { "type": "Punctuator", "value": "{", - "loc": { - "end": { - "column": 29, - "line": 1 - }, - "start": { - "column": 28, - "line": 1 - } - }, "range": [ 28, 29 - ] + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } }, { "type": "Identifier", "value": "await", - "loc": { - "end": { - "column": 9, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, "range": [ 34, 39 - ] + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 9 + } + } }, { "type": "Identifier", "value": "future", - "loc": { - "end": { - "column": 16, - "line": 2 - }, - "start": { - "column": 10, - "line": 2 - } - }, "range": [ 40, 46 - ] + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 16 + } + } }, { "type": "Punctuator", "value": ";", - "loc": { - "end": { - "column": 17, - "line": 2 - }, - "start": { - "column": 16, - "line": 2 - } - }, "range": [ 46, 47 - ] + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + } }, { "type": "Punctuator", "value": "}", - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 3 - } - }, "range": [ 48, 49 - ] + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js index de960f1ca9e8..71cb2fa4b2dc 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js @@ -1,213 +1,220 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { - "async": false, - "body": { - "body": [], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 47, - "line": 1 - } + "type": "FunctionDeclaration", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - "range": [ - 47, - 51 - ], - "type": "BlockStatement" + "end": { + "line": 3, + "column": 1 + } }, - "expression": false, - "generator": false, "id": { - "loc": { - "end": { - "column": 12, - "line": 1 - }, - "start": { - "column": 9, - "line": 1 - } - }, - "name": "foo", + "type": "Identifier", "range": [ 9, 12 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 1, - "line": 3 + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 + } }, - "start": { - "column": 0, - "line": 1 - } + "name": "foo" }, + "generator": false, + "expression": false, + "async": false, "params": [ { + "type": "ObjectPattern", + "range": [ + 13, + 23 + ], "loc": { - "end": { - "column": 23, - "line": 1 - }, "start": { - "column": 13, - "line": 1 + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 23 } }, "properties": [ { - "computed": false, - "key": { - "loc": { - "end": { - "column": 17, - "line": 1 - }, - "start": { - "column": 14, - "line": 1 - } + "type": "Property", + "range": [ + 14, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 14 }, - "name": "bar", + "end": { + "line": 1, + "column": 17 + } + }, + "key": { + "type": "Identifier", "range": [ 14, 17 ], - "type": "Identifier" - }, - "kind": "init", - "loc": { - "end": { - "column": 17, - "line": 1 - }, - "start": { - "column": 14, - "line": 1 - } - }, - "method": false, - "range": [ - 14, - 17 - ], - "shorthand": true, - "type": "Property", - "value": { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 } }, - "name": "bar", + "name": "bar" + }, + "value": { + "type": "Identifier", "range": [ 14, 17 ], - "type": "Identifier" - } - }, - { - "computed": false, - "key": { "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 19, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 } }, - "name": "baz", - "range": [ - 19, - 22 - ], - "type": "Identifier" - }, - "kind": "init", - "loc": { - "end": { - "column": 22, - "line": 1 - }, - "start": { - "column": 19, - "line": 1 - } + "name": "bar" }, + "computed": false, "method": false, + "shorthand": true, + "kind": "init" + }, + { + "type": "Property", "range": [ 19, 22 ], - "shorthand": true, - "type": "Property", - "value": { + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "key": { + "type": "Identifier", + "range": [ + 19, + 22 + ], "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 19, - "line": 1 + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 } }, - "name": "baz", + "name": "baz" + }, + "value": { + "type": "Identifier", "range": [ 19, 22 ], - "type": "Identifier" - } + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "name": "baz" + }, + "computed": false, + "method": false, + "shorthand": true, + "kind": "init" } ], - "range": [ - 13, - 23 - ], - "type": "ObjectPattern", "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 45, - "line": 1 - }, "start": { - "column": 25, - "line": 1 + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 45 } }, "range": [ 25, 45 ], - "type": "TypeAnnotation", "typeAnnotation": { + "type": "TSTypeLiteral", + "range": [ + 25, + 45 + ], "loc": { - "end": { - "column": 45, - "line": 1 - }, "start": { - "column": 25, - "line": 1 + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 45 } }, "members": [ @@ -330,417 +337,410 @@ module.exports = { "static": false, "export": false } - ], - "range": [ - 25, - 45 - ], - "type": "TSTypeLiteral" + ] } } } ], - "range": [ - 0, - 51 - ], - "type": "FunctionDeclaration" - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 + "body": { + "type": "BlockStatement", + "range": [ + 47, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [] + } } - }, - "range": [ - 0, - 51 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 8, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "function", "range": [ 0, 8 ], - "type": "Keyword", - "value": "function" - }, - { "loc": { - "end": { - "column": 12, - "line": 1 - }, "start": { - "column": 9, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 } - }, + } + }, + { + "type": "Identifier", + "value": "foo", "range": [ 9, 12 ], - "type": "Identifier", - "value": "foo" - }, - { "loc": { - "end": { - "column": 13, - "line": 1 - }, "start": { - "column": 12, - "line": 1 + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 12, 13 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 13, - "line": 1 + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 13, 14 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 } - }, + } + }, + { + "type": "Identifier", + "value": "bar", "range": [ 14, 17 ], - "type": "Identifier", - "value": "bar" - }, - { "loc": { - "end": { - "column": 18, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 17 } - }, + } + }, + { + "type": "Punctuator", + "value": ",", "range": [ 17, 18 ], - "type": "Punctuator", - "value": "," - }, - { "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 19, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 } - }, + } + }, + { + "type": "Identifier", + "value": "baz", "range": [ 19, 22 ], - "type": "Identifier", - "value": "baz" - }, - { "loc": { - "end": { - "column": 23, - "line": 1 - }, "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 22 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 22, 23 ], - "type": "Punctuator", - "value": "}" - }, - { "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 23, - "line": 1 + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 23, 24 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 26, - "line": 1 - }, "start": { - "column": 25, - "line": 1 + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 25, 26 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 29, - "line": 1 - }, "start": { - "column": 26, - "line": 1 + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 } - }, + } + }, + { + "type": "Identifier", + "value": "bar", "range": [ 26, 29 ], - "type": "Identifier", - "value": "bar" - }, - { "loc": { - "end": { - "column": 30, - "line": 1 - }, "start": { - "column": 29, - "line": 1 + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 29 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 29, 30 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 31, - "line": 1 - }, "start": { - "column": 30, - "line": 1 + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 30, 31 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 38, - "line": 1 - }, "start": { - "column": 32, - "line": 1 + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 32, 38 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 39, - "line": 1 - }, "start": { - "column": 38, - "line": 1 + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 } - }, + } + }, + { + "type": "Punctuator", + "value": ",", "range": [ 38, 39 ], - "type": "Punctuator", - "value": "," - }, - { "loc": { - "end": { - "column": 43, - "line": 1 - }, "start": { - "column": 40, - "line": 1 + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 } - }, + } + }, + { + "type": "Identifier", + "value": "baz", "range": [ 40, 43 ], - "type": "Identifier", - "value": "baz" - }, - { "loc": { - "end": { - "column": 44, - "line": 1 - }, "start": { - "column": 43, - "line": 1 + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 43 } - }, + } + }, + { + "type": "Punctuator", + "value": "?", "range": [ 43, 44 ], - "type": "Punctuator", - "value": "?" - }, - { "loc": { - "end": { - "column": 45, - "line": 1 - }, "start": { - "column": 44, - "line": 1 + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 44, 45 ], - "type": "Punctuator", - "value": "}" - }, - { "loc": { - "end": { - "column": 46, - "line": 1 - }, "start": { - "column": 45, - "line": 1 + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 45 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 45, 46 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 48, - "line": 1 - }, "start": { - "column": 47, - "line": 1 + "line": 1, + "column": 45 + }, + "end": { + "line": 1, + "column": 46 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 47, 48 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 50, 51 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js index a9644360c9a9..07e565ffe5c1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js @@ -707,4 +707,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js index bf999101281a..6b925ea897a2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js @@ -1,229 +1,279 @@ module.exports = { - body: [{ - async: false, - body: { - body: [], - loc: { - end: { - column: 35, - line: 1 - }, - start: { - column: 33, - line: 1 - } - }, - range: [33, 35], - type: "BlockStatement" + "type": "Program", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - expression: false, - generator: false, - id: { - loc: { - end: { - column: 16, - line: 1 + "end": { + "line": 1, + "column": 35 + } + }, + "body": [ + { + "type": "FunctionDeclaration", + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - start: { - column: 9, - line: 1 + "end": { + "line": 1, + "column": 35 } }, - name: "compare", - range: [9, 16], - type: "Identifier" - }, - loc: { - end: { - column: 35, - line: 1 + "id": { + "type": "Identifier", + "range": [ + 9, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "name": "compare" }, - start: { - column: 0, - line: 1 - } - }, - params: [], - range: [0, 35], - type: "FunctionDeclaration", - typeParameters: { - loc: { - end: { - column: 30, - line: 1 + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 33, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 35 + } }, - start: { - column: 16, - line: 1 - } + "body": [] }, - params: [{ - constraint: null, - loc: { - end: { - column: 29, - line: 1 + "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 16, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 16 }, - start: { - column: 28, - line: 1 + "end": { + "line": 1, + "column": 30 } }, - name: "T", - range: [28, 29], - type: "TypeParameter" - }], - range: [16, 30], - type: "TypeParameterDeclaration" - } - }], - loc: { - end: { - column: 35, - line: 1 - }, - start: { - column: 0, - line: 1 + "params": [ + { + "type": "TypeParameter", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "name": "T", + "constraint": null + } + ] + } } - }, - range: [0, 35], - sourceType: "script", - tokens: [{ - loc: { - end: { - column: 8, - line: 1 + ], + "sourceType": "script", + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - start: { - column: 0, - line: 1 + "end": { + "line": 1, + "column": 8 } - }, - range: [0, 8], - type: "Keyword", - value: "function" + } }, { - loc: { - end: { - column: 16, - line: 1 + "type": "Identifier", + "value": "compare", + "range": [ + 9, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 9 }, - start: { - column: 9, - line: 1 + "end": { + "line": 1, + "column": 16 } - }, - range: [9, 16], - type: "Identifier", - value: "compare" + } }, { - loc: { - end: { - column: 17, - line: 1 + "type": "Punctuator", + "value": "<", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 }, - start: { - column: 16, - line: 1 + "end": { + "line": 1, + "column": 17 } - }, - range: [16, 17], - type: "Punctuator", - value: "<" + } }, { - loc: { - end: { - column: 29, - line: 1 + "type": "Identifier", + "value": "T", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 }, - start: { - column: 28, - line: 1 + "end": { + "line": 1, + "column": 29 } - }, - range: [28, 29], - type: "Identifier", - value: "T" + } }, { - loc: { - end: { - column: 30, - line: 1 + "type": "Punctuator", + "value": ">", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 }, - start: { - column: 29, - line: 1 + "end": { + "line": 1, + "column": 30 } - }, - range: [29, 30], - type: "Punctuator", - value: ">" + } }, { - loc: { - end: { - column: 31, - line: 1 + "type": "Punctuator", + "value": "(", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 }, - start: { - column: 30, - line: 1 + "end": { + "line": 1, + "column": 31 } - }, - range: [30, 31], - type: "Punctuator", - value: "(" + } }, { - loc: { - end: { - column: 32, - line: 1 + "type": "Punctuator", + "value": ")", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 31 }, - start: { - column: 31, - line: 1 + "end": { + "line": 1, + "column": 32 } - }, - range: [31, 32], - type: "Punctuator", - value: ")" + } }, { - loc: { - end: { - column: 34, - line: 1 + "type": "Punctuator", + "value": "{", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 }, - start: { - column: 33, - line: 1 + "end": { + "line": 1, + "column": 34 } - }, - range: [33, 34], - type: "Punctuator", - value: "{" + } }, { - loc: { - end: { - column: 35, - line: 1 + "type": "Punctuator", + "value": "}", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 }, - start: { - column: 34, - line: 1 + "end": { + "line": 1, + "column": 35 } - }, - range: [34, 35], - type: "Punctuator", - value: "}" + } } - ], - type: "Program" + ] }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js index e212335b28b3..1e7df8cc0750 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js @@ -1,670 +1,670 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { - "async": false, - "body": { - "body": [ - { - "argument": { - "loc": { - "end": { - "column": 12, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 - } - }, - "name": "b", - "range": [ - 47, - 48 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 13, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "range": [ - 40, - 49 - ], - "type": "ReturnStatement" - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 34, - "line": 1 - } + "type": "FunctionDeclaration", + "range": [ + 0, + 51 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - "range": [ - 34, - 51 - ], - "type": "BlockStatement" + "end": { + "line": 3, + "column": 1 + } }, - "expression": false, - "generator": false, "id": { - "loc": { - "end": { - "column": 10, - "line": 1 - }, - "start": { - "column": 9, - "line": 1 - } - }, - "name": "a", + "type": "Identifier", "range": [ 9, 10 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 1, - "line": 3 + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } }, - "start": { - "column": 0, - "line": 1 - } + "name": "a" }, + "generator": false, + "expression": false, + "async": false, "params": [ { + "type": "Identifier", + "range": [ + 25, + 26 + ], "loc": { - "end": { - "column": 26, - "line": 1 - }, "start": { - "column": 25, - "line": 1 + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 } }, "name": "b", - "range": [ - 25, - 26 - ], - "type": "Identifier", "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 29, - "line": 1 - }, "start": { - "column": 28, - "line": 1 + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 } }, "range": [ 28, 29 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 29, - "line": 1 - }, - "start": { - "column": 28, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 28, 29 ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 29, - "line": 1 - }, - "start": { - "column": 28, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 28 }, - "name": "X", + "end": { + "line": 1, + "column": 29 + } + }, + "typeName": { + "type": "Identifier", "range": [ 28, 29 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "name": "X" } } } } ], - "range": [ - 0, - 51 - ], - "returnType": { + "body": { + "type": "BlockStatement", + "range": [ + 34, + 51 + ], "loc": { - "end": { - "column": 33, - "line": 1 + "start": { + "line": 1, + "column": 34 }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 40, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "argument": { + "type": "Identifier", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "name": "b" + } + } + ] + }, + "returnType": { + "type": "TypeAnnotation", + "loc": { "start": { - "column": 32, - "line": 1 + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 } }, "range": [ 32, 33 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 33, - "line": 1 - }, - "start": { - "column": 32, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 32, 33 ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 33, - "line": 1 - }, - "start": { - "column": 32, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 32 }, - "name": "X", + "end": { + "line": 1, + "column": 33 + } + }, + "typeName": { + "type": "Identifier", "range": [ 32, 33 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 + } + }, + "name": "X" } } }, - "type": "FunctionDeclaration", "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 10, + 24 + ], "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 24 } }, "params": [ { + "type": "TypeParameter", + "range": [ + 11, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "name": "X", "constraint": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 23, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 } }, "range": [ 21, 23 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 23, - "line": 1 - }, - "start": { - "column": 21, - "line": 1 - } - }, - "members": [], + "type": "TSTypeLiteral", "range": [ 21, 23 ], - "type": "TSTypeLiteral" - } - }, - "loc": { - "end": { - "column": 23, - "line": 1 - }, - "start": { - "column": 11, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "members": [] } - }, - "name": "X", - "range": [ - 11, - 23 - ], - "type": "TypeParameter" + } } - ], - "range": [ - 10, - 24 - ], - "type": "TypeParameterDeclaration" + ] } } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 51 - ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 8, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "function", "range": [ 0, 8 ], - "type": "Keyword", - "value": "function" - }, - { "loc": { - "end": { - "column": 10, - "line": 1 - }, "start": { - "column": 9, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 } - }, + } + }, + { + "type": "Identifier", + "value": "a", "range": [ 9, 10 ], - "type": "Identifier", - "value": "a" - }, - { "loc": { - "end": { - "column": 11, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 10, 11 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 12, - "line": 1 - }, "start": { - "column": 11, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 11, 12 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 20, - "line": 1 - }, "start": { - "column": 13, - "line": 1 + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 } - }, + } + }, + { + "type": "Keyword", + "value": "extends", "range": [ 13, 20 ], - "type": "Keyword", - "value": "extends" - }, - { "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 21, 22 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 23, - "line": 1 - }, "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 22, 23 ], - "type": "Punctuator", - "value": "}" - }, - { "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 23, - "line": 1 + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 23, 24 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 25, - "line": 1 - }, "start": { - "column": 24, - "line": 1 + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 24, 25 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 26, - "line": 1 - }, "start": { - "column": 25, - "line": 1 + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 } - }, + } + }, + { + "type": "Identifier", + "value": "b", "range": [ 25, 26 ], - "type": "Identifier", - "value": "b" - }, - { "loc": { - "end": { - "column": 27, - "line": 1 - }, "start": { - "column": 26, - "line": 1 + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 26, 27 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 29, - "line": 1 - }, "start": { - "column": 28, - "line": 1 + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 28, 29 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 30, - "line": 1 - }, "start": { - "column": 29, - "line": 1 + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 29, 30 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 31, - "line": 1 - }, "start": { - "column": 30, - "line": 1 + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 30, 31 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 33, - "line": 1 - }, "start": { - "column": 32, - "line": 1 + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 } - }, + } + }, + { + "type": "Identifier", + "value": "X", "range": [ 32, 33 ], - "type": "Identifier", - "value": "X" - }, - { "loc": { - "end": { - "column": 35, - "line": 1 - }, "start": { - "column": 34, - "line": 1 + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 33 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 34, 35 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 10, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 } - }, + } + }, + { + "type": "Keyword", + "value": "return", "range": [ 40, 46 ], - "type": "Keyword", - "value": "return" - }, - { "loc": { - "end": { - "column": 12, - "line": 2 - }, "start": { - "column": 11, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 } - }, + } + }, + { + "type": "Identifier", + "value": "b", "range": [ 47, 48 ], - "type": "Identifier", - "value": "b" - }, - { "loc": { - "end": { - "column": 13, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 48, 49 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 50, 51 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js index 6263e613bafe..1eb54056a311 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js @@ -579,4 +579,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js index 0a1f4f5d1768..f6383aff9e62 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js @@ -5,74 +5,32 @@ module.exports = { 96 ], "loc": { - "end": { - "line": 3, - "column": 1 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 3, + "column": 1 } }, "body": [ { - "async": false, - "body": { - "body": [ - { - "argument": { - "type": "Identifier", - "range": [ - 89, - 93 - ], - "loc": { - "end": { - "line": 2, - "column": 13 - }, - "start": { - "line": 2, - "column": 9 - } - }, - "name": "name" - }, - "type": "ReturnStatement", - "range": [ - 82, - 94 - ], - "loc": { - "end": { - "line": 2, - "column": 14 - }, - "start": { - "line": 2, - "column": 2 - } - } - } - ], - "type": "BlockStatement", - "range": [ - 78, - 96 - ], - "loc": { - "end": { - "line": 3, - "column": 1 - }, - "start": { - "line": 1, - "column": 78 - } + "type": "FunctionDeclaration", + "range": [ + 0, + 96 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 } }, - "expression": false, - "generator": false, "id": { "type": "Identifier", "range": [ @@ -80,66 +38,54 @@ module.exports = { 16 ], "loc": { - "end": { - "line": 1, - "column": 16 - }, "start": { "line": 1, "column": 9 + }, + "end": { + "line": 1, + "column": 16 } }, "name": "message" }, - "type": "FunctionDeclaration", - "range": [ - 0, - 96 - ], - "loc": { - "end": { - "line": 3, - "column": 1 - }, - "start": { - "line": 1, - "column": 0 - } - }, + "generator": false, + "expression": false, + "async": false, "params": [ { + "type": "Identifier", + "range": [ + 17, + 21 + ], "loc": { - "end": { - "line": 1, - "column": 21 - }, "start": { "line": 1, "column": 17 + }, + "end": { + "line": 1, + "column": 21 } }, "name": "name", - "range": [ - 17, - 21 - ], - "type": "Identifier", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 22, - 28 - ], "loc": { - "end": { - "line": 1, - "column": 28 - }, "start": { "line": 1, "column": 22 + }, + "end": { + "line": 1, + "column": 28 } }, + "range": [ + 22, + 28 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -147,13 +93,13 @@ module.exports = { 28 ], "loc": { - "end": { - "line": 1, - "column": 28 - }, "start": { "line": 1, "column": 22 + }, + "end": { + "line": 1, + "column": 28 } } } @@ -166,13 +112,13 @@ module.exports = { 46 ], "loc": { - "end": { - "line": 1, - "column": 46 - }, "start": { "line": 1, "column": 30 + }, + "end": { + "line": 1, + "column": 46 } }, "left": { @@ -182,32 +128,32 @@ module.exports = { 33 ], "loc": { - "end": { - "line": 1, - "column": 33 - }, "start": { "line": 1, "column": 30 + }, + "end": { + "line": 1, + "column": 33 } }, "name": "age", "typeAnnotation": { "type": "TypeAnnotation", - "range": [ - 34, - 40 - ], "loc": { - "end": { - "line": 1, - "column": 40 - }, "start": { "line": 1, "column": 34 + }, + "end": { + "line": 1, + "column": 40 } }, + "range": [ + 34, + 40 + ], "typeAnnotation": { "type": "TSNumberKeyword", "range": [ @@ -215,13 +161,13 @@ module.exports = { 40 ], "loc": { - "end": { - "line": 1, - "column": 40 - }, "start": { "line": 1, "column": 34 + }, + "end": { + "line": 1, + "column": 40 } } } @@ -234,178 +180,231 @@ module.exports = { 46 ], "loc": { - "end": { - "line": 1, - "column": 46 - }, "start": { "line": 1, "column": 43 + }, + "end": { + "line": 1, + "column": 46 } }, - "raw": "100", - "value": 100 + "value": 100, + "raw": "100" } }, { + "type": "RestElement", + "range": [ + 48, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 69 + } + }, "argument": { + "type": "Identifier", + "range": [ + 51, + 55 + ], "loc": { - "end": { - "line": 1, - "column": 55 - }, "start": { "line": 1, "column": 51 + }, + "end": { + "line": 1, + "column": 55 } }, "name": "args", - "range": [ - 51, - 55 - ], - "type": "Identifier", "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "line": 1, - "column": 69 - }, "start": { "line": 1, "column": 56 + }, + "end": { + "line": 1, + "column": 69 } }, "range": [ 56, 69 ], - "type": "TypeAnnotation", "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 56, + 69 + ], "loc": { - "end": { - "line": 1, - "column": 69 - }, "start": { "line": 1, "column": 56 + }, + "end": { + "line": 1, + "column": 69 } }, - "range": [ - 56, - 69 - ], - "type": "TSTypeReference", "typeName": { + "type": "Identifier", + "range": [ + 56, + 61 + ], "loc": { - "end": { - "line": 1, - "column": 61 - }, "start": { "line": 1, "column": 56 + }, + "end": { + "line": 1, + "column": 61 } }, - "name": "Array", - "range": [ - 56, - 61 - ], - "type": "Identifier" + "name": "Array" }, "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 61, + 69 + ], "loc": { - "end": { - "column": 69, - "line": 1 - }, "start": { - "column": 61, - "line": 1 + "line": 1, + "column": 61 + }, + "end": { + "line": 1, + "column": 69 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 68, - "line": 1 - }, - "start": { - "column": 62, - "line": 1 - } + "type": "GenericTypeAnnotation", + "range": [ + 62, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 62 }, + "end": { + "line": 1, + "column": 68 + } + }, + "id": { + "type": "TSStringKeyword", "range": [ 62, 68 ], - "type": "TSStringKeyword" - }, - - "loc": { - "end": { - "column": 68, - "line": 1 - }, - "start": { - "column": 62, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 62 + }, + "end": { + "line": 1, + "column": 68 + } } }, - "range": [ - 62, - 68 - ], - "type": "GenericTypeAnnotation", "typeParameters": null } - ], - "range": [ - 61, - 69 - ], - "type": "TypeParameterInstantiation" + ] } } } - }, - "loc": { - "end": { - "line": 1, - "column": 69 - }, - "start": { - "line": 1, - "column": 48 - } - }, - "range": [ - 48, - 69 - ], - "type": "RestElement" + } } ], - "returnType": { - "type": "TypeAnnotation", + "body": { + "type": "BlockStatement", "range": [ - 71, - 77 + 78, + 96 ], "loc": { - "end": { + "start": { "line": 1, - "column": 77 + "column": 78 }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ReturnStatement", + "range": [ + 82, + 94 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "argument": { + "type": "Identifier", + "range": [ + 89, + 93 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 13 + } + }, + "name": "name" + } + } + ] + }, + "returnType": { + "type": "TypeAnnotation", + "loc": { "start": { "line": 1, "column": 71 + }, + "end": { + "line": 1, + "column": 77 } }, + "range": [ + 71, + 77 + ], "typeAnnotation": { "type": "TSStringKeyword", "range": [ @@ -413,13 +412,13 @@ module.exports = { 77 ], "loc": { - "end": { - "line": 1, - "column": 77 - }, "start": { "line": 1, "column": 71 + }, + "end": { + "line": 1, + "column": 77 } } } @@ -430,507 +429,507 @@ module.exports = { "tokens": [ { "type": "Keyword", + "value": "function", "range": [ 0, 8 ], "loc": { - "end": { - "line": 1, - "column": 8 - }, "start": { "line": 1, "column": 0 + }, + "end": { + "line": 1, + "column": 8 } - }, - "value": "function" + } }, { "type": "Identifier", + "value": "message", "range": [ 9, 16 ], "loc": { - "end": { - "line": 1, - "column": 16 - }, "start": { "line": 1, "column": 9 + }, + "end": { + "line": 1, + "column": 16 } - }, - "value": "message" + } }, { "type": "Punctuator", + "value": "(", "range": [ 16, 17 ], "loc": { - "end": { - "line": 1, - "column": 17 - }, "start": { "line": 1, "column": 16 + }, + "end": { + "line": 1, + "column": 17 } - }, - "value": "(" + } }, { "type": "Identifier", + "value": "name", "range": [ 17, 21 ], "loc": { - "end": { - "line": 1, - "column": 21 - }, "start": { "line": 1, "column": 17 + }, + "end": { + "line": 1, + "column": 21 } - }, - "value": "name" + } }, { "type": "Punctuator", + "value": ":", "range": [ 21, 22 ], "loc": { - "end": { - "line": 1, - "column": 22 - }, "start": { "line": 1, "column": 21 + }, + "end": { + "line": 1, + "column": 22 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 22, 28 ], "loc": { - "end": { - "line": 1, - "column": 28 - }, "start": { "line": 1, "column": 22 + }, + "end": { + "line": 1, + "column": 28 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ",", "range": [ 28, 29 ], "loc": { - "end": { - "line": 1, - "column": 29 - }, "start": { "line": 1, "column": 28 + }, + "end": { + "line": 1, + "column": 29 } - }, - "value": "," + } }, { "type": "Identifier", + "value": "age", "range": [ 30, 33 ], "loc": { - "end": { - "line": 1, - "column": 33 - }, "start": { "line": 1, "column": 30 + }, + "end": { + "line": 1, + "column": 33 } - }, - "value": "age" + } }, { "type": "Punctuator", + "value": ":", "range": [ 33, 34 ], "loc": { - "end": { - "line": 1, - "column": 34 - }, "start": { "line": 1, "column": 33 + }, + "end": { + "line": 1, + "column": 34 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "number", "range": [ 34, 40 ], "loc": { - "end": { - "line": 1, - "column": 40 - }, "start": { "line": 1, "column": 34 + }, + "end": { + "line": 1, + "column": 40 } - }, - "value": "number" + } }, { "type": "Punctuator", + "value": "=", "range": [ 41, 42 ], "loc": { - "end": { - "line": 1, - "column": 42 - }, "start": { "line": 1, "column": 41 + }, + "end": { + "line": 1, + "column": 42 } - }, - "value": "=" + } }, { "type": "Numeric", + "value": "100", "range": [ 43, 46 ], "loc": { - "end": { - "line": 1, - "column": 46 - }, "start": { "line": 1, "column": 43 + }, + "end": { + "line": 1, + "column": 46 } - }, - "value": "100" + } }, { "type": "Punctuator", + "value": ",", "range": [ 46, 47 ], "loc": { - "end": { - "line": 1, - "column": 47 - }, "start": { "line": 1, "column": 46 + }, + "end": { + "line": 1, + "column": 47 } - }, - "value": "," + } }, { "type": "Punctuator", + "value": "...", "range": [ 48, 51 ], "loc": { - "end": { - "line": 1, - "column": 51 - }, "start": { "line": 1, "column": 48 + }, + "end": { + "line": 1, + "column": 51 } - }, - "value": "..." + } }, { "type": "Identifier", + "value": "args", "range": [ 51, 55 ], "loc": { - "end": { - "line": 1, - "column": 55 - }, "start": { "line": 1, "column": 51 + }, + "end": { + "line": 1, + "column": 55 } - }, - "value": "args" + } }, { "type": "Punctuator", + "value": ":", "range": [ 55, 56 ], "loc": { - "end": { - "line": 1, - "column": 56 - }, "start": { "line": 1, "column": 55 + }, + "end": { + "line": 1, + "column": 56 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "Array", "range": [ 56, 61 ], "loc": { - "end": { - "line": 1, - "column": 61 - }, "start": { "line": 1, "column": 56 + }, + "end": { + "line": 1, + "column": 61 } - }, - "value": "Array" + } }, { "type": "Punctuator", + "value": "<", "range": [ 61, 62 ], "loc": { - "end": { - "line": 1, - "column": 62 - }, "start": { "line": 1, "column": 61 + }, + "end": { + "line": 1, + "column": 62 } - }, - "value": "<" + } }, { "type": "Identifier", + "value": "string", "range": [ 62, 68 ], "loc": { - "end": { - "line": 1, - "column": 68 - }, "start": { "line": 1, "column": 62 + }, + "end": { + "line": 1, + "column": 68 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": ">", "range": [ 68, 69 ], "loc": { - "end": { - "line": 1, - "column": 69 - }, "start": { "line": 1, "column": 68 + }, + "end": { + "line": 1, + "column": 69 } - }, - "value": ">" + } }, { "type": "Punctuator", + "value": ")", "range": [ 69, 70 ], "loc": { - "end": { - "line": 1, - "column": 70 - }, "start": { "line": 1, "column": 69 + }, + "end": { + "line": 1, + "column": 70 } - }, - "value": ")" + } }, { "type": "Punctuator", + "value": ":", "range": [ 70, 71 ], "loc": { - "end": { - "line": 1, - "column": 71 - }, "start": { "line": 1, "column": 70 + }, + "end": { + "line": 1, + "column": 71 } - }, - "value": ":" + } }, { "type": "Identifier", + "value": "string", "range": [ 71, 77 ], "loc": { - "end": { - "line": 1, - "column": 77 - }, "start": { "line": 1, "column": 71 + }, + "end": { + "line": 1, + "column": 77 } - }, - "value": "string" + } }, { "type": "Punctuator", + "value": "{", "range": [ 78, 79 ], "loc": { - "end": { - "line": 1, - "column": 79 - }, "start": { "line": 1, "column": 78 + }, + "end": { + "line": 1, + "column": 79 } - }, - "value": "{" + } }, { "type": "Keyword", + "value": "return", "range": [ 82, 88 ], "loc": { - "end": { - "line": 2, - "column": 8 - }, "start": { "line": 2, "column": 2 + }, + "end": { + "line": 2, + "column": 8 } - }, - "value": "return" + } }, { "type": "Identifier", + "value": "name", "range": [ 89, 93 ], "loc": { - "end": { - "line": 2, - "column": 13 - }, "start": { "line": 2, "column": 9 + }, + "end": { + "line": 2, + "column": 13 } - }, - "value": "name" + } }, { "type": "Punctuator", + "value": ";", "range": [ 93, 94 ], "loc": { - "end": { - "line": 2, - "column": 14 - }, "start": { "line": 2, "column": 13 + }, + "end": { + "line": 2, + "column": 14 } - }, - "value": ";" + } }, { "type": "Punctuator", + "value": "}", "range": [ 95, 96 ], "loc": { - "end": { - "line": 3, - "column": 1 - }, "start": { "line": 3, "column": 0 + }, + "end": { + "line": 3, + "column": 1 } - }, - "value": "}" + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js index bae2be7e256a..72601f01d7ed 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js @@ -17,7 +17,6 @@ module.exports = { "body": [ { "type": "TSInterfaceDeclaration", - "abstract": false, "range": [ 0, 295 @@ -32,6 +31,7 @@ module.exports = { "column": 1 } }, + "abstract": false, "body": { "type": "TSInterfaceBody", "body": [ @@ -479,7 +479,6 @@ module.exports = { } }, "name": "fff", - "optional": true, "typeAnnotation": { "type": "TypeAnnotation", "loc": { @@ -513,7 +512,8 @@ module.exports = { } } } - } + }, + "optional": true }, "typeAnnotation": { "type": "TypeAnnotation", @@ -1018,6 +1018,10 @@ module.exports = { } } }, + "accessibility": null, + "readonly": false, + "static": false, + "export": false, "typeParameters": { "type": "TypeParameterDeclaration", "range": [ @@ -1055,11 +1059,7 @@ module.exports = { "constraint": null } ] - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false + } }, { "type": "TSConstructSignature", @@ -3335,4 +3335,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js index 8e7e7b687faa..4fb6325935f9 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js @@ -69,9 +69,9 @@ module.exports = { } }, "accessibility": "public", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -108,9 +108,9 @@ module.exports = { } }, "accessibility": "private", + "readonly": false, "static": false, "export": false, - "readonly": false, "parameter": { "type": "Identifier", "range": [ @@ -407,4 +407,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js index a45c01b15f1a..140dbae83120 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js @@ -677,4 +677,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js index 27d058c67970..5af78ee6053c 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js @@ -226,7 +226,6 @@ module.exports = { } }, "name": "bar", - "optional": true, "typeAnnotation": { "type": "TypeAnnotation", "loc": { @@ -260,7 +259,8 @@ module.exports = { } } } - } + }, + "optional": true }, { "type": "Identifier", @@ -796,4 +796,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js index 560bbb2637a8..e307ccc38dcd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js @@ -226,4 +226,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js index e8c62c8fd6fb..8d9cd85d32e1 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js @@ -1,526 +1,526 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, "body": [ { + "type": "VariableDeclaration", + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + }, "declarations": [ { + "type": "VariableDeclarator", + "range": [ + 4, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 44 + } + }, "id": { + "type": "Identifier", + "range": [ + 4, + 15 + ], "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 4, - "line": 1 + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 } }, "name": "nestedArray", - "range": [ - 4, - 15 - ], - "type": "Identifier", "typeAnnotation": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 44, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 44 } }, "range": [ 17, 44 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 44, - "line": 1 - }, - "start": { - "column": 17, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 17, 44 ], - "type": "TSTypeReference", - "typeParameters": { + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 44 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 17, + 22 + ], "loc": { - "end": { - "column": 44, - "line": 1 + "start": { + "line": 1, + "column": 17 }, + "end": { + "line": 1, + "column": 22 + } + }, + "name": "Array" + }, + "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 22, + 44 + ], + "loc": { "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 44 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 28, - "line": 1 - }, - "start": { - "column": 23, - "line": 1 - } + "type": "GenericTypeAnnotation", + "range": [ + 23, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 23 }, - "name": "Array", + "end": { + "line": 1, + "column": 43 + } + }, + "id": { + "type": "Identifier", "range": [ 23, 28 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 43, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } }, - "start": { - "column": 23, - "line": 1 - } + "name": "Array" }, - "range": [ - 23, - 43 - ], - "type": "GenericTypeAnnotation", "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 28, + 43 + ], "loc": { - "end": { - "column": 43, - "line": 1 - }, "start": { - "column": 28, - "line": 1 + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 43 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 34, - "line": 1 - }, - "start": { - "column": 29, - "line": 1 - } + "type": "GenericTypeAnnotation", + "range": [ + 29, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 29 }, - "name": "Array", + "end": { + "line": 1, + "column": 42 + } + }, + "id": { + "type": "Identifier", "range": [ 29, 34 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 42, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 + } }, - "start": { - "column": 29, - "line": 1 - } + "name": "Array" }, - "range": [ - 29, - 42 - ], - "type": "GenericTypeAnnotation", "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 34, + 42 + ], "loc": { - "end": { - "column": 42, - "line": 1 - }, "start": { - "column": 34, - "line": 1 + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 42 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 41, - "line": 1 - }, - "start": { - "column": 35, - "line": 1 - } + "type": "GenericTypeAnnotation", + "range": [ + 35, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 35 }, + "end": { + "line": 1, + "column": 41 + } + }, + "id": { + "type": "TSStringKeyword", "range": [ 35, 41 ], - "type": "TSStringKeyword" - }, - "loc": { - "end": { - "column": 41, - "line": 1 - }, - "start": { - "column": 35, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 41 + } } }, - "range": [ - 35, - 41 - ], - "type": "GenericTypeAnnotation", "typeParameters": null } - ], - "range": [ - 34, - 42 - ], - "type": "TypeParameterInstantiation" + ] } } - ], - "range": [ - 28, - 43 - ], - "type": "TypeParameterInstantiation" + ] } } - ], - "range": [ - 22, - 44 - ], - "type": "TypeParameterInstantiation" - }, - "typeName": { - "loc": { - "end": { - "column": 22, - "line": 1 - }, - "start": { - "column": 17, - "line": 1 - } - }, - "name": "Array", - "range": [ - 17, - 22 - ], - "type": "Identifier" + ] } } } }, - "init": null, - "loc": { - "end": { - "column": 44, - "line": 1 - }, - "start": { - "column": 4, - "line": 1 - } - }, - "range": [ - 4, - 44 - ], - "type": "VariableDeclarator" + "init": null } ], - "kind": "var", - "loc": { - "end": { - "column": 44, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 44 - ], - "type": "VariableDeclaration" - } - ], - "loc": { - "end": { - "column": 44, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 + "kind": "var" } - }, - "range": [ - 0, - 44 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 3, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "var", "range": [ 0, 3 ], - "type": "Keyword", - "value": "var" - }, - { "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 4, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 } - }, + } + }, + { + "type": "Identifier", + "value": "nestedArray", "range": [ 4, 15 ], - "type": "Identifier", - "value": "nestedArray" - }, - { "loc": { - "end": { - "column": 16, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": ":", "range": [ 15, 16 ], - "type": "Punctuator", - "value": ":" - }, - { "loc": { - "end": { - "column": 22, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 } - }, + } + }, + { + "type": "Identifier", + "value": "Array", "range": [ 17, 22 ], - "type": "Identifier", - "value": "Array" - }, - { "loc": { - "end": { - "column": 23, - "line": 1 - }, "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 22, 23 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 28, - "line": 1 - }, "start": { - "column": 23, - "line": 1 + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 } - }, + } + }, + { + "type": "Identifier", + "value": "Array", "range": [ 23, 28 ], - "type": "Identifier", - "value": "Array" - }, - { "loc": { - "end": { - "column": 29, - "line": 1 - }, "start": { - "column": 28, - "line": 1 + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 28, 29 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 34, - "line": 1 - }, "start": { - "column": 29, - "line": 1 + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 } - }, + } + }, + { + "type": "Identifier", + "value": "Array", "range": [ 29, 34 ], - "type": "Identifier", - "value": "Array" - }, - { "loc": { - "end": { - "column": 35, - "line": 1 - }, "start": { - "column": 34, - "line": 1 + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 34 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 34, 35 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 41, - "line": 1 - }, "start": { - "column": 35, - "line": 1 + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 } - }, + } + }, + { + "type": "Identifier", + "value": "string", "range": [ 35, 41 ], - "type": "Identifier", - "value": "string" - }, - { "loc": { - "end": { - "column": 42, - "line": 1 - }, "start": { - "column": 41, - "line": 1 + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 41 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 41, 42 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 43, - "line": 1 - }, "start": { - "column": 42, - "line": 1 + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 42, 43 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 44, - "line": 1 - }, "start": { - "column": 43, - "line": 1 + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 43, 44 ], - "type": "Punctuator", - "value": ">" + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js index 3cab39a3d838..1655eddaf037 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js @@ -70,7 +70,6 @@ module.exports = { } }, "name": "e", - "optional": true, "typeAnnotation": { "type": "TypeAnnotation", "loc": { @@ -122,7 +121,8 @@ module.exports = { "name": "Entity" } } - } + }, + "optional": true } ], "body": { @@ -761,4 +761,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js index f2a8f46d22de..062b16c62ed7 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js @@ -1,76 +1,108 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, "body": [ { + "type": "VariableDeclaration", + "range": [ + 0, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "kind": "type", "declarations": [ { + "type": "VariableDeclarator", "id": { - "loc": { - "end": { - "column": 11, - "line": 1 - }, - "start": { - "column": 5, - "line": 1 - } - }, - "name": "Result", + "type": "Identifier", "range": [ 5, 11 ], - "type": "Identifier" - }, - "init": { "loc": { - "end": { - "column": 48, - "line": 1 - }, "start": { - "column": 28, - "line": 1 + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 } }, + "name": "Result" + }, + "init": { + "type": "TSUnionType", "range": [ 28, 48 ], - "type": "TSUnionType", + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 48 + } + }, "types": [ { - "loc": { - "end": { - "column": 38, - "line": 1 - }, - "start": { - "column": 28, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 28, 38 ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 35, - "line": 1 - }, - "start": { - "column": 28, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 28 }, - "name": "Success", + "end": { + "line": 1, + "column": 38 + } + }, + "typeName": { + "type": "Identifier", "range": [ 28, 35 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 35 + } + }, + "name": "Success" }, "typeParameters": { "type": "TypeParameterInstantiation", @@ -79,485 +111,453 @@ module.exports = { 38 ], "loc": { - "end": { - "column": 38, - "line": 1 - }, "start": { - "column": 35, - "line": 1 + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 } }, "params": [ { - "loc": { - "end": { - "column": 37, - "line": 1 - }, - "start": { - "column": 36, - "line": 1 - } - }, + "type": "GenericTypeAnnotation", "range": [ 36, 37 ], - "id": { - "loc": { - "end": { - "column": 37, - "line": 1 - }, - "start": { - "column": 36, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 36 }, - "name": "T", + "end": { + "line": 1, + "column": 37 + } + }, + "id": { + "type": "Identifier", "range": [ 36, 37 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 + } + }, + "name": "T" }, - "type": "GenericTypeAnnotation", "typeParameters": null } ] } }, { - "loc": { - "end": { - "column": 48, - "line": 1 - }, - "start": { - "column": 41, - "line": 1 - } - }, + "type": "TSTypeReference", "range": [ 41, 48 ], - "type": "TSTypeReference", - "typeName": { - "loc": { - "end": { - "column": 48, - "line": 1 - }, - "start": { - "column": 41, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 41 }, - "name": "Failure", + "end": { + "line": 1, + "column": 48 + } + }, + "typeName": { + "type": "Identifier", "range": [ 41, 48 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 48 + } + }, + "name": "Failure" } } ] }, - "loc": { - "end": { - "column": 48, - "line": 1 - }, - "start": { - "column": 5, - "line": 1 - } - }, "range": [ 5, 48 ], - "type": "VariableDeclarator", + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 48 + } + }, "typeParameters": { + "type": "TypeParameterDeclaration", + "range": [ + 11, + 25 + ], "loc": { - "end": { - "column": 25, - "line": 1 - }, "start": { - "column": 11, - "line": 1 + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 25 } }, "params": [ { + "type": "TypeParameter", + "range": [ + 12, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "name": "T", "constraint": { + "type": "TypeAnnotation", "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 } }, "range": [ 22, 24 ], - "type": "TypeAnnotation", "typeAnnotation": { - "loc": { - "end": { - "column": 24, - "line": 1 - }, - "start": { - "column": 22, - "line": 1 - } - }, - "members": [], + "type": "TSTypeLiteral", "range": [ 22, 24 ], - "type": "TSTypeLiteral" - } - }, - "loc": { - "end": { - "column": 24, - "line": 1 - }, - "start": { - "column": 12, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "members": [] } - }, - "name": "T", - "range": [ - 12, - 24 - ], - "type": "TypeParameter" + } } - ], - "range": [ - 11, - 25 - ], - "type": "TypeParameterDeclaration" + ] } } - ], - "kind": "type", - "loc": { - "end": { - "column": 48, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 48 - ], - "type": "VariableDeclaration" - } - ], - "loc": { - "end": { - "column": 48, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 + ] } - }, - "range": [ - 0, - 48 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 4, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Identifier", + "value": "type", "range": [ 0, 4 ], - "type": "Identifier", - "value": "type" - }, - { "loc": { - "end": { - "column": 11, - "line": 1 - }, "start": { - "column": 5, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 } - }, + } + }, + { + "type": "Identifier", + "value": "Result", "range": [ 5, 11 ], - "type": "Identifier", - "value": "Result" - }, - { "loc": { - "end": { - "column": 12, - "line": 1 - }, "start": { - "column": 11, - "line": 1 + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 11, 12 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 13, - "line": 1 - }, "start": { - "column": 12, - "line": 1 + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 } - }, + } + }, + { + "type": "Identifier", + "value": "T", "range": [ 12, 13 ], - "type": "Identifier", - "value": "T" - }, - { "loc": { - "end": { - "column": 21, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 } - }, + } + }, + { + "type": "Keyword", + "value": "extends", "range": [ 14, 21 ], - "type": "Keyword", - "value": "extends" - }, - { "loc": { - "end": { - "column": 23, - "line": 1 - }, "start": { - "column": 22, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 22, 23 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 23, - "line": 1 + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 23, 24 ], - "type": "Punctuator", - "value": "}" - }, - { "loc": { - "end": { - "column": 25, - "line": 1 - }, "start": { - "column": 24, - "line": 1 + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 24, 25 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 27, - "line": 1 - }, "start": { - "column": 26, - "line": 1 + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 } - }, + } + }, + { + "type": "Punctuator", + "value": "=", "range": [ 26, 27 ], - "type": "Punctuator", - "value": "=" - }, - { "loc": { - "end": { - "column": 35, - "line": 1 - }, "start": { - "column": 28, - "line": 1 + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 } - }, + } + }, + { + "type": "Identifier", + "value": "Success", "range": [ 28, 35 ], - "type": "Identifier", - "value": "Success" - }, - { "loc": { - "end": { - "column": 36, - "line": 1 - }, "start": { - "column": 35, - "line": 1 + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 35 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 35, 36 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 37, - "line": 1 - }, "start": { - "column": 36, - "line": 1 + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 36 } - }, + } + }, + { + "type": "Identifier", + "value": "T", "range": [ 36, 37 ], - "type": "Identifier", - "value": "T" - }, - { "loc": { - "end": { - "column": 38, - "line": 1 - }, "start": { - "column": 37, - "line": 1 + "line": 1, + "column": 36 + }, + "end": { + "line": 1, + "column": 37 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 37, 38 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 40, - "line": 1 - }, "start": { - "column": 39, - "line": 1 + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 38 } - }, + } + }, + { + "type": "Punctuator", + "value": "|", "range": [ 39, 40 ], - "type": "Punctuator", - "value": "|" - }, - { "loc": { - "end": { - "column": 48, - "line": 1 - }, "start": { - "column": 41, - "line": 1 + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 } - }, + } + }, + { + "type": "Identifier", + "value": "Failure", "range": [ 41, 48 ], - "type": "Identifier", - "value": "Failure" + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 48 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js index c6c963fd77ae..53891226c4a0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js @@ -105,59 +105,59 @@ module.exports = { "name": "Success" }, "typeParameters": { - "loc": { - "end": { - "column": 27, - "line": 1 - }, - "start": { - "column": 24, - "line": 1 - } - }, + "type": "TypeParameterInstantiation", "range": [ 24, 27 ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 27 + } + }, "params": [ { - "loc": { - "end": { - "column": 26, - "line": 1 - }, - "start": { - "column": 25, - "line": 1 - } - }, + "type": "GenericTypeAnnotation", "range": [ 25, 26 ], - "id": { - "loc": { - "end": { - "column": 26, - "line": 1 - }, - "start": { - "column": 25, - "line": 1 - } + "loc": { + "start": { + "line": 1, + "column": 25 }, - "name": "T", + "end": { + "line": 1, + "column": 26 + } + }, + "id": { + "type": "Identifier", "range": [ 25, 26 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + }, + "name": "T" }, - "type": "GenericTypeAnnotation", "typeParameters": null } - ], - "type": "TypeParameterInstantiation" + ] } }, { @@ -472,4 +472,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js index 46e51d845402..986ef4578e50 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js @@ -410,4 +410,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js index 38131df1ef41..9f7066551998 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js @@ -1,627 +1,634 @@ module.exports = { - "body": [{ - "async": false, - "body": { - "body": [{ - "argument": { - "left": { - "argument": { - "loc": { - "end": { - "column": 19, - "line": 2 - }, - "start": { - "column": 18, - "line": 2 - } - }, - "name": "x", - "range": [ - 59, - 60 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 19, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 - } - }, - "operator": "typeof", - "prefix": true, - "range": [ - 52, - 60 - ], - "type": "UnaryExpression" - }, - "loc": { - "end": { - "column": 32, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 - } - }, - "operator": "===", - "range": [ - 52, - 73 - ], - "right": { - "loc": { - "end": { - "column": 32, - "line": 2 - }, - "start": { - "column": 24, - "line": 2 - } - }, - "range": [ - 65, - 73 - ], - "raw": "'string'", - "type": "Literal", - "value": "string" - }, - "type": "BinaryExpression" - }, - "loc": { - "end": { - "column": 32, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } - }, - "range": [ - 45, - 73 - ], - "type": "ReturnStatement" - }], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 39, - "line": 1 - } - }, + "type": "Program", + "range": [ + 0, + 75 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "FunctionDeclaration", "range": [ - 39, + 0, 75 ], - "type": "BlockStatement" - }, - "expression": false, - "generator": false, - "id": { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 9, - "line": 1 - } - }, - "name": "isString", - "range": [ - 9, - 17 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "params": [{ - "loc": { - "end": { - "column": 19, - "line": 1 + "line": 1, + "column": 0 }, - "start": { - "column": 18, - "line": 1 + "end": { + "line": 3, + "column": 1 } }, - "name": "x", - "range": [ - 18, - 19 - ], - "type": "Identifier", - "typeAnnotation": { + "id": { + "type": "Identifier", + "range": [ + 9, + 17 + ], "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 } }, - "range": [ - 21, - 24 - ], - "type": "TypeAnnotation", - "typeAnnotation": { + "name": "isString" + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "range": [ + 18, + 19 + ], "loc": { - "end": { - "column": 24, - "line": 1 - }, "start": { - "column": 21, - "line": 1 + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 } }, - "range": [ - 21, - 24 - ], - "type": "TSAnyKeyword" - } - } - }], - "range": [ - 0, - 75 - ], - "returnType": { - "loc": { - "end": { - "column": 38, - "line": 1 - }, - "start": { - "column": 27, - "line": 1 + "name": "x", + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "range": [ + 21, + 24 + ], + "typeAnnotation": { + "type": "TSAnyKeyword", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + } } - }, - "range": [ - 27, - 38 ], - "type": "TypeAnnotation", - "typeAnnotation": { + "body": { + "type": "BlockStatement", + "range": [ + 39, + 75 + ], "loc": { - "end": { - "column": 38, - "line": 1 - }, "start": { - "column": 27, - "line": 1 + "line": 1, + "column": 39 + }, + "end": { + "line": 3, + "column": 1 } }, - "parameterName": { - "loc": { - "end": { - "column": 28, - "line": 1 + "body": [ + { + "type": "ReturnStatement", + "range": [ + 45, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 32 + } }, - "start": { - "column": 27, - "line": 1 + "argument": { + "type": "BinaryExpression", + "range": [ + 52, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "operator": "===", + "left": { + "type": "UnaryExpression", + "range": [ + 52, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "operator": "typeof", + "prefix": true, + "argument": { + "type": "Identifier", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "name": "x" + } + }, + "right": { + "type": "Literal", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "value": "string", + "raw": "'string'" + } } + } + ] + }, + "returnType": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 1, + "column": 27 }, - "name": "x", - "range": [ - 27, - 28 - ], - "type": "Identifier" + "end": { + "line": 1, + "column": 38 + } }, "range": [ 27, 38 ], - "type": "TSTypePredicate", "typeAnnotation": { + "type": "TSTypePredicate", + "range": [ + 27, + 38 + ], "loc": { - "end": { - "column": 38, - "line": 1 - }, "start": { - "column": 32, - "line": 1 + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 38 } }, - "range": [ - 32, - 38 - ], - "type": "TypeAnnotation", - "typeAnnotation": { + "parameterName": { + "type": "Identifier", + "range": [ + 27, + 28 + ], "loc": { - "end": { - "column": 38, - "line": 1 + "start": { + "line": 1, + "column": 27 }, + "end": { + "line": 1, + "column": 28 + } + }, + "name": "x" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "loc": { "start": { - "column": 32, - "line": 1 + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 } }, "range": [ 32, 38 ], - "type": "TSStringKeyword" + "typeAnnotation": { + "type": "TSStringKeyword", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } + } + } } } } - }, - "type": "FunctionDeclaration" - }], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 } - }, - "range": [ - 0, - 75 ], "sourceType": "script", - "tokens": [{ - "loc": { - "end": { - "column": 8, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 + "tokens": [ + { + "type": "Keyword", + "value": "function", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } } }, - "range": [ - 0, - 8 - ], - "type": "Keyword", - "value": "function" - }, - { - "loc": { - "end": { - "column": 17, - "line": 1 - }, - "start": { - "column": 9, - "line": 1 + { + "type": "Identifier", + "value": "isString", + "range": [ + 9, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 17 + } } }, - "range": [ - 9, - 17 - ], - "type": "Identifier", - "value": "isString" - }, - { - "loc": { - "end": { - "column": 18, - "line": 1 - }, - "start": { - "column": 17, - "line": 1 + { + "type": "Punctuator", + "value": "(", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } } }, - "range": [ - 17, - 18 - ], - "type": "Punctuator", - "value": "(" - }, - { - "loc": { - "end": { - "column": 19, - "line": 1 - }, - "start": { - "column": 18, - "line": 1 + { + "type": "Identifier", + "value": "x", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 + } } }, - "range": [ - 18, - 19 - ], - "type": "Identifier", - "value": "x" - }, - { - "loc": { - "end": { - "column": 20, - "line": 1 - }, - "start": { - "column": 19, - "line": 1 + { + "type": "Punctuator", + "value": ":", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } } }, - "range": [ - 19, - 20 - ], - "type": "Punctuator", - "value": ":" - }, - { - "loc": { - "end": { - "column": 24, - "line": 1 - }, - "start": { - "column": 21, - "line": 1 + { + "type": "Identifier", + "value": "any", + "range": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 24 + } } }, - "range": [ - 21, - 24 - ], - "type": "Identifier", - "value": "any" - }, - { - "loc": { - "end": { - "column": 25, - "line": 1 - }, - "start": { - "column": 24, - "line": 1 + { + "type": "Punctuator", + "value": ")", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } } }, - "range": [ - 24, - 25 - ], - "type": "Punctuator", - "value": ")" - }, - { - "loc": { - "end": { - "column": 26, - "line": 1 - }, - "start": { - "column": 25, - "line": 1 + { + "type": "Punctuator", + "value": ":", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } } }, - "range": [ - 25, - 26 - ], - "type": "Punctuator", - "value": ":" - }, - { - "loc": { - "end": { - "column": 28, - "line": 1 - }, - "start": { - "column": 27, - "line": 1 + { + "type": "Identifier", + "value": "x", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } } }, - "range": [ - 27, - 28 - ], - "type": "Identifier", - "value": "x" - }, - { - "loc": { - "end": { - "column": 31, - "line": 1 - }, - "start": { - "column": 29, - "line": 1 + { + "type": "Identifier", + "value": "is", + "range": [ + 29, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 31 + } } }, - "range": [ - 29, - 31 - ], - "type": "Identifier", - "value": "is" - }, - { - "loc": { - "end": { - "column": 38, - "line": 1 - }, - "start": { - "column": 32, - "line": 1 + { + "type": "Identifier", + "value": "string", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 1, + "column": 38 + } } }, - "range": [ - 32, - 38 - ], - "type": "Identifier", - "value": "string" - }, - { - "loc": { - "end": { - "column": 40, - "line": 1 - }, - "start": { - "column": 39, - "line": 1 + { + "type": "Punctuator", + "value": "{", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } } }, - "range": [ - 39, - 40 - ], - "type": "Punctuator", - "value": "{" - }, - { - "loc": { - "end": { - "column": 10, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 + { + "type": "Keyword", + "value": "return", + "range": [ + 45, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } } }, - "range": [ - 45, - 51 - ], - "type": "Keyword", - "value": "return" - }, - { - "loc": { - "end": { - "column": 17, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 + { + "type": "Keyword", + "value": "typeof", + "range": [ + 52, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 17 + } } }, - "range": [ - 52, - 58 - ], - "type": "Keyword", - "value": "typeof" - }, - { - "loc": { - "end": { - "column": 19, - "line": 2 - }, - "start": { - "column": 18, - "line": 2 + { + "type": "Identifier", + "value": "x", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } } }, - "range": [ - 59, - 60 - ], - "type": "Identifier", - "value": "x" - }, - { - "loc": { - "end": { - "column": 23, - "line": 2 - }, - "start": { - "column": 20, - "line": 2 + { + "type": "Punctuator", + "value": "===", + "range": [ + 61, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 23 + } } }, - "range": [ - 61, - 64 - ], - "type": "Punctuator", - "value": "===" - }, - { - "loc": { - "end": { - "column": 32, - "line": 2 - }, - "start": { - "column": 24, - "line": 2 + { + "type": "String", + "value": "'string'", + "range": [ + 65, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 32 + } } }, - "range": [ - 65, - 73 - ], - "type": "String", - "value": "'string'" - }, - { - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 3 + { + "type": "Punctuator", + "value": "}", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } } - }, - "range": [ - 74, - 75 - ], - "type": "Punctuator", - "value": "}" - } - ], - "type": "Program" -}; + } + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js index d62448fb56e6..2b8a61ba4989 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js @@ -777,4 +777,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js index c6e2d7653909..64bb25a08c3a 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js @@ -359,4 +359,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js index 5ab2db2a7a71..e210bea07bb6 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js @@ -90,6 +90,7 @@ module.exports = { "computed": false, "static": false, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", @@ -220,6 +221,7 @@ module.exports = { "computed": false, "static": false, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js index ed82988f5470..bb41d9b136bd 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js @@ -90,6 +90,7 @@ module.exports = { "computed": false, "static": true, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", @@ -205,6 +206,7 @@ module.exports = { "computed": false, "static": true, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js index 0d6a7725d673..f4f9f9ffd1ba 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js @@ -90,6 +90,7 @@ module.exports = { "computed": false, "static": false, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", @@ -167,6 +168,7 @@ module.exports = { "computed": false, "static": false, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js index c03092e14d05..8b161b2af00b 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js @@ -90,6 +90,7 @@ module.exports = { "computed": false, "static": true, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", @@ -167,6 +168,7 @@ module.exports = { "computed": false, "static": true, "accessibility": null, + "readonly": false, "decorators": [ { "type": "Decorator", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js index dec45ce27030..1c3776e12866 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js @@ -201,4 +201,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js index 5f0f82e7833f..cc88e51b9720 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js @@ -165,4 +165,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js index 4c1f0ac8ace9..2b6254959084 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js @@ -218,4 +218,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js index 6d0710f97e81..96d62353ce35 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js @@ -4813,4 +4813,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js index 3dfc5256786d..f8a47b5721a5 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js @@ -16,474 +16,474 @@ module.exports = { }, "body": [ { + "type": "ExpressionStatement", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, "expression": { - "arguments": [], - "callee": { - "loc": { - "end": { - "column": 3, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } + "type": "CallExpression", + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, - "name": "foo", + "end": { + "line": 1, + "column": 8 + } + }, + "callee": { + "type": "Identifier", "range": [ 0, 3 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 8, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 + } }, - "start": { - "column": 0, - "line": 1 - } + "name": "foo" }, - "range": [ - 0, - 8 - ], - "type": "CallExpression", + "arguments": [], "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 3, + 6 + ], "loc": { - "end": { - "column": 6, - "line": 1 - }, "start": { - "column": 3, - "line": 1 + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 6 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 4, - "line": 1 - } + "type": "GenericTypeAnnotation", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 }, - "name": "A", + "end": { + "line": 1, + "column": 5 + } + }, + "id": { + "type": "Identifier", "range": [ 4, 5 ], - "type": "Identifier" - }, - "typeParameters": null, - "loc": { - "end": { - "column": 5, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } }, - "start": { - "column": 4, - "line": 1 - } + "name": "A" }, - "range": [ - 4, - 5 - ], - "type": "GenericTypeAnnotation" + "typeParameters": null } - ], - "range": [ - 3, - 6 - ], - "type": "TypeParameterInstantiation" + ] } - }, + } + }, + { + "type": "ExpressionStatement", + "range": [ + 10, + 24 + ], "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 0, - "line": 1 + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 14 } }, - "range": [ - 0, - 9 - ], - "type": "ExpressionStatement" - }, - { "expression": { - "arguments": [], - "callee": { - "loc": { - "end": { - "column": 3, - "line": 2 - }, - "start": { - "column": 0, - "line": 2 - } + "type": "CallExpression", + "range": [ + 10, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 0 }, - "name": "foo", + "end": { + "line": 2, + "column": 13 + } + }, + "callee": { + "type": "Identifier", "range": [ 10, 13 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 13, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 + } }, - "start": { - "column": 0, - "line": 2 - } + "name": "foo" }, - "range": [ - 10, - 23 - ], - "type": "CallExpression", + "arguments": [], "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 13, + 21 + ], "loc": { - "end": { - "column": 11, - "line": 2 - }, "start": { - "column": 3, - "line": 2 + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 11 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 10, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 - } + "type": "GenericTypeAnnotation", + "range": [ + 14, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 4 }, + "end": { + "line": 2, + "column": 10 + } + }, + "id": { + "type": "TSNumberKeyword", "range": [ 14, 20 ], - "type": "TSNumberKeyword" - }, - "typeParameters": null, - "loc": { - "end": { - "column": 10, - "line": 2 - }, - "start": { - "column": 4, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } } }, - "range": [ - 14, - 20 - ], - "type": "GenericTypeAnnotation" + "typeParameters": null } - ], - "range": [ - 13, - 21 - ], - "type": "TypeParameterInstantiation" - } - }, - "loc": { - "end": { - "column": 14, - "line": 2 - }, - "start": { - "column": 0, - "line": 2 + ] } - }, - "range": [ - 10, - 24 - ], - "type": "ExpressionStatement" + } } ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 3, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Identifier", + "value": "foo", "range": [ 0, 3 ], - "type": "Identifier", - "value": "foo" - }, - { "loc": { - "end": { - "column": 4, - "line": 1 - }, "start": { - "column": 3, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 3 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 3, 4 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 5, - "line": 1 - }, "start": { - "column": 4, - "line": 1 + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 } - }, + } + }, + { + "type": "Identifier", + "value": "A", "range": [ 4, 5 ], - "type": "Identifier", - "value": "A" - }, - { "loc": { - "end": { - "column": 6, - "line": 1 - }, "start": { - "column": 5, - "line": 1 + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 5, 6 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 7, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 6, 7 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 8, - "line": 1 - }, "start": { - "column": 7, - "line": 1 + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 7, 8 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 8, - "line": 1 + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 8, 9 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 3, - "line": 2 - }, "start": { - "column": 0, - "line": 2 + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Identifier", + "value": "foo", "range": [ 10, 13 ], - "type": "Identifier", - "value": "foo" - }, - { "loc": { - "end": { - "column": 4, - "line": 2 - }, "start": { - "column": 3, - "line": 2 + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 3 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 13, 14 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 10, - "line": 2 - }, "start": { - "column": 4, - "line": 2 + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 } - }, + } + }, + { + "type": "Identifier", + "value": "number", "range": [ 14, 20 ], - "type": "Identifier", - "value": "number" - }, - { "loc": { - "end": { - "column": 11, - "line": 2 - }, "start": { - "column": 10, - "line": 2 + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 20, 21 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 12, - "line": 2 - }, "start": { - "column": 11, - "line": 2 + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 21, 22 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 13, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 22, 23 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 14, - "line": 2 - }, "start": { - "column": 13, - "line": 2 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 23, 24 ], - "type": "Punctuator", - "value": ";" + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } } ] -}; +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js index 1d3d5bc26dca..459bac2e5388 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js @@ -1,366 +1,366 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, "body": [ { + "type": "VariableDeclaration", + "range": [ + 0, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 21 + } + }, "declarations": [ { - "id": { - "loc": { - "end": { - "column": 7, - "line": 1 - }, - "start": { - "column": 6, - "line": 1 - } + "type": "VariableDeclarator", + "range": [ + 6, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 6 }, - "name": "a", + "end": { + "line": 1, + "column": 20 + } + }, + "id": { + "type": "Identifier", "range": [ 6, 7 ], - "type": "Identifier" + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "name": "a" }, "init": { - "arguments": [], - "callee": { - "loc": { - "end": { - "column": 15, - "line": 1 - }, - "start": { - "column": 14, - "line": 1 - } + "type": "NewExpression", + "range": [ + 10, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 10 }, - "name": "A", + "end": { + "line": 1, + "column": 20 + } + }, + "callee": { + "type": "Identifier", "range": [ 14, 15 ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 20, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + } }, - "start": { - "column": 10, - "line": 1 - } + "name": "A" }, - "range": [ - 10, - 20 - ], - "type": "NewExpression", + "arguments": [], "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 15, + 18 + ], "loc": { - "end": { - "column": 18, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 18 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 17, - "line": 1 - }, - "start": { - "column": 16, - "line": 1 - } + "type": "GenericTypeAnnotation", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 }, - "name": "B", + "end": { + "line": 1, + "column": 17 + } + }, + "id": { + "type": "Identifier", "range": [ 16, 17 ], - "type": "Identifier" - }, - "typeParameters": null, - "loc": { - "end": { - "column": 17, - "line": 1 + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } }, - "start": { - "column": 16, - "line": 1 - } + "name": "B" }, - "range": [ - 16, - 17 - ], - "type": "GenericTypeAnnotation" + "typeParameters": null } - ], - "range": [ - 15, - 18 - ], - "type": "TypeParameterInstantiation" - } - }, - "loc": { - "end": { - "column": 20, - "line": 1 - }, - "start": { - "column": 6, - "line": 1 + ] } - }, - "range": [ - 6, - 20 - ], - "type": "VariableDeclarator" - } - ], - "kind": "const", - "loc": { - "end": { - "column": 21, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 + } } - }, - "range": [ - 0, - 21 ], - "type": "VariableDeclaration" - } - ], - "loc": { - "end": { - "column": 21, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 + "kind": "const" } - }, - "range": [ - 0, - 21 ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Keyword", + "value": "const", "range": [ 0, 5 ], - "type": "Keyword", - "value": "const" - }, - { "loc": { - "end": { - "column": 7, - "line": 1 - }, "start": { - "column": 6, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 } - }, + } + }, + { + "type": "Identifier", + "value": "a", "range": [ 6, 7 ], - "type": "Identifier", - "value": "a" - }, - { "loc": { - "end": { - "column": 9, - "line": 1 - }, "start": { - "column": 8, - "line": 1 + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 } - }, + } + }, + { + "type": "Punctuator", + "value": "=", "range": [ 8, 9 ], - "type": "Punctuator", - "value": "=" - }, - { "loc": { - "end": { - "column": 13, - "line": 1 - }, "start": { - "column": 10, - "line": 1 + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 } - }, + } + }, + { + "type": "Keyword", + "value": "new", "range": [ 10, 13 ], - "type": "Keyword", - "value": "new" - }, - { "loc": { - "end": { - "column": 15, - "line": 1 - }, "start": { - "column": 14, - "line": 1 + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 } - }, + } + }, + { + "type": "Identifier", + "value": "A", "range": [ 14, 15 ], - "type": "Identifier", - "value": "A" - }, - { "loc": { - "end": { - "column": 16, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 } - }, + } + }, + { + "type": "Punctuator", + "value": "<", "range": [ 15, 16 ], - "type": "Punctuator", - "value": "<" - }, - { "loc": { - "end": { - "column": 17, - "line": 1 - }, "start": { - "column": 16, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 } - }, + } + }, + { + "type": "Identifier", + "value": "B", "range": [ 16, 17 ], - "type": "Identifier", - "value": "B" - }, - { "loc": { - "end": { - "column": 18, - "line": 1 - }, "start": { - "column": 17, - "line": 1 + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 } - }, + } + }, + { + "type": "Punctuator", + "value": ">", "range": [ 17, 18 ], - "type": "Punctuator", - "value": ">" - }, - { "loc": { - "end": { - "column": 19, - "line": 1 - }, "start": { - "column": 18, - "line": 1 + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 } - }, + } + }, + { + "type": "Punctuator", + "value": "(", "range": [ 18, 19 ], - "type": "Punctuator", - "value": "(" - }, - { "loc": { - "end": { - "column": 20, - "line": 1 - }, "start": { - "column": 19, - "line": 1 + "line": 1, + "column": 18 + }, + "end": { + "line": 1, + "column": 19 } - }, + } + }, + { + "type": "Punctuator", + "value": ")", "range": [ 19, 20 ], - "type": "Punctuator", - "value": ")" - }, - { "loc": { - "end": { - "column": 21, - "line": 1 - }, "start": { - "column": 20, - "line": 1 + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 20, 21 ], - "type": "Punctuator", - "value": ";" + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 21 + } + } } - ], - "type": "Program" -}; + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js index 63172cd3b1ca..da04e376a0c2 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js @@ -1,349 +1,349 @@ module.exports = { + "type": "Program", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { + "type": "TSModuleDeclaration", + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "modifiers": [ + { + "type": "TSDeclareKeyword", + "range": [ + 0, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 + } + } + } + ], + "name": { + "type": "Literal", + "range": [ + 15, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 + } + }, + "value": "i-use-things", + "raw": "\"i-use-things\"" + }, "body": { + "type": "TSModuleBlock", + "range": [ + 30, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 3, + "column": 1 + } + }, "body": [ { - "loc": { - "end": { - "column": 22, - "line": 2 - }, - "start": { - "column": 2, - "line": 2 - } - }, + "type": "ImportDeclaration", "range": [ 34, 54 ], - "source": { - "loc": { - "end": { - "column": 21, - "line": 2 - }, - "start": { - "column": 17, - "line": 2 - } + "loc": { + "start": { + "line": 2, + "column": 2 }, + "end": { + "line": 2, + "column": 22 + } + }, + "source": { + "type": "Literal", "range": [ 49, 53 ], - "raw": "'fs'", - "type": "Literal", - "value": "fs" + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": "fs", + "raw": "'fs'" }, "specifiers": [ { + "type": "ImportDefaultSpecifier", + "range": [ + 41, + 43 + ], "loc": { - "end": { - "column": 11, - "line": 2 - }, "start": { - "column": 9, - "line": 2 + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 } }, "local": { - "loc": { - "end": { - "column": 11, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } - }, - "name": "fs", + "type": "Identifier", "range": [ 41, 43 ], - "type": "Identifier" - }, - "range": [ - 41, - 43 - ], - "type": "ImportDefaultSpecifier" + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "name": "fs" + } } - ], - "type": "ImportDeclaration" - } - ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 30, - "line": 1 - } - }, - "range": [ - 30, - 56 - ], - "type": "TSModuleBlock" - }, - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "modifiers": [ - { - "loc": { - "end": { - "column": 7, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 7 - ], - "type": "TSDeclareKeyword" - } - ], - "name": { - "loc": { - "end": { - "column": 29, - "line": 1 - }, - "start": { - "column": 15, - "line": 1 + ] } - }, - "range": [ - 15, - 29 - ], - "raw": "\"i-use-things\"", - "type": "Literal", - "value": "i-use-things" - }, - "range": [ - 0, - 56 - ], - "type": "TSModuleDeclaration" + ] + } } ], - "loc": { - "end": { - "column": 1, - "line": 3 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 56 - ], "sourceType": "script", "tokens": [ { - "loc": { - "end": { - "column": 7, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, + "type": "Identifier", + "value": "declare", "range": [ 0, 7 ], - "type": "Identifier", - "value": "declare" - }, - { "loc": { - "end": { - "column": 14, - "line": 1 - }, "start": { - "column": 8, - "line": 1 + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 7 } - }, + } + }, + { + "type": "Identifier", + "value": "module", "range": [ 8, 14 ], - "type": "Identifier", - "value": "module" - }, - { "loc": { - "end": { - "column": 29, - "line": 1 - }, "start": { - "column": 15, - "line": 1 + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 14 } - }, + } + }, + { + "type": "String", + "value": "\"i-use-things\"", "range": [ 15, 29 ], - "type": "String", - "value": "\"i-use-things\"" - }, - { "loc": { - "end": { - "column": 31, - "line": 1 - }, "start": { - "column": 30, - "line": 1 + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 29 } - }, + } + }, + { + "type": "Punctuator", + "value": "{", "range": [ 30, 31 ], - "type": "Punctuator", - "value": "{" - }, - { "loc": { - "end": { - "column": 8, - "line": 2 - }, "start": { - "column": 2, - "line": 2 + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 } - }, + } + }, + { + "type": "Keyword", + "value": "import", "range": [ 34, 40 ], - "type": "Keyword", - "value": "import" - }, - { "loc": { - "end": { - "column": 11, - "line": 2 - }, "start": { - "column": 9, - "line": 2 + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 8 } - }, + } + }, + { + "type": "Identifier", + "value": "fs", "range": [ 41, 43 ], - "type": "Identifier", - "value": "fs" - }, - { "loc": { - "end": { - "column": 16, - "line": 2 - }, "start": { - "column": 12, - "line": 2 + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 } - }, + } + }, + { + "type": "Identifier", + "value": "from", "range": [ 44, 48 ], - "type": "Identifier", - "value": "from" - }, - { "loc": { - "end": { - "column": 21, - "line": 2 - }, "start": { - "column": 17, - "line": 2 + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 } - }, + } + }, + { + "type": "String", + "value": "'fs'", "range": [ 49, 53 ], - "type": "String", - "value": "'fs'" - }, - { "loc": { - "end": { - "column": 22, - "line": 2 - }, "start": { - "column": 21, - "line": 2 + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 21 } - }, + } + }, + { + "type": "Punctuator", + "value": ";", "range": [ 53, 54 ], - "type": "Punctuator", - "value": ";" - }, - { "loc": { - "end": { - "column": 1, - "line": 3 - }, "start": { - "column": 0, - "line": 3 + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 } - }, + } + }, + { + "type": "Punctuator", + "value": "}", "range": [ 55, 56 ], - "type": "Punctuator", - "value": "}" + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } } - ], - "type": "Program" -} + ] +}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js index 5d7507c54760..9bee7fd7f406 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js @@ -230,59 +230,58 @@ module.exports = { "name": "Selection" }, "typeParameters": { + "type": "TypeParameterInstantiation", + "range": [ + 76, + 81 + ], "loc": { - "end": { - "column": 58, - "line": 2 - }, "start": { - "column": 53, - "line": 2 + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 58 } }, "params": [ { - "id": { - "loc": { - "end": { - "column": 57, - "line": 2 - }, - "start": { - "column": 54, - "line": 2 - } + "type": "GenericTypeAnnotation", + "range": [ + 77, + 80 + ], + "loc": { + "start": { + "line": 2, + "column": 54 }, + "end": { + "line": 2, + "column": 57 + } + }, + "id": { + "type": "TSAnyKeyword", "range": [ 77, 80 ], - "type": "TSAnyKeyword" - }, - - "loc": { - "end": { - "column": 57, - "line": 2 - }, - "start": { - "column": 54, - "line": 2 + "loc": { + "start": { + "line": 2, + "column": 54 + }, + "end": { + "line": 2, + "column": 57 + } } }, - "range": [ - 77, - 80 - ], - "type": "GenericTypeAnnotation", "typeParameters": null } - ], - "range": [ - 76, - 81 - ], - "type": "TypeParameterInstantiation" + ] } } } @@ -653,4 +652,4 @@ module.exports = { } } ] -}; +}; \ No newline at end of file From b6e56c99025ef0b71b378c382e09e591b662053d Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sat, 3 Jun 2017 06:33:46 -0500 Subject: [PATCH 163/326] Breaking: Use ESTree export node types in modules (fixes# 263) (#265) --- packages/typescript-eslint-parser/README.md | 6 +- .../lib/node-utils.js | 10 +- ...namespace-with-exported-function.result.js | 2 +- .../module-with-default-exports.result.js | 825 ++++++++++++++++++ .../module-with-default-exports.src.ts | 7 + 5 files changed, 838 insertions(+), 12 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index d94324cf0d04..9d8031820ae0 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -2,7 +2,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint. -**Important:** This parser is not fully compatbile with all ESLint rules and plugins. Some rules will improperly mark source code as failing or not find problems where it should. +**Important:** This parser is not fully compatible with all ESLint rules and plugins. Some rules will improperly mark source code as failing or not find problems where it should. ## Supported TypeScript Version @@ -24,6 +24,8 @@ The following ESLint rules will fail on acceptable code: The follow ESLint plugins have issues when used with this parser: - eslint-plugin-react [#213](https://github.com/eslint/typescript-eslint-parser/issues/213) + - eslint-plugin-import + - prefer-default-export - Will fail exports inside of Namespaces or Modules The following TypeScript syntax will cause rules to fail or ESLint v3 to crash: - Empty body functions @@ -51,7 +53,7 @@ If you're familiar with TypeScript and ESLint, and you'd like to see this projec ## Reporting Bugs -Please check the current list of open and known issues and ensure the bug has not been reported before. When creating a new issue provide as much information about your enviroment as possible. This includes: +Please check the current list of open and known issues and ensure the bug has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes: - ESLint Version - TypeScript version - TypeScript parser version diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 28f1e4aa550b..60fcd64b4ae4 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -491,15 +491,7 @@ function fixExports(node, result, ast) { result.range[0] = varToken.getStart(); result.loc = getLocFor(result.range[0], result.range[1], ast); - let declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration"; - - /** - * Prefix exports from TypeScript namespaces with "TS" to distinguish - * them from ES2015 exports - */ - if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { - declarationType = "TSNamespaceExportDeclaration"; - } + const declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration"; const newResult = { type: declarationType, diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js index 9bee7fd7f406..178d5e737ed3 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js @@ -86,7 +86,7 @@ module.exports = { }, "body": [ { - "type": "TSNamespaceExportDeclaration", + "type": "ExportNamedDeclaration", "declaration": { "type": "TSNamespaceFunctionDeclaration", "range": [ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js new file mode 100644 index 000000000000..8b9adfd89192 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js @@ -0,0 +1,825 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "TSModuleDeclaration", + "range": [ + 0, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "name": { + "type": "Literal", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "value": "foo", + "raw": "\"foo\"" + }, + "body": { + "type": "TSModuleBlock", + "range": [ + 13, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "range": [ + 34, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 4, + "column": 5 + } + }, + "id": { + "type": "Identifier", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "name": "C" + }, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "range": [ + 52, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "key": { + "type": "Identifier", + "range": [ + 52, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "name": "method" + }, + "value": { + "type": "FunctionExpression", + "id": null, + "generator": false, + "expression": false, + "async": false, + "body": { + "type": "BlockStatement", + "range": [ + 64, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "body": [] + }, + "range": [ + 58, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "returnType": { + "type": "TypeAnnotation", + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "range": [ + 62, + 63 + ], + "typeAnnotation": { + "type": "TSTypeReference", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "typeName": { + "type": "Identifier", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "name": "C" + } + } + }, + "params": [] + }, + "computed": false, + "static": false, + "kind": "method", + "accessibility": null, + "decorators": [] + } + ], + "range": [ + 42, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "superClass": null, + "implements": [], + "decorators": [] + }, + "range": [ + 19, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "TSNamespaceFunctionDeclaration", + "range": [ + 93, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "id": { + "type": "Identifier", + "range": [ + 102, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 31 + } + }, + "name": "bar" + }, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "range": [ + 108, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 34 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "body": [] + } + }, + "range": [ + 78, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 36 + } + } + } + ] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Identifier", + "value": "module", + "range": [ + 0, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "String", + "value": "\"foo\"", + "range": [ + 7, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 19, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "class", + "range": [ + 34, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "method", + "range": [ + 52, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "C", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "export", + "range": [ + 78, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Keyword", + "value": "default", + "range": [ + 85, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 93, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 102, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 34 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts new file mode 100644 index 000000000000..ae4410a51bd3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.src.ts @@ -0,0 +1,7 @@ +module "foo" { + export default class C { + method(): C {}; + } + export default function bar() {} +} + From f7592e2eb78480e765c3903e758b3f89bf890fe4 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Sun, 4 Jun 2017 14:11:25 -0500 Subject: [PATCH 164/326] Fix: Add name to JSXIdentifier when converting ThisKeyword (fixes #307) (#310) --- .../typescript-eslint-parser/lib/convert.js | 5 +- .../jsx/member-expression-this.result.js | 327 +++++++++++++++ .../jsx/member-expression-this.src.js | 1 + .../fixtures/jsx/member-expression.result.js | 397 ++++++++++++++++++ .../fixtures/jsx/member-expression.src.js | 1 + 5 files changed, 729 insertions(+), 2 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.src.js diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 564cd018c85c..1d55359f7824 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -290,9 +290,7 @@ module.exports = function convert(config) { // Assign the appropriate types tagNameToken.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.JSXMemberExpression : AST_NODE_TYPES.JSXIdentifier; tagNameToken.property.type = AST_NODE_TYPES.JSXIdentifier; - } else { - tagNameToken.name = tagNameToken.value; } @@ -1447,6 +1445,9 @@ module.exports = function convert(config) { property: convertChild(node.name) }; const isNestedMemberExpression = (node.expression.kind === SyntaxKind.PropertyAccessExpression); + if (node.expression.kind === SyntaxKind.ThisKeyword) { + jsxMemberExpression.object.name = "this"; + } jsxMemberExpression.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.MemberExpression : AST_NODE_TYPES.JSXIdentifier; jsxMemberExpression.property.type = AST_NODE_TYPES.JSXIdentifier; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js new file mode 100644 index 000000000000..2df3406de0c1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js @@ -0,0 +1,327 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "JSXElement", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "selfClosing": true, + "name": { + "type": "JSXMemberExpression", + "range": [ + 1, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "object": { + "type": "JSXMemberExpression", + "range": [ + 1, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "object": { + "type": "JSXIdentifier", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "name": "this" + }, + "property": { + "type": "JSXIdentifier", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": "state" + } + }, + "property": { + "type": "JSXIdentifier", + "range": [ + 12, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + }, + "name": "Component" + } + }, + "attributes": [] + }, + "closingElement": null, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "Keyword", + "value": "this", + "range": [ + 1, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "JSXIdentifier", + "value": "state", + "range": [ + 6, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 11, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "JSXIdentifier", + "value": "Component", + "range": [ + 12, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 23, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js new file mode 100644 index 000000000000..f3bd61bc75f1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js @@ -0,0 +1 @@ +; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js new file mode 100644 index 000000000000..a69bd2696379 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js @@ -0,0 +1,397 @@ +module.exports = { + "type": "Program", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "JSXElement", + "range": [ + 0, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "openingElement": { + "type": "JSXOpeningElement", + "range": [ + 0, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 5 + } + }, + "selfClosing": false, + "name": { + "type": "JSXMemberExpression", + "range": [ + 1, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "object": { + "type": "JSXIdentifier", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "name": "a" + }, + "property": { + "type": "JSXIdentifier", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + }, + "name": "b" + } + }, + "attributes": [] + }, + "closingElement": { + "type": "JSXClosingElement", + "range": [ + 5, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "name": { + "type": "JSXMemberExpression", + "range": [ + 7, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "object": { + "type": "JSXIdentifier", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "name": "a" + }, + "property": { + "type": "JSXIdentifier", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "name": "b" + } + } + }, + "children": [] + } + } + ], + "sourceType": "script", + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 1, + 2 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 2, + 3 + ], + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 1, + "column": 3 + } + } + }, + { + "type": "JSXIdentifier", + "value": "b", + "range": [ + 3, + 4 + ], + "loc": { + "start": { + "line": 1, + "column": 3 + }, + "end": { + "line": 1, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 4, + 5 + ], + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 5, + 6 + ], + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 6, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "JSXIdentifier", + "value": "a", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 8, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "JSXIdentifier", + "value": "b", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 10, + 11 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 11 + } + } + } + ] +}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.src.js new file mode 100644 index 000000000000..a5cd092d6ed2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.src.js @@ -0,0 +1 @@ + From e0ef6b471271bc6c3211ad2b4ec0391d8a1ebb37 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 5 Jun 2017 10:44:44 +0100 Subject: [PATCH 165/326] Chore: Refactor tests to assert snapshots not JSON (#311) * Chore: Refactor tests to assert snapshots not JSON * Chore: Remove unused fixture and result files --- .../fixtures/ast/Additive-Operators.json | 217 - .../tests/fixtures/ast/Array-Initializer.json | 1198 - .../fixtures/ast/Assignment-Operators.json | 1082 - .../ast/Automatic-semicolon-insertion.json | 1707 - .../ast/Binary-Bitwise-Operators.json | 215 - .../fixtures/ast/Binary-Expressions.json | 1928 - .../ast/Binary-Logical-Operators.json | 572 - .../fixtures/ast/Bitwise-Shift-Operator.json | 215 - .../tests/fixtures/ast/Block.json | 199 - .../tests/fixtures/ast/Comments.json | 4322 - .../fixtures/ast/Complex-Expression.json | 397 - .../fixtures/ast/Conditional-Operator.json | 345 - .../tests/fixtures/ast/Const-Statement.json | 370 - .../tests/fixtures/ast/Directive-Prolog.json | 332 - .../tests/fixtures/ast/Empty-Statement.json | 19 - .../fixtures/ast/Equality-Operators.json | 286 - .../fixtures/ast/Expression-Statement.json | 249 - .../fixtures/ast/Function-Definition.json | 1681 - .../tests/fixtures/ast/Grouping-Operator.json | 222 - .../tests/fixtures/ast/If-Statement.json | 742 - .../tests/fixtures/ast/Invalid-syntax.json | 1334 - .../fixtures/ast/Iteration-Statements.json | 2684 - .../fixtures/ast/Labelled-Statements.json | 268 - .../ast/Left-Hand-Side-Expression.json | 2188 - .../tests/fixtures/ast/Let-Statement.json | 427 - .../ast/Multiplicative-Operators.json | 286 - .../tests/fixtures/ast/Numeric-Literals.json | 780 - .../fixtures/ast/Object-Initializer.json | 4950 - .../fixtures/ast/Postfix-Expressions.json | 326 - .../fixtures/ast/Primary-Expression.json | 335 - .../ast/Regular-Expression-Literals.json | 1215 - .../fixtures/ast/Relational-Operators.json | 535 - .../tests/fixtures/ast/Source-elements.json | 21 - .../tests/fixtures/ast/Source-option.json | 304 - .../tests/fixtures/ast/String-Literals.json | 686 - .../tests/fixtures/ast/Tokenize.json | 1277 - .../tests/fixtures/ast/Tolerant-parse.json | 6139 - .../tests/fixtures/ast/Unary-Operators.json | 704 - .../fixtures/ast/Variable-Statement.json | 826 - .../tests/fixtures/ast/Whitespace.json | 254 - .../tests/fixtures/ast/break-statement.json | 450 - .../fixtures/ast/continue-statement.json | 523 - .../fixtures/ast/debugger-statement.json | 19 - .../tests/fixtures/ast/return-statement.json | 380 - .../tests/fixtures/ast/switch-statement.json | 368 - .../tests/fixtures/ast/throw-statement.json | 202 - .../tests/fixtures/ast/try-statement.json | 1080 - .../tests/fixtures/ast/with-statement.json | 339 - .../basics/delete-expression.result.js | 202 - .../basics/do-while-statements.result.js | 780 - .../identifiers-double-underscore.result.js | 479 - .../fixtures/basics/instanceof.result.js | 148 - .../new-with-member-expression.result.js | 237 - .../basics/new-without-parens.result.js | 294 - .../basics/typeof-expression.result.js | 113 - .../basics/update-expression.result.js | 585 - .../fixtures/basics/void-expression.result.js | 276 - .../comments/block-trailing-comment.result.js | 222 - .../comment-within-condition.result.js | 222 - .../export-default-anonymous-class.result.js | 377 - .../comments/jsx-block-comment.result.js | 732 - .../comments/jsx-tag-comments.result.js | 644 - .../line-comment-with-block-syntax.result.js | 40 - .../mix-line-and-block-comments.result.js | 242 - .../comments/no-comment-regex.result.js | 195 - .../comments/no-comment-template.result.js | 287 - .../surrounding-call-comments.result.js | 351 - .../surrounding-debugger-comments.result.js | 279 - .../surrounding-return-comments.result.js | 280 - .../surrounding-throw-comments.result.js | 316 - .../surrounding-while-loop-comments.result.js | 498 - ...-fallthrough-comment-in-function.result.js | 716 - .../switch-fallthrough-comment.result.js | 513 - ...h-no-default-comment-in-function.result.js | 682 - ...ault-comment-in-nested-functions.result.js | 1550 - .../switch-no-default-comment.result.js | 333 - .../comments/template-string-block.result.js | 414 - .../classes-and-generators.config.js | 4 - .../classes-and-generators.result.js | 336 - .../classes-and-generators.src.js | 4 - .../computed-generator.config.js | 4 - .../computed-generator.result.js | 444 - .../computed-generator.src.js | 4 - .../error-generator.config.js | 4 - .../error-generator.result.js | 6 - .../error-generator.src.js | 4 - .../error-no-class.config.js | 5 - .../error-no-class.result.js | 6 - .../error-no-class.src.js | 4 - .../error-static-no-generators.config.js | 4 - .../error-static-no-generators.result.js | 6 - .../error-static-no-generators.src.js | 4 - .../static-generators.config.js | 4 - .../static-generators.result.js | 354 - .../static-generators.src.js | 4 - .../default-param-arrow.config.js | 4 - .../default-param-arrow.result.js | 462 - .../default-param-arrow.src.js | 1 - .../default-param.config.js | 4 - .../default-param.result.js | 350 - .../default-param.src.js | 1 - .../local-eval-multi.config.js | 4 - .../local-eval-multi.result.js | 333 - .../local-eval-multi.src.js | 1 - .../local-eval.config.js | 4 - .../local-eval.result.js | 279 - .../local-eval.src.js | 1 - .../yield-default-param.config.js | 5 - .../yield-default-param.result.js | 461 - .../yield-default-param.src.js | 1 - .../arrow-param-array.config.js | 4 - .../arrow-param-array.result.js | 261 - .../arrow-param-array.src.js | 1 - .../arrow-param-nested-array.config.js | 4 - .../arrow-param-nested-array.result.js | 370 - .../arrow-param-nested-array.src.js | 1 - .../arrow-param-nested-object-named.config.js | 4 - .../arrow-param-nested-object-named.result.js | 595 - .../arrow-param-nested-object-named.src.js | 1 - .../arrow-param-nested-object.config.js | 4 - .../arrow-param-nested-object.result.js | 523 - .../arrow-param-nested-object.src.js | 1 - .../arrow-param-object.config.js | 4 - .../arrow-param-object.result.js | 300 - .../arrow-param-object.src.js | 1 - .../param-defaults-array.config.js | 4 - .../param-defaults-array.result.js | 315 - .../param-defaults-array.src.js | 1 - .../param-defaults-object-nested.config.js | 4 - .../param-defaults-object-nested.result.js | 758 - .../param-defaults-object-nested.src.js | 1 - .../param-defaults-object.config.js | 4 - .../param-defaults-object.result.js | 354 - .../param-defaults-object.src.js | 1 - .../array-const-undefined.config.js | 4 - .../array-const-undefined.result.js | 258 - .../array-const-undefined.src.js | 1 - .../array-let-undefined.config.js | 4 - .../array-let-undefined.result.js | 258 - .../array-let-undefined.src.js | 1 - .../object-const-named.config.js | 4 - .../object-const-named.result.js | 333 - .../object-const-named.src.js | 1 - .../object-const-undefined.config.js | 4 - .../object-const-undefined.result.js | 297 - .../object-const-undefined.src.js | 1 - .../object-let-named.config.js | 4 - .../object-let-named.result.js | 333 - .../object-let-named.src.js | 1 - .../object-let-undefined.config.js | 4 - .../object-let-undefined.result.js | 297 - .../object-let-undefined.src.js | 1 - .../param-array.config.js | 4 - .../param-array.result.js | 441 - .../param-array.src.js | 1 - .../param-object-short.config.js | 5 - .../param-object-short.result.js | 650 - .../param-object-short.src.js | 1 - .../param-object-wrapped.config.js | 4 - .../param-object-wrapped.result.js | 141 - .../param-object-wrapped.src.xjs | 1 - .../param-object.config.js | 4 - .../param-object.result.js | 592 - .../param-object.src.js | 1 - .../invalid-rest.config.js | 4 - .../invalid-rest.result.js | 6 - .../invalid-rest.src.js | 1 - .../object-rest.config.js | 4 - .../object-rest.result.js | 982 - .../object-rest.src.js | 1 - .../destructuring-and-forOf/loop.config.js | 4 - .../destructuring-and-forOf/loop.result.js | 273 - .../destructuring-and-forOf/loop.src.js | 1 - .../complex-destructured.config.js | 4 - .../complex-destructured.result.js | 496 - .../complex-destructured.src.js | 1 - .../destructured-array-literal.config.js | 4 - .../destructured-array-literal.result.js | 418 - .../destructured-array-literal.src.js | 1 - .../destructuring-param.config.js | 4 - .../destructuring-param.result.js | 512 - .../destructuring-param.src.js | 1 - ...omplex-destructured-spread-first.config.js | 4 - ...omplex-destructured-spread-first.result.js | 6 - ...r-complex-destructured-spread-first.src.js | 1 - .../multi-destructured.config.js | 4 - .../multi-destructured.result.js | 309 - .../multi-destructured.src.js | 1 - .../not-final-array-empty.config.js | 4 - .../not-final-array-empty.result.js | 273 - .../not-final-array-empty.src.js | 1 - .../not-final-array.config.js | 4 - .../not-final-array.result.js | 6 - .../not-final-array.src.js | 1 - .../single-destructured.config.js | 4 - .../single-destructured.result.js | 255 - .../single-destructured.src.js | 1 - .../var-complex-destructured.config.js | 4 - .../var-complex-destructured.result.js | 516 - .../var-complex-destructured.src.js | 1 - .../var-destructured-array-literal.config.js | 4 - .../var-destructured-array-literal.result.js | 438 - .../var-destructured-array-literal.src.js | 1 - .../var-multi-destructured.config.js | 4 - .../var-multi-destructured.result.js | 329 - .../var-multi-destructured.src.js | 1 - .../var-single-destructured.config.js | 4 - .../var-single-destructured.result.js | 275 - .../var-single-destructured.src.js | 1 - .../for-of-with-const-and-no-braces.config.js | 4 - .../for-of-with-const-and-no-braces.result.js | 364 - .../for-of-with-const-and-no-braces.src.js | 2 - .../for-of-with-let-and-no-braces.config.js | 4 - .../for-of-with-let-and-no-braces.result.js | 364 - .../for-of-with-let-and-no-braces.src.js | 2 - .../export-const-number.config.js | 4 - .../export-const-number.result.js | 223 - .../export-const-number.src.js | 1 - .../export-const-object.config.js | 4 - .../export-const-object.result.js | 222 - .../export-const-object.src.js | 1 - .../export-let-number.config.js | 4 - .../export-let-number.result.js | 223 - .../export-let-number.src.js | 1 - .../export-let-object.config.js | 4 - .../export-let-object.result.js | 222 - .../export-let-object.src.js | 1 - .../export-let.config.js | 4 - .../export-let.result.js | 169 - .../export-let.src.js | 1 - .../class-default-anonymous-extends.config.js | 4 - .../class-default-anonymous-extends.result.js | 255 - .../class-default-anonymous-extends.src.js | 1 - .../class-default-anonymous.config.js | 4 - .../class-default-anonymous.result.js | 202 - .../class-default-anonymous.src.js | 1 - .../class-default-extends.config.js | 4 - .../class-default-extends.result.js | 290 - .../class-default-extends.src.js | 1 - .../class-default.config.js | 4 - .../class-default.result.js | 237 - .../modules-and-classes/class-default.src.js | 1 - .../class-extends.config.js | 4 - .../class-extends.result.js | 274 - .../modules-and-classes/class-extends.src.js | 1 - .../modules-and-classes/class.config.js | 4 - .../modules-and-classes/class.result.js | 221 - .../modules-and-classes/class.src.js | 1 - .../proto-computed-property.config.js | 4 - .../proto-computed-property.result.js | 1083 - .../proto-computed-property.src.js | 9 - .../default-params.config.js | 4 - .../default-params.result.js | 1308 - .../default-params.src.js | 7 - .../array-destructuring.config.js | 4 - .../array-destructuring.result.js | 463 - .../array-destructuring.src.js | 1 - .../error-no-shorthand.config.js | 4 - .../error-no-shorthand.result.js | 6 - .../error-no-shorthand.src.js | 1 - .../generator-object-literal-method.config.js | 4 - .../generator-object-literal-method.result.js | 499 - .../generator-object-literal-method.src.js | 1 - .../computed-method-property.config.js | 4 - .../computed-method-property.result.js | 499 - .../computed-method-property.src.js | 5 - .../shorthand-properties.config.js | 4 - .../shorthand-properties.result.js | 715 - .../shorthand-properties.src.js | 9 - .../arrow-rest-multi.config.js | 4 - .../arrow-rest-multi.result.js | 313 - .../arrow-rest-multi.src.js | 1 - .../arrow-rest.config.js | 4 - .../arrow-rest.result.js | 259 - .../arrow-rest.src.js | 1 - .../destructured-arrow-array.config.js | 5 - .../destructured-arrow-array.result.js | 407 - .../destructured-arrow-array.src.js | 1 - .../destructured-arrow-multi.config.js | 5 - .../destructured-arrow-multi.result.js | 699 - .../destructured-arrow-multi.src.js | 1 - .../destructured-arrow-object.config.js | 5 - .../destructured-arrow-object.result.js | 552 - .../destructured-arrow-object.src.js | 1 - .../error-attempted-spread-param.config.js | 5 - .../error-attempted-spread-param.result.js | 6 - .../error-attempted-spread-param.src.js | 1 - .../invalid-arrow-rest-params.config.js | 5 - .../invalid-arrow-rest-params.result.js | 6 - .../invalid-arrow-rest-params.src.js | 1 - .../template-strings-in-jsx-complex.config.js | 4 - .../template-strings-in-jsx-complex.result.js | 2526 - .../template-strings-in-jsx-complex.src.js | 14 - .../template-strings-in-jsx-multi.config.js | 4 - .../template-strings-in-jsx-multi.result.js | 560 - .../template-strings-in-jsx-multi.src.js | 1 - .../template-strings-in-jsx.config.js | 4 - .../template-strings-in-jsx.result.js | 429 - .../template-strings-in-jsx.src.js | 1 - .../template-strings-unicode-escape.config.js | 4 - .../template-strings-unicode-escape.result.js | 209 - .../template-strings-unicode-escape.src.js | 1 - .../as-param-with-params.result.js | 369 - .../arrowFunctions/as-param.result.js | 278 - .../arrowFunctions/basic.result.js | 170 - .../block-body-not-object.result.js | 314 - .../arrowFunctions/block-body.result.js | 261 - .../arrowFunctions/error-dup-params.result.js | 6 - .../error-missing-paren.result.js | 6 - .../arrowFunctions/error-not-arrow.result.js | 6 - .../error-numeric-param-multi.result.js | 6 - .../error-numeric-param.result.js | 6 - .../error-reverse-arrow.result.js | 6 - .../error-strict-default-param-eval.result.js | 6 - .../error-strict-dup-params.result.js | 6 - .../error-strict-eval-return.result.js | 6 - .../error-strict-eval.result.js | 6 - .../error-strict-octal.result.js | 6 - .../error-strict-param-arguments.result.js | 6 - .../error-strict-param-eval.result.js | 6 - .../error-strict-param-names.result.js | 6 - ...-strict-param-no-paren-arguments.result.js | 6 - ...error-strict-param-no-paren-eval.result.js | 6 - .../arrowFunctions/error-two-lines.result.js | 6 - .../error-wrapped-param.result.js | 6 - .../arrowFunctions/expression.result.js | 206 - .../arrowFunctions/iife.result.js | 337 - .../arrowFunctions/multiple-params.result.js | 261 - .../arrowFunctions/no-auto-return.result.js | 351 - .../not-strict-arguments.result.js | 171 - .../not-strict-eval-params.result.js | 261 - .../arrowFunctions/not-strict-eval.result.js | 171 - .../arrowFunctions/not-strict-octal.result.js | 207 - .../return-arrow-function.result.js | 248 - .../arrowFunctions/return-sequence.result.js | 572 - .../single-param-parens.result.js | 207 - .../single-param-return-identifier.result.js | 206 - .../arrowFunctions/single-param.result.js | 171 - .../binaryLiterals/invalid.result.js | 6 - .../binaryLiterals/lowercase.result.js | 94 - .../binaryLiterals/uppercase.result.js | 94 - .../blockBindings/const.result.js | 185 - .../blockBindings/let-in-switchcase.result.js | 477 - .../ecma-features/blockBindings/let.result.js | 185 - .../class-accessor-properties.result.js | 618 - .../class-computed-static-method.result.js | 428 - .../classes/class-expression.result.js | 186 - .../class-method-named-prototype.result.js | 356 - .../class-method-named-static.result.js | 374 - .../class-method-named-with-space.result.js | 321 - .../classes/class-one-method-super.result.js | 481 - .../classes/class-one-method.result.js | 356 - ...ss-static-method-named-prototype.result.js | 411 - ...class-static-method-named-static.result.js | 392 - .../classes/class-static-method.result.js | 392 - ...-methods-and-accessor-properties.result.js | 824 - ...lass-two-computed-static-methods.result.js | 652 - ...two-methods-computed-constructor.result.js | 564 - .../classes/class-two-methods-semi.result.js | 544 - .../class-two-methods-three-semi.result.js | 580 - .../class-two-methods-two-semi.result.js | 562 - .../classes/class-two-methods.result.js | 526 - ...static-methods-named-constructor.result.js | 560 - ...lass-with-constructor-parameters.result.js | 413 - ...lass-with-constructor-with-space.result.js | 355 - .../classes/class-with-constructor.result.js | 355 - .../derived-class-assign-to-var.result.js | 331 - .../derived-class-expression.result.js | 240 - .../classes/empty-class-double-semi.result.js | 185 - .../classes/empty-class-semi.result.js | 203 - .../classes/empty-class.result.js | 185 - .../empty-literal-derived-class.result.js | 239 - .../invalid-class-declaration.result.js | 6 - ...invalid-class-setter-declaration.result.js | 6 - .../classes/named-class-expression.result.js | 221 - .../named-derived-class-expression.result.js | 275 - .../defaultParams/class-constructor.result.js | 430 - .../defaultParams/class-method.result.js | 431 - .../defaultParams/declaration.result.js | 296 - .../defaultParams/expression.result.js | 350 - .../defaultParams/method.result.js | 480 - .../defaultParams/not-all-params.result.js | 496 - .../arrow-param-array.result.js | 261 - .../arrow-param-nested-array.result.js | 370 - .../arrow-param-nested-object-named.result.js | 595 - .../arrow-param-nested-object.result.js | 523 - .../arrow-param-object.result.js | 300 - .../param-defaults-array.result.js | 315 - .../param-defaults-object-nested.result.js | 758 - .../param-defaults-object.result.js | 354 - .../array-const-undefined.result.js | 258 - .../array-let-undefined.result.js | 258 - .../object-const-named.result.js | 333 - .../object-const-undefined.result.js | 297 - .../object-let-named.result.js | 333 - .../object-let-undefined.result.js | 297 - .../param-array.result.js | 441 - .../param-object-short.result.js | 650 - .../param-object-wrapped.result.js | 141 - .../param-object.result.js | 592 - .../destructuring-and-forOf/loop.result.js | 273 - .../complex-destructured.result.js | 496 - .../destructured-array-literal.result.js | 418 - .../destructuring-param.result.js | 512 - ...omplex-destructured-spread-first.result.js | 6 - .../invalid-not-final-array-empty.result.js | 6 - .../multi-destructured.result.js | 309 - .../not-final-array.result.js | 6 - .../single-destructured.result.js | 255 - .../var-complex-destructured.result.js | 516 - .../var-destructured-array-literal.result.js | 438 - .../var-multi-destructured.result.js | 329 - .../var-single-destructured.result.js | 275 - .../destructuring/array-member.result.js | 293 - .../destructuring/array-to-array.result.js | 383 - .../array-var-undefined.result.js | 258 - .../class-constructor-params-array.result.js | 468 - ...onstructor-params-defaults-array.result.js | 612 - ...nstructor-params-defaults-object.result.js | 690 - .../class-constructor-params-object.result.js | 546 - .../class-method-params-array.result.js | 468 - ...ass-method-params-defaults-array.result.js | 612 - ...ss-method-params-defaults-object.result.js | 690 - .../class-method-params-object.result.js | 546 - .../defaults-array-all.result.js | 564 - ...ults-array-longform-nested-multi.result.js | 775 - .../defaults-array-multi.result.js | 420 - .../defaults-array-nested-all.result.js | 493 - .../defaults-array-nested-multi.result.js | 421 - .../destructuring/defaults-array.result.js | 274 - .../defaults-object-all.result.js | 681 - .../defaults-object-longform-all.result.js | 789 - .../defaults-object-longform-multi.result.js | 645 - .../defaults-object-longform.result.js | 387 - .../defaults-object-mixed-multi.result.js | 573 - .../defaults-object-multi.result.js | 537 - .../defaults-object-nested-all.result.js | 646 - .../defaults-object-nested-multi.result.js | 574 - .../destructuring/defaults-object.result.js | 333 - .../destructured-array-catch.result.js | 918 - .../destructured-object-catch.result.js | 957 - .../invalid-defaults-object-assign.result.js | 6 - .../destructuring/named-param.result.js | 331 - .../destructuring/nested-array.result.js | 663 - .../destructuring/nested-object.result.js | 965 - .../destructuring/object-var-named.result.js | 333 - .../object-var-undefined.result.js | 297 - .../param-deafults-object.result.js | 6 - .../param-defaults-array.result.js | 351 - .../param-defaults-object-nested.result.js | 720 - .../param-defaults-object.result.js | 390 - .../params-array-wrapped.result.js | 404 - .../destructuring/params-array.result.js | 368 - .../params-multi-object.result.js | 407 - .../params-nested-array.result.js | 461 - .../params-nested-object.result.js | 648 - .../params-object-wrapped.result.js | 482 - .../destructuring/params-object.result.js | 446 - .../destructuring/sparse-array.result.js | 293 - .../async-generators.result.js | 223 - .../async-iterator.result.js | 496 - .../arg-spread.result.js | 409 - .../destructuring-assign-mirror.result.js | 549 - ...function-parameter-object-spread.result.js | 316 - .../invalid-rest-trailing-comma.result.js | 6 - .../invalid-rest.result.js | 6 - .../object-rest.result.js | 984 - .../property-spread.result.js | 859 - .../shorthand-method-args.result.js | 629 - .../shorthand-methods.result.js | 688 - .../shorthand-properties.result.js | 715 - .../single-spread.result.js | 787 - .../spread-trailing-comma.result.js | 405 - .../two-spread.result.js | 747 - .../exponential-operators.result.js | 403 - ...for-of-with-function-initializer.result.js | 711 - .../for-of-with-var-and-braces.result.js | 419 - .../for-of-with-var-and-no-braces.result.js | 364 - ...-for-of-with-const-and-no-braces.result.js | 6 - ...id-for-of-with-let-and-no-braces.result.js | 6 - .../generators/anonymous-generator.result.js | 331 - .../async-generator-function.result.js | 223 - .../async-generator-method.result.js | 629 - .../generators/double-yield.result.js | 368 - .../empty-generator-declaration.result.js | 240 - .../generator-declaration.result.js | 348 - .../generators/yield-delegation.result.js | 349 - .../yield-without-value-in-call.result.js | 405 - .../yield-without-value-no-semi.result.js | 296 - .../generators/yield-without-value.result.js | 314 - .../globalReturn/return-identifier.result.js | 111 - .../globalReturn/return-no-arg.result.js | 76 - .../globalReturn/return-true.result.js | 112 - .../modules/error-delete.result.js | 6 - .../modules/error-function.result.js | 6 - .../modules/error-strict.result.js | 6 - .../modules/export-default-array.result.js | 147 - .../modules/export-default-class.result.js | 168 - .../export-default-expression.result.js | 239 - .../modules/export-default-function.result.js | 205 - .../export-default-named-class.result.js | 203 - .../export-default-named-function.result.js | 240 - .../modules/export-default-number.result.js | 130 - .../modules/export-default-object.result.js | 260 - .../modules/export-default-value.result.js | 129 - .../modules/export-from-batch.result.js | 148 - .../modules/export-from-default.result.js | 240 - .../export-from-named-as-default.result.js | 276 - .../export-from-named-as-specifier.result.js | 276 - .../export-from-named-as-specifiers.result.js | 365 - .../modules/export-from-specifier.result.js | 240 - .../modules/export-from-specifiers.result.js | 329 - .../modules/export-function.result.js | 224 - .../modules/export-named-as-default.result.js | 222 - .../export-named-as-specifier.result.js | 222 - .../export-named-as-specifiers.result.js | 311 - .../modules/export-named-class.result.js | 188 - .../modules/export-named-empty.result.js | 114 - .../modules/export-named-specifier.result.js | 186 - .../export-named-specifiers-comma.result.js | 293 - .../modules/export-named-specifiers.result.js | 275 - .../export-var-anonymous-function.result.js | 316 - .../modules/export-var-number.result.js | 223 - .../modules/export-var.result.js | 169 - ...ort-default-and-named-specifiers.result.js | 310 - ...default-and-namespace-specifiers.result.js | 292 - .../modules/import-default-as.result.js | 275 - .../modules/import-default.result.js | 185 - .../modules/import-jquery.result.js | 167 - .../modules/import-module.result.js | 113 - .../import-named-as-specifier.result.js | 275 - .../import-named-as-specifiers.result.js | 364 - .../modules/import-named-empty.result.js | 167 - .../modules/import-named-specifier.result.js | 239 - .../import-named-specifiers-comma.result.js | 346 - .../modules/import-named-specifiers.result.js | 328 - .../import-namespace-specifier.result.js | 221 - .../modules/import-null-as-nil.result.js | 257 - .../modules/invalid-await.result.js | 6 - .../modules/invalid-class.result.js | 6 - ...export-batch-missing-from-clause.result.js | 6 - .../invalid-export-batch-token.result.js | 6 - .../invalid-export-default-equal.result.js | 6 - .../invalid-export-default-token.result.js | 6 - .../modules/invalid-export-default.result.js | 6 - .../invalid-export-named-default.result.js | 6 - ...invalid-export-named-extra-comma.result.js | 6 - ...nvalid-export-named-middle-comma.result.js | 6 - ...efault-after-named-after-default.result.js | 6 - ...valid-import-default-after-named.result.js | 6 - ...default-missing-module-specifier.result.js | 6 - ...-import-default-module-specifier.result.js | 6 - .../modules/invalid-import-default.result.js | 6 - ...-import-missing-module-specifier.result.js | 6 - .../invalid-import-module-specifier.result.js | 6 - ...invalid-import-named-after-named.result.js | 6 - ...lid-import-named-after-namespace.result.js | 6 - ...lid-import-named-as-missing-from.result.js | 6 - ...invalid-import-named-extra-comma.result.js | 6 - ...nvalid-import-named-middle-comma.result.js | 6 - ...lid-import-namespace-after-named.result.js | 6 - ...alid-import-namespace-missing-as.result.js | 6 - .../newTarget/invalid-new-target.result.js | 6 - .../invalid-unknown-property.result.js | 6 - .../newTarget/simple-new-target.result.js | 422 - .../computed-addition-property.result.js | 425 - .../computed-and-identifier.result.js | 426 - .../computed-getter-and-setter.result.js | 649 - .../computed-string-property.result.js | 352 - .../computed-variable-property.result.js | 351 - ...valid-computed-variable-property.result.js | 6 - ...alone-computed-variable-property.result.js | 6 - ...ndalone-expression-with-addition.result.js | 370 - ...tandalone-expression-with-method.result.js | 389 - .../standalone-expression.result.js | 296 - .../error-proto-property.result.js | 6 - .../error-proto-string-property.result.js | 6 - .../strict-duplicate-properties.result.js | 518 - ...rict-duplicate-string-properties.result.js | 520 - .../invalid-method-no-braces.result.js | 6 - .../method-property.result.js | 463 - .../simple-method-named-get.result.js | 388 - .../simple-method-named-set.result.js | 388 - .../simple-method-with-argument.result.js | 425 - .../simple-method-with-string-name.result.js | 389 - .../simple-method.result.js | 388 - .../string-name-method-property.result.js | 464 - .../shorthand-properties.result.js | 719 - .../octalLiterals/invalid.result.js | 6 - .../octalLiterals/lowercase.result.js | 94 - .../octalLiterals/strict-uppercase.result.js | 166 - .../octalLiterals/uppercase.result.js | 94 - .../regex/regexp-simple.result.js | 194 - ...egex-u-extended-escape.supported.result.js | 194 - ...ex-u-extended-escape.unsupported.result.js | 194 - .../regex-u-invalid-extended-escape.result.js | 6 - .../regex-u-simple.supported.result.js | 194 - .../regex-u-simple.unsupported.result.js | 194 - .../regexp-y-simple.supported.result.js | 194 - .../regexp-y-simple.unsupported.result.js | 194 - .../restParams/basic-rest.result.js | 348 - .../restParams/class-constructor.result.js | 393 - .../restParams/class-method.result.js | 394 - .../restParams/error-no-default.result.js | 6 - .../restParams/error-not-last.result.js | 6 - .../func-expression-multi.result.js | 405 - .../restParams/func-expression.result.js | 351 - .../restParams/invalid-rest-param.result.js | 6 - .../restParams/single-rest.result.js | 294 - .../spread/error-invalid-if.result.js | 6 - .../spread/error-invalid-sequence.result.js | 6 - .../spread/multi-function-call.result.js | 273 - .../spread/not-final-param.result.js | 273 - .../spread/simple-function-call.result.js | 219 - .../templateStrings/deeply-nested.result.js | 462 - .../error-octal-literal.result.js | 6 - .../escape-characters.result.js | 209 - .../templateStrings/expressions.result.js | 671 - .../multi-line-template-string.result.js | 117 - .../simple-template-string.result.js | 117 - .../single-dollar-sign.result.js | 209 - .../tagged-no-placeholders.result.js | 170 - .../tagged-template-string.result.js | 723 - .../basic-string-literal.result.js | 94 - .../complex-string-literal.result.js | 94 - .../invalid-empty-escape.result.js | 6 - .../invalid-too-large-escape.result.js | 6 - .../self-closing-tag-inside-tag.result.js | 458 - .../jsx-useJSXTextNode/test-content.result.js | 311 - .../tests/fixtures/jsx/attributes.result.js | 740 - .../fixtures/jsx/embedded-comment.result.js | 344 - .../jsx/embedded-conditional.result.js | 655 - .../embedded-invalid-js-identifier.result.js | 439 - .../fixtures/jsx/embedded-tags.result.js | 710 - .../fixtures/jsx/empty-placeholder.result.js | 344 - .../fixtures/jsx/escape-patterns.result.js | 995 - ...invalid-attribute-missing-equals.result.js | 6 - .../fixtures/jsx/invalid-attribute.result.js | 6 - .../fixtures/jsx/invalid-broken-tag.result.js | 6 - .../invalid-computed-end-tag-name.result.js | 6 - ...lid-computed-string-end-tag-name.result.js | 6 - .../jsx/invalid-embedded-expression.result.js | 6 - .../invalid-leading-dot-tag-name.result.js | 6 - ...ching-placeholder-in-closing-tag.result.js | 6 - .../invalid-mismatched-closing-tag.result.js | 6 - .../invalid-mismatched-closing-tags.result.js | 6 - .../invalid-mismatched-dot-tag-name.result.js | 6 - ...invalid-mismatched-namespace-tag.result.js | 6 - ...losing-tag-attribute-placeholder.result.js | 6 - .../jsx/invalid-missing-closing-tag.result.js | 6 - .../invalid-missing-namespace-name.result.js | 6 - .../invalid-missing-namespace-value.result.js | 6 - .../invalid-missing-spread-operator.result.js | 6 - ...nvalid-namespace-name-with-docts.result.js | 6 - ...nvalid-namespace-value-with-dots.result.js | 557 - ...id-no-common-parent-with-comment.result.js | 6 - .../jsx/invalid-no-common-parent.result.js | 6 - .../jsx/invalid-no-tag-name.result.js | 6 - ...valid-placeholder-in-closing-tag.result.js | 6 - .../invalid-trailing-dot-tag-name.result.js | 6 - .../jsx/invalid-unexpected-comma.result.js | 6 - .../jsx/japanese-characters.result.js | 273 - .../fixtures/jsx/less-than-operator.result.js | 293 - .../jsx/member-expression-this.result.js | 327 - .../fixtures/jsx/member-expression.result.js | 397 - .../jsx/multiple-blank-spaces.result.js | 311 - ...ced-attribute-and-value-inserted.result.js | 962 - .../namespaced-name-and-attribute.result.js | 382 - .../jsx/newslines-and-entities.result.js | 6 - .../jsx/self-closing-tag-inside-tag.result.js | 458 - .../self-closing-tag-with-newline.result.js | 6 - .../fixtures/jsx/self-closing-tag.result.js | 185 - ...-attribute-and-regular-attribute.result.js | 401 - .../jsx/spread-operator-attributes.result.js | 293 - .../jsx/tag-names-with-dots.result.js | 415 - .../jsx/tag-names-with-multi-dots.result.js | 557 - .../tests/fixtures/jsx/test-content.result.js | 311 - ...ailing-spread-operator-attribute.result.js | 597 - .../jsx/unknown-escape-pattern.result.js | 294 - .../tests/fixtures/parse/all-pieces.json | 186 - .../fixtures/tokenize/const-result.tokens.js | 93 - .../fixtures/tokenize/let-result.tokens.js | 93 - .../tokenize/regex-in-parens-result.tokens.js | 169 - .../tokenize/regexp-u-result.tokens.js | 97 - .../regexp-u-unicode-escape-result.tokens.js | 37 - .../tokenize/regexp-y-result.tokens.js | 97 - .../template-string-embedded-result.tokens.js | 129 - ...template-string-embedded2-result.tokens.js | 255 - ...mplate-string-expressions-result.tokens.js | 201 - .../template-string-simple-result.tokens.js | 93 - ...-class-with-abstract-constructor.result.js | 358 - ...tract-class-with-abstract-method.result.js | 555 - ...t-class-with-abstract-properties.result.js | 415 - ...-with-abstract-readonly-property.result.js | 355 - ...tract-class-with-optional-method.result.js | 556 - .../basics/abstract-interface.result.js | 204 - ...ow-function-with-type-parameters.result.js | 564 - .../async-function-expression.result.js | 330 - ...nc-function-with-var-declaration.result.js | 698 - ...ass-with-accessibility-modifiers.result.js | 1359 - ...with-export-parameter-properties.result.js | 467 - ...ss-with-extends-generic-multiple.result.js | 563 - .../class-with-extends-generic.result.js | 404 - ...lass-with-generic-method-default.result.js | 484 - .../class-with-generic-method.result.js | 413 - ...with-implements-generic-multiple.result.js | 403 - .../class-with-implements-generic.result.js | 331 - .../basics/class-with-implements.result.js | 222 - .../basics/class-with-mixin.result.js | 2082 - ...-with-optional-computed-property.result.js | 356 - .../class-with-optional-methods.result.js | 771 - .../class-with-optional-properties.result.js | 598 - ...with-optional-property-undefined.result.js | 319 - ...ith-private-parameter-properties.result.js | 1139 - ...h-protected-parameter-properties.result.js | 1139 - ...with-public-parameter-properties.result.js | 1139 - ...th-readonly-parameter-properties.result.js | 703 - .../class-with-readonly-property.result.js | 319 - ...with-static-parameter-properties.result.js | 467 - ...lass-with-type-parameter-default.result.js | 313 - ...s-with-type-parameter-underscore.result.js | 242 - .../class-with-type-parameter.result.js | 242 - ...clare-class-with-optional-method.result.js | 393 - .../basics/declare-function.result.js | 347 - ...xport-default-class-with-generic.result.js | 260 - ...ult-class-with-multiple-generics.result.js | 315 - .../export-named-class-with-generic.result.js | 279 - ...med-class-with-multiple-generics.result.js | 334 - .../export-type-alias-declaration.result.js | 293 - .../export-type-class-declaration.result.js | 371 - ...export-type-function-declaration.result.js | 418 - .../basics/function-with-await.result.js | 349 - ...ct-type-with-optional-properties.result.js | 746 - ...h-object-type-without-annotation.result.js | 710 - ...pe-parameters-that-have-comments.result.js | 279 - ...-type-parameters-with-constraint.result.js | 670 - .../function-with-type-parameters.result.js | 582 - .../function-with-types-assignation.result.js | 935 - .../basics/function-with-types.result.js | 454 - .../interface-extends-multiple.result.js | 292 - .../basics/interface-extends.result.js | 221 - .../interface-type-parameters.result.js | 241 - ...nterface-with-all-property-types.result.js | 3338 - ...ure-with-parameter-accessibility.result.js | 410 - ...ace-with-extends-type-parameters.result.js | 422 - .../basics/interface-with-generic.result.js | 241 - .../basics/interface-with-jsdoc.result.js | 680 - ...terface-with-optional-properties.result.js | 799 - ...nterface-without-type-annotation.result.js | 229 - .../basics/nested-type-arguments.result.js | 526 - .../non-null-assertion-operator.result.js | 764 - ...-with-constrained-type-parameter.result.js | 563 - .../basics/type-alias-declaration.result.js | 475 - ...-alias-object-without-annotation.result.js | 413 - .../typescript/basics/type-guard.result.js | 634 - .../typescript/basics/typed-this.result.js | 780 - .../basics/var-with-dotted-type.result.js | 362 - .../typescript/basics/var-with-type.result.js | 256 - ...ecorator-factory-instance-member.result.js | 664 - ...-decorator-factory-static-member.result.js | 812 - ...cessor-decorator-instance-member.result.js | 572 - ...accessor-decorator-static-member.result.js | 682 - .../class-decorator-factory.result.js | 462 - .../class-decorator.result.js | 222 - ...ecorator-factory-instance-member.result.js | 485 - ...-decorator-factory-static-member.result.js | 503 - ...method-decorator-instance-member.result.js | 393 - .../method-decorator-static-member.result.js | 411 - .../parameter-decorator-constructor.result.js | 896 - ...orator-decorator-instance-member.result.js | 593 - ...ecorator-decorator-static-member.result.js | 611 - ...ameter-decorator-instance-member.result.js | 737 - ...arameter-decorator-static-member.result.js | 755 - ...ecorator-factory-instance-member.result.js | 684 - ...-decorator-factory-static-member.result.js | 671 - ...operty-decorator-instance-member.result.js | 451 - ...property-decorator-static-member.result.js | 487 - .../class-empty-extends-implements.result.js | 204 - .../class-empty-extends.result.js | 168 - .../class-extends-empty-implements.result.js | 221 - .../decorator-on-enum-declaration.result.js | 203 - .../interface-empty-extends.result.js | 167 - .../interface-property-modifiers.result.js | 4816 - .../call-expression-type-arguments.result.js | 489 - .../new-expression-type-arguments.result.js | 366 - ...t-module-declaration-with-import.result.js | 349 - ...namespace-with-exported-function.result.js | 655 - .../module-with-default-exports.result.js | 825 - ...thand-ambient-module-declaration.result.js | 149 - .../tests/lib/__snapshots__/basics.js.snap | 1450 + .../tests/lib/__snapshots__/comments.js.snap | 3039 + .../lib/__snapshots__/ecma-features.js.snap | 93995 ++++++++++++++++ .../tests/lib/__snapshots__/jsx.js.snap | 9529 ++ .../tests/lib/__snapshots__/parse.js.snap | 190 + .../lib/__snapshots__/typescript.js.snap | 26518 +++++ .../tests/lib/basics.js | 28 +- .../tests/lib/comments.js | 24 +- .../tests/lib/ecma-features.js | 165 +- .../typescript-eslint-parser/tests/lib/jsx.js | 45 +- .../tests/lib/parse.js | 25 +- .../tests/lib/typescript.js | 28 +- .../tools/test-utils.js | 39 +- .../tools/update-typescript-tests.js | 90 - 803 files changed, 134825 insertions(+), 252322 deletions(-) delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Block.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.unsupported.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.unsupported.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.unsupported.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js delete mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap delete mode 100644 packages/typescript-eslint-parser/tools/update-typescript-tests.js diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json deleted file mode 100644 index 38952f10473c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Additive-Operators.json +++ /dev/null @@ -1,217 +0,0 @@ -{ - "x + y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x - y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "\"use strict\" + 42": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json deleted file mode 100644 index 072c4e3d4348..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Array-Initializer.json +++ /dev/null @@ -1,1198 +0,0 @@ -{ - "x = []": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ] - }, - "x = [ ]": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x = [ 42 ]": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "x = [ 42, ]": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "x = [ ,, 42 ]": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [ - null, - null, - { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "x = [ 1, 2, 3, ]": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "range": [ - 4, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "x = [ 1, 2,, 3, ]": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - null, - { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "日本語 = []": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "日本語", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "T‿ = []": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "T‿", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "T‌ = []": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "T‌", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "T‍ = []": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "T‍", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "ⅣⅡ = []": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "ⅣⅡ", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "ⅣⅡ = []": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "ⅣⅡ", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json deleted file mode 100644 index 928106763e1e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Assignment-Operators.json +++ /dev/null @@ -1,1082 +0,0 @@ -{ - "x = 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "eval = 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "eval", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 7, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "arguments = 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "arguments", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "x *= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "*=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x /= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "/=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x %= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "%=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x += 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "+=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x -= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "-=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x **= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "**=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "x <<= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "<<=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "x >>= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": ">>=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "x >>>= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": ">>>=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 7, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x &= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "&=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x ^= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "^=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x |= 42": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "|=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json deleted file mode 100644 index d1e681950216..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Automatic-semicolon-insertion.json +++ /dev/null @@ -1,1707 +0,0 @@ -{ - "{ x\n++y }": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 2, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "y", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - } - }, - "prefix": true, - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - }, - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - } - } - ], - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "{ x\n--y }": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 2, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "y", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - } - }, - "prefix": true, - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - }, - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - } - } - ], - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "var x /* comment */;": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": null, - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "{ var x = 14, y = 3\nz; }": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": { - "type": "Literal", - "value": 14, - "raw": "14", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "y", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "init": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "kind": "var", - "range": [ - 2, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "z", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "range": [ - 20, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - } - ], - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - "while (true) { continue\nthere; }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": null, - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "there", - "range": [ - 24, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "range": [ - 13, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "while (true) { continue // Comment\nthere; }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": null, - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "there", - "range": [ - 35, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "range": [ - 35, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "range": [ - 13, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "while (true) { continue /* Multiline\nComment */there; }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": null, - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "there", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "range": [ - 13, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "range": [ - 0, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "while (true) { break\nthere; }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "BreakStatement", - "label": null, - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "there", - "range": [ - 21, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "range": [ - 21, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "range": [ - 13, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "while (true) { break // Comment\nthere; }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "BreakStatement", - "label": null, - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "there", - "range": [ - 32, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "range": [ - 13, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "while (true) { break /* Multiline\nComment */there; }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "BreakStatement", - "label": null, - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "there", - "range": [ - 44, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "range": [ - 44, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "range": [ - 13, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "(function(){ return\nx; })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": null, - "range": [ - 13, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "x", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "range": [ - 20, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - } - ], - "range": [ - 11, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "(function(){ return // Comment\nx; })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": null, - "range": [ - 13, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "x", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - } - ], - "range": [ - 11, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "(function(){ return/* Multiline\nComment */x; })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": null, - "range": [ - 13, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "x", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "range": [ - 42, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - ], - "range": [ - 11, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "{ throw error\nerror; }": { - "type": "BlockStatement", - "body": [ - { - "type": "ThrowStatement", - "argument": { - "type": "Identifier", - "name": "error", - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 2, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "error", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "{ throw error// Comment\nerror; }": { - "type": "BlockStatement", - "body": [ - { - "type": "ThrowStatement", - "argument": { - "type": "Identifier", - "name": "error", - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 2, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "error", - "range": [ - 24, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "{ throw error/* Multiline\nComment */error; }": { - "type": "BlockStatement", - "body": [ - { - "type": "ThrowStatement", - "argument": { - "type": "Identifier", - "name": "error", - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 2, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "error", - "range": [ - 36, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "range": [ - 36, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - } - } - ], - "range": [ - 0, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json deleted file mode 100644 index 4502ac1b474e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Bitwise-Operators.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "x & y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "&", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x ^ y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "^", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x | y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "|", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json deleted file mode 100644 index 2fd02552715c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Expressions.json +++ /dev/null @@ -1,1928 +0,0 @@ -{ - "x + y + z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x - y + z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x + y - z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x - y - z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x + y * z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x + y / z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "/", - "left": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x - y % z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "%", - "left": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x * y * z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x * y / z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "/", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x * y % z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "%", - "left": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x % y * z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "BinaryExpression", - "operator": "%", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x << y << z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "<<", - "left": { - "type": "BinaryExpression", - "operator": "<<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "x | y | z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "|", - "left": { - "type": "BinaryExpression", - "operator": "|", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x & y & z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "&", - "left": { - "type": "BinaryExpression", - "operator": "&", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x ^ y ^ z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "^", - "left": { - "type": "BinaryExpression", - "operator": "^", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x & y | z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "|", - "left": { - "type": "BinaryExpression", - "operator": "&", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x | y ^ z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "|", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "^", - "left": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x | y & z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "|", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "&", - "left": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json deleted file mode 100644 index c1eef8d20f25..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Binary-Logical-Operators.json +++ /dev/null @@ -1,572 +0,0 @@ -{ - "x || y": { - "type": "ExpressionStatement", - "expression": { - "type": "LogicalExpression", - "operator": "||", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x && y": { - "type": "ExpressionStatement", - "expression": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x || y || z": { - "type": "ExpressionStatement", - "expression": { - "type": "LogicalExpression", - "operator": "||", - "left": { - "type": "LogicalExpression", - "operator": "||", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "x && y && z": { - "type": "ExpressionStatement", - "expression": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "x || y && z": { - "type": "ExpressionStatement", - "expression": { - "type": "LogicalExpression", - "operator": "||", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 5, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "x || y ^ z": { - "type": "ExpressionStatement", - "expression": { - "type": "LogicalExpression", - "operator": "||", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "^", - "left": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json deleted file mode 100644 index a024ab9f6a41..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Bitwise-Shift-Operator.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "x << y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "<<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x >> y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": ">>", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x >>> y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": ">>>", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Block.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Block.json deleted file mode 100644 index bf48af39640e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Block.json +++ /dev/null @@ -1,199 +0,0 @@ -{ - "{ foo }": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "foo", - "range": [ - 2, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 2, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "{ doThis(); doThat(); }": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThis", - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "arguments": [], - "range": [ - 2, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 2, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThat", - "range": [ - 12, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "arguments": [], - "range": [ - 12, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 12, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "{}": { - "type": "BlockStatement", - "body": [], - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json deleted file mode 100644 index e2bec3ddea8a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Comments.json +++ /dev/null @@ -1,4322 +0,0 @@ -{ - "/* block comment */ 42": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 20, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 20, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "42 /* block comment 1 */ /* block comment 2 */": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ], - "trailingComments": [ - { - "type": "Block", - "value": " block comment 1 ", - "range": [ - 3, - 24 - ] - }, - { - "type": "Block", - "value": " block comment 2 ", - "range": [ - 25, - 46 - ] - } - ] - }, - "range": [ - 0, - 46 - ] - } - ], - "range": [ - 0, - 46 - ], - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " block comment 1 ", - "range": [ - 3, - 24 - ] - }, - { - "type": "Block", - "value": " block comment 2 ", - "range": [ - 25, - 46 - ] - } - ], - "tokens": [ - { - "type": "Numeric", - "range": [ - 0, - 2 - ], - "value": "42" - } - ] - }, - "var p1;/* block comment 1 */ /* block comment 2 */": { - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "type": "Program", - "body": [ - { - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "type": "VariableDeclaration", - "declarations": [ - { - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "type": "VariableDeclarator", - "id": { - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "type": "Identifier", - "name": "p1" - }, - "init": null - } - ], - "kind": "var", - "trailingComments": [ - { - "range": [ - 7, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "type": "Block", - "value": " block comment 1 " - }, - { - "range": [ - 29, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "type": "Block", - "value": " block comment 2 " - } - ] - } - ], - "sourceType": "script", "comments": [ - { - "range": [ - 7, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "type": "Block", - "value": " block comment 1 " - }, - { - "range": [ - 29, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "type": "Block", - "value": " block comment 2 " - } - ], - "tokens": [ - { - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "type": "Keyword", - "value": "var" - }, - { - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "type": "Identifier", - "value": "p1" - }, - { - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "type": "Punctuator", - "value": ";" - } - ] - }, - "/*42*/": { - "range": [ - 6, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "type": "Program", - "body": [], - "sourceType": "script", "leadingComments": [ - { - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "type": "Block", - "value": "42" - } - ], - "comments": [ - { - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "type": "Block", - "value": "42" - } - ], - "tokens": [] - }, - "(a + /* assignmenr */b ) * c": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "Identifier", - "name": "b", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " assignmenr ", - "range": [ - 5, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] - }, - "range": [ - 1, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "right": { - "type": "Identifier", - "name": "c", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " assignmenr ", - "range": [ - 5, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] - }, - "/* assignmenr */\n a = b": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - "right": { - "type": "Identifier", - "name": "b", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 18, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 18, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " assignmenr ", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - } - ], - "range": [ - 18, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " assignmenr ", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - }, - "42 /*The*/ /*Answer*/": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "The", - "range": [ - 3, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Block", - "value": "Answer", - "range": [ - 11, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] - }, - "42 /*the*/ /*answer*/": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ] - }, - "range": [ - 0, - 21 - ] - } - ], - "range": [ - 0, - 21 - ], - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "the", - "range": [ - 3, - 10 - ] - }, - { - "type": "Block", - "value": "answer", - "range": [ - 11, - 21 - ] - } - ] - }, - "42 /* the * answer */": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "42 /* The * answer */": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " The * answer ", - "range": [ - 3, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] - }, - "/* multiline\ncomment\nshould\nbe\nignored */ 42": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 42, - 44 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "range": [ - 42, - 44 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "/*a\r\nb*/ 42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": "a\r\nb", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - } - ] - } - ], - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "a\r\nb", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - } - ] - }, - "/*a\rb*/ 42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ], - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "a\rb", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - } - ] - }, - "/*a\nb*/ 42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": "a\nb", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - } - ] - } - ], - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "a\nb", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - } - ] - }, - "/*a\nc*/ 42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": "a\nc", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - } - ] - } - ], - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "a\nc", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - } - ] - }, - "// one\\n": { - "type": "Program", - "body": [], - "range": [ - 8, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "sourceType": "script", "leadingComments": [ - { - "type": "Line", - "value": " one\\n", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "comments": [ - { - "type": "Line", - "value": " one\\n", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ] - }, - "// line comment\n42": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - "42 // line comment": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "trailingComments": [ - { - "type": "Line", - "value": " line comment", - "range": [ - 3, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ] - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " line comment", - "range": [ - 3, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ] - }, - "// Hello, world!\n42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "leadingComments": [ - { - "type": "Line", - "value": " Hello, world!", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - } - ], - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " Hello, world!", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - }, - "// Hello, world!\n": { - "type": "Program", - "body": [], - "range": [ - 17, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " Hello, world!", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - }, - "// Hallo, world!\n": { - "type": "Program", - "body": [], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " Hallo, world!", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - }, - "//\n42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 3, - 5 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - "range": [ - 3, - 5 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "leadingComments": [ - { - "type": "Line", - "value": "", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - } - ] - } - ], - "range": [ - 3, - 5 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": "", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - } - ] - }, - "//": { - "type": "Program", - "body": [], - "range": [ - 2, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": "", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - } - ] - }, - "// ": { - "type": "Program", - "body": [], - "range": [ - 3, - 3 - ], - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " ", - "range": [ - 0, - 3 - ] - } - ] - }, - "/**/42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": "", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ] - } - ], - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ] - }, - "42/**/": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "trailingComments": [ - { - "type": "Block", - "value": "", - "range": [ - 2, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ] - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": "", - "range": [ - 2, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ] - }, - "// Hello, world!\n\n// Another hello\n42": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 37, - 39 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - } - }, - "range": [ - 37, - 39 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "leadingComments": [ - { - "type": "Line", - "value": " Hello, world!", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Line", - "value": " Another hello", - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - } - } - ] - } - ], - "range": [ - 37, - 39 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " Hello, world!", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Line", - "value": " Another hello", - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 18 - } - } - } - ] - }, - "if (x) { doThat() // Some comment\n }": { - "type": "Program", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThat", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "arguments": [], - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "trailingComments": [ - { - "type": "Line", - "value": " Some comment", - "range": [ - 18, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ] - }, - "range": [ - 9, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 2, - "column": 1 - } - } - } - ], - "range": [ - 7, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - "alternate": null, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - } - } - ], - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " Some comment", - "range": [ - 18, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ] - }, - "if (x) { // Some comment\ndoThat(); }": { - "type": "Program", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThat", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "arguments": [], - "range": [ - 25, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "range": [ - 25, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "leadingComments": [ - { - "type": "Line", - "value": " Some comment", - "range": [ - 9, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] - } - ], - "range": [ - 7, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - "alternate": null, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - } - } - ], - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " Some comment", - "range": [ - 9, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] - }, - "if (x) { /* Some comment */ doThat() }": { - "type": "Program", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThat", - "range": [ - 28, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "arguments": [], - "range": [ - 28, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 28, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " Some comment ", - "range": [ - 9, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ] - } - ], - "range": [ - 7, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "alternate": null, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - ], - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " Some comment ", - "range": [ - 9, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ] - }, - "if (x) { doThat() /* Some comment */ }": { - "type": "Program", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThat", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "arguments": [], - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "trailingComments": [ - { - "type": "Block", - "value": " Some comment ", - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ] - }, - "range": [ - 9, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ], - "range": [ - 7, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "alternate": null, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - ], - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " Some comment ", - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ] - }, - "switch (answer) { case 42: /* perfect */ bingo() }": { - "type": "Program", - "body": [ - { - "type": "SwitchStatement", - "discriminant": { - "type": "Identifier", - "name": "answer", - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "cases": [ - { - "type": "SwitchCase", - "test": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "consequent": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "bingo", - "range": [ - 41, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "arguments": [], - "range": [ - 41, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - } - }, - "range": [ - 41, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 49 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " perfect ", - "range": [ - 27, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] - } - ], - "range": [ - 18, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 49 - } - } - } - ], - "range": [ - 0, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - } - } - ], - "range": [ - 0, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " perfect ", - "range": [ - 27, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] - }, - "switch (answer) { case 42: bingo() /* perfect */ }": { - "type": "Program", - "body": [ - { - "type": "SwitchStatement", - "discriminant": { - "type": "Identifier", - "name": "answer", - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "cases": [ - { - "type": "SwitchCase", - "test": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "consequent": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "bingo", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "arguments": [], - "range": [ - 27, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "trailingComments": [ - { - "type": "Block", - "value": " perfect ", - "range": [ - 35, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ] - }, - "range": [ - 27, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 49 - } - } - } - ], - "range": [ - 18, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 49 - } - } - } - ], - "range": [ - 0, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - } - } - ], - "range": [ - 0, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " perfect ", - "range": [ - 35, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ] - }, - "/* header */ (function(){ var version = 1; }).call(this)": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "version", - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "init": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "range": [ - 30, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 41 - } - } - } - ], - "kind": "var", - "range": [ - 26, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 42 - } - } - } - ], - "range": [ - 24, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - "property": { - "type": "Identifier", - "name": "call", - "range": [ - 46, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 50 - } - } - }, - "range": [ - 13, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 50 - } - } - }, - "arguments": [ - { - "type": "ThisExpression", - "range": [ - 51, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 55 - } - } - } - ], - "range": [ - 13, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 56 - } - } - }, - "range": [ - 13, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " header ", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ] - } - ], - "range": [ - 13, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " header ", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ] - }, - "(function(){ var version = 1; /* sync */ }).call(this)": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "version", - "range": [ - 17, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "init": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 17, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "kind": "var", - "range": [ - 13, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "trailingComments": [ - { - "type": "Block", - "value": " sync ", - "range": [ - 30, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] - } - ], - "range": [ - 11, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "property": { - "type": "Identifier", - "name": "call", - "range": [ - 44, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " sync ", - "range": [ - 30, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] - }, - "range": [ - 0, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - } - }, - "arguments": [ - { - "type": "ThisExpression", - "range": [ - 49, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 53 - } - } - } - ], - "range": [ - 0, - 54 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - } - }, - "range": [ - 0, - 54 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - } - } - ], - "range": [ - 0, - 54 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " sync ", - "range": [ - 30, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] - }, - " comment": { - "type": "Program", - "body": [], - "range": [ - 11, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " comment", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ] - }, - " comment": { - "type": "Program", - "body": [], - "range": [ - 14, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Line", - "value": " comment", - "range": [ - 3, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ] - }, - " \t /* block comment */ --> comment": { - "type": "Program", - "body": [], - "range": [ - 35, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " block comment ", - "range": [ - 3, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Line", - "value": " comment", - "range": [ - 24, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ] - }, - "/* block comment */--> comment": { - "type": "Program", - "body": [], - "range": [ - 30, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "sourceType": "script", "comments": [ - { - "type": "Block", - "value": " block comment ", - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Line", - "value": " comment", - "range": [ - 19, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ] - }, - "/* not comment*/; i-->0": { - "type": "Program", - "body": [ - { - "type": "EmptyStatement", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": ">", - "left": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "i", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "prefix": false, - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "range": [ - 18, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "range": [ - 18, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "range": [ - 16, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": ";", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "i", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "--", - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Numeric", - "value": "0", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ] - }, - "while (i-->0) {}": { - "type": "WhileStatement", - "test": { - "type": "BinaryExpression", - "operator": ">", - "left": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "i", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "prefix": false, - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json deleted file mode 100644 index 39c21c43075b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Complex-Expression.json +++ /dev/null @@ -1,397 +0,0 @@ -{ - "a || b && c | d ^ e & f == g < h >>> i + j * k": { - "type": "ExpressionStatement", - "expression": { - "type": "LogicalExpression", - "operator": "||", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "Identifier", - "name": "b", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "|", - "left": { - "type": "Identifier", - "name": "c", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "^", - "left": { - "type": "Identifier", - "name": "d", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "&", - "left": { - "type": "Identifier", - "name": "e", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "==", - "left": { - "type": "Identifier", - "name": "f", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "g", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": ">>>", - "left": { - "type": "Identifier", - "name": "h", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "i", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "j", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "right": { - "type": "Identifier", - "name": "k", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 41, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 37, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 31, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 27, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 22, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 18, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 14, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 10, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 5, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 0, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 0, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json deleted file mode 100644 index 06db73a75620..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Conditional-Operator.json +++ /dev/null @@ -1,345 +0,0 @@ -{ - "y ? 1 : 2": { - "type": "ExpressionStatement", - "expression": { - "type": "ConditionalExpression", - "test": { - "type": "Identifier", - "name": "y", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "consequent": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "alternate": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "x && y ? 1 : 2": { - "type": "ExpressionStatement", - "expression": { - "type": "ConditionalExpression", - "test": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "consequent": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "alternate": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "x = (0) ? 1 : 2": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ConditionalExpression", - "test": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "consequent": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "alternate": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 4, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json deleted file mode 100644 index 684f8147ac05..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Const-Statement.json +++ /dev/null @@ -1,370 +0,0 @@ -{ - "const x = 42": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "kind": "const", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "{ const x = 42 }": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "kind": "const", - "range": [ - 2, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "{ const x = 14, y = 3, z = 1977 }": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "Literal", - "value": 14, - "raw": "14", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "y", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "init": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "z", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "init": { - "type": "Literal", - "value": 1977, - "raw": "1977", - "range": [ - 27, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 23, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "kind": "const", - "range": [ - 2, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ], - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json deleted file mode 100644 index 2c5f7951f609..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Directive-Prolog.json +++ /dev/null @@ -1,332 +0,0 @@ -{ - "(function () { 'use\\x20strict'; with (i); }())": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "'use\\x20strict'", - "range": [ - 15, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 15, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "WithStatement", - "object": { - "type": "Identifier", - "name": "i", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "body": { - "type": "EmptyStatement", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "range": [ - 32, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 41 - } - } - } - ], - "range": [ - 13, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - "arguments": [], - "range": [ - 1, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - "range": [ - 0, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "(function () { 'use\\nstrict'; with (i); }())": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use\nstrict", - "raw": "'use\\nstrict'", - "range": [ - 15, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "WithStatement", - "object": { - "type": "Identifier", - "name": "i", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "body": { - "type": "EmptyStatement", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "range": [ - 30, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ], - "range": [ - 13, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "arguments": [], - "range": [ - 1, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - "range": [ - 0, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json deleted file mode 100644 index 4a1f85a244d8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Empty-Statement.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - ";": { - "type": "EmptyStatement", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json deleted file mode 100644 index c5cab39fbe60..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Equality-Operators.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "x == y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "==", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x != y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "!=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x === y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x !== y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "!==", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json deleted file mode 100644 index f67bb5c5e598..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Expression-Statement.json +++ /dev/null @@ -1,249 +0,0 @@ -{ - "x": { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "x, y": { - "type": "ExpressionStatement", - "expression": { - "type": "SequenceExpression", - "expressions": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "name": "y", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ], - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "\\u0061": { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "a", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "a\\u0061": { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "aa", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "\\u0061a": { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "aa", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "\\u0061a ": { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "aa", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json deleted file mode 100644 index 4592ad265c57..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Function-Definition.json +++ /dev/null @@ -1,1681 +0,0 @@ -{ - "function hello() { sayHi(); }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "hello", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "sayHi", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "arguments": [], - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 19, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - "range": [ - 17, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "function eval() { }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "eval", - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "function arguments() { }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "arguments", - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "function test(t, t) { }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "test", - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "t", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "name": "t", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "(function test(t, t) { })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "test", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "t", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "name": "t", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "function eval() { function inner() { \"use strict\" } }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "eval", - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "inner", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 37, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 49 - } - } - }, - "range": [ - 37, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - } - } - ], - "range": [ - 35, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 51 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 18, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 51 - } - } - } - ], - "range": [ - 16, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 53 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - } - }, - "function hello(a) { sayHi(); }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "hello", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "sayHi", - "range": [ - 20, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "arguments": [], - "range": [ - 20, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 20, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "range": [ - 18, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "function hello(a, b) { sayHi(); }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "hello", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "name": "b", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "sayHi", - "range": [ - 23, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "arguments": [], - "range": [ - 23, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 23, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "range": [ - 21, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "var hi = function() { sayHi() };": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "hi", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "init": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "sayHi", - "range": [ - 22, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "arguments": [], - "range": [ - 22, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 22, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ], - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 9, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 4, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "var hi = function eval() { };": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "hi", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "init": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "eval", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 9, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 4, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "var hi = function arguments() { };": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "hi", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "init": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "arguments", - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 30, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 9, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "range": [ - 4, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "var hello = function hi() { sayHi() };": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "hello", - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "hi", - "range": [ - 21, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "sayHi", - "range": [ - 28, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "arguments": [], - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 28, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ], - "range": [ - 26, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 12, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "range": [ - 4, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "(function(){})": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "function universe(__proto__) { }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "universe", - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "__proto__", - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "function test() { \"use strict\" + 42; }": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "test", - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 18, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 33, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 18, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ], - "range": [ - 16, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json deleted file mode 100644 index 0bac15ebe2af..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Grouping-Operator.json +++ /dev/null @@ -1,222 +0,0 @@ -{ - "(1) + (2 ) + 3": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "right": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "4 + 5 << (6)": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "<<", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Literal", - "value": 4, - "raw": "4", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 5, - "raw": "5", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Literal", - "value": 6, - "raw": "6", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json deleted file mode 100644 index b774be8a3c4f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/If-Statement.json +++ /dev/null @@ -1,742 +0,0 @@ -{ - "if (morning) goodMorning()": { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "morning", - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "goodMorning", - "range": [ - 13, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "arguments": [], - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "alternate": null, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "if (morning) (function(){})": { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "morning", - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 24, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 13, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "alternate": null, - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "if (morning) var x = 0;": { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "morning", - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "consequent": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "init": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 17, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "kind": "var", - "range": [ - 13, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "alternate": null, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "if (morning) function a(){}": { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "morning", - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "consequent": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "a", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 25, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 13, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "alternate": null, - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "if (morning) goodMorning(); else goodDay()": { - "type": "IfStatement", - "test": { - "type": "Identifier", - "name": "morning", - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "goodMorning", - "range": [ - 13, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "arguments": [], - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 13, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "alternate": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "goodDay", - "range": [ - 33, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - "arguments": [], - "range": [ - 33, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "range": [ - 33, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "range": [ - 0, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "if (true) that()\n; else;": { - "type": "IfStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "that", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "arguments": [], - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 10, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "alternate": { - "type": "EmptyStatement", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - "if (true) that(); else;": { - "type": "IfStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "that", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "arguments": [], - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "alternate": { - "type": "EmptyStatement", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json deleted file mode 100644 index 0b301962c156..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Invalid-syntax.json +++ /dev/null @@ -1,1334 +0,0 @@ -{ - "{": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected end of input" - }, - "}": { - "index": 0, - "lineNumber": 1, - "column": 1, - "message": "Error: Line 1: Unexpected token }" - }, - "3ea": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3in []": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3e": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3e+": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3e-": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3x": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3x0": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "0x": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "09": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "018": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "01a": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3in[]": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "0x3in[]": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\"Hello\nWorld\"": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "x\\": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "x\\u005c": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "x\\u002a": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "var x = /(s/g": { - "index": 13, - "lineNumber": 1, - "column": 14, - "message": "Error: Line 1: Invalid regular expression" - }, - "a\\u": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\\ua": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "/": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Invalid regular expression: missing /" - }, - "/test": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Invalid regular expression: missing /" - }, - "/test\n/": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Invalid regular expression: missing /" - }, - "var x = /[a-z]/\\ux": { - "index": 17, - "lineNumber": 1, - "column": 18, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "var x = /[a-z\n]/\\ux": { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Invalid regular expression: missing /" - }, - "var x = /[a-z]/\\\\ux": { - "index": 16, - "lineNumber": 1, - "column": 17, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "var x = /[P QR]/\\\\u0067": { - "index": 17, - "lineNumber": 1, - "column": 18, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "3 = 4": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "func() = 4": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "(1 + 1) = 10": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "1++": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "1--": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "++1": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "--1": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "for((1 + 1) in list) process(x);": { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Error: Line 1: Invalid left-hand side in for-in" - }, - "[": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected end of input" - }, - "[,": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected end of input" - }, - "1 + {": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Unexpected end of input" - }, - "1 + { t:t ": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Unexpected end of input" - }, - "1 + { t:t,": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Unexpected end of input" - }, - "var x = /\n/": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Invalid regular expression: missing /" - }, - "var x = \"\n": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "var if = 42": { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Error: Line 1: Unexpected token if" - }, - "i #= 42": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "i + 2 = 42": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "+i = 42": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Invalid left-hand side in assignment" - }, - "1 + (": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Unexpected end of input" - }, - "\n\n\n{": { - "index": 4, - "lineNumber": 4, - "column": 2, - "message": "Error: Line 4: Unexpected end of input" - }, - "\n/* Some multiline\ncomment */\n)": { - "index": 30, - "lineNumber": 4, - "column": 1, - "message": "Error: Line 4: Unexpected token )" - }, - "{ set 1 }": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Unexpected number" - }, - "{ get 2 }": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Unexpected number" - }, - "({ set: s(if) { } })": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Unexpected token if" - }, - "({ set s(.) { } })": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token ." - }, - "({ set s() { } })": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token )" - }, - "({ set: s() { } })": { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Error: Line 1: Unexpected token {" - }, - "({ set: s(a, b) { } })": { - "index": 16, - "lineNumber": 1, - "column": 17, - "message": "Error: Line 1: Unexpected token {" - }, - "({ get: g(d) { } })": { - "index": 13, - "lineNumber": 1, - "column": 14, - "message": "Error: Line 1: Unexpected token {" - }, - "({ get i() { }, i: 42 })": { - "index": 21, - "lineNumber": 1, - "column": 22, - "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" - }, - "({ i: 42, get i() { } })": { - "index": 21, - "lineNumber": 1, - "column": 22, - "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" - }, - "({ set i(x) { }, i: 42 })": { - "index": 22, - "lineNumber": 1, - "column": 23, - "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" - }, - "({ i: 42, set i(x) { } })": { - "index": 22, - "lineNumber": 1, - "column": 23, - "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" - }, - "({ get i() { }, get i() { } })": { - "index": 27, - "lineNumber": 1, - "column": 28, - "message": "Error: Line 1: Object literal may not have multiple get/set accessors with the same name" - }, - "({ set i(x) { }, set i(x) { } })": { - "index": 29, - "lineNumber": 1, - "column": 30, - "message": "Error: Line 1: Object literal may not have multiple get/set accessors with the same name" - }, - "function t(if) { }": { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Error: Line 1: Unexpected token if" - }, - "function t(true) { }": { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Error: Line 1: Unexpected token true" - }, - "function t(false) { }": { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Error: Line 1: Unexpected token false" - }, - "function t(null) { }": { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Error: Line 1: Unexpected token null" - }, - "function null() { }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token null" - }, - "function true() { }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token true" - }, - "function false() { }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token false" - }, - "function if() { }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token if" - }, - "a b;": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected identifier" - }, - "if.a;": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ." - }, - "a if;": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token if" - }, - "a class;": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected reserved word" - }, - "break\n": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Illegal break statement" - }, - "break 1;": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Unexpected number" - }, - "continue\n": { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "Error: Line 1: Illegal continue statement" - }, - "continue 2;": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected number" - }, - "throw": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Unexpected end of input" - }, - "throw;": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Unexpected token ;" - }, - "throw\n": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Illegal newline after throw" - }, - "for (var i, i2 in {});": { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Error: Line 1: Unexpected token in" - }, - "for ((i in {}));": { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Unexpected token )" - }, - "for (i + 1 in {});": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Invalid left-hand side in for-in" - }, - "for (+i in {});": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Invalid left-hand side in for-in" - }, - "if(false)": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected end of input" - }, - "if(false) doThis(); else": { - "index": 24, - "lineNumber": 1, - "column": 25, - "message": "Error: Line 1: Unexpected end of input" - }, - "do": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected end of input" - }, - "while(false)": { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Error: Line 1: Unexpected end of input" - }, - "for(;;)": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Unexpected end of input" - }, - "with(x)": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Unexpected end of input" - }, - "try { }": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Missing catch or finally after try" - }, - "try {} catch (42) {} ": { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Unexpected number" - }, - "try {} catch (answer()) {} ": { - "index": 20, - "lineNumber": 1, - "column": 21, - "message": "Error: Line 1: Unexpected token (" - }, - "try {} catch (-x) {} ": { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Unexpected token -" - }, - "‿ = 10": { - "index": 0, - "lineNumber": 1, - "column": 1, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "const x = 12, y;": { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Error: Line 1: Const must be initialized" - }, - "const x, y = 12;": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Const must be initialized" - }, - "const x;": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Const must be initialized" - }, - "if(true) let a = 1;": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token let" - }, - "if(true) const a = 1;": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token const" - }, - "switch (c) { default: default: }": { - "index": 30, - "lineNumber": 1, - "column": 31, - "message": "Error: Line 1: More than one default clause in switch statement" - }, - "new X().\"s\"": { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "Error: Line 1: Unexpected string" - }, - "/*": { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "/*\n\n\n": { - "index": 5, - "lineNumber": 4, - "column": 1, - "message": "Error: Line 4: Unexpected token ILLEGAL" - }, - "/**": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "/*\n\n*": { - "index": 5, - "lineNumber": 3, - "column": 2, - "message": "Error: Line 3: Unexpected token ILLEGAL" - }, - "/*hello": { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "/*hello *": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\n]": { - "index": 1, - "lineNumber": 2, - "column": 1, - "message": "Error: Line 2: Unexpected token ]" - }, - "\r]": { - "index": 1, - "lineNumber": 2, - "column": 1, - "message": "Error: Line 2: Unexpected token ]" - }, - "\r\n]": { - "index": 2, - "lineNumber": 2, - "column": 1, - "message": "Error: Line 2: Unexpected token ]" - }, - "\n\r]": { - "index": 2, - "lineNumber": 3, - "column": 1, - "message": "Error: Line 3: Unexpected token ]" - }, - "//\r\n]": { - "index": 4, - "lineNumber": 2, - "column": 1, - "message": "Error: Line 2: Unexpected token ]" - }, - "//\n\r]": { - "index": 4, - "lineNumber": 3, - "column": 1, - "message": "Error: Line 3: Unexpected token ]" - }, - "/a\\\n/": { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Error: Line 1: Invalid regular expression: missing /" - }, - "//\r \n]": { - "index": 5, - "lineNumber": 3, - "column": 1, - "message": "Error: Line 3: Unexpected token ]" - }, - "/*\r\n*/]": { - "index": 6, - "lineNumber": 2, - "column": 3, - "message": "Error: Line 2: Unexpected token ]" - }, - "/*\n\r*/]": { - "index": 6, - "lineNumber": 3, - "column": 3, - "message": "Error: Line 3: Unexpected token ]" - }, - "/*\r \n*/]": { - "index": 7, - "lineNumber": 3, - "column": 3, - "message": "Error: Line 3: Unexpected token ]" - }, - "\\\\": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\\u005c": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\\x": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\\u0000": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "‌ = []": { - "index": 0, - "lineNumber": 1, - "column": 1, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "‍ = []": { - "index": 0, - "lineNumber": 1, - "column": 1, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\"\\": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "\"\\u": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - "try { } catch() {}": { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Unexpected token )" - }, - "return": { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Illegal return statement" - }, - "break": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Illegal break statement" - }, - "continue": { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "Error: Line 1: Illegal continue statement" - }, - "switch (x) { default: continue; }": { - "index": 31, - "lineNumber": 1, - "column": 32, - "message": "Error: Line 1: Illegal continue statement" - }, - "do { x } *": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Unexpected token *" - }, - "while (true) { break x; }": { - "index": 22, - "lineNumber": 1, - "column": 23, - "message": "Error: Line 1: Undefined label 'x'" - }, - "while (true) { continue x; }": { - "index": 25, - "lineNumber": 1, - "column": 26, - "message": "Error: Line 1: Undefined label 'x'" - }, - "x: while (true) { (function () { break x; }); }": { - "index": 40, - "lineNumber": 1, - "column": 41, - "message": "Error: Line 1: Undefined label 'x'" - }, - "x: while (true) { (function () { continue x; }); }": { - "index": 43, - "lineNumber": 1, - "column": 44, - "message": "Error: Line 1: Undefined label 'x'" - }, - "x: while (true) { (function () { break; }); }": { - "index": 39, - "lineNumber": 1, - "column": 40, - "message": "Error: Line 1: Illegal break statement" - }, - "x: while (true) { (function () { continue; }); }": { - "index": 42, - "lineNumber": 1, - "column": 43, - "message": "Error: Line 1: Illegal continue statement" - }, - "x: while (true) { x: while (true) { } }": { - "index": 20, - "lineNumber": 1, - "column": 21, - "message": "Error: Line 1: Label 'x' has already been declared" - }, - "(function () { 'use strict'; delete i; }())": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Delete of an unqualified identifier in strict mode." - }, - "(function () { 'use strict'; with (i); }())": { - "index": 29, - "lineNumber": 1, - "column": 30, - "message": "Error: Line 1: Strict mode code may not include a with statement" - }, - "function hello() {'use strict'; ({ i: 42, i: 42 }) }": { - "index": 47, - "lineNumber": 1, - "column": 48, - "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" - }, - "function hello() {'use strict'; ({ hasOwnProperty: 42, hasOwnProperty: 42 }) }": { - "index": 73, - "lineNumber": 1, - "column": 74, - "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" - }, - "function hello() {'use strict'; var eval = 10; }": { - "index": 40, - "lineNumber": 1, - "column": 41, - "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; var arguments = 10; }": { - "index": 45, - "lineNumber": 1, - "column": 46, - "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; try { } catch (eval) { } }": { - "index": 51, - "lineNumber": 1, - "column": 52, - "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; try { } catch (arguments) { } }": { - "index": 56, - "lineNumber": 1, - "column": 57, - "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; eval = 10; }": { - "index": 32, - "lineNumber": 1, - "column": 33, - "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" - }, - "function hello() {'use strict'; arguments = 10; }": { - "index": 32, - "lineNumber": 1, - "column": 33, - "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" - }, - "function hello() {'use strict'; ++eval; }": { - "index": 38, - "lineNumber": 1, - "column": 39, - "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; --eval; }": { - "index": 38, - "lineNumber": 1, - "column": 39, - "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; ++arguments; }": { - "index": 43, - "lineNumber": 1, - "column": 44, - "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; --arguments; }": { - "index": 43, - "lineNumber": 1, - "column": 44, - "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; eval++; }": { - "index": 36, - "lineNumber": 1, - "column": 37, - "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; eval--; }": { - "index": 36, - "lineNumber": 1, - "column": 37, - "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; arguments++; }": { - "index": 41, - "lineNumber": 1, - "column": 42, - "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; arguments--; }": { - "index": 41, - "lineNumber": 1, - "column": 42, - "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" - }, - "function hello() {'use strict'; function eval() { } }": { - "index": 41, - "lineNumber": 1, - "column": 42, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; function arguments() { } }": { - "index": 41, - "lineNumber": 1, - "column": 42, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "function eval() {'use strict'; }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "function arguments() {'use strict'; }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; (function eval() { }()) }": { - "index": 42, - "lineNumber": 1, - "column": 43, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; (function arguments() { }()) }": { - "index": 42, - "lineNumber": 1, - "column": 43, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "(function eval() {'use strict'; })()": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "(function arguments() {'use strict'; })()": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "function hello() {'use strict'; ({ s: function eval() { } }); }": { - "index": 47, - "lineNumber": 1, - "column": 48, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "(function package() {'use strict'; })()": { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() {'use strict'; ({ i: 10, set s(eval) { } }); }": { - "index": 48, - "lineNumber": 1, - "column": 49, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "function hello() {'use strict'; ({ set s(eval) { } }); }": { - "index": 41, - "lineNumber": 1, - "column": 42, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "function hello() {'use strict'; ({ s: function s(eval) { } }); }": { - "index": 49, - "lineNumber": 1, - "column": 50, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "function hello(eval) {'use strict';}": { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "function hello(arguments) {'use strict';}": { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "function hello() { 'use strict'; function inner(eval) {} }": { - "index": 48, - "lineNumber": 1, - "column": 49, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "function hello() { 'use strict'; function inner(arguments) {} }": { - "index": 48, - "lineNumber": 1, - "column": 49, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - " \"\\1\"; 'use strict';": { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { 'use strict'; \"\\1\"; }": { - "index": 33, - "lineNumber": 1, - "column": 34, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { 'use strict'; 021; }": { - "index": 33, - "lineNumber": 1, - "column": 34, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { 'use strict'; ({ \"\\1\": 42 }); }": { - "index": 36, - "lineNumber": 1, - "column": 37, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { 'use strict'; ({ 021: 42 }); }": { - "index": 36, - "lineNumber": 1, - "column": 37, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { \"octal directive\\1\"; \"use strict\"; }": { - "index": 19, - "lineNumber": 1, - "column": 20, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { \"octal directive\\1\"; \"octal directive\\2\"; \"use strict\"; }": { - "index": 19, - "lineNumber": 1, - "column": 20, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { \"use strict\"; function inner() { \"octal directive\\1\"; } }": { - "index": 52, - "lineNumber": 1, - "column": 53, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - }, - "function hello() { \"use strict\"; var implements; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var interface; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var package; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var private; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var protected; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var public; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var static; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var yield; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello() { \"use strict\"; var let; }": { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function hello(static) { \"use strict\"; }": { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function static() { \"use strict\"; }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function eval(a) { \"use strict\"; }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "function arguments(a) { \"use strict\"; }": { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - }, - "var yield": { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Error: Line 1: Unexpected token yield" - }, - "var let": { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Error: Line 1: Unexpected token let" - }, - "\"use strict\"; function static() { }": { - "index": 23, - "lineNumber": 1, - "column": 24, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function a(t, t) { \"use strict\"; }": { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" - }, - "function a(eval) { \"use strict\"; }": { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "function a(package) { \"use strict\"; }": { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "function a() { \"use strict\"; function b(t, t) { }; }": { - "index": 43, - "lineNumber": 1, - "column": 44, - "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" - }, - "(function a(t, t) { \"use strict\"; })": { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" - }, - "function a() { \"use strict\"; (function b(t, t) { }); }": { - "index": 44, - "lineNumber": 1, - "column": 45, - "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" - }, - "(function a(eval) { \"use strict\"; })": { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - }, - "(function a(package) { \"use strict\"; })": { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Error: Line 1: Use of future reserved word in strict mode" - }, - "__proto__: __proto__: 42;": { - "index": 21, - "lineNumber": 1, - "column": 22, - "message": "Error: Line 1: Label '__proto__' has already been declared" - }, - "\"use strict\"; function t(__proto__, __proto__) { }": { - "index": 36, - "lineNumber": 1, - "column": 37, - "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" - }, - "\"use strict\"; x = { __proto__: 42, __proto__: 43 }": { - "index": 48, - "lineNumber": 1, - "column": 49, - "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" - }, - "\"use strict\"; x = { get __proto__() { }, __proto__: 43 }": { - "index": 54, - "lineNumber": 1, - "column": 55, - "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" - }, - "var": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected end of input" - }, - "let": { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Unexpected end of input" - }, - "const": { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Error: Line 1: Unexpected end of input" - }, - "{ ; ; ": { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "Error: Line 1: Unexpected end of input" - }, - "function t() { ; ; ": { - "index": 21, - "lineNumber": 1, - "column": 22, - "message": "Error: Line 1: Unexpected end of input" - }, - "left = (aSize.width/2) - ()": { - "index": 26, - "lineNumber": 1, - "column": 27, - "message": "Error: Line 1: Unexpected token )" - }, - "switch(x) { case 'x': break;\n": { - "index": 31, - "lineNumber": 2, - "column": 1, - "message": "Error: Line 2: Unexpected end of input" - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json deleted file mode 100644 index c3861d3ac204..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Iteration-Statements.json +++ /dev/null @@ -1,2684 +0,0 @@ -{ - "do keep(); while (true)": { - "type": "DoWhileStatement", - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "keep", - "range": [ - 3, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "arguments": [], - "range": [ - 3, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 3, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "do keep(); while (true);": { - "type": "DoWhileStatement", - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "keep", - "range": [ - 3, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "arguments": [], - "range": [ - 3, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 3, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "do { x++; y--; } while (x < 10)": { - "type": "DoWhileStatement", - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "prefix": false, - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 5, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "y", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "prefix": false, - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "range": [ - 3, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 28, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "{ do { } while (false) false }": { - "type": "BlockStatement", - "body": [ - { - "type": "DoWhileStatement", - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "test": { - "type": "Literal", - "value": false, - "raw": "false", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 2, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": false, - "raw": "false", - "range": [ - 23, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "do that();while (true)": { - "type": "DoWhileStatement", - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "that", - "range": [ - 3, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "arguments": [], - "range": [ - 3, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 3, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "do that()\n;while (true)": { - "type": "DoWhileStatement", - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "that", - "range": [ - 3, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "arguments": [], - "range": [ - 3, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 3, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "while (true) doSomething()": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doSomething", - "range": [ - 13, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "arguments": [], - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "while (x < 10) { x++; y--; }": { - "type": "WhileStatement", - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 7, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "prefix": false, - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "y", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "prefix": false, - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 22, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "range": [ - 15, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "for(;;);": { - "type": "ForStatement", - "init": null, - "test": null, - "update": null, - "body": { - "type": "EmptyStatement", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "for(;;){}": { - "type": "ForStatement", - "init": null, - "test": null, - "update": null, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 7, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "for(x = 0;;);": { - "type": "ForStatement", - "init": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "test": null, - "update": null, - "body": { - "type": "EmptyStatement", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "for(var x = 0;;);": { - "type": "ForStatement", - "init": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "kind": "var", - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "test": null, - "update": null, - "body": { - "type": "EmptyStatement", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "for(let x = 0;;);": { - "type": "ForStatement", - "init": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "kind": "let", - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "test": null, - "update": null, - "body": { - "type": "EmptyStatement", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "for(var x = 0, y = 1;;);": { - "type": "ForStatement", - "init": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "y", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "init": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "kind": "var", - "range": [ - 4, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "test": null, - "update": null, - "body": { - "type": "EmptyStatement", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "for(x = 0; x < 42;);": { - "type": "ForStatement", - "init": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 11, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "update": null, - "body": { - "type": "EmptyStatement", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "for(x = 0; x < 42; x++);": { - "type": "ForStatement", - "init": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 11, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "update": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "prefix": false, - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "body": { - "type": "EmptyStatement", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "for(x = 0; x < 42; x++) process(x);": { - "type": "ForStatement", - "init": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "test": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "right": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 11, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "update": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "prefix": false, - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "process", - "range": [ - 24, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "range": [ - 24, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 24, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "for(x in list) process(x);": { - "type": "ForInStatement", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "list", - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "process", - "range": [ - 15, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "range": [ - 15, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 15, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "each": false, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "for (var x in list) process(x);": { - "type": "ForInStatement", - "left": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "init": null, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "kind": "var", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "list", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "process", - "range": [ - 20, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "range": [ - 20, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "each": false, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "for (var x in list) process(x);": { - "type": "ForInStatement", - "left": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "init": null, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "kind": "var", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "list", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "process", - "range": [ - 20, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "range": [ - 20, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "each": false, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "for (let x in list) process(x);": { - "type": "ForInStatement", - "left": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "init": null, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "kind": "let", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "list", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "process", - "range": [ - 20, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "range": [ - 20, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "each": false, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json deleted file mode 100644 index a37d11ddf95c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Labelled-Statements.json +++ /dev/null @@ -1,268 +0,0 @@ -{ - "start: for (;;) break start": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "start", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "body": { - "type": "ForStatement", - "init": null, - "test": null, - "update": null, - "body": { - "type": "BreakStatement", - "label": { - "type": "Identifier", - "name": "start", - "range": [ - 22, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 16, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 7, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "start: while (true) break start": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "start", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "body": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "body": { - "type": "BreakStatement", - "label": { - "type": "Identifier", - "name": "start", - "range": [ - 26, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 7, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "__proto__: test": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "__proto__", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "Identifier", - "name": "test", - "range": [ - 11, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 11, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json deleted file mode 100644 index 8b23bae1d9b7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Left-Hand-Side-Expression.json +++ /dev/null @@ -1,2188 +0,0 @@ -{ - "new Button": { - "type": "ExpressionStatement", - "expression": { - "type": "NewExpression", - "callee": { - "type": "Identifier", - "name": "Button", - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "arguments": [], - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "new Button()": { - "type": "ExpressionStatement", - "expression": { - "type": "NewExpression", - "callee": { - "type": "Identifier", - "name": "Button", - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "arguments": [], - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "new new foo": { - "type": "ExpressionStatement", - "expression": { - "type": "NewExpression", - "callee": { - "type": "NewExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "arguments": [], - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "arguments": [], - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "new new foo()": { - "type": "ExpressionStatement", - "expression": { - "type": "NewExpression", - "callee": { - "type": "NewExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "arguments": [], - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "arguments": [], - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "new foo().bar()": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "NewExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "arguments": [], - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "property": { - "type": "Identifier", - "name": "bar", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "arguments": [], - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "new foo[bar]": { - "type": "ExpressionStatement", - "expression": { - "type": "NewExpression", - "callee": { - "type": "MemberExpression", - "computed": true, - "object": { - "type": "Identifier", - "name": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "bar", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 4, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "arguments": [], - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "new foo.bar()": { - "type": "ExpressionStatement", - "expression": { - "type": "NewExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "bar", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "arguments": [], - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "( new foo).bar()": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "NewExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "arguments": [], - "range": [ - 2, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "property": { - "type": "Identifier", - "name": "bar", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "arguments": [], - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "foo(bar, baz)": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "bar", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "name": "baz", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "( foo )()": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "arguments": [], - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "universe.milkyway": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "milkyway", - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "universe.milkyway.solarsystem": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "milkyway", - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "property": { - "type": "Identifier", - "name": "solarsystem", - "range": [ - 18, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "universe.milkyway.solarsystem.Earth": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "milkyway", - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "property": { - "type": "Identifier", - "name": "solarsystem", - "range": [ - 18, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "property": { - "type": "Identifier", - "name": "Earth", - "range": [ - 30, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "universe[galaxyName, otherUselessName]": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": true, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "SequenceExpression", - "expressions": [ - { - "type": "Identifier", - "name": "galaxyName", - "range": [ - 9, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Identifier", - "name": "otherUselessName", - "range": [ - 21, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ], - "range": [ - 9, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "universe[galaxyName]": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": true, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "galaxyName", - "range": [ - 9, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "universe[42].galaxies": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": true, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "galaxies", - "range": [ - 13, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "universe(42).galaxies": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "arguments": [ - { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "galaxies", - "range": [ - 13, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "universe(42).galaxies(14, 3, 77).milkyway": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "arguments": [ - { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "galaxies", - "range": [ - 13, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "arguments": [ - { - "type": "Literal", - "value": 14, - "raw": "14", - "range": [ - 22, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Literal", - "value": 77, - "raw": "77", - "range": [ - 29, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "property": { - "type": "Identifier", - "name": "milkyway", - "range": [ - 33, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "earth.asia.Indonesia.prepareForElection(2014)": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "earth", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "property": { - "type": "Identifier", - "name": "asia", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "Indonesia", - "range": [ - 11, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "property": { - "type": "Identifier", - "name": "prepareForElection", - "range": [ - 21, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "arguments": [ - { - "type": "Literal", - "value": 2014, - "raw": "2014", - "range": [ - 40, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - } - } - } - ], - "range": [ - 0, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - "range": [ - 0, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - "universe.if": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "if", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "universe.true": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "true", - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "universe.false": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "false", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "universe.null": { - "type": "ExpressionStatement", - "expression": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "universe", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "null", - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json deleted file mode 100644 index 40a06abf6a0c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Let-Statement.json +++ /dev/null @@ -1,427 +0,0 @@ -{ - "let x": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": null, - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "kind": "let", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "{ let x }": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": null, - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "kind": "let", - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "{ let x = 42 }": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "kind": "let", - "range": [ - 2, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "{ let x = 14, y = 3, z = 1977 }": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": { - "type": "Literal", - "value": 14, - "raw": "14", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "y", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "init": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "z", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "init": { - "type": "Literal", - "value": 1977, - "raw": "1977", - "range": [ - 25, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 21, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "kind": "let", - "range": [ - 2, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ], - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json deleted file mode 100644 index 7b64264e748f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Multiplicative-Operators.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "x * y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x / y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "/", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x % y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "%", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x ** y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "**", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json deleted file mode 100644 index 8ff062fecb8c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Numeric-Literals.json +++ /dev/null @@ -1,780 +0,0 @@ -{ - "0": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "3": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 0, - 1 - ] - }, - "range": [ - 0, - 1 - ] - } - ], - "range": [ - 0, - 1 - ], - "sourceType": "script", "tokens": [ - { - "type": "Numeric", - "value": "3", - "range": [ - 0, - 1 - ] - } - ] - }, - "5": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 5, - "raw": "5", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Numeric", - "value": "5", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - } - ] - }, - "42": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - ".14": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 0.14, - "raw": ".14", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "3.14159": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 3.14159, - "raw": "3.14159", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "6.02214179e+23": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 6.02214179e+23, - "raw": "6.02214179e+23", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "1.492417830e-10": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 1.49241783e-10, - "raw": "1.492417830e-10", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "0x0": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 0, - "raw": "0x0", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "0x0;": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 0, - "raw": "0x0", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "0e+100 ": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 0, - "raw": "0e+100", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "0e+100": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 0, - "raw": "0e+100", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "0xabc": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 2748, - "raw": "0xabc", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "0xdef": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 3567, - "raw": "0xdef", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "0X1A": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 26, - "raw": "0X1A", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "0x10": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 16, - "raw": "0x10", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "0x100": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 256, - "raw": "0x100", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "0X04": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 4, - "raw": "0X04", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "02": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 2, - "raw": "02", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "012": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 10, - "raw": "012", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "0012": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 10, - "raw": "0012", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json deleted file mode 100644 index d38fe7f111f1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Object-Initializer.json +++ /dev/null @@ -1,4950 +0,0 @@ -{ - "x = {}": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x = { }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "x = { answer: 42 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "answer", - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "kind": "init", - "range": [ - 6, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "x = { if: 42 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "if", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "kind": "init", - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "x = { true: 42 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "true", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "kind": "init", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "x = { false: 42 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "false", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 13, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "kind": "init", - "range": [ - 6, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "x = { null: 42 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "null", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "kind": "init", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "x = { \"answer\": 42 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": "answer", - "raw": "\"answer\"", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "kind": "init", - "range": [ - 6, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "x = { x: 1, x: 2 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "value": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "kind": "init", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "method": false, - "shorthand": false, - "computed": false - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "value": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "kind": "init", - "range": [ - 12, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "x = { get width() { return m_width } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "width", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "m_width", - "range": [ - 27, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 20, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "kind": "get", - "range": [ - 6, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "x = { get undef() {} }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "undef", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "kind": "get", - "range": [ - 6, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "x = { get if() {} }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "if", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 12, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "kind": "get", - "range": [ - 6, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "x = { get true() {} }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "true", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "kind": "get", - "range": [ - 6, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "x = { get false() {} }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "false", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "kind": "get", - "range": [ - 6, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "x = { get null() {} }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "null", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "kind": "get", - "range": [ - 6, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "x = { get \"undef\"() {} }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": "undef", - "raw": "\"undef\"", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 20, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 17, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "kind": "get", - "range": [ - 6, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "x = { get 10() {} }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 12, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "kind": "get", - "range": [ - 6, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "x = { set width(w) { m_width = w } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "width", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "w", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_width", - "range": [ - 21, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "right": { - "type": "Identifier", - "name": "w", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 21, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 21, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "range": [ - 19, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "kind": "set", - "range": [ - 6, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "x = { set if(w) { m_if = w } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "if", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "w", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_if", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "right": { - "type": "Identifier", - "name": "w", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 18, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - "range": [ - 16, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 12, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "kind": "set", - "range": [ - 6, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "x = { set true(w) { m_true = w } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "true", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "w", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_true", - "range": [ - 20, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "right": { - "type": "Identifier", - "name": "w", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 20, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "range": [ - 18, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "kind": "set", - "range": [ - 6, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "x = { set false(w) { m_false = w } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "false", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "w", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_false", - "range": [ - 21, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "right": { - "type": "Identifier", - "name": "w", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 21, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 21, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "range": [ - 19, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "kind": "set", - "range": [ - 6, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "x = { set null(w) { m_null = w } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "null", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "w", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_null", - "range": [ - 20, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "right": { - "type": "Identifier", - "name": "w", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 20, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "range": [ - 18, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "kind": "set", - "range": [ - 6, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "x = { set \"null\"(w) { m_null = w } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": "null", - "raw": "\"null\"", - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "w", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_null", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "right": { - "type": "Identifier", - "name": "w", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 22, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 22, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "range": [ - 20, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 16, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "kind": "set", - "range": [ - 6, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "x = { set 10(w) { m_null = w } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "w", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_null", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "right": { - "type": "Identifier", - "name": "w", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 18, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 18, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "range": [ - 16, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 12, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "kind": "set", - "range": [ - 6, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "x = { get: 42 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "get", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "kind": "init", - "range": [ - 6, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "x = { set: 43 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "set", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "value": { - "type": "Literal", - "value": 43, - "raw": "43", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "kind": "init", - "range": [ - 6, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "x = { __proto__: 2 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "__proto__", - "range": [ - 6, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "kind": "init", - "range": [ - 6, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "x = {\"__proto__\": 2 }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": "__proto__", - "raw": "\"__proto__\"", - "range": [ - 5, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "value": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "kind": "init", - "range": [ - 5, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "x = { get width() { return m_width }, set width(width) { m_width = width; } }": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "width", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "m_width", - "range": [ - 27, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 20, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "kind": "get", - "range": [ - 6, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "method": false, - "shorthand": false, - "computed": false - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "width", - "range": [ - 42, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "width", - "range": [ - 48, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 53 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "m_width", - "range": [ - 57, - 64 - ], - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 64 - } - } - }, - "right": { - "type": "Identifier", - "name": "width", - "range": [ - 67, - 72 - ], - "loc": { - "start": { - "line": 1, - "column": 67 - }, - "end": { - "line": 1, - "column": 72 - } - } - }, - "range": [ - 57, - 72 - ], - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 72 - } - } - }, - "range": [ - 57, - 73 - ], - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 73 - } - } - } - ], - "range": [ - 55, - 75 - ], - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 75 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 47, - 75 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 75 - } - } - }, - "kind": "set", - "range": [ - 38, - 75 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 75 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 4, - 77 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 77 - } - } - }, - "range": [ - 0, - 77 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - } - }, - "range": [ - 0, - 77 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 77 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json deleted file mode 100644 index 8f241ff50dc3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Postfix-Expressions.json +++ /dev/null @@ -1,326 +0,0 @@ -{ - "x++": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "prefix": false, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "x--": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "prefix": false, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "eval++": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "eval", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "prefix": false, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "eval--": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "eval", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "prefix": false, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "arguments++": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "arguments", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "prefix": false, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "arguments--": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "arguments", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "prefix": false, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json deleted file mode 100644 index 86c0681f08fa..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Primary-Expression.json +++ /dev/null @@ -1,335 +0,0 @@ -{ - "this\n": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ThisExpression", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - } - } - ], - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "this", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ] - }, - "null\n": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - } - } - ], - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Null", - "value": "null", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ] - }, - "\n 42\n\n": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 5, - 9 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 0 - } - } - } - ], - "range": [ - 5, - 9 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 0 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Numeric", - "value": "42", - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 6 - } - } - } - ] - }, - "(1 + 2 ) * 3": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 1, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json deleted file mode 100644 index da59d8c05657..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Regular-Expression-Literals.json +++ /dev/null @@ -1,1215 +0,0 @@ -{ - "var x = /[a-z]/i": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/[a-z]/i", - "raw": "/[a-z]/i", - "regex": { - "pattern": "[a-z]", - "flags": "i" - }, - "range": [ - 8, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 4, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "RegularExpression", - "value": "/[a-z]/i", - "regex": { - "pattern": "[a-z]", - "flags": "i" - }, - "range": [ - 8, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - }, - "var x = /[x-z]/i": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ] - }, - "init": { - "type": "Literal", - "value": "/[x-z]/i", - "raw": "/[x-z]/i", - "regex": { - "pattern": "[x-z]", - "flags": "i" - }, - "range": [ - 8, - 16 - ] - }, - "range": [ - 4, - 16 - ] - } - ], - "kind": "var", - "range": [ - 0, - 16 - ] - } - ], - "range": [ - 0, - 16 - ], - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ] - }, - { - "type": "RegularExpression", - "value": "/[x-z]/i", - "regex": { - "pattern": "[x-z]", - "flags": "i" - }, - "range": [ - 8, - 16 - ] - } - ] - }, - "var x = /[a-c]/i": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/[a-c]/i", - "raw": "/[a-c]/i", - "regex": { - "pattern": "[a-c]", - "flags": "i" - }, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "kind": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "RegularExpression", - "value": "/[a-c]/i", - "regex": { - "pattern": "[a-c]", - "flags": "i" - }, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] - }, - "var x = /[P QR]/i": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/[P QR]/i", - "raw": "/[P QR]/i", - "regex": { - "pattern": "[P QR]", - "flags": "i" - }, - "range": [ - 8, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "RegularExpression", - "value": "/[P QR]/i", - "regex": { - "pattern": "[P QR]", - "flags": "i" - }, - "range": [ - 8, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ] - }, - "var x = /[\\]/]/": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/[\\]/]/", - "raw": "/[\\]/]/", - "regex": { - "pattern": "[\\]/]", - "flags": "" - }, - "range": [ - 8, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 4, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "RegularExpression", - "value": "/[\\]/]/", - "regex": { - "pattern": "[\\]/]", - "flags": "" - }, - "range": [ - 8, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] - }, - "var x = /foo\\/bar/": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/foo\\/bar/", - "raw": "/foo\\/bar/", - "regex": { - "pattern": "foo\\/bar", - "flags": "" - }, - "range": [ - 8, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 4, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "RegularExpression", - "value": "/foo\\/bar/", - "regex": { - "pattern": "foo\\/bar", - "flags": "" - }, - "range": [ - 8, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ] - }, - "var x = /=([^=\\s])+/g": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/=([^=\\s])+/g", - "raw": "/=([^=\\s])+/g", - "regex": { - "pattern": "=([^=\\s])+", - "flags": "g" - }, - "range": [ - 8, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 4, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "sourceType": "script", "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "RegularExpression", - "value": "/=([^=\\s])+/g", - "regex": { - "pattern": "=([^=\\s])+", - "flags": "g" - }, - "range": [ - 8, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] - }, - "var x = /42/g.test": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Literal", - "value": "/42/g", - "raw": "/42/g", - "regex": { - "pattern": "42", - "flags": "g" - }, - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "property": { - "type": "Identifier", - "name": "test", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 8, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 4, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json deleted file mode 100644 index d09a5aef8424..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Relational-Operators.json +++ /dev/null @@ -1,535 +0,0 @@ -{ - "x < y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x > y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": ">", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "x <= y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "<=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x >= y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": ">=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x in y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "in", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "x instanceof y": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "instanceof", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "x < y < z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json deleted file mode 100644 index 00a98c0352a9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Source-elements.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "": { - "type": "Program", - "body": [], - "range": [ - 0, - 0 - ], - "loc": { - "start": { - "line": 0, - "column": 0 - }, - "end": { - "line": 0, - "column": 0 - } - }, - "sourceType": "script", "tokens": [] - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json deleted file mode 100644 index f3f84d7c93aa..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Source-option.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "x + y - z": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "-", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "source": "42.js" - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - }, - "source": "42.js" - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - }, - "source": "42.js" - } - }, - "right": { - "type": "Identifier", - "name": "z", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - }, - "source": "42.js" - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "source": "42.js" - } - }, - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - }, - "source": "42.js" - } - }, - "a + (b < (c * d)) + e": { - "type": "ExpressionStatement", - "expression": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - }, - "source": "42.js" - } - }, - "right": { - "type": "BinaryExpression", - "operator": "<", - "left": { - "type": "Identifier", - "name": "b", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - }, - "source": "42.js" - } - }, - "right": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "c", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - }, - "source": "42.js" - } - }, - "right": { - "type": "Identifier", - "name": "d", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - }, - "source": "42.js" - } - }, - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - }, - "source": "42.js" - } - }, - "range": [ - 5, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 16 - }, - "source": "42.js" - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - }, - "source": "42.js" - } - }, - "right": { - "type": "Identifier", - "name": "e", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - }, - "source": "42.js" - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - }, - "source": "42.js" - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - }, - "source": "42.js" - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json b/packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json deleted file mode 100644 index 9617d9cb805e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/String-Literals.json +++ /dev/null @@ -1,686 +0,0 @@ -{ - "\"Hello\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello", - "raw": "\"Hello\"", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "\n\r\t\u000b\b\f\\'\"\u0000", - "raw": "\"\\n\\r\\t\\v\\b\\f\\\\\\'\\\"\\0\"", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "\"\\u0061\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "a", - "raw": "\"\\u0061\"", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "\"\\x61\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "a", - "raw": "\"\\x61\"", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "\"\\u00\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "u00", - "raw": "\"\\u00\"", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "\"\\xt\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "xt", - "raw": "\"\\xt\"", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "\"Hello\\nworld\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello\nworld", - "raw": "\"Hello\\nworld\"", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "\"Hello\\\nworld\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Helloworld", - "raw": "\"Hello\\\nworld\"", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "\"Hello\\02World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello\u0002World", - "raw": "\"Hello\\02World\"", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "\"Hello\\012World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello\nWorld", - "raw": "\"Hello\\012World\"", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "\"Hello\\122World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "HelloRWorld", - "raw": "\"Hello\\122World\"", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "\"Hello\\0122World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello\n2World", - "raw": "\"Hello\\0122World\"", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "\"Hello\\312World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "HelloÊWorld", - "raw": "\"Hello\\312World\"", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "\"Hello\\412World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello!2World", - "raw": "\"Hello\\412World\"", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "\"Hello\\812World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello812World", - "raw": "\"Hello\\812World\"", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "\"Hello\\712World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello92World", - "raw": "\"Hello\\712World\"", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "\"Hello\\0World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello\u0000World", - "raw": "\"Hello\\0World\"", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "\"Hello\\\r\nworld\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Helloworld", - "raw": "\"Hello\\\r\nworld\"", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - "\"Hello\\1World\"": { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "Hello\u0001World", - "raw": "\"Hello\\1World\"", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json deleted file mode 100644 index 06400daa5f64..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Tokenize.json +++ /dev/null @@ -1,1277 +0,0 @@ -{ - "tokenize(/42/)": [ - { - "type": "Identifier", - "value": "tokenize", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "RegularExpression", - "value": "/42/", - "regex": { - "pattern": "42", - "flags": "" - }, - "range": [ - 9, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "if (false) { /42/ }": [ - { - "type": "Keyword", - "value": "if", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "RegularExpression", - "value": "/42/", - "regex": { - "pattern": "42", - "flags": "" - }, - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "with (false) /42/": [ - { - "type": "Keyword", - "value": "with", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "RegularExpression", - "value": "/42/", - "regex": { - "pattern": "42", - "flags": "" - }, - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "(false) /42/": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 1, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Numeric", - "value": "42", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "function f(){} /42/": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "RegularExpression", - "value": "/42/", - "regex": { - "pattern": "42", - "flags": "" - }, - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "function(){} /42": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Numeric", - "value": "42", - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "{} /42": [ - { - "type": "Punctuator", - "value": "{", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Numeric", - "value": "42", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "[function(){} /42]": [ - { - "type": "Punctuator", - "value": "[", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 1, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Numeric", - "value": "42", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - ";function f(){} /42/": [ - { - "type": "Punctuator", - "value": ";", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 1, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "RegularExpression", - "value": "/42/", - "regex": { - "pattern": "42", - "flags": "" - }, - "range": [ - 16, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "void /42/": [ - { - "type": "Keyword", - "value": "void", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "RegularExpression", - "value": "/42/", - "regex": { - "pattern": "42", - "flags": "" - }, - "range": [ - 5, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "/42/": [ - { - "type": "RegularExpression", - "value": "/42/", - "regex": { - "pattern": "42", - "flags": "" - }, - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ], - "foo[/42]": [ - { - "type": "Identifier", - "value": "foo", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ], - "[a] / b": [ - { - "type": "Punctuator", - "value": "[", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "": [], - "/42": { - "tokenize": true, - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Invalid regular expression: missing /" - }, - "foo[/42": { - "tokenize": true, - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Error: Line 1: Invalid regular expression: missing /" - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json deleted file mode 100644 index 44b2f96108c9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json +++ /dev/null @@ -1,6139 +0,0 @@ -{ - "return": { - "type": "Program", - "body": [ - { - "type": "ReturnStatement", - "argument": null, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "sourceType": "script", "errors": [ - { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Illegal return statement" - } - ] - }, - "(function () { 'use strict'; with (i); }())": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "'use strict'", - "range": [ - 15, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 15, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "WithStatement", - "object": { - "type": "Identifier", - "name": "i", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "body": { - "type": "EmptyStatement", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 29, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - ], - "range": [ - 13, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - "arguments": [], - "range": [ - 1, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - } - } - ], - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "sourceType": "script", "errors": [ - { - "index": 29, - "lineNumber": 1, - "column": 30, - "message": "Error: Line 1: Strict mode code may not include a with statement" - } - ] - }, - "(function () { 'use strict'; 021 }())": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "'use strict'", - "range": [ - 15, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 15, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 17, - "raw": "021", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 29, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "range": [ - 13, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "arguments": [], - "range": [ - 1, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ], - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "sourceType": "script", "errors": [ - { - "index": 29, - "lineNumber": 1, - "column": 30, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - } - ] - }, - "\"use strict\"; delete x": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "delete", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "prefix": true, - "range": [ - 14, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 14, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "sourceType": "script", "errors": [ - { - "index": 22, - "lineNumber": 1, - "column": 23, - "message": "Error: Line 1: Delete of an unqualified identifier in strict mode." - } - ] - }, - "\"use strict\"; try {} catch (eval) {}": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "eval", - "range": [ - 28, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 21, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "finalizer": null, - "range": [ - 14, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ], - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "sourceType": "script", "errors": [ - { - "index": 32, - "lineNumber": 1, - "column": 33, - "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; try {} catch (arguments) {}": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "arguments", - "range": [ - 28, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 39, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "range": [ - 21, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "finalizer": null, - "range": [ - 14, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 41 - } - } - } - ], - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "sourceType": "script", "errors": [ - { - "index": 37, - "lineNumber": 1, - "column": 38, - "message": "Error: Line 1: Catch variable may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; var eval;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "eval", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "init": null, - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "kind": "var", - "range": [ - 14, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "sourceType": "script", "errors": [ - { - "index": 22, - "lineNumber": 1, - "column": 23, - "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; var arguments;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "arguments", - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "init": null, - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - "kind": "var", - "range": [ - 14, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "sourceType": "script", "errors": [ - { - "index": 27, - "lineNumber": 1, - "column": 28, - "message": "Error: Line 1: Variable name may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; eval = 0;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "eval", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 14, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 14, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "sourceType": "script", "errors": [ - { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" - } - ] - }, - "\"use strict\"; eval++;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "eval", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "prefix": false, - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "sourceType": "script", "errors": [ - { - "index": 18, - "lineNumber": 1, - "column": 19, - "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" - } - ] - }, - "\"use strict\"; --eval;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "eval", - "range": [ - 16, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "prefix": true, - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "sourceType": "script", "errors": [ - { - "index": 20, - "lineNumber": 1, - "column": 21, - "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" - } - ] - }, - "\"use strict\"; arguments = 0;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "arguments", - "range": [ - 14, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "right": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 14, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 14, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "sourceType": "script", "errors": [ - { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Error: Line 1: Assignment to eval or arguments is not allowed in strict mode" - } - ] - }, - "\"use strict\"; arguments--;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "arguments", - "range": [ - 14, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "prefix": false, - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 14, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "sourceType": "script", "errors": [ - { - "index": 23, - "lineNumber": 1, - "column": 24, - "message": "Error: Line 1: Postfix increment/decrement may not have eval or arguments operand in strict mode" - } - ] - }, - "\"use strict\"; ++arguments;": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "arguments", - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "prefix": true, - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 14, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "sourceType": "script", "errors": [ - { - "index": 25, - "lineNumber": 1, - "column": 26, - "message": "Error: Line 1: Prefix increment/decrement may not have eval or arguments operand in strict mode" - } - ] - }, - "\"use strict\";x={y:1,y:1}": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "y", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "value": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "kind": "init", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "method": false, - "shorthand": false, - "computed": false - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "y", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "value": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "kind": "init", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 13, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 13, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "sourceType": "script", "errors": [ - { - "index": 23, - "lineNumber": 1, - "column": 24, - "message": "Error: Line 1: Duplicate data property in object literal not allowed in strict mode" - } - ] - }, - "\"use strict\"; function eval() {};": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "eval", - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 30, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "sourceType": "script", "errors": [ - { - "index": 23, - "lineNumber": 1, - "column": 24, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; function arguments() {};": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "arguments", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 35, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - ], - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "sourceType": "script", "errors": [ - { - "index": 23, - "lineNumber": 1, - "column": 24, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; function interface() {};": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "interface", - "range": [ - 23, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 35, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - ], - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "sourceType": "script", "errors": [ - { - "index": 23, - "lineNumber": 1, - "column": 24, - "message": "Error: Line 1: Use of future reserved word in strict mode" - } - ] - }, - "\"use strict\"; (function eval() {});": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "eval", - "range": [ - 24, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "range": [ - 14, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "sourceType": "script", "errors": [ - { - "index": 24, - "lineNumber": 1, - "column": 25, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; (function arguments() {});": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "arguments", - "range": [ - 24, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 36, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 14, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ], - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "sourceType": "script", "errors": [ - { - "index": 24, - "lineNumber": 1, - "column": 25, - "message": "Error: Line 1: Function name may not be eval or arguments in strict mode" - } - ] - }, - "\"use strict\"; (function interface() {});": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "interface", - "range": [ - 24, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 36, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 14, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ], - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "sourceType": "script", "errors": [ - { - "index": 24, - "lineNumber": 1, - "column": 25, - "message": "Error: Line 1: Use of future reserved word in strict mode" - } - ] - }, - "\"use strict\"; function f(eval) {};": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "eval", - "range": [ - 25, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "sourceType": "script", "errors": [ - { - "index": 25, - "lineNumber": 1, - "column": 26, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - } - ] - }, - "\"use strict\"; function f(arguments) {};": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "arguments", - "range": [ - 25, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 36, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ], - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "sourceType": "script", "errors": [ - { - "index": 25, - "lineNumber": 1, - "column": 26, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - } - ] - }, - "\"use strict\"; function f(foo, foo) {};": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "foo", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "name": "foo", - "range": [ - 31, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 36, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 14, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ], - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "sourceType": "script", "errors": [ - { - "index": 31, - "lineNumber": 1, - "column": 32, - "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" - } - ] - }, - "\"use strict\"; (function f(eval) {});": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "eval", - "range": [ - 26, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 32, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 14, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ], - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "sourceType": "script", "errors": [ - { - "index": 26, - "lineNumber": 1, - "column": 27, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - } - ] - }, - "\"use strict\"; (function f(arguments) {});": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "arguments", - "range": [ - 26, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 37, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "range": [ - 14, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 41 - } - } - } - ], - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "sourceType": "script", "errors": [ - { - "index": 26, - "lineNumber": 1, - "column": 27, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - } - ] - }, - "\"use strict\"; (function f(foo, foo) {});": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "foo", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Identifier", - "name": "foo", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 37, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 15, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "range": [ - 14, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 41 - } - } - } - ], - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "sourceType": "script", "errors": [ - { - "index": 32, - "lineNumber": 1, - "column": 33, - "message": "Error: Line 1: Strict mode function may not have duplicate parameter names" - } - ] - }, - "\"use strict\"; x = { set f(eval) {} }": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "f", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "eval", - "range": [ - 26, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 32, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 25, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "kind": "set", - "range": [ - 20, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 18, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 14, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 14, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ], - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "sourceType": "script", "errors": [ - { - "index": 26, - "lineNumber": 1, - "column": 27, - "message": "Error: Line 1: Parameter name eval or arguments is not allowed in strict mode" - } - ] - }, - "function hello() { \"octal directive\\1\"; \"use strict\"; }": { - "type": "Program", - "body": [ - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "hello", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "octal directive\u0001", - "raw": "\"octal directive\\1\"", - "range": [ - 19, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 19, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 40, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 52 - } - } - }, - "range": [ - 40, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 53 - } - } - } - ], - "range": [ - 17, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 55 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 0, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - } - } - ], - "range": [ - 0, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, - "sourceType": "script", "errors": [ - { - "index": 19, - "lineNumber": 1, - "column": 20, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - } - ] - }, - "\"\\1\"; 'use strict';": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "\u0001", - "raw": "\"\\1\"", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "'use strict'", - "range": [ - 6, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 6, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "sourceType": "script", "errors": [ - { - "index": 0, - "lineNumber": 1, - "column": 1, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - } - ] - }, - "\"use strict\"; var x = { 014: 3}": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": 12, - "raw": "014", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "value": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "kind": "init", - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 18, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "kind": "var", - "range": [ - 14, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "sourceType": "script", "errors": [ - { - "index": 24, - "lineNumber": 1, - "column": 25, - "message": "Error: Line 1: Octal literals are not allowed in strict mode." - } - ] - }, - "\"use strict\"; var x = { get i() {}, get i() {} }": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "i", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 32, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 29, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "kind": "get", - "range": [ - 24, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "method": false, - "shorthand": false, - "computed": false - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "i", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 44, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 41, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "kind": "get", - "range": [ - 36, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 22, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 48 - } - } - }, - "range": [ - 18, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ], - "kind": "var", - "range": [ - 14, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ], - "range": [ - 0, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "sourceType": "script", "errors": [ - { - "index": 46, - "lineNumber": 1, - "column": 47, - "message": "Error: Line 1: Object literal may not have multiple get/set accessors with the same name" - } - ] - }, - "\"use strict\"; var x = { i: 42, get i() {} }": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "i", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 27, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "kind": "init", - "range": [ - 24, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "method": false, - "shorthand": false, - "computed": false - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "i", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 39, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 36, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "kind": "get", - "range": [ - 31, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 22, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - "range": [ - 18, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 43 - } - } - } - ], - "kind": "var", - "range": [ - 14, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 43 - } - } - } - ], - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "sourceType": "script", "errors": [ - { - "index": 41, - "lineNumber": 1, - "column": 42, - "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" - } - ] - }, - "\"use strict\"; var x = { set i(x) {}, i: 42 }": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "i", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 33, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 29, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "kind": "set", - "range": [ - 24, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "method": false, - "shorthand": false, - "computed": false - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "i", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "value": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 40, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "kind": "init", - "range": [ - 37, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 22, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - "range": [ - 18, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 44 - } - } - } - ], - "kind": "var", - "range": [ - 14, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 44 - } - } - } - ], - "range": [ - 0, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "sourceType": "script", "errors": [ - { - "index": 42, - "lineNumber": 1, - "column": 43, - "message": "Error: Line 1: Object literal may not have data and accessor property with the same name" - } - ] - }, - "foo(\"bar\") = baz": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "foo", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "arguments": [ - { - "type": "Literal", - "value": "bar", - "raw": "\"bar\"", - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "baz", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "sourceType": "script", "errors": [ - { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Error: Line 1: Invalid left-hand side in assignment" - } - ] - }, - "1 = 2": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "sourceType": "script", "errors": [ - { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Invalid left-hand side in assignment" - } - ] - }, - "3++": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "prefix": false, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - } - ], - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "sourceType": "script", "errors": [ - { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Error: Line 1: Invalid left-hand side in assignment" - } - ] - }, - "--4": { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Literal", - "value": 4, - "raw": "4", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "prefix": true, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - } - ], - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "sourceType": "script", "errors": [ - { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Error: Line 1: Invalid left-hand side in assignment" - } - ] - }, - "for (5 in []) {}": { - "type": "Program", - "body": [ - { - "type": "ForInStatement", - "left": { - "type": "Literal", - "value": 5, - "raw": "5", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "each": false, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "sourceType": "script", "errors": [ - { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Error: Line 1: Invalid left-hand side in for-in" - } - ] - }, - "var x = /[P QR]/\\g": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/[P QR]/g", - "raw": "/[P QR]/\\g", - "regex": { - "pattern": "[P QR]", - "flags": "g" - }, - "range": [ - 8, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 4, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "sourceType": "script", "errors": [ - { - "index": 17, - "lineNumber": 1, - "column": 18, - "message": "Error: Line 1: Unexpected token ILLEGAL" - } - ] - }, - "var x = /[P QR]/\\\\u0067": { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": "/[P QR]/g", - "raw": "/[P QR]/\\\\u0067", - "regex": { - "pattern": "[P QR]", - "flags": "g" - }, - "range": [ - 8, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "range": [ - 4, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "sourceType": "script", "errors": [ - { - "index": 17, - "lineNumber": 1, - "column": 18, - "message": "Error: Line 1: Unexpected token ILLEGAL" - }, - { - "index": 23, - "lineNumber": 1, - "column": 24, - "message": "Error: Line 1: Unexpected token ILLEGAL" - } - ] - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json deleted file mode 100644 index 92cf4e639037..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Unary-Operators.json +++ /dev/null @@ -1,704 +0,0 @@ -{ - "++x": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "prefix": true, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "--x": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "prefix": true, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "++eval": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "eval", - "range": [ - 2, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "prefix": true, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "--eval": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "eval", - "range": [ - 2, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "prefix": true, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "++arguments": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "++", - "argument": { - "type": "Identifier", - "name": "arguments", - "range": [ - 2, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "prefix": true, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "--arguments": { - "type": "ExpressionStatement", - "expression": { - "type": "UpdateExpression", - "operator": "--", - "argument": { - "type": "Identifier", - "name": "arguments", - "range": [ - 2, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "prefix": true, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "+x": { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "+", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "prefix": true, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "-x": { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "-", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "prefix": true, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "~x": { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "~", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "prefix": true, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "!x": { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "!", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "prefix": true, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "void x": { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "void", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "prefix": true, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "delete x": { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "delete", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "prefix": true, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "typeof x": { - "type": "ExpressionStatement", - "expression": { - "type": "UnaryExpression", - "operator": "typeof", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "prefix": true, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json deleted file mode 100644 index a5e1c1a1ffc9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Variable-Statement.json +++ /dev/null @@ -1,826 +0,0 @@ -{ - "var x": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": null, - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "var x, y;": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": null, - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "y", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "init": null, - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "var x = 42": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "var eval = 42, arguments = 42": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "eval", - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "init": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "arguments", - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "init": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 27, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "var x = 14, y = 3, z = 1977": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "Literal", - "value": 14, - "raw": "14", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "y", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "init": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 12, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "z", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "init": { - "type": "Literal", - "value": 1977, - "raw": "1977", - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 19, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "var implements, interface, package": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "implements", - "range": [ - 4, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "init": null, - "range": [ - 4, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "interface", - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "init": null, - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "package", - "range": [ - 27, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "init": null, - "range": [ - 27, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "var private, protected, public, static": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "private", - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "init": null, - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "protected", - "range": [ - 13, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "init": null, - "range": [ - 13, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "public", - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "init": null, - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "static", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "init": null, - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json b/packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json deleted file mode 100644 index 1dc081ab28ee..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/Whitespace.json +++ /dev/null @@ -1,254 +0,0 @@ -{ - "new \t\u000b\f  ᠎              a": { - "type": "ExpressionStatement", - "expression": { - "type": "NewExpression", - "callee": { - "type": "Identifier", - "name": "a", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "arguments": [], - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "{0\n1\r2
3
4}": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 0, - "raw": "0", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "range": [ - 1, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "range": [ - 3, - 5 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "range": [ - 5, - 7 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 4, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "range": [ - 7, - 9 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 5, - "column": 0 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": 4, - "raw": "4", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ], - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json deleted file mode 100644 index a1606c07dd6d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/break-statement.json +++ /dev/null @@ -1,450 +0,0 @@ -{ - "while (true) { break }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "BreakStatement", - "label": null, - "range": [ - 15, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 13, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "done: while (true) { break done }": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "body": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "BreakStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 27, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 21, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ], - "range": [ - 19, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "range": [ - 6, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "done: while (true) { break done; }": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "body": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "BreakStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 27, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 21, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ], - "range": [ - 19, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 6, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "__proto__: while (true) { break __proto__; }": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "__proto__", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "body": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "BreakStatement", - "label": { - "type": "Identifier", - "name": "__proto__", - "range": [ - 32, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "range": [ - 26, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 42 - } - } - } - ], - "range": [ - 24, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - "range": [ - 11, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - "range": [ - 0, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json deleted file mode 100644 index d6fc698816e6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/continue-statement.json +++ /dev/null @@ -1,523 +0,0 @@ -{ - "while (true) { continue; }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": null, - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "while (true) { continue }": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": null, - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "range": [ - 13, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "done: while (true) { continue done }": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "body": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 30, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 21, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "range": [ - 19, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 6, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "done: while (true) { continue done; }": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "body": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": { - "type": "Identifier", - "name": "done", - "range": [ - 30, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 21, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "range": [ - 19, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "range": [ - 6, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - "__proto__: while (true) { continue __proto__; }": { - "type": "LabeledStatement", - "label": { - "type": "Identifier", - "name": "__proto__", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "body": { - "type": "WhileStatement", - "test": { - "type": "Literal", - "value": true, - "raw": "true", - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ContinueStatement", - "label": { - "type": "Identifier", - "name": "__proto__", - "range": [ - 35, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - "range": [ - 26, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 45 - } - } - } - ], - "range": [ - 24, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - "range": [ - 11, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json deleted file mode 100644 index db1e5f1a8b9e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/debugger-statement.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "debugger;": { - "type": "DebuggerStatement", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json deleted file mode 100644 index 0e8afbf550ed..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/return-statement.json +++ /dev/null @@ -1,380 +0,0 @@ -{ - "(function(){ return })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": null, - "range": [ - 13, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "range": [ - 11, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "(function(){ return; })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": null, - "range": [ - 13, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "range": [ - 11, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "(function(){ return x; })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 13, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "range": [ - 11, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "(function(){ return x * y })": { - "type": "ExpressionStatement", - "expression": { - "type": "FunctionExpression", - "id": null, - "params": [], - - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 20, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "range": [ - 11, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - - "generator": false, - "expression": false, - "range": [ - 1, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json deleted file mode 100644 index 50068e71782f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/switch-statement.json +++ /dev/null @@ -1,368 +0,0 @@ -{ - "switch (x) {}": { - "type": "SwitchStatement", - "discriminant": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "cases": [], - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "switch (answer) { case 42: hi(); break; }": { - "type": "SwitchStatement", - "discriminant": { - "type": "Identifier", - "name": "answer", - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "cases": [ - { - "type": "SwitchCase", - "test": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "consequent": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "hi", - "range": [ - 27, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "arguments": [], - "range": [ - 27, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "BreakStatement", - "label": null, - "range": [ - 33, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ], - "range": [ - 18, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ], - "range": [ - 0, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "switch (answer) { case 42: hi(); break; default: break }": { - "type": "SwitchStatement", - "discriminant": { - "type": "Identifier", - "name": "answer", - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "cases": [ - { - "type": "SwitchCase", - "test": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "consequent": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "hi", - "range": [ - 27, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "arguments": [], - "range": [ - 27, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "BreakStatement", - "label": null, - "range": [ - 33, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ], - "range": [ - 18, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "SwitchCase", - "test": null, - "consequent": [ - { - "type": "BreakStatement", - "label": null, - "range": [ - 49, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 55 - } - } - } - ], - "range": [ - 40, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 55 - } - } - } - ], - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json deleted file mode 100644 index 5f673b84354a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/throw-statement.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "throw x;": { - "type": "ThrowStatement", - "argument": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "throw x * y": { - "type": "ThrowStatement", - "argument": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "right": { - "type": "Identifier", - "name": "y", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "throw { message: \"Error\" }": { - "type": "ThrowStatement", - "argument": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "message", - "range": [ - 8, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "Literal", - "value": "Error", - "raw": "\"Error\"", - "range": [ - 17, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "kind": "init", - "range": [ - 8, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "method": false, - "shorthand": false, - "computed": false - } - ], - "range": [ - 6, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json deleted file mode 100644 index 0413194c53d8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/try-statement.json +++ /dev/null @@ -1,1080 +0,0 @@ -{ - "try { } catch (e) { }": { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "e", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 8, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "finalizer": null, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "try { } catch (eval) { }": { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "eval", - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 8, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "finalizer": null, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "try { } catch (arguments) { }": { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "arguments", - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 8, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "finalizer": null, - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "try { } catch (e) { say(e) }": { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "e", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "say", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "e", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ], - "range": [ - 20, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 20, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - "range": [ - 18, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "range": [ - 8, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "finalizer": null, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "try { } finally { cleanup(stuff) }": { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "handler": null, - "finalizer": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "cleanup", - "range": [ - 18, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "stuff", - "range": [ - 26, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "range": [ - 18, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "range": [ - 18, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "range": [ - 16, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "try { doThat(); } catch (e) { say(e) }": { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThat", - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "arguments": [], - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 6, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "e", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "say", - "range": [ - 30, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "e", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ], - "range": [ - 28, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 18, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "finalizer": null, - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "try { doThat(); } catch (e) { say(e) } finally { cleanup(stuff) }": { - "type": "TryStatement", - "block": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doThat", - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "arguments": [], - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 6, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "handler": { - "type": "CatchClause", - "param": { - "type": "Identifier", - "name": "e", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "say", - "range": [ - 30, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "e", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ], - "range": [ - 28, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "range": [ - 18, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "finalizer": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "cleanup", - "range": [ - 49, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 56 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "stuff", - "range": [ - 57, - 62 - ], - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 62 - } - } - } - ], - "range": [ - 49, - 63 - ], - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 63 - } - } - }, - "range": [ - 49, - 64 - ], - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 64 - } - } - } - ], - "range": [ - 47, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 65 - } - } - }, - "range": [ - 0, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 65 - } - } - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json b/packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json deleted file mode 100644 index 6371d7218d63..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ast/with-statement.json +++ /dev/null @@ -1,339 +0,0 @@ -{ - "with (x) foo = bar": { - "type": "WithStatement", - "object": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "foo", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "right": { - "type": "Identifier", - "name": "bar", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "with (x) foo = bar;": { - "type": "WithStatement", - "object": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "foo", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "right": { - "type": "Identifier", - "name": "bar", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 9, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "with (x) { foo = bar }": { - "type": "WithStatement", - "object": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "foo", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "right": { - "type": "Identifier", - "name": "bar", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 11, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 11, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js deleted file mode 100644 index 590085bedb3d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/delete-expression.result.js +++ /dev/null @@ -1,202 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "expression": { - "type": "UnaryExpression", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "operator": "delete", - "prefix": true, - "argument": { - "type": "MemberExpression", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "foo" - }, - "property": { - "type": "Identifier", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "bar" - }, - "computed": false - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "delete", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js deleted file mode 100644 index c31d35005fff..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/do-while-statements.result.js +++ /dev/null @@ -1,780 +0,0 @@ -module.exports = { - "body": [ - { - "body": { - "loc": { - "end": { - "column": 3, - "line": 1 - }, - "start": { - "column": 2, - "line": 1 - } - }, - "range": [ - 2, - 3 - ], - "type": "EmptyStatement" - }, - "loc": { - "end": { - "column": 13, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 13 - ], - "test": { - "loc": { - "end": { - "column": 11, - "line": 1 - }, - "start": { - "column": 10, - "line": 1 - } - }, - "range": [ - 10, - 11 - ], - "raw": "1", - "type": "Literal", - "value": 1 - }, - "type": "DoWhileStatement" - }, - { - "declarations": [ - { - "id": { - "loc": { - "end": { - "column": 5, - "line": 3 - }, - "start": { - "column": 4, - "line": 3 - } - }, - "name": "i", - "range": [ - 19, - 20 - ], - "type": "Identifier" - }, - "init": { - "loc": { - "end": { - "column": 9, - "line": 3 - }, - "start": { - "column": 8, - "line": 3 - } - }, - "range": [ - 23, - 24 - ], - "raw": "0", - "type": "Literal", - "value": 0 - }, - "loc": { - "end": { - "column": 9, - "line": 3 - }, - "start": { - "column": 4, - "line": 3 - } - }, - "range": [ - 19, - 24 - ], - "type": "VariableDeclarator" - } - ], - "kind": "var", - "loc": { - "end": { - "column": 10, - "line": 3 - }, - "start": { - "column": 0, - "line": 3 - } - }, - "range": [ - 15, - 25 - ], - "type": "VariableDeclaration" - }, - { - "body": { - "body": [ - { - "expression": { - "left": { - "loc": { - "end": { - "column": 4, - "line": 5 - }, - "start": { - "column": 3, - "line": 5 - } - }, - "name": "i", - "range": [ - 34, - 35 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 9, - "line": 5 - }, - "start": { - "column": 3, - "line": 5 - } - }, - "operator": "+=", - "range": [ - 34, - 40 - ], - "right": { - "loc": { - "end": { - "column": 9, - "line": 5 - }, - "start": { - "column": 8, - "line": 5 - } - }, - "range": [ - 39, - 40 - ], - "raw": "1", - "type": "Literal", - "value": 1 - }, - "type": "AssignmentExpression" - }, - "loc": { - "end": { - "column": 10, - "line": 5 - }, - "start": { - "column": 3, - "line": 5 - } - }, - "range": [ - 34, - 41 - ], - "type": "ExpressionStatement" - } - ], - "loc": { - "end": { - "column": 1, - "line": 6 - }, - "start": { - "column": 3, - "line": 4 - } - }, - "range": [ - 29, - 43 - ], - "type": "BlockStatement" - }, - "loc": { - "end": { - "column": 16, - "line": 6 - }, - "start": { - "column": 0, - "line": 4 - } - }, - "range": [ - 26, - 58 - ], - "test": { - "left": { - "loc": { - "end": { - "column": 10, - "line": 6 - }, - "start": { - "column": 9, - "line": 6 - } - }, - "name": "i", - "range": [ - 51, - 52 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 14, - "line": 6 - }, - "start": { - "column": 9, - "line": 6 - } - }, - "operator": "<", - "range": [ - 51, - 56 - ], - "right": { - "loc": { - "end": { - "column": 14, - "line": 6 - }, - "start": { - "column": 13, - "line": 6 - } - }, - "range": [ - 55, - 56 - ], - "raw": "5", - "type": "Literal", - "value": 5 - }, - "type": "BinaryExpression" - }, - "type": "DoWhileStatement" - } - ], - "loc": { - "end": { - "column": 16, - "line": 6 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 58 - ], - "sourceType": "script", - "tokens": [ - { - "loc": { - "end": { - "column": 2, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 2 - ], - "type": "Keyword", - "value": "do" - }, - { - "loc": { - "end": { - "column": 3, - "line": 1 - }, - "start": { - "column": 2, - "line": 1 - } - }, - "range": [ - 2, - 3 - ], - "type": "Punctuator", - "value": ";" - }, - { - "loc": { - "end": { - "column": 9, - "line": 1 - }, - "start": { - "column": 4, - "line": 1 - } - }, - "range": [ - 4, - 9 - ], - "type": "Keyword", - "value": "while" - }, - { - "loc": { - "end": { - "column": 10, - "line": 1 - }, - "start": { - "column": 9, - "line": 1 - } - }, - "range": [ - 9, - 10 - ], - "type": "Punctuator", - "value": "(" - }, - { - "loc": { - "end": { - "column": 11, - "line": 1 - }, - "start": { - "column": 10, - "line": 1 - } - }, - "range": [ - 10, - 11 - ], - "type": "Numeric", - "value": "1" - }, - { - "loc": { - "end": { - "column": 12, - "line": 1 - }, - "start": { - "column": 11, - "line": 1 - } - }, - "range": [ - 11, - 12 - ], - "type": "Punctuator", - "value": ")" - }, - { - "loc": { - "end": { - "column": 13, - "line": 1 - }, - "start": { - "column": 12, - "line": 1 - } - }, - "range": [ - 12, - 13 - ], - "type": "Punctuator", - "value": ";" - }, - { - "loc": { - "end": { - "column": 3, - "line": 3 - }, - "start": { - "column": 0, - "line": 3 - } - }, - "range": [ - 15, - 18 - ], - "type": "Keyword", - "value": "var" - }, - { - "loc": { - "end": { - "column": 5, - "line": 3 - }, - "start": { - "column": 4, - "line": 3 - } - }, - "range": [ - 19, - 20 - ], - "type": "Identifier", - "value": "i" - }, - { - "loc": { - "end": { - "column": 7, - "line": 3 - }, - "start": { - "column": 6, - "line": 3 - } - }, - "range": [ - 21, - 22 - ], - "type": "Punctuator", - "value": "=" - }, - { - "loc": { - "end": { - "column": 9, - "line": 3 - }, - "start": { - "column": 8, - "line": 3 - } - }, - "range": [ - 23, - 24 - ], - "type": "Numeric", - "value": "0" - }, - { - "loc": { - "end": { - "column": 10, - "line": 3 - }, - "start": { - "column": 9, - "line": 3 - } - }, - "range": [ - 24, - 25 - ], - "type": "Punctuator", - "value": ";" - }, - { - "loc": { - "end": { - "column": 2, - "line": 4 - }, - "start": { - "column": 0, - "line": 4 - } - }, - "range": [ - 26, - 28 - ], - "type": "Keyword", - "value": "do" - }, - { - "loc": { - "end": { - "column": 4, - "line": 4 - }, - "start": { - "column": 3, - "line": 4 - } - }, - "range": [ - 29, - 30 - ], - "type": "Punctuator", - "value": "{" - }, - { - "loc": { - "end": { - "column": 4, - "line": 5 - }, - "start": { - "column": 3, - "line": 5 - } - }, - "range": [ - 34, - 35 - ], - "type": "Identifier", - "value": "i" - }, - { - "loc": { - "end": { - "column": 7, - "line": 5 - }, - "start": { - "column": 5, - "line": 5 - } - }, - "range": [ - 36, - 38 - ], - "type": "Punctuator", - "value": "+=" - }, - { - "loc": { - "end": { - "column": 9, - "line": 5 - }, - "start": { - "column": 8, - "line": 5 - } - }, - "range": [ - 39, - 40 - ], - "type": "Numeric", - "value": "1" - }, - { - "loc": { - "end": { - "column": 10, - "line": 5 - }, - "start": { - "column": 9, - "line": 5 - } - }, - "range": [ - 40, - 41 - ], - "type": "Punctuator", - "value": ";" - }, - { - "loc": { - "end": { - "column": 1, - "line": 6 - }, - "start": { - "column": 0, - "line": 6 - } - }, - "range": [ - 42, - 43 - ], - "type": "Punctuator", - "value": "}" - }, - { - "loc": { - "end": { - "column": 7, - "line": 6 - }, - "start": { - "column": 2, - "line": 6 - } - }, - "range": [ - 44, - 49 - ], - "type": "Keyword", - "value": "while" - }, - { - "loc": { - "end": { - "column": 9, - "line": 6 - }, - "start": { - "column": 8, - "line": 6 - } - }, - "range": [ - 50, - 51 - ], - "type": "Punctuator", - "value": "(" - }, - { - "loc": { - "end": { - "column": 10, - "line": 6 - }, - "start": { - "column": 9, - "line": 6 - } - }, - "range": [ - 51, - 52 - ], - "type": "Identifier", - "value": "i" - }, - { - "loc": { - "end": { - "column": 12, - "line": 6 - }, - "start": { - "column": 11, - "line": 6 - } - }, - "range": [ - 53, - 54 - ], - "type": "Punctuator", - "value": "<" - }, - { - "loc": { - "end": { - "column": 14, - "line": 6 - }, - "start": { - "column": 13, - "line": 6 - } - }, - "range": [ - 55, - 56 - ], - "type": "Numeric", - "value": "5" - }, - { - "loc": { - "end": { - "column": 15, - "line": 6 - }, - "start": { - "column": 14, - "line": 6 - } - }, - "range": [ - 56, - 57 - ], - "type": "Punctuator", - "value": ")" - }, - { - "loc": { - "end": { - "column": 16, - "line": 6 - }, - "start": { - "column": 15, - "line": 6 - } - }, - "range": [ - 57, - 58 - ], - "type": "Punctuator", - "value": ";" - } - ], - "type": "Program" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js deleted file mode 100644 index 74fe3d4c5fa5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/identifiers-double-underscore.result.js +++ /dev/null @@ -1,479 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "id": { - "type": "Identifier", - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "__test" - }, - "init": { - "type": "Literal", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "value": "ff", - "raw": "'ff'" - } - } - ], - "kind": "var" - }, - { - "type": "ClassDeclaration", - "range": [ - 20, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 26, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "name": "__Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 32, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "FunctionDeclaration", - "range": [ - 38, - 59 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 14 - } - }, - "name": "__Bar" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 55, - 59 - ], - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "__test", - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "String", - "value": "'ff'", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 20, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "__Foo", - "range": [ - 26, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 38, - 46 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "__Bar", - "range": [ - 47, - 52 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 7, - "column": 15 - }, - "end": { - "line": 7, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js deleted file mode 100644 index c68fecd17912..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/instanceof.result.js +++ /dev/null @@ -1,148 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "expression": { - "type": "BinaryExpression", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "left": { - "type": "Literal", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "value": "", - "raw": "''" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "Set" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "String", - "value": "''", - "range": [ - 0, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Keyword", - "value": "instanceof", - "range": [ - 3, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "Set", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js deleted file mode 100644 index e790c4f826b6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/new-with-member-expression.result.js +++ /dev/null @@ -1,237 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "expression": { - "type": "NewExpression", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "callee": { - "type": "MemberExpression", - "range": [ - 4, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "object": { - "type": "Identifier", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "foo" - }, - "property": { - "type": "Identifier", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "bar" - }, - "computed": false - }, - "arguments": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "new", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js deleted file mode 100644 index 46b5482a36ab..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/new-without-parens.result.js +++ /dev/null @@ -1,294 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "X" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "body": [] - } - }, - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 17, - 23 - ], - "expression": { - "type": "NewExpression", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 17, - 22 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 21, - 22 - ], - "name": "X" - }, - "arguments": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "X", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Keyword", - "value": "new", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "range": [ - 17, - 20 - ] - }, - { - "type": "Identifier", - "value": "X", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js deleted file mode 100644 index f2bc9338b4db..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/typeof-expression.result.js +++ /dev/null @@ -1,113 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "expression": { - "type": "UnaryExpression", - "operator": "typeof", - "prefix": true, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "argument": { - "type": "Literal", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "value": "str", - "raw": "'str'" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "typeof", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "String", - "value": "'str'", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js deleted file mode 100644 index 119a5fb037f6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/update-expression.result.js +++ /dev/null @@ -1,585 +0,0 @@ -module.exports = { - "body": [ - { - "declarations": [ - { - "id": { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 4, - "line": 1 - } - }, - "name": "i", - "range": [ - 4, - 5 - ], - "type": "Identifier" - }, - "init": { - "loc": { - "end": { - "column": 9, - "line": 1 - }, - "start": { - "column": 8, - "line": 1 - } - }, - "range": [ - 8, - 9 - ], - "raw": "0", - "type": "Literal", - "value": 0 - }, - "loc": { - "end": { - "column": 9, - "line": 1 - }, - "start": { - "column": 4, - "line": 1 - } - }, - "range": [ - 4, - 9 - ], - "type": "VariableDeclarator" - } - ], - "kind": "var", - "loc": { - "end": { - "column": 10, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 10 - ], - "type": "VariableDeclaration" - }, - { - "body": { - "body": [ - { - "expression": { - "argument": { - "loc": { - "end": { - "column": 3, - "line": 3 - }, - "start": { - "column": 2, - "line": 3 - } - }, - "name": "i", - "range": [ - 28, - 29 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 5, - "line": 3 - }, - "start": { - "column": 2, - "line": 3 - } - }, - "operator": "++", - "prefix": false, - "range": [ - 28, - 31 - ], - "type": "UpdateExpression" - }, - "loc": { - "end": { - "column": 6, - "line": 3 - }, - "start": { - "column": 2, - "line": 3 - } - }, - "range": [ - 28, - 32 - ], - "type": "ExpressionStatement" - } - ], - "loc": { - "end": { - "column": 1, - "line": 4 - }, - "start": { - "column": 13, - "line": 2 - } - }, - "range": [ - 24, - 34 - ], - "type": "BlockStatement" - }, - "generator": false, - "expression": false, - "async": false, - "id": { - "loc": { - "end": { - "column": 10, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } - }, - "name": "f", - "range": [ - 20, - 21 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 1, - "line": 4 - }, - "start": { - "column": 0, - "line": 2 - } - }, - "params": [], - "range": [ - 11, - 34 - ], - "type": "FunctionDeclaration" - }, - { - "expression": { - "arguments": [], - "callee": { - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 0, - "line": 5 - } - }, - "name": "f", - "range": [ - 35, - 36 - ], - "type": "Identifier" - }, - "loc": { - "end": { - "column": 3, - "line": 5 - }, - "start": { - "column": 0, - "line": 5 - } - }, - "range": [ - 35, - 38 - ], - "type": "CallExpression" - }, - "loc": { - "end": { - "column": 4, - "line": 5 - }, - "start": { - "column": 0, - "line": 5 - } - }, - "range": [ - 35, - 39 - ], - "type": "ExpressionStatement" - } - ], - "loc": { - "end": { - "column": 4, - "line": 5 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 39 - ], - "sourceType": "script", - "tokens": [ - { - "loc": { - "end": { - "column": 3, - "line": 1 - }, - "start": { - "column": 0, - "line": 1 - } - }, - "range": [ - 0, - 3 - ], - "type": "Keyword", - "value": "var" - }, - { - "loc": { - "end": { - "column": 5, - "line": 1 - }, - "start": { - "column": 4, - "line": 1 - } - }, - "range": [ - 4, - 5 - ], - "type": "Identifier", - "value": "i" - }, - { - "loc": { - "end": { - "column": 7, - "line": 1 - }, - "start": { - "column": 6, - "line": 1 - } - }, - "range": [ - 6, - 7 - ], - "type": "Punctuator", - "value": "=" - }, - { - "loc": { - "end": { - "column": 9, - "line": 1 - }, - "start": { - "column": 8, - "line": 1 - } - }, - "range": [ - 8, - 9 - ], - "type": "Numeric", - "value": "0" - }, - { - "loc": { - "end": { - "column": 10, - "line": 1 - }, - "start": { - "column": 9, - "line": 1 - } - }, - "range": [ - 9, - 10 - ], - "type": "Punctuator", - "value": ";" - }, - { - "loc": { - "end": { - "column": 8, - "line": 2 - }, - "start": { - "column": 0, - "line": 2 - } - }, - "range": [ - 11, - 19 - ], - "type": "Keyword", - "value": "function" - }, - { - "loc": { - "end": { - "column": 10, - "line": 2 - }, - "start": { - "column": 9, - "line": 2 - } - }, - "range": [ - 20, - 21 - ], - "type": "Identifier", - "value": "f" - }, - { - "loc": { - "end": { - "column": 11, - "line": 2 - }, - "start": { - "column": 10, - "line": 2 - } - }, - "range": [ - 21, - 22 - ], - "type": "Punctuator", - "value": "(" - }, - { - "loc": { - "end": { - "column": 12, - "line": 2 - }, - "start": { - "column": 11, - "line": 2 - } - }, - "range": [ - 22, - 23 - ], - "type": "Punctuator", - "value": ")" - }, - { - "loc": { - "end": { - "column": 14, - "line": 2 - }, - "start": { - "column": 13, - "line": 2 - } - }, - "range": [ - 24, - 25 - ], - "type": "Punctuator", - "value": "{" - }, - { - "loc": { - "end": { - "column": 3, - "line": 3 - }, - "start": { - "column": 2, - "line": 3 - } - }, - "range": [ - 28, - 29 - ], - "type": "Identifier", - "value": "i" - }, - { - "loc": { - "end": { - "column": 5, - "line": 3 - }, - "start": { - "column": 3, - "line": 3 - } - }, - "range": [ - 29, - 31 - ], - "type": "Punctuator", - "value": "++" - }, - { - "loc": { - "end": { - "column": 6, - "line": 3 - }, - "start": { - "column": 5, - "line": 3 - } - }, - "range": [ - 31, - 32 - ], - "type": "Punctuator", - "value": ";" - }, - { - "loc": { - "end": { - "column": 1, - "line": 4 - }, - "start": { - "column": 0, - "line": 4 - } - }, - "range": [ - 33, - 34 - ], - "type": "Punctuator", - "value": "}" - }, - { - "loc": { - "end": { - "column": 1, - "line": 5 - }, - "start": { - "column": 0, - "line": 5 - } - }, - "range": [ - 35, - 36 - ], - "type": "Identifier", - "value": "f" - }, - { - "loc": { - "end": { - "column": 2, - "line": 5 - }, - "start": { - "column": 1, - "line": 5 - } - }, - "range": [ - 36, - 37 - ], - "type": "Punctuator", - "value": "(" - }, - { - "loc": { - "end": { - "column": 3, - "line": 5 - }, - "start": { - "column": 2, - "line": 5 - } - }, - "range": [ - 37, - 38 - ], - "type": "Punctuator", - "value": ")" - }, - { - "loc": { - "end": { - "column": 4, - "line": 5 - }, - "start": { - "column": 3, - "line": 5 - } - }, - "range": [ - 38, - 39 - ], - "type": "Punctuator", - "value": ";" - } - ], - "type": "Program" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js deleted file mode 100644 index 12437f1d8976..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/basics/void-expression.result.js +++ /dev/null @@ -1,276 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "expression": { - "type": "UnaryExpression", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "operator": "void", - "prefix": true, - "argument": { - "type": "Literal", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "value": 4, - "raw": "4" - } - } - }, - { - "type": "ExpressionStatement", - "range": [ - 8, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "expression": { - "type": "UnaryExpression", - "range": [ - 8, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "operator": "void", - "prefix": true, - "argument": { - "type": "Literal", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "value": 3, - "raw": "3" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "void", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Numeric", - "value": "4", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 8, - 12 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.result.js deleted file mode 100644 index dd318cf175a7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/block-trailing-comment.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 0, - 26 - ], - "body": [ - { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 0, - 26 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 6, - 10 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 6, - 9 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 6, - 7 - ], - "name": "a" - }, - "arguments": [] - } - } - ] - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Line", - "value": "comment", - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - } - } - ], - "tokens": [ - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 25, - 26 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.result.js deleted file mode 100644 index e4092de3ea36..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/comment-within-condition.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "range": [ - 10, - 30 - ], - "body": [ - { - "type": "IfStatement", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "range": [ - 10, - 30 - ], - "test": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 25, - 26 - ], - "name": "a" - }, - "consequent": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "range": [ - 28, - 30 - ], - "body": [] - }, - "alternate": null - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Block", - "value": " foo ", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Block", - "value": " bar ", - "range": [ - 14, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "if", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 2 - } - }, - "range": [ - 10, - 12 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "range": [ - 29, - 30 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.result.js deleted file mode 100644 index 978a65a2ba45..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/export-default-anonymous-class.result.js +++ /dev/null @@ -1,377 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "decorators": [], - "id": null, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "method1", - "range": [ - 103, - 110 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 11 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 112, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 9, - "column": 5 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 110, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 9, - "column": 5 - } - } - }, - "kind": "method", - "computed": false, - "accessibility": null, - "decorators": [], - "range": [ - 103, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 9, - "column": 5 - } - }, - "static": false - } - ], - "range": [ - 57, - 121 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 10, - "column": 1 - } - } - }, - "range": [ - 51, - 121 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 10, - "column": 1 - } - } - }, - "range": [ - 36, - 121 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - } - } - ], - "sourceType": "module", - "range": [ - 36, - 121 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, - "comments": [ - { - "type": "Block", - "value": "*\n * this is anonymous class.\n ", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } - }, - { - "type": "Block", - "value": "*\n * this is method1.\n ", - "range": [ - 63, - 98 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 36, - 42 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 43, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 51, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "method1", - "range": [ - 103, - 110 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 111, - 112 - ], - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 112, - 113 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 118, - 119 - ], - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 120, - 121 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js deleted file mode 100644 index 0334ec36f196..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-block-comment.result.js +++ /dev/null @@ -1,732 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 6, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "pure" - }, - "init": { - "type": "ArrowFunctionExpression", - "range": [ - 13, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "generator": false, - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 19, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 25, - 95 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 6, - "column": 6 - } - }, - "argument": { - "type": "JSXElement", - "range": [ - 42, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 42, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "selfClosing": false, - "name": { - "type": "JSXIdentifier", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "name": "Foo" - }, - "attributes": [] - }, - "closingElement": { - "type": "JSXClosingElement", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 84, - 87 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - }, - "name": "Foo" - } - }, - "children": [ - { - "type": "Literal", - "range": [ - 47, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXExpressionContainer", - "range": [ - 60, - 73 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "expression": { - "type": "JSXEmptyExpression", - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "range": [ - 61, - 72 - ] - } - }, - { - "type": "Literal", - "range": [ - 73, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 5, - "column": 8 - } - }, - "value": "\n ", - "raw": "\n " - } - ] - } - } - ] - }, - "async": false, - "expression": false - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "pure", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "JSXIdentifier", - "value": "Foo", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 47, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 73, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 82, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "JSXIdentifier", - "value": "Foo", - "range": [ - 84, - 87 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 87, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 93, - 94 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - } - } - ], - "comments": [ - { - "type": "Block", - "value": "COMMENT", - "range": [ - 61, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js deleted file mode 100644 index 1f28bc32b813..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/jsx-tag-comments.result.js +++ /dev/null @@ -1,644 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 127 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 127 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 6, - 127 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "pure" - }, - "init": { - "type": "ArrowFunctionExpression", - "range": [ - 13, - 127 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "generator": false, - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 19, - 127 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 25, - 125 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 8, - "column": 6 - } - }, - "argument": { - "type": "JSXElement", - "range": [ - 42, - 118 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 7, - "column": 14 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 42, - 103 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - }, - "selfClosing": false, - "name": { - "type": "JSXIdentifier", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "name": "Foo" - }, - "attributes": [] - }, - "closingElement": { - "type": "JSXClosingElement", - "range": [ - 112, - 118 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 14 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 114, - 117 - ], - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 13 - } - }, - "name": "Foo" - } - }, - "children": [ - { - "type": "Literal", - "range": [ - 103, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 7, - "column": 8 - } - }, - "value": "\n ", - "raw": "\n " - } - ] - } - } - ] - }, - "async": false, - "expression": false - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "pure", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "JSXIdentifier", - "value": "Foo", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 103, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 112, - 113 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 113, - 114 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - { - "type": "JSXIdentifier", - "value": "Foo", - "range": [ - 114, - 117 - ], - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 117, - 118 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 124, - 125 - ], - "loc": { - "start": { - "line": 8, - "column": 5 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 126, - 127 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - } - ], - "comments": [ - { - "type": "Line", - "value": " single", - "range": [ - 59, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - { - "type": "Block", - "value": " block ", - "range": [ - 81, - 92 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 23 - } - } - } - ] -}; - diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js deleted file mode 100644 index 85be15e4fa2c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/line-comment-with-block-syntax.result.js +++ /dev/null @@ -1,40 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 12, - 0 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 1, - "column": 0 - } - }, - "body": [], - "sourceType": "script", - "tokens": [], - "comments": [ - { - "type": "Line", - "value": " /*test*/", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.result.js deleted file mode 100644 index c31fce20f8e8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/mix-line-and-block-comments.result.js +++ /dev/null @@ -1,242 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 6, - 28 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 6, - 28 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "range": [ - 10, - 27 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 10, - 13 - ], - "name": "zzz" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "range": [ - 24, - 27 - ], - "value": 777, - "raw": "777" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Line", - "value": "foo", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Block", - "value": "aaa", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Line", - "value": "bar", - "range": [ - 29, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 5 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "range": [ - 6, - 9 - ] - }, - { - "type": "Identifier", - "value": "zzz", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 10, - 13 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Numeric", - "value": "777", - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "range": [ - 24, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js deleted file mode 100644 index 519738014de6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-regex.result.js +++ /dev/null @@ -1,195 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 6, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "regex" - }, - "init": { - "type": "Literal", - "range": [ - 14, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "value": null, - "raw": "/no comment\\/**foo/", - "regex": { - "pattern": "no comment\\/**foo", - "flags": "" - } - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "regex", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "RegularExpression", - "value": "/no comment\\/**foo/", - "range": [ - 14, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "regex": { - "pattern": "no comment\\/**foo", - "flags": "" - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "comments": [] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js deleted file mode 100644 index fba63388208c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/no-comment-template.result.js +++ /dev/null @@ -1,287 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 6, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "str" - }, - "init": { - "type": "TemplateLiteral", - "range": [ - 12, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "quasis": [ - { - "type": "TemplateElement", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "value": { - "raw": "", - "cooked": "" - }, - "tail": false - }, - { - "type": "TemplateElement", - "range": [ - 24, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "value": { - "raw": "/test/*.js", - "cooked": "/test/*.js" - }, - "tail": true - } - ], - "expressions": [ - { - "type": "Identifier", - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "__dirname" - } - ] - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "str", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Template", - "value": "`${", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "__dirname", - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Template", - "value": "}/test/*.js`", - "range": [ - 24, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ], - "comments": [] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.result.js deleted file mode 100644 index fd5615fff2d5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-call-comments.result.js +++ /dev/null @@ -1,351 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 60 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 60 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 13, - 60 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 36, - 42 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "range": [ - 36, - 41 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 36, - 39 - ], - "name": "foo" - }, - "arguments": [] - } - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Block", - "value": " after ", - "range": [ - 47, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 36, - 39 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 39, - 40 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 41, - 42 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 59, - 60 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.result.js deleted file mode 100644 index 1e55dce7ee78..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-debugger-comments.result.js +++ /dev/null @@ -1,279 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 63 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 63 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 13, - 63 - ], - "body": [ - { - "type": "DebuggerStatement", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "range": [ - 36, - 45 - ] - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Block", - "value": " after ", - "range": [ - 50, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Keyword", - "value": "debugger", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "range": [ - 36, - 44 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "range": [ - 44, - 45 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 62, - 63 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.result.js deleted file mode 100644 index aa103fee4b8e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-return-comments.result.js +++ /dev/null @@ -1,280 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 61 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 61 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 13, - 61 - ], - "body": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 36, - 43 - ], - "argument": null - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Block", - "value": " after ", - "range": [ - 48, - 59 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 36, - 42 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 42, - 43 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 60, - 61 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.result.js deleted file mode 100644 index bcb53e19d8f8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-throw-comments.result.js +++ /dev/null @@ -1,316 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 63 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 63 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 13, - 63 - ], - "body": [ - { - "type": "ThrowStatement", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "range": [ - 36, - 45 - ], - "argument": { - "type": "Literal", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "range": [ - 42, - 44 - ], - "value": 55, - "raw": "55" - } - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Block", - "value": " before ", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Block", - "value": " after ", - "range": [ - 50, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Keyword", - "value": "throw", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "range": [ - 36, - 41 - ] - }, - { - "type": "Numeric", - "value": "55", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "range": [ - 42, - 44 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "range": [ - 44, - 45 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 62, - 63 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.result.js deleted file mode 100644 index ec4e87bb9e35..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/surrounding-while-loop-comments.result.js +++ /dev/null @@ -1,498 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, - "range": [ - 0, - 68 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 68 - } - }, - "range": [ - 0, - 68 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "f" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 68 - } - }, - "range": [ - 13, - 68 - ], - "body": [ - { - "type": "WhileStatement", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 30, - 46 - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 37, - 41 - ], - "value": true, - "raw": "true" - }, - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 43, - 46 - ], - "body": [] - } - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 66 - } - }, - "range": [ - 57, - 66 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 65 - } - }, - "range": [ - 61, - 65 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 65 - } - }, - "range": [ - 61, - 65 - ], - "name": "each" - }, - "init": null - } - ], - "kind": "var" - } - ] - } - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Block", - "value": " infinite ", - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Block", - "value": " bar ", - "range": [ - 47, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 56 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Keyword", - "value": "while", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 30, - 35 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Boolean", - "value": "true", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 37, - 41 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 41, - 42 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 43, - 44 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 60 - } - }, - "range": [ - 57, - 60 - ] - }, - { - "type": "Identifier", - "value": "each", - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 65 - } - }, - "range": [ - 61, - 65 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 65 - }, - "end": { - "line": 1, - "column": 66 - } - }, - "range": [ - 65, - 66 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 67 - }, - "end": { - "line": 1, - "column": 68 - } - }, - "range": [ - 67, - 68 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.result.js deleted file mode 100644 index 210b717f7399..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment-in-function.result.js +++ /dev/null @@ -1,716 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 0, - 141 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 0, - 141 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "name": "bar" - }, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "foo" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 18, - 141 - ], - "body": [ - { - "type": "SwitchStatement", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, - "range": [ - 24, - 139 - ], - "discriminant": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 31, - 34 - ], - "name": "foo" - }, - "cases": [ - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 15 - } - }, - "range": [ - 61, - 68 - ], - "consequent": [], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - }, - "range": [ - 66, - 67 - ], - "value": 1, - "raw": "1" - } - }, - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 7, - "column": 19 - } - }, - "range": [ - 106, - 133 - ], - "consequent": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 19 - } - }, - "range": [ - 126, - 133 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 18 - } - }, - "range": [ - 126, - 132 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 16 - } - }, - "range": [ - 126, - 130 - ], - "name": "doIt" - }, - "arguments": [] - } - } - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 14 - } - }, - "range": [ - 111, - 112 - ], - "value": 2, - "raw": "2" - } - } - ] - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Line", - "value": " foo", - "range": [ - 46, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Line", - "value": " falls through", - "range": [ - 81, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 28 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Keyword", - "value": "switch", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 24, - 30 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 31, - 34 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "range": [ - 61, - 65 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - }, - "range": [ - 66, - 67 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 15 - } - }, - "range": [ - 67, - 68 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 106, - 110 - ] - }, - { - "type": "Numeric", - "value": "2", - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 14 - } - }, - "range": [ - 111, - 112 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 15 - } - }, - "range": [ - 112, - 113 - ] - }, - { - "type": "Identifier", - "value": "doIt", - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 16 - } - }, - "range": [ - 126, - 130 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 17 - } - }, - "range": [ - 130, - 131 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 18 - } - }, - "range": [ - 131, - 132 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 7, - "column": 18 - }, - "end": { - "line": 7, - "column": 19 - } - }, - "range": [ - 132, - 133 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, - "range": [ - 138, - 139 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 140, - 141 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.result.js deleted file mode 100644 index 91c10191c188..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-fallthrough-comment.result.js +++ /dev/null @@ -1,513 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 0, - 91 - ], - "body": [ - { - "type": "SwitchStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 0, - 91 - ], - "discriminant": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "name": "foo" - }, - "cases": [ - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 29, - 36 - ], - "consequent": [], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 34, - 35 - ], - "value": 1, - "raw": "1" - } - }, - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 6, - "column": 15 - } - }, - "range": [ - 66, - 89 - ], - "consequent": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 15 - } - }, - "range": [ - 82, - 89 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 14 - } - }, - "range": [ - 82, - 88 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 82, - 86 - ], - "name": "doIt" - }, - "arguments": [] - } - } - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - }, - "range": [ - 71, - 72 - ], - "value": 2, - "raw": "2" - } - } - ] - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Line", - "value": " foo", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Line", - "value": " falls through", - "range": [ - 45, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "switch", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 29, - 33 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 8 - } - }, - "range": [ - 66, - 70 - ] - }, - { - "type": "Numeric", - "value": "2", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - }, - "range": [ - 71, - 72 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "range": [ - 72, - 73 - ] - }, - { - "type": "Identifier", - "value": "doIt", - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 82, - 86 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "range": [ - 86, - 87 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 14 - } - }, - "range": [ - 87, - 88 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 15 - } - }, - "range": [ - 88, - 89 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 90, - 91 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.result.js deleted file mode 100644 index 473225db87f5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-function.result.js +++ /dev/null @@ -1,682 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 0, - 133 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 0, - 133 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "name": "bar" - }, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "a" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 16, - 133 - ], - "body": [ - { - "type": "SwitchStatement", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, - "range": [ - 22, - 131 - ], - "discriminant": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "range": [ - 30, - 31 - ], - "name": "a" - }, - "cases": [ - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 4, - "column": 18 - } - }, - "range": [ - 43, - 69 - ], - "consequent": [ - { - "type": "BreakStatement", - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 18 - } - }, - "range": [ - 63, - 69 - ], - "label": null - } - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "range": [ - 48, - 49 - ], - "value": 2, - "raw": "2" - } - }, - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "range": [ - 78, - 104 - ], - "consequent": [ - { - "type": "BreakStatement", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "range": [ - 98, - 104 - ], - "label": null - } - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 83, - 84 - ], - "value": 1, - "raw": "1" - } - } - ] - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Line", - "value": "no default", - "range": [ - 113, - 125 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 20 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Keyword", - "value": "switch", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 22, - 28 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "range": [ - 43, - 47 - ] - }, - { - "type": "Numeric", - "value": "2", - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "range": [ - 48, - 49 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 49, - 50 - ] - }, - { - "type": "Keyword", - "value": "break", - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 17 - } - }, - "range": [ - 63, - 68 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - } - }, - "range": [ - 68, - 69 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "range": [ - 78, - 82 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 83, - 84 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "range": [ - 84, - 85 - ] - }, - { - "type": "Keyword", - "value": "break", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 17 - } - }, - "range": [ - 98, - 103 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "range": [ - 103, - 104 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 5 - } - }, - "range": [ - 130, - 131 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 132, - 133 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.result.js deleted file mode 100644 index aa9dd9a6940d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment-in-nested-functions.result.js +++ /dev/null @@ -1,1550 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 2 - } - }, - "range": [ - 0, - 287 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 2 - } - }, - "range": [ - 0, - 287 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - } - }, - "range": [ - 0, - 286 - ], - "operator": "=", - "left": { - "type": "MemberExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "object": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "name": "module" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ], - "name": "exports" - }, - "computed": false - }, - "right": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 12, - "column": 1 - } - }, - "range": [ - 17, - 286 - ], - "id": null, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 26, - 33 - ], - "name": "context" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 12, - "column": 1 - } - }, - "range": [ - 35, - 286 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 10, - "column": 5 - } - }, - "range": [ - 42, - 283 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "range": [ - 51, - 61 - ], - "name": "isConstant" - }, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "range": [ - 62, - 66 - ], - "name": "node" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 10, - "column": 5 - } - }, - "range": [ - 68, - 283 - ], - "body": [ - { - "type": "SwitchStatement", - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - }, - "range": [ - 78, - 255 - ], - "discriminant": { - "type": "MemberExpression", - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "range": [ - 86, - 95 - ], - "object": { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 20 - } - }, - "range": [ - 86, - 90 - ], - "name": "node" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "range": [ - 91, - 95 - ], - "name": "type" - }, - "computed": false - }, - "cases": [ - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 6, - "column": 81 - } - }, - "range": [ - 111, - 219 - ], - "consequent": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 81 - } - }, - "range": [ - 154, - 219 - ], - "argument": { - "type": "CallExpression", - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 80 - } - }, - "range": [ - 161, - 218 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 33 - } - }, - "range": [ - 161, - 171 - ], - "name": "isConstant" - }, - "arguments": [ - { - "type": "MemberExpression", - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 79 - } - }, - "range": [ - 172, - 217 - ], - "object": { - "type": "MemberExpression", - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 50 - } - }, - "range": [ - 172, - 188 - ], - "object": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 38 - } - }, - "range": [ - 172, - 176 - ], - "name": "node" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 39 - }, - "end": { - "line": 6, - "column": 50 - } - }, - "range": [ - 177, - 188 - ], - "name": "expressions" - }, - "computed": false - }, - "property": { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 78 - } - }, - "range": [ - 189, - 216 - ], - "left": { - "type": "MemberExpression", - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 74 - } - }, - "range": [ - 189, - 212 - ], - "object": { - "type": "MemberExpression", - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 67 - } - }, - "range": [ - 189, - 205 - ], - "object": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 55 - } - }, - "range": [ - 189, - 193 - ], - "name": "node" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 56 - }, - "end": { - "line": 6, - "column": 67 - } - }, - "range": [ - 194, - 205 - ], - "name": "expressions" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 68 - }, - "end": { - "line": 6, - "column": 74 - } - }, - "range": [ - 206, - 212 - ], - "name": "length" - }, - "computed": false - }, - "operator": "-", - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 6, - "column": 77 - }, - "end": { - "line": 6, - "column": 78 - } - }, - "range": [ - 215, - 216 - ], - "value": 1, - "raw": "1" - } - }, - "computed": true - } - ] - } - } - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 37 - } - }, - "range": [ - 116, - 136 - ], - "value": "SequenceExpression", - "raw": "\"SequenceExpression\"" - } - } - ] - }, - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 21 - } - }, - "range": [ - 264, - 277 - ], - "argument": { - "type": "Literal", - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 20 - } - }, - "range": [ - 271, - 276 - ], - "value": false, - "raw": "false" - } - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - ] - }, - "expression": false, - "async": false, - "generator": false - } - } - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Line", - "value": " no default", - "range": [ - 232, - 245 - ], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 25 - } - } - } - ], - "tokens": [ - { - "type": "Identifier", - "value": "module", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "exports", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 17, - 25 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Identifier", - "value": "context", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 26, - 33 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "range": [ - 42, - 50 - ] - }, - { - "type": "Identifier", - "value": "isConstant", - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "range": [ - 51, - 61 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 24 - } - }, - "range": [ - 61, - 62 - ] - }, - { - "type": "Identifier", - "value": "node", - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "range": [ - 62, - 66 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - }, - "range": [ - 66, - 67 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "range": [ - 68, - 69 - ] - }, - { - "type": "Keyword", - "value": "switch", - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 14 - } - }, - "range": [ - 78, - 84 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 16 - } - }, - "range": [ - 85, - 86 - ] - }, - { - "type": "Identifier", - "value": "node", - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 20 - } - }, - "range": [ - 86, - 90 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - }, - "range": [ - 90, - 91 - ] - }, - { - "type": "Identifier", - "value": "type", - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "range": [ - 91, - 95 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 26 - } - }, - "range": [ - 95, - 96 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "range": [ - 97, - 98 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 16 - } - }, - "range": [ - 111, - 115 - ] - }, - { - "type": "String", - "value": "\"SequenceExpression\"", - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 37 - } - }, - "range": [ - 116, - 136 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 5, - "column": 37 - }, - "end": { - "line": 5, - "column": 38 - } - }, - "range": [ - 136, - 137 - ] - }, - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 22 - } - }, - "range": [ - 154, - 160 - ] - }, - { - "type": "Identifier", - "value": "isConstant", - "loc": { - "start": { - "line": 6, - "column": 23 - }, - "end": { - "line": 6, - "column": 33 - } - }, - "range": [ - 161, - 171 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 6, - "column": 33 - }, - "end": { - "line": 6, - "column": 34 - } - }, - "range": [ - 171, - 172 - ] - }, - { - "type": "Identifier", - "value": "node", - "loc": { - "start": { - "line": 6, - "column": 34 - }, - "end": { - "line": 6, - "column": 38 - } - }, - "range": [ - 172, - 176 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 6, - "column": 38 - }, - "end": { - "line": 6, - "column": 39 - } - }, - "range": [ - 176, - 177 - ] - }, - { - "type": "Identifier", - "value": "expressions", - "loc": { - "start": { - "line": 6, - "column": 39 - }, - "end": { - "line": 6, - "column": 50 - } - }, - "range": [ - 177, - 188 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 6, - "column": 50 - }, - "end": { - "line": 6, - "column": 51 - } - }, - "range": [ - 188, - 189 - ] - }, - { - "type": "Identifier", - "value": "node", - "loc": { - "start": { - "line": 6, - "column": 51 - }, - "end": { - "line": 6, - "column": 55 - } - }, - "range": [ - 189, - 193 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 6, - "column": 55 - }, - "end": { - "line": 6, - "column": 56 - } - }, - "range": [ - 193, - 194 - ] - }, - { - "type": "Identifier", - "value": "expressions", - "loc": { - "start": { - "line": 6, - "column": 56 - }, - "end": { - "line": 6, - "column": 67 - } - }, - "range": [ - 194, - 205 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 6, - "column": 67 - }, - "end": { - "line": 6, - "column": 68 - } - }, - "range": [ - 205, - 206 - ] - }, - { - "type": "Identifier", - "value": "length", - "loc": { - "start": { - "line": 6, - "column": 68 - }, - "end": { - "line": 6, - "column": 74 - } - }, - "range": [ - 206, - 212 - ] - }, - { - "type": "Punctuator", - "value": "-", - "loc": { - "start": { - "line": 6, - "column": 75 - }, - "end": { - "line": 6, - "column": 76 - } - }, - "range": [ - 213, - 214 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 6, - "column": 77 - }, - "end": { - "line": 6, - "column": 78 - } - }, - "range": [ - 215, - 216 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 6, - "column": 78 - }, - "end": { - "line": 6, - "column": 79 - } - }, - "range": [ - 216, - 217 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 6, - "column": 79 - }, - "end": { - "line": 6, - "column": 80 - } - }, - "range": [ - 217, - 218 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 6, - "column": 80 - }, - "end": { - "line": 6, - "column": 81 - } - }, - "range": [ - 218, - 219 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - }, - "range": [ - 254, - 255 - ] - }, - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 14 - } - }, - "range": [ - 264, - 270 - ] - }, - { - "type": "Boolean", - "value": "false", - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 20 - } - }, - "range": [ - 271, - 276 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 9, - "column": 20 - }, - "end": { - "line": 9, - "column": 21 - } - }, - "range": [ - 276, - 277 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 5 - } - }, - "range": [ - 282, - 283 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - } - }, - "range": [ - 285, - 286 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 2 - } - }, - "range": [ - 286, - 287 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.result.js deleted file mode 100644 index 29c1ece8b32d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/switch-no-default-comment.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 58 - ], - "body": [ - { - "type": "SwitchStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 58 - ], - "discriminant": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "a" - }, - "cases": [ - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "range": [ - 17, - 39 - ], - "consequent": [ - { - "type": "BreakStatement", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "range": [ - 33, - 39 - ], - "label": null - } - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 22, - 23 - ], - "value": 1, - "raw": "1" - } - } - ] - } - ], - "sourceType": "script", - "comments": [ - { - "type": "Line", - "value": "no default", - "range": [ - 44, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 16 - } - } - } - ], - "tokens": [ - { - "type": "Keyword", - "value": "switch", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 17, - 21 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Keyword", - "value": "break", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "range": [ - 33, - 38 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 57, - 58 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js b/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js deleted file mode 100644 index a363db182a90..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/comments/template-string-block.result.js +++ /dev/null @@ -1,414 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 64 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "expression": { - "type": "TemplateLiteral", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "quasis": [ - { - "type": "TemplateElement", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "value": { - "raw": "", - "cooked": "" - }, - "tail": false - }, - { - "type": "TemplateElement", - "range": [ - 7, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "value": { - "raw": "", - "cooked": "" - }, - "tail": true - } - ], - "expressions": [ - { - "type": "Identifier", - "range": [ - 3, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "name" - } - ] - } - }, - { - "type": "BlockStatement", - "range": [ - 11, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 56, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 10 - } - }, - "expression": { - "type": "BinaryExpression", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 9 - } - }, - "operator": "+", - "left": { - "type": "Literal", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "value": 1, - "raw": "1" - }, - "right": { - "type": "Literal", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - }, - "value": 1, - "raw": "1" - } - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Template", - "value": "`${", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 3, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 7, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 7 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ], - "comments": [ - { - "type": "Block", - "value": " TODO comment comment comment ", - "range": [ - 17, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 38 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js deleted file mode 100644 index 65354f7e2f68..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - generators: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js deleted file mode 100644 index c0a881fdfbb8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.result.js +++ /dev/null @@ -1,336 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "id": { - "type": "Identifier", - "name": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "superClass": null, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "bar", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 20, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - "generator": true, - "expression": false, - "async": false, - "range": [ - 17, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - "kind": "method", - "computed": false, - "range": [ - 13, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "static": false - } - ], - "range": [ - 10, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js deleted file mode 100644 index ca3360a7460b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/classes-and-generators.src.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - *bar() { - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js deleted file mode 100644 index b8d550c328bd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - generators: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js deleted file mode 100644 index e8987ca66cf1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.result.js +++ /dev/null @@ -1,444 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "id": { - "type": "Identifier", - "name": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "superClass": null, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "Symbol", - "range": [ - 15, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - "property": { - "type": "Identifier", - "name": "iterator", - "range": [ - 22, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "range": [ - 15, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 34, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - "generator": true, - "expression": false, - "async": false, - "range": [ - 31, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - "kind": "method", - "computed": true, - "range": [ - 13, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "static": false - } - ], - "range": [ - 10, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "Symbol", - "range": [ - 15, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "iterator", - "range": [ - 22, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js deleted file mode 100644 index 7646f9fecfee..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/computed-generator.src.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - *[Symbol.iterator]() { - } -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js deleted file mode 100644 index 93e315c3fb1b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - generators: false -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js deleted file mode 100644 index 4b195c07a466..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 16, - "lineNumber": 2, - "column": 5, - "message": "Unexpected token *" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js deleted file mode 100644 index a35a8c89aa95..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-generator.src.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - *bar() { - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js deleted file mode 100644 index 0fcd9d994938..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - classes: false, - objectLiteralShorthandMethods: false, - generators: false -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js deleted file mode 100644 index 28e10338f64b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 0, - "lineNumber": 1, - "column": 1, - "message": "Unexpected reserved word" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js deleted file mode 100644 index a35a8c89aa95..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-no-class.src.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - *bar() { - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js deleted file mode 100644 index 93e315c3fb1b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - generators: false -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js deleted file mode 100644 index 8e587ffdd601..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 20, - "lineNumber": 2, - "column": 9, - "message": "Unexpected token *" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js deleted file mode 100644 index 24da58ebf114..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/error-static-no-generators.src.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - static *bar() { - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js deleted file mode 100644 index 65354f7e2f68..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - generators: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js deleted file mode 100644 index ea238e92e1d5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.result.js +++ /dev/null @@ -1,354 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "id": { - "type": "Identifier", - "name": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "superClass": null, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "key": { - "type": "Identifier", - "name": "bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 27, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - "generator": true, - "expression": false, - "async": false, - "range": [ - 24, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - "kind": "method", - "computed": false, - "range": [ - 13, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "static": true - } - ], - "range": [ - 10, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 13, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js deleted file mode 100644 index 24da58ebf114..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/classes-and-generators/static-generators.src.js +++ /dev/null @@ -1,4 +0,0 @@ -class Foo { - static *bar() { - } -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js deleted file mode 100644 index 6b23d86af28a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - defaultParams: true, - arrowFunctions: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js deleted file mode 100644 index dc6700eba07e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.result.js +++ /dev/null @@ -1,462 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "b", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "c", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 6, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js deleted file mode 100644 index 1ddfc6d19249..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param-arrow.src.js +++ /dev/null @@ -1 +0,0 @@ -(a, b=(c)=>{}) => {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js deleted file mode 100644 index 6b23d86af28a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - defaultParams: true, - arrowFunctions: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js deleted file mode 100644 index ffc3bd84ab9a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.result.js +++ /dev/null @@ -1,350 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "right": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ], - "body": { - "type": "BinaryExpression", - "operator": "*", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "x", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js deleted file mode 100644 index b331559eacd7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/default-param.src.js +++ /dev/null @@ -1 +0,0 @@ -(x=1) => x * x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js deleted file mode 100644 index 6b23d86af28a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - defaultParams: true, - arrowFunctions: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js deleted file mode 100644 index f976d1830ec5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "eval", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 7, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "body": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "eval", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Numeric", - "value": "42", - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js deleted file mode 100644 index 404864045043..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval-multi.src.js +++ /dev/null @@ -1 +0,0 @@ -(eval, a = 10) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js deleted file mode 100644 index 6b23d86af28a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - defaultParams: true, - arrowFunctions: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js deleted file mode 100644 index 8b79b305f9dd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.result.js +++ /dev/null @@ -1,279 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "eval", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 1, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "body": { - "type": "Literal", - "value": 42, - "raw": "42", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "eval", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Numeric", - "value": "42", - "range": [ - 15, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js deleted file mode 100644 index 136339954fe9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/local-eval.src.js +++ /dev/null @@ -1 +0,0 @@ -(eval = 10) => 42; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js deleted file mode 100644 index 3e5bd9b5d12d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - defaultParams: true, - arrowFunctions: true, - generators: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js deleted file mode 100644 index be049431ec01..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.result.js +++ /dev/null @@ -1,461 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "g", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "params": [], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "right": { - "type": "Identifier", - "range": [ - 21, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "yield" - }, - "range": [ - 17, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 16, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "range": [ - 16, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "range": [ - 14, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "generator": true, - "expression": false, - "async": false, - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "g", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "yield", - "range": [ - 21, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 28, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js deleted file mode 100644 index fafac7f8064c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/defaultParams-and-arrowFunctions/yield-default-param.src.js +++ /dev/null @@ -1 +0,0 @@ -function *g() { (x = yield) => {} } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js deleted file mode 100644 index 4f67f926ea38..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.result.js +++ /dev/null @@ -1,261 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - } - ], - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ], - "body": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js deleted file mode 100644 index c2f38722e62b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-array.src.js +++ /dev/null @@ -1 +0,0 @@ -([y]) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js deleted file mode 100644 index a10038071724..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js +++ /dev/null @@ -1,370 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 1, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "body": { - "type": "Identifier", - "name": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js deleted file mode 100644 index 75bb19b495b8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js +++ /dev/null @@ -1 +0,0 @@ -([y, [x]]) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js deleted file mode 100644 index 5d844af1d52a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js +++ /dev/null @@ -1,595 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "foo", - "range": [ - 2, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "value": { - "type": "Identifier", - "name": "y", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "value": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "bar", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "value": { - "type": "Identifier", - "name": "x", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 13, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "range": [ - 12, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 10, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "range": [ - 1, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "body": { - "type": "Identifier", - "name": "x", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 2, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js deleted file mode 100644 index c2a809e04a22..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js +++ /dev/null @@ -1 +0,0 @@ -({foo: y, a:{bar: x}}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js deleted file mode 100644 index 88daa074deca..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js +++ /dev/null @@ -1,523 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "value": { - "type": "Identifier", - "name": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "value": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "value": { - "type": "Identifier", - "name": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "range": [ - 1, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "body": { - "type": "Identifier", - "name": "x", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 13, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js deleted file mode 100644 index 177cd72468dd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js +++ /dev/null @@ -1 +0,0 @@ -({y, a:{x}}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js deleted file mode 100644 index c8298834bc40..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.result.js +++ /dev/null @@ -1,300 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "value": { - "type": "Identifier", - "name": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - } - ], - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ], - "body": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js deleted file mode 100644 index 7f6a1fb1436e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/arrow-param-object.src.js +++ /dev/null @@ -1 +0,0 @@ -({y}) => x; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js deleted file mode 100644 index e98e28d7e112..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.result.js +++ /dev/null @@ -1,315 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ArrayPattern", - "elements": [ - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 1, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "body": { - "type": "Identifier", - "name": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js deleted file mode 100644 index 7fa2d1940626..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-array.src.js +++ /dev/null @@ -1 +0,0 @@ -([x = 10]) => x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js deleted file mode 100644 index 413473aa5844..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js +++ /dev/null @@ -1,758 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "y", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "value": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "z", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "z", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 15, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 15, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 13, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 10, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "range": [ - 1, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "body": { - "type": "ArrayExpression", - "elements": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Identifier", - "name": "z", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "range": [ - 29, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "z", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 26, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "z", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js deleted file mode 100644 index 410eed8cc78f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js +++ /dev/null @@ -1 +0,0 @@ -({x = 10, y: { z = 10 }}) => [x, z] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js deleted file mode 100644 index 66e72f8be7f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js deleted file mode 100644 index 7dc67fdcfeae..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.result.js +++ /dev/null @@ -1,354 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 2, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 1, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "body": { - "type": "Identifier", - "name": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "generator": false, - "expression": true, - "async": false, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 6, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js deleted file mode 100644 index c6b403750620..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-arrowFunctions/param-defaults-object.src.js +++ /dev/null @@ -1 +0,0 @@ -({x = 10}) => x \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js deleted file mode 100644 index 6256cf3759b5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js deleted file mode 100644 index a18b273865b3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.result.js +++ /dev/null @@ -1,258 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "kind": "const", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js deleted file mode 100644 index 0ff51d044822..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-const-undefined.src.js +++ /dev/null @@ -1 +0,0 @@ -const [a] = []; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js deleted file mode 100644 index 6256cf3759b5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js deleted file mode 100644 index cd35dfa56c76..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.result.js +++ /dev/null @@ -1,258 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": { - "type": "ArrayExpression", - "elements": [], - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 4, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "kind": "let", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "let", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js deleted file mode 100644 index c705f581d5a1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/array-let-undefined.src.js +++ /dev/null @@ -1 +0,0 @@ -let [a] = []; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js deleted file mode 100644 index 6256cf3759b5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js deleted file mode 100644 index e4e5349f54fc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 6, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "kind": "const", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js deleted file mode 100644 index 67a0d1a4e9c7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-named.src.js +++ /dev/null @@ -1 +0,0 @@ -const {a:b} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js deleted file mode 100644 index 6256cf3759b5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js deleted file mode 100644 index 797767742fe0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.result.js +++ /dev/null @@ -1,297 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "kind": "const", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js deleted file mode 100644 index 80b78cb8d264..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-const-undefined.src.js +++ /dev/null @@ -1 +0,0 @@ -const {a} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js deleted file mode 100644 index 6256cf3759b5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js deleted file mode 100644 index 08a692cd9861..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 4, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "kind": "let", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "let", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js deleted file mode 100644 index 53b1654cb828..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-named.src.js +++ /dev/null @@ -1 +0,0 @@ -let {a:b} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js deleted file mode 100644 index 6256cf3759b5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js deleted file mode 100644 index fe8c833f3fd2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.result.js +++ /dev/null @@ -1,297 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 4, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "kind": "let", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "let", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js deleted file mode 100644 index 51c02f8b6ed1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-blockBindings/object-let-undefined.src.js +++ /dev/null @@ -1 +0,0 @@ -let {a} = {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js deleted file mode 100644 index b549aa41da36..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - defaultParams: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js deleted file mode 100644 index ce25b86d218c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.result.js +++ /dev/null @@ -1,441 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "f", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "params": [ - { - "type": "AssignmentPattern", - "left": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "x", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "right": { - "type": "ArrayExpression", - "elements": [ - { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 11, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 22, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js deleted file mode 100644 index b233ca5bd452..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-array.src.js +++ /dev/null @@ -1 +0,0 @@ -function f([x] = [1]) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js deleted file mode 100644 index 0642270c4aa5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - defaultParams: true, - destructuring: true, - objectLiteralShorthandMethods: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js deleted file mode 100644 index 730eacb51de0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.result.js +++ /dev/null @@ -1,650 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "f", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "AssignmentPattern", - "left": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "value": { - "type": "Identifier", - "name": "x", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - } - ], - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "value": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 11, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 3, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "kind": "init", - "method": true, - "shorthand": false, - "computed": false, - "range": [ - 2, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 1, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js deleted file mode 100644 index 0821397f396c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-short.src.js +++ /dev/null @@ -1 +0,0 @@ -({f({x} = {x: 10}) {}}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js deleted file mode 100644 index b549aa41da36..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - defaultParams: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js deleted file mode 100644 index 2b7ccdbb5823..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.result.js +++ /dev/null @@ -1,141 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - type: 'ExpressionStatement', - expression: { - type: 'ObjectExpression', - properties: [{ - type: 'Property', - key: { - type: 'Identifier', - name: 'f', - range: [2, 3], - loc: { - start: { line: 1, column: 2 }, - end: { line: 1, column: 3 } - } - }, - value: { - type: 'FunctionExpression', - id: null, - params: [{ - type: 'ObjectPattern', - properties: [{ - type: 'Property', - key: { - type: 'Identifier', - name: 'x', - range: [15, 16], - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - } - }, - value: { - type: 'Identifier', - name: 'x', - range: [15, 16], - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - } - }, - kind: 'init', - method: false, - shorthand: true, - computed: false, - range: [15, 16], - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - } - }], - range: [14, 17], - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 17 } - } - }], - defaults: [{ - type: 'ObjectExpression', - properties: [{ - type: 'Property', - key: { - type: 'Identifier', - name: 'x', - range: [21, 22], - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - } - }, - value: { - type: 'Literal', - value: 10, - raw: '10', - range: [24, 26], - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 26 } - } - }, - kind: 'init', - method: false, - shorthand: false, - computed: false, - range: [21, 26], - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 26 } - } - }], - range: [20, 27], - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 27 } - } - }], - body: { - type: 'BlockStatement', - body: [], - range: [29, 31], - loc: { - start: { line: 1, column: 29 }, - end: { line: 1, column: 31 } - } - }, - rest: null, - generator: false, - expression: false, - async: false, - range: [5, 31], - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 31 } - } - }, - kind: 'init', - method: false, - shorthand: false, - computed: false, - range: [2, 31], - loc: { - start: { line: 1, column: 2 }, - end: { line: 1, column: 31 } - } - }], - range: [1, 32], - loc: { - start: { line: 1, column: 1 }, - end: { line: 1, column: 32 } - } - }, - range: [0, 33], - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 33 } - } - } - ] -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs deleted file mode 100644 index 1740302f8291..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object-wrapped.src.xjs +++ /dev/null @@ -1 +0,0 @@ -({f: function({x} = {x: 10}) {}}); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js deleted file mode 100644 index b549aa41da36..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - defaultParams: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js deleted file mode 100644 index 6f3c7ef0d156..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.result.js +++ /dev/null @@ -1,592 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "f", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - "right": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "AssignmentPattern", - "left": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "Identifier", - "name": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "value": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 20, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ], - "range": [ - 19, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 13, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 28, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 4, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "tokens": [ - { - "type": "Identifier", - "value": "f", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 4, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js deleted file mode 100644 index 753d7b471310..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-defaultParams/param-object.src.js +++ /dev/null @@ -1 +0,0 @@ -f = function({x} = {x: 10}) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js deleted file mode 100644 index f407ad5aee4c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - destructuring: true, - experimentalObjectRestSpread: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js deleted file mode 100644 index 96d8256364fd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 18, - "lineNumber": 1, - "column": 19, - "message": "Unexpected token ." -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js deleted file mode 100644 index a38d92cf9298..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/invalid-rest.src.js +++ /dev/null @@ -1 +0,0 @@ -var { x, y, ...foo.bar } = { x: 1, y: 2, a: 3, b: 4 }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js deleted file mode 100644 index f407ad5aee4c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - destructuring: true, - experimentalObjectRestSpread: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js deleted file mode 100644 index 04af44a06839..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.result.js +++ /dev/null @@ -1,982 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "value": { - "type": "Identifier", - "name": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "y", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "value": { - "type": "Identifier", - "name": "y", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "ExperimentalRestProperty", - "argument": { - "type": "Identifier", - "name": "z", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "range": [ - 12, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 4, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "value": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "y", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "value": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 29, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "value": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 35, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - "value": { - "type": "Literal", - "value": 4, - "raw": "4", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 41, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 45 - } - } - } - ], - "range": [ - 21, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - "range": [ - 4, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 47 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "z", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - { - "type": "Numeric", - "value": "4", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js deleted file mode 100644 index 4d733791c65d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-experimentalObjectRestSpread/object-rest.src.js +++ /dev/null @@ -1 +0,0 @@ -var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js deleted file mode 100644 index 56a38343032a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - forOf: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js deleted file mode 100644 index 85206496a6c9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.result.js +++ /dev/null @@ -1,273 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ForOfStatement", - "left": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "right": { - "type": "Identifier", - "name": "foo", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "body": { - "type": "EmptyStatement", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "for", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "of", - "range": [ - 9, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js deleted file mode 100644 index 7751aeddd636..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-forOf/loop.src.js +++ /dev/null @@ -1 +0,0 @@ -for ([a] of foo); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js deleted file mode 100644 index dc67f75b492f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.result.js +++ /dev/null @@ -1,496 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "ArrayPattern", - "elements": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "range": [ - 1, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "c", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 11, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "right": { - "type": "Identifier", - "name": "d", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "d", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js deleted file mode 100644 index a14d109bf05d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/complex-destructured.src.js +++ /dev/null @@ -1 +0,0 @@ -[{ a, b }, ...c] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js deleted file mode 100644 index 15e5387f1f3f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.result.js +++ /dev/null @@ -1,418 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "b", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "name": "c", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "range": [ - 7, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "right": { - "type": "Identifier", - "name": "d", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "d", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js deleted file mode 100644 index 1a8ecca05ecd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructured-array-literal.src.js +++ /dev/null @@ -1 +0,0 @@ -[a, ...[b, c]] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js deleted file mode 100644 index 4920e70453ad..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.result.js +++ /dev/null @@ -1,512 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "a", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "params": [ - { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "name": "b", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "ok", - "range": [ - 22, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "range": [ - 21, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "range": [ - 18, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ], - "range": [ - 11, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 28, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "ok", - "range": [ - 22, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js deleted file mode 100644 index 28bec5ed0b4e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/destructuring-param.src.js +++ /dev/null @@ -1 +0,0 @@ -function a([a, b, ...[ok]]) {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js deleted file mode 100644 index b833630af047..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - index: 1, - column: 2, - lineNumber: 1, - message: "Assigning to rvalue" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js deleted file mode 100644 index eee98799d22b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/error-complex-destructured-spread-first.src.js +++ /dev/null @@ -1 +0,0 @@ -[...c, { a, b }] = d; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js deleted file mode 100644 index d639c8045d5d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.result.js +++ /dev/null @@ -1,309 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "right": { - "type": "Identifier", - "name": "c", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js deleted file mode 100644 index c7f6aa97b292..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/multi-destructured.src.js +++ /dev/null @@ -1 +0,0 @@ -[a, ...b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js deleted file mode 100644 index c54ecee9697f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.result.js +++ /dev/null @@ -1,273 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "ArrayPattern", - "elements": [ - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "a", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "right": { - "type": "Identifier", - "name": "b", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js deleted file mode 100644 index 6154cfe049dd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array-empty.src.js +++ /dev/null @@ -1 +0,0 @@ -[...a, ] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js deleted file mode 100644 index b833630af047..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - index: 1, - column: 2, - lineNumber: 1, - message: "Assigning to rvalue" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js deleted file mode 100644 index cb9a2a141cc8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/not-final-array.src.js +++ /dev/null @@ -1 +0,0 @@ -[...a, b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js deleted file mode 100644 index 5e6629e76dcd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.result.js +++ /dev/null @@ -1,255 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "ArrayPattern", - "elements": [ - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "a", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "right": { - "type": "Identifier", - "name": "b", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js deleted file mode 100644 index 0be6e5d967b2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/single-destructured.src.js +++ /dev/null @@ -1 +0,0 @@ -[...a] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js deleted file mode 100644 index bb7d46b4ea0d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.result.js +++ /dev/null @@ -1,516 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ArrayPattern", - "elements": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "b", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "range": [ - 5, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "c", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "range": [ - 4, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "init": { - "type": "Identifier", - "name": "d", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 4, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "d", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js deleted file mode 100644 index dabf00dc6ecb..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-complex-destructured.src.js +++ /dev/null @@ -1 +0,0 @@ -var [{ a, b }, ...c] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js deleted file mode 100644 index b75cd2d5287f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.result.js +++ /dev/null @@ -1,438 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "b", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "name": "c", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 11, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 8, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "range": [ - 4, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "init": { - "type": "Identifier", - "name": "d", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 4, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "d", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js deleted file mode 100644 index ed56a2030533..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-destructured-array-literal.src.js +++ /dev/null @@ -1 +0,0 @@ -var [a, ...[b, c]] = d; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js deleted file mode 100644 index ec1b7c6724ea..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.result.js +++ /dev/null @@ -1,329 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 8, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "init": { - "type": "Identifier", - "name": "c", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "range": [ - 4, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js deleted file mode 100644 index 897bcba9d9b1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-multi-destructured.src.js +++ /dev/null @@ -1 +0,0 @@ -var [a, ...b] = c; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js deleted file mode 100644 index c93db2bb065a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js deleted file mode 100644 index 7498e1cb6cb5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.result.js +++ /dev/null @@ -1,275 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "ArrayPattern", - "elements": [ - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "a", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 5, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "init": { - "type": "Identifier", - "name": "b", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 4, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js deleted file mode 100644 index e6dc8d642048..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/destructuring-and-spread/var-single-destructured.src.js +++ /dev/null @@ -1 +0,0 @@ -var [...a] = b; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js deleted file mode 100644 index eb87cca63057..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - forOf: true, - blockBindings: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js deleted file mode 100644 index 4c190b97489a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.result.js +++ /dev/null @@ -1,364 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ForOfStatement", - "left": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "init": null, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "kind": "let", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doSomething", - "range": [ - 23, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "arguments": [], - "range": [ - 23, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 23, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "for", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "of", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "doSomething", - "range": [ - 23, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js deleted file mode 100644 index 7d9d367e23a0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-const-and-no-braces.src.js +++ /dev/null @@ -1,2 +0,0 @@ -for (let x of foo) - doSomething(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js deleted file mode 100644 index eb87cca63057..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - forOf: true, - blockBindings: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js deleted file mode 100644 index 4c190b97489a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.result.js +++ /dev/null @@ -1,364 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ForOfStatement", - "left": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "init": null, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "kind": "let", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "doSomething", - "range": [ - 23, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "arguments": [], - "range": [ - 23, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - "range": [ - 23, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "for", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "of", - "range": [ - 11, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "doSomething", - "range": [ - 23, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js deleted file mode 100644 index 7d9d367e23a0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/forOf-and-blockBindings/for-of-with-let-and-no-braces.src.js +++ /dev/null @@ -1,2 +0,0 @@ -for (let x of foo) - doSomething(); diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js deleted file mode 100644 index 4e67c7999a3c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js deleted file mode 100644 index 92936e7cf474..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.result.js +++ /dev/null @@ -1,223 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "init": { - "type": "Literal", - "value": 3, - "raw": "3", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 13, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "kind": "const", - "range": [ - 7, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js deleted file mode 100644 index 0146d2af06d6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-number.src.js +++ /dev/null @@ -1 +0,0 @@ -export const foo = 3; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js deleted file mode 100644 index 4e67c7999a3c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js deleted file mode 100644 index a302a9045b79..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 13, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "kind": "const", - "range": [ - 7, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js deleted file mode 100644 index 5a76a5bcfab7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-const-object.src.js +++ /dev/null @@ -1 +0,0 @@ -export const foo = {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js deleted file mode 100644 index 4e67c7999a3c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js deleted file mode 100644 index 82d22d706a0b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.result.js +++ /dev/null @@ -1,223 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "init": { - "type": "Literal", - "value": 2, - "raw": "2", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 11, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "kind": "let", - "range": [ - 7, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js deleted file mode 100644 index a3bcdb0d8122..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-number.src.js +++ /dev/null @@ -1 +0,0 @@ -export let foo = 2; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js deleted file mode 100644 index 4e67c7999a3c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js deleted file mode 100644 index c4f1c05cd9b2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 11, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "kind": "let", - "range": [ - 7, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js deleted file mode 100644 index 12613c647f39..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let-object.src.js +++ /dev/null @@ -1 +0,0 @@ -export let foo = {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js deleted file mode 100644 index 4e67c7999a3c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - blockBindings: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js deleted file mode 100644 index 0313428a124b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.result.js +++ /dev/null @@ -1,169 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "bar", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "init": null, - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "kind": "let", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js deleted file mode 100644 index c2aed8a392ad..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-blockBindings/export-let.src.js +++ /dev/null @@ -1 +0,0 @@ -export let bar; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js deleted file mode 100644 index dccb693a66d0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js deleted file mode 100644 index c9c742eb458b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.result.js +++ /dev/null @@ -1,255 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "decorators": [], - "id": null, - "superClass": { - "type": "Identifier", - "name": "bar", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 33, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 15, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 21, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js deleted file mode 100644 index 97e4cc63d048..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous-extends.src.js +++ /dev/null @@ -1 +0,0 @@ -export default class extends bar {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js deleted file mode 100644 index dccb693a66d0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js deleted file mode 100644 index 3b3618ad5172..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.result.js +++ /dev/null @@ -1,202 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "decorators": [], - "id": null, - "superClass": null, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 21, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js deleted file mode 100644 index b8260ae06fcc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-anonymous.src.js +++ /dev/null @@ -1 +0,0 @@ -export default class {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js deleted file mode 100644 index dccb693a66d0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js deleted file mode 100644 index f726afc0c3e6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.result.js +++ /dev/null @@ -1,290 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "decorators": [], - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "superClass": { - "type": "Identifier", - "name": "bar", - "range": [ - 33, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 37, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "range": [ - 15, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 25, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 33, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js deleted file mode 100644 index dfdd2554f233..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default-extends.src.js +++ /dev/null @@ -1 +0,0 @@ -export default class foo extends bar {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js deleted file mode 100644 index dccb693a66d0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js deleted file mode 100644 index 7f61b7cb1022..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.result.js +++ /dev/null @@ -1,237 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "decorators": [], - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "superClass": null, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 25, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 15, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js deleted file mode 100644 index b9b30a7d5926..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-default.src.js +++ /dev/null @@ -1 +0,0 @@ -export default class foo {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js deleted file mode 100644 index dccb693a66d0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js deleted file mode 100644 index 19809e4807a5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.result.js +++ /dev/null @@ -1,274 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "ClassDeclaration", - "decorators": [], - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "superClass": { - "type": "Identifier", - "name": "bar", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 29, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "range": [ - 7, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 17, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js deleted file mode 100644 index abbbd194cf56..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class-extends.src.js +++ /dev/null @@ -1 +0,0 @@ -export class foo extends bar {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js deleted file mode 100644 index dccb693a66d0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - classes: true, - modules: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js deleted file mode 100644 index 68d44f1b22f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.result.js +++ /dev/null @@ -1,221 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "ClassDeclaration", - "decorators": [], - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "superClass": null, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 7, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "EmptyStatement", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js deleted file mode 100644 index 2d677350efdd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/modules-and-classes/class.src.js +++ /dev/null @@ -1 +0,0 @@ -export class foo {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js deleted file mode 100644 index 4dc6605483f2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - objectLiteralDuplicateProperties: true, - objectLiteralComputedProperties: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js deleted file mode 100644 index 14a6d40ae203..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.result.js +++ /dev/null @@ -1,1083 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "proto", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [], - "range": [ - 27, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "range": [ - 19, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 14 - } - } - } - ], - "kind": "var", - "range": [ - 15, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Literal", - "value": "__proto__", - "raw": "\"__proto__\"", - "range": [ - 44, - 55 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - "value": { - "type": "Identifier", - "name": "proto", - "range": [ - 58, - 63 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": true, - "range": [ - 43, - 63 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - { - "type": "Property", - "key": { - "type": "Literal", - "value": "__proto__", - "raw": "\"__proto__\"", - "range": [ - 67, - 78 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - "value": { - "type": "Identifier", - "name": "proto", - "range": [ - 81, - 86 - ], - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": true, - "range": [ - 66, - 86 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - { - "type": "Property", - "key": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "BinaryExpression", - "operator": "+", - "left": { - "type": "Literal", - "value": "__", - "raw": "\"__\"", - "range": [ - 90, - 94 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - "right": { - "type": "Literal", - "value": "proto", - "raw": "\"proto\"", - "range": [ - 97, - 104 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 16 - } - } - }, - "range": [ - 90, - 104 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 16 - } - } - }, - "right": { - "type": "Literal", - "value": "__", - "raw": "\"__\"", - "range": [ - 107, - 111 - ], - "loc": { - "start": { - "line": 8, - "column": 19 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - "range": [ - 90, - 111 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - "value": { - "type": "Identifier", - "name": "proto", - "range": [ - 114, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 26 - }, - "end": { - "line": 8, - "column": 31 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": true, - "range": [ - 89, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 31 - } - } - } - ], - "range": [ - 40, - 121 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - "range": [ - 36, - 121 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 9, - "column": 1 - } - } - } - ], - "kind": "var", - "range": [ - 32, - 122 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 122 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "tokens": [ - { - "type": "String", - "value": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "var", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "proto", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "var", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - } - }, - { - "type": "String", - "value": "\"__proto__\"", - "range": [ - 44, - 55 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 6, - "column": 13 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "proto", - "range": [ - 58, - 63 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - }, - { - "type": "String", - "value": "\"__proto__\"", - "range": [ - 67, - 78 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "proto", - "range": [ - 81, - 86 - ], - "loc": { - "start": { - "line": 7, - "column": 16 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 86, - 87 - ], - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 89, - 90 - ], - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 2 - } - } - }, - { - "type": "String", - "value": "\"__\"", - "range": [ - 90, - 94 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": "String", - "value": "\"proto\"", - "range": [ - 97, - 104 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 8, - "column": 17 - }, - "end": { - "line": 8, - "column": 18 - } - } - }, - { - "type": "String", - "value": "\"__\"", - "range": [ - 107, - 111 - ], - "loc": { - "start": { - "line": 8, - "column": 19 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 111, - 112 - ], - "loc": { - "start": { - "line": 8, - "column": 23 - }, - "end": { - "line": 8, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 112, - 113 - ], - "loc": { - "start": { - "line": 8, - "column": 24 - }, - "end": { - "line": 8, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "proto", - "range": [ - 114, - 119 - ], - "loc": { - "start": { - "line": 8, - "column": 26 - }, - "end": { - "line": 8, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 120, - 121 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 121, - 122 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js deleted file mode 100644 index d7fc93f96b07..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralDuplicateProperties-and-objectLiteralComputedProperties/proto-computed-property.src.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -var proto = {}; - -var x = { - ["__proto__"]: proto, - ["__proto__"]: proto, - ["__" + "proto" + "__"]: proto -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js deleted file mode 100644 index 695d353ec6af..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - objectLiteralShorthandMethods: true, - defaultParams: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js deleted file mode 100644 index d5346e2739ec..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.result.js +++ /dev/null @@ -1,1308 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "Literal", - "value": "use strict", - "raw": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "baz", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "a", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 11 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 38, - 40 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 29, - 40 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - "kind": "init", - "method": true, - "shorthand": false, - "computed": false, - "range": [ - 26, - 40 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "foo", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "b", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 54, - 56 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - "range": [ - 50, - 56 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 14 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 58, - 60 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 46, - 60 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - "kind": "init", - "method": true, - "shorthand": false, - "computed": false, - "range": [ - 43, - 60 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "toast", - "range": [ - 63, - 68 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "name": "b", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - "right": { - "type": "Literal", - "value": 10, - "raw": "10", - "range": [ - 76, - 78 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - "range": [ - 72, - 78 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "Identifier", - "name": "c", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 6, - "column": 19 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 83, - 85 - ], - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 68, - 85 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "kind": "init", - "method": true, - "shorthand": false, - "computed": false, - "range": [ - 63, - 85 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 23 - } - } - } - ], - "range": [ - 23, - 87 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - "range": [ - 19, - 87 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 7, - "column": 1 - } - } - } - ], - "kind": "var", - "range": [ - 15, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 88 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, - "tokens": [ - { - "type": "String", - "value": "\"use strict\"", - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "var", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 34, - 36 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 54, - 56 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "toast", - "range": [ - 63, - 68 - ], - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": "Numeric", - "value": "10", - "range": [ - 76, - 78 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 6, - "column": 21 - }, - "end": { - "line": 6, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 84, - 85 - ], - "loc": { - "start": { - "line": 6, - "column": 22 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 86, - 87 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 87, - 88 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js deleted file mode 100644 index b196d3234c1e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-defaultParams/default-params.src.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -var x = { - baz(a = 10) {}, - foo(a, b = 10) {}, - toast(a, b = 10, c) {} -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js deleted file mode 100644 index 93bc6ff64bbf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - objectLiteralShorthandMethods: true, - destructuring: true -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js deleted file mode 100644 index fb8ac4366730..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.result.js +++ /dev/null @@ -1,463 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "x", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "name": "b", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "range": [ - 5, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 4, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - "kind": "init", - "method": true, - "shorthand": false, - "computed": false, - "range": [ - 3, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 1, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js deleted file mode 100644 index c78cc0dcc444..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-destructuring/array-destructuring.src.js +++ /dev/null @@ -1 +0,0 @@ -({ x([ a, b ]){} }); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js deleted file mode 100644 index a93e5488c7ba..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - objectLiteralShorthandMethods: false, - generators: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js deleted file mode 100644 index bf0222ccafff..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 10, - "lineNumber": 1, - "column": 11, - "message": "Unexpected token *" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js deleted file mode 100644 index 1ae2612b5515..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/error-no-shorthand.src.js +++ /dev/null @@ -1 +0,0 @@ -var x = { *test () { yield *v } }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js deleted file mode 100644 index 5555feec4d2f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - objectLiteralShorthandMethods: true, - generators: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js deleted file mode 100644 index 6caea87446c3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.result.js +++ /dev/null @@ -1,499 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "test", - "range": [ - 11, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "YieldExpression", - "argument": { - "type": "Identifier", - "name": "v", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "delegate": true, - "range": [ - 21, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - "range": [ - 21, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "generator": true, - "expression": false, - "async": false, - "range": [ - 16, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "kind": "init", - "method": true, - "shorthand": false, - "computed": false, - "range": [ - 10, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 31 - } - } - } - ], - "range": [ - 8, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "range": [ - 4, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "test", - "range": [ - 11, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "yield", - "range": [ - 21, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "v", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js deleted file mode 100644 index 1ae2612b5515..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-generators/generator-object-literal-method.src.js +++ /dev/null @@ -1 +0,0 @@ -var x = { *test () { yield *v } }; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js deleted file mode 100644 index f8d2a83cdd3e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - objectLiteralShorthandMethods: true, - objectLiteralComputedProperties: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js deleted file mode 100644 index bf0710da0caf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.result.js +++ /dev/null @@ -1,499 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "bar", - "range": [ - 39, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - "range": [ - 32, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - } - } - } - ], - "range": [ - 22, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 19, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - "kind": "init", - "method": true, - "shorthand": false, - "computed": true, - "range": [ - 14, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - } - ], - "range": [ - 8, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "range": [ - 4, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 39, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js deleted file mode 100644 index 30e3c778e0b1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandMethods-and-objectLiteralComputedProperties/computed-method-property.src.js +++ /dev/null @@ -1,5 +0,0 @@ -var x = { - [foo]() { - return bar; - } -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js deleted file mode 100644 index a5a7e4d79fe2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - objectLiteralShorthandProperties: true, - experimentalObjectRestSpread: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js deleted file mode 100644 index c911790dfbea..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.result.js +++ /dev/null @@ -1,715 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": null, - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "get", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - "init": null, - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "set", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - "init": null, - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "x", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - "init": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "foo", - "range": [ - 42, - 45 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - "value": { - "type": "Identifier", - "name": "foo", - "range": [ - 42, - 45 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 42, - 45 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "get", - "range": [ - 51, - 54 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } - }, - "value": { - "type": "Identifier", - "name": "get", - "range": [ - 51, - 54 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 51, - 54 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } - }, - { - "type": "ExperimentalSpreadProperty", - "argument": { - "type": "Identifier", - "name": "set", - "range": [ - 63, - 66 - ], - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - } - }, - "range": [ - 60, - 66 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 10 - } - } - } - ], - "range": [ - 36, - 68 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - "range": [ - 32, - 68 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 9, - "column": 1 - } - } - } - ], - "kind": "var", - "range": [ - 28, - 69 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "set", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "var", - "range": [ - 28, - 31 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 42, - 45 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 51, - 54 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 60, - 63 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "set", - "range": [ - 63, - 66 - ], - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 67, - 68 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js deleted file mode 100644 index 11d8c39bfa8b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/objectLiteralShorthandProperties-and-experimentObjectRestSpread/shorthand-properties.src.js +++ /dev/null @@ -1,9 +0,0 @@ -var foo, - get, - set; - -var x = { - foo, - get, - ...set -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js deleted file mode 100644 index 37664407347f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - restParams: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js deleted file mode 100644 index 87c65263781a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.result.js +++ /dev/null @@ -1,313 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 13, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js deleted file mode 100644 index 09ec648ae18e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest-multi.src.js +++ /dev/null @@ -1 +0,0 @@ -(a, ...b) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js deleted file mode 100644 index 37664407347f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - arrowFunctions: true, - restParams: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js deleted file mode 100644 index 2fbab660aea1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.result.js +++ /dev/null @@ -1,259 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "a", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 7, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js deleted file mode 100644 index fae03351a18a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/arrow-rest.src.js +++ /dev/null @@ -1 +0,0 @@ -(...a) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js deleted file mode 100644 index 4ef77f98f31f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - arrowFunctions: true, - restParams: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js deleted file mode 100644 index 056fe91c2535..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.result.js +++ /dev/null @@ -1,407 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - } - ], - "range": [ - 1, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "range": [ - 8, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 14, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js deleted file mode 100644 index 9c56a46d6b31..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-array.src.js +++ /dev/null @@ -1 +0,0 @@ -({ a }, ...b) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js deleted file mode 100644 index 4ef77f98f31f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - arrowFunctions: true, - restParams: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js deleted file mode 100644 index fbd27ec7eae3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.result.js +++ /dev/null @@ -1,699 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "value": { - "type": "Identifier", - "name": "b", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 3, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "c", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "value": { - "type": "Identifier", - "name": "c", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "range": [ - 1, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "d", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "name": "e", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "f", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "range": [ - 22, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "d", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "e", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 28, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js deleted file mode 100644 index 49f55da3b4c8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-multi.src.js +++ /dev/null @@ -1 +0,0 @@ -({ a: b, c }, [d, e], ...f) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js deleted file mode 100644 index 4ef77f98f31f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - arrowFunctions: true, - restParams: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js deleted file mode 100644 index 7007fb941980..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.result.js +++ /dev/null @@ -1,552 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "ArrowFunctionExpression", - "id": null, - "params": [ - { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "value": { - "type": "ArrayPattern", - "elements": [ - { - "type": "Identifier", - "name": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "name": "b", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ], - "range": [ - 6, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 3, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - } - } - ], - "range": [ - 1, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "RestElement", - "argument": { - "type": "Identifier", - "name": "c", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 16, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [], - "range": [ - 25, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 22, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js deleted file mode 100644 index 0aa03bd886ff..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/destructured-arrow-object.src.js +++ /dev/null @@ -1 +0,0 @@ -({ a: [a, b] }, ...c) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js deleted file mode 100644 index 4ef77f98f31f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - arrowFunctions: true, - restParams: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js deleted file mode 100644 index 7cb67f68f7fd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 11, - "lineNumber": 1, - "column": 12, - "description": "Unexpected token [" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js deleted file mode 100644 index 00c0e530c37b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/restParams-and-arrowFunctions/error-attempted-spread-param.src.js +++ /dev/null @@ -1 +0,0 @@ -(a, ...[b]) => {}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js deleted file mode 100644 index 2cd5f3c10c93..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - arrowFunctions: true, - spread: true, - destructuring: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js deleted file mode 100644 index 376a1438960f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Unexpected token ..." -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js deleted file mode 100644 index 2d0036ad542e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/spread-and-arrowFunctions/invalid-arrow-rest-params.src.js +++ /dev/null @@ -1 +0,0 @@ -var x = (a, ...b) => {}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js deleted file mode 100644 index 0ac8d1008be0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - jsx: true, - templateStrings: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js deleted file mode 100644 index 8158d2ffa1d5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.result.js +++ /dev/null @@ -1,2526 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "React", - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "require", - "range": [ - 12, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "arguments": [ - { - "type": "Literal", - "value": "react/addons", - "raw": "'react/addons'", - "range": [ - 20, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - } - } - ], - "range": [ - 12, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - "range": [ - 4, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "MyComponent", - "range": [ - 42, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "React", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - "property": { - "type": "Identifier", - "name": "createClass", - "range": [ - 62, - 73 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - "range": [ - 56, - 73 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - "arguments": [ - { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "render", - "range": [ - 78, - 84 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "ReturnStatement", - "argument": { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "div", - "range": [ - 119, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - "selfClosing": false, - "attributes": [], - "range": [ - 118, - 123 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - "closingElement": { - "type": "JSXClosingElement", - "name": { - "type": "JSXIdentifier", - "name": "div", - "range": [ - 242, - 245 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - "range": [ - 240, - 246 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - "children": [ - { - "type": "Literal", - "value": "\n ", - "raw": "\n ", - "range": [ - 123, - 132 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "div", - "range": [ - 133, - 136 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - "selfClosing": true, - "attributes": [ - { - "type": "JSXAttribute", - "name": { - "type": "JSXIdentifier", - "name": "myProp", - "range": [ - 137, - 143 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 19 - } - } - }, - "value": { - "type": "JSXExpressionContainer", - "expression": { - "type": "TemplateLiteral", - "quasis": [ - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": false, - "range": [ - 145, - 148 - ], - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 24 - } - } - }, - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": true, - "range": [ - 168, - 170 - ], - "loc": { - "start": { - "line": 7, - "column": 44 - }, - "end": { - "line": 7, - "column": 46 - } - } - } - ], - "expressions": [ - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "ThisExpression", - "range": [ - 148, - 152 - ], - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 28 - } - } - }, - "property": { - "type": "Identifier", - "name": "props", - "range": [ - 153, - 158 - ], - "loc": { - "start": { - "line": 7, - "column": 29 - }, - "end": { - "line": 7, - "column": 34 - } - } - }, - "range": [ - 148, - 158 - ], - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 34 - } - } - }, - "property": { - "type": "Identifier", - "name": "something", - "range": [ - 159, - 168 - ], - "loc": { - "start": { - "line": 7, - "column": 35 - }, - "end": { - "line": 7, - "column": 44 - } - } - }, - "range": [ - 148, - 168 - ], - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 44 - } - } - } - ], - "range": [ - 145, - 170 - ], - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 46 - } - } - }, - "range": [ - 144, - 171 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 47 - } - } - }, - "range": [ - 137, - 171 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 47 - } - } - } - ], - "range": [ - 132, - 173 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 49 - } - } - }, - "closingElement": null, - "children": [], - "range": [ - 132, - 173 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 49 - } - } - }, - { - "type": "Literal", - "value": "\n ", - "raw": "\n ", - "range": [ - 173, - 182 - ], - "loc": { - "start": { - "line": 7, - "column": 49 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "div", - "range": [ - 183, - 186 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 12 - } - } - }, - "selfClosing": true, - "attributes": [ - { - "type": "JSXAttribute", - "name": { - "type": "JSXIdentifier", - "name": "differentProp", - "range": [ - 187, - 200 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 26 - } - } - }, - "value": { - "type": "JSXExpressionContainer", - "expression": { - "type": "TemplateLiteral", - "quasis": [ - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": false, - "range": [ - 202, - 205 - ], - "loc": { - "start": { - "line": 8, - "column": 28 - }, - "end": { - "line": 8, - "column": 31 - } - } - }, - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": true, - "range": [ - 228, - 230 - ], - "loc": { - "start": { - "line": 8, - "column": 54 - }, - "end": { - "line": 8, - "column": 56 - } - } - } - ], - "expressions": [ - { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "ThisExpression", - "range": [ - 205, - 209 - ], - "loc": { - "start": { - "line": 8, - "column": 31 - }, - "end": { - "line": 8, - "column": 35 - } - } - }, - "property": { - "type": "Identifier", - "name": "props", - "range": [ - 210, - 215 - ], - "loc": { - "start": { - "line": 8, - "column": 36 - }, - "end": { - "line": 8, - "column": 41 - } - } - }, - "range": [ - 205, - 215 - ], - "loc": { - "start": { - "line": 8, - "column": 31 - }, - "end": { - "line": 8, - "column": 41 - } - } - }, - "property": { - "type": "Identifier", - "name": "anotherThing", - "range": [ - 216, - 228 - ], - "loc": { - "start": { - "line": 8, - "column": 42 - }, - "end": { - "line": 8, - "column": 54 - } - } - }, - "range": [ - 205, - 228 - ], - "loc": { - "start": { - "line": 8, - "column": 31 - }, - "end": { - "line": 8, - "column": 54 - } - } - } - ], - "range": [ - 202, - 230 - ], - "loc": { - "start": { - "line": 8, - "column": 28 - }, - "end": { - "line": 8, - "column": 56 - } - } - }, - "range": [ - 201, - 231 - ], - "loc": { - "start": { - "line": 8, - "column": 27 - }, - "end": { - "line": 8, - "column": 57 - } - } - }, - "range": [ - 187, - 231 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 57 - } - } - } - ], - "range": [ - 182, - 233 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 59 - } - } - }, - "closingElement": null, - "children": [], - "range": [ - 182, - 233 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 59 - } - } - }, - { - "type": "Literal", - "value": "\n ", - "raw": "\n ", - "range": [ - 233, - 240 - ], - "loc": { - "start": { - "line": 8, - "column": 59 - }, - "end": { - "line": 9, - "column": 6 - } - } - } - ], - "range": [ - 118, - 246 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - "range": [ - 103, - 253 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 10, - "column": 6 - } - } - } - ], - "range": [ - 97, - 257 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "generator": false, - "expression": false, - "async": false, - "range": [ - 86, - 257 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - "kind": "init", - "method": false, - "shorthand": false, - "computed": false, - "range": [ - 78, - 257 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - } - ], - "range": [ - 74, - 259 - ], - "loc": { - "start": { - "line": 3, - "column": 36 - }, - "end": { - "line": 12, - "column": 1 - } - } - } - ], - "range": [ - 56, - 260 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - "range": [ - 42, - 260 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 12, - "column": 2 - } - } - } - ], - "kind": "var", - "range": [ - 38, - 261 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "module", - "range": [ - 263, - 269 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 6 - } - } - }, - "property": { - "type": "Identifier", - "name": "exports", - "range": [ - 270, - 277 - ], - "loc": { - "start": { - "line": 14, - "column": 7 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - "range": [ - 263, - 277 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - "right": { - "type": "Identifier", - "name": "MyComponent", - "range": [ - 280, - 291 - ], - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 28 - } - } - }, - "range": [ - 263, - 291 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 28 - } - } - }, - "range": [ - 263, - 292 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 29 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 292 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 29 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "React", - "range": [ - 4, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "require", - "range": [ - 12, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "String", - "value": "'react/addons'", - "range": [ - 20, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Keyword", - "value": "var", - "range": [ - 38, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "MyComponent", - "range": [ - 42, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "React", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "createClass", - "range": [ - 62, - 73 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 3, - "column": 36 - }, - "end": { - "line": 3, - "column": 37 - } - } - }, - { - "type": "Identifier", - "value": "render", - "range": [ - 78, - 84 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 84, - 85 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 86, - 94 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 97, - 98 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 103, - 109 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 118, - 119 - ], - "loc": { - "start": { - "line": 6, - "column": 6 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 119, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 122, - 123 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 123, - 132 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 132, - 133 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 133, - 136 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - { - "type": "JSXIdentifier", - "value": "myProp", - "range": [ - 137, - 143 - ], - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 143, - 144 - ], - "loc": { - "start": { - "line": 7, - "column": 19 - }, - "end": { - "line": 7, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 144, - 145 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - { - "type": "Template", - "value": "`${", - "range": [ - 145, - 148 - ], - "loc": { - "start": { - "line": 7, - "column": 21 - }, - "end": { - "line": 7, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 148, - 152 - ], - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 152, - 153 - ], - "loc": { - "start": { - "line": 7, - "column": 28 - }, - "end": { - "line": 7, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "props", - "range": [ - 153, - 158 - ], - "loc": { - "start": { - "line": 7, - "column": 29 - }, - "end": { - "line": 7, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 158, - 159 - ], - "loc": { - "start": { - "line": 7, - "column": 34 - }, - "end": { - "line": 7, - "column": 35 - } - } - }, - { - "type": "Identifier", - "value": "something", - "range": [ - 159, - 168 - ], - "loc": { - "start": { - "line": 7, - "column": 35 - }, - "end": { - "line": 7, - "column": 44 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 168, - 170 - ], - "loc": { - "start": { - "line": 7, - "column": 44 - }, - "end": { - "line": 7, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 7, - "column": 46 - }, - "end": { - "line": 7, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 171, - 172 - ], - "loc": { - "start": { - "line": 7, - "column": 47 - }, - "end": { - "line": 7, - "column": 48 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 172, - 173 - ], - "loc": { - "start": { - "line": 7, - "column": 48 - }, - "end": { - "line": 7, - "column": 49 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 173, - 182 - ], - "loc": { - "start": { - "line": 7, - "column": 49 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 182, - 183 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 183, - 186 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 12 - } - } - }, - { - "type": "JSXIdentifier", - "value": "differentProp", - "range": [ - 187, - 200 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 200, - 201 - ], - "loc": { - "start": { - "line": 8, - "column": 26 - }, - "end": { - "line": 8, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 8, - "column": 27 - }, - "end": { - "line": 8, - "column": 28 - } - } - }, - { - "type": "Template", - "value": "`${", - "range": [ - 202, - 205 - ], - "loc": { - "start": { - "line": 8, - "column": 28 - }, - "end": { - "line": 8, - "column": 31 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 205, - 209 - ], - "loc": { - "start": { - "line": 8, - "column": 31 - }, - "end": { - "line": 8, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 209, - 210 - ], - "loc": { - "start": { - "line": 8, - "column": 35 - }, - "end": { - "line": 8, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "props", - "range": [ - 210, - 215 - ], - "loc": { - "start": { - "line": 8, - "column": 36 - }, - "end": { - "line": 8, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 215, - 216 - ], - "loc": { - "start": { - "line": 8, - "column": 41 - }, - "end": { - "line": 8, - "column": 42 - } - } - }, - { - "type": "Identifier", - "value": "anotherThing", - "range": [ - 216, - 228 - ], - "loc": { - "start": { - "line": 8, - "column": 42 - }, - "end": { - "line": 8, - "column": 54 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 228, - 230 - ], - "loc": { - "start": { - "line": 8, - "column": 54 - }, - "end": { - "line": 8, - "column": 56 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 230, - 231 - ], - "loc": { - "start": { - "line": 8, - "column": 56 - }, - "end": { - "line": 8, - "column": 57 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 231, - 232 - ], - "loc": { - "start": { - "line": 8, - "column": 57 - }, - "end": { - "line": 8, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 232, - 233 - ], - "loc": { - "start": { - "line": 8, - "column": 58 - }, - "end": { - "line": 8, - "column": 59 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 233, - 240 - ], - "loc": { - "start": { - "line": 8, - "column": 59 - }, - "end": { - "line": 9, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 240, - 241 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 241, - 242 - ], - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 242, - 245 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 245, - 246 - ], - "loc": { - "start": { - "line": 9, - "column": 11 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 251, - 252 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 252, - 253 - ], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 256, - 257 - ], - "loc": { - "start": { - "line": 11, - "column": 2 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 258, - 259 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 259, - 260 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 260, - 261 - ], - "loc": { - "start": { - "line": 12, - "column": 2 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "module", - "range": [ - 263, - 269 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 269, - 270 - ], - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "exports", - "range": [ - 270, - 277 - ], - "loc": { - "start": { - "line": 14, - "column": 7 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 278, - 279 - ], - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "MyComponent", - "range": [ - 280, - 291 - ], - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 291, - 292 - ], - "loc": { - "start": { - "line": 14, - "column": 28 - }, - "end": { - "line": 14, - "column": 29 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js deleted file mode 100644 index 340bc7245f8b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-complex.src.js +++ /dev/null @@ -1,14 +0,0 @@ -var React = require('react/addons'); - -var MyComponent = React.createClass({ - render: function() { - return ( -
-
-
-
- ); - } -}); - -module.exports = MyComponent; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js deleted file mode 100644 index 0ac8d1008be0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - jsx: true, - templateStrings: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js deleted file mode 100644 index 26dbb21e0c9e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.result.js +++ /dev/null @@ -1,560 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - "selfClosing": false, - "attributes": [], - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "closingElement": { - "type": "JSXClosingElement", - "name": { - "type": "JSXIdentifier", - "name": "a", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "children": [ - { - "type": "JSXExpressionContainer", - "expression": { - "type": "TemplateLiteral", - "quasis": [ - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": false, - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": true, - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - } - } - ], - "expressions": [ - { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - } - ], - "range": [ - 4, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "range": [ - 3, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "JSXExpressionContainer", - "expression": { - "type": "TemplateLiteral", - "quasis": [ - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": true, - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "expressions": [], - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 11, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ], - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "JSXIdentifier", - "value": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Template", - "value": "`${", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Numeric", - "value": "1", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 8, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Template", - "value": "``", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "JSXIdentifier", - "value": "a", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js deleted file mode 100644 index e8f0a6010909..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx-multi.src.js +++ /dev/null @@ -1 +0,0 @@ -
{`${1}`}{``} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js deleted file mode 100644 index 0ac8d1008be0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - jsx: true, - templateStrings: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js deleted file mode 100644 index 7293ee259732..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.result.js +++ /dev/null @@ -1,429 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "JSXElement", - "openingElement": { - "type": "JSXOpeningElement", - "name": { - "type": "JSXIdentifier", - "name": "foo", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - "selfClosing": true, - "attributes": [ - { - "type": "JSXAttribute", - "name": { - "type": "JSXIdentifier", - "name": "bar", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - "value": { - "type": "JSXExpressionContainer", - "expression": { - "type": "TemplateLiteral", - "quasis": [ - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": false, - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "TemplateElement", - "value": { - "raw": "", - "cooked": "" - }, - "tail": true, - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - } - } - ], - "expressions": [ - { - "type": "Identifier", - "name": "baz", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - } - ], - "range": [ - 10, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - "range": [ - 9, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - "range": [ - 5, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 19 - } - } - } - ], - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "closingElement": null, - "children": [], - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "JSXIdentifier", - "value": "foo", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "JSXIdentifier", - "value": "bar", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Template", - "value": "`${", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js deleted file mode 100644 index e3edcd339071..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-jsx/template-strings-in-jsx.src.js +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js deleted file mode 100644 index 34cf505fc9d6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.config.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - unicodeCodePointEscapes: true, - templateStrings: true -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js deleted file mode 100644 index 93d224cfd08f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.result.js +++ /dev/null @@ -1,209 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "ts", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - "init": { - "type": "TemplateLiteral", - "quasis": [ - { - "type": "TemplateElement", - "value": { - "raw": "\\\\u{000042}\\\\u0042\\\\x42\\\\u0\\\\102\\\\A", - "cooked": "\\u{000042}\\u0042\\x42\\u0\\102\\A" - }, - "tail": true, - "range": [ - 9, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 46 - } - } - } - ], - "expressions": [], - "range": [ - 9, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - "range": [ - 4, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 46 - } - } - } - ], - "kind": "var", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "ts", - "range": [ - 4, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Template", - "value": "`\\\\u{000042}\\\\u0042\\\\x42\\\\u0\\\\102\\\\A`", - "range": [ - 9, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js deleted file mode 100644 index 165980e6eac5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features-mix/templateStrings-and-unicodeCodePointEscapes/template-strings-unicode-escape.src.js +++ /dev/null @@ -1 +0,0 @@ -var ts = `\\u{000042}\\u0042\\x42\\u0\\102\\A`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js deleted file mode 100644 index 347fc610a280..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param-with-params.result.js +++ /dev/null @@ -1,369 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "name": "foo" - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "y" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "body": [] - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 11, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js deleted file mode 100644 index d15557475888..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/as-param.result.js +++ /dev/null @@ -1,278 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "name": "foo" - }, - "arguments": [ - { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ], - "body": [] - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js deleted file mode 100644 index 70ee8b395b28..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic.result.js +++ /dev/null @@ -1,170 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 6, - 12 - ], - "value": "test", - "raw": "\"test\"" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 3, - 5 - ] - }, - { - "type": "String", - "value": "\"test\"", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 6, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js deleted file mode 100644 index 902c6754b3f8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body-not-object.result.js +++ /dev/null @@ -1,314 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "e" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 5, - 18 - ], - "body": [ - { - "type": "LabeledStatement", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 7, - 16 - ], - "body": { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "value": 42, - "raw": "42" - } - }, - "label": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 7, - 12 - ], - "name": "label" - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "e", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 2, - 4 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Identifier", - "value": "label", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 7, - 12 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js deleted file mode 100644 index 7848b1acbb67..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/block-body.result.js +++ /dev/null @@ -1,261 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "e" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 5, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ], - "value": 42, - "raw": "42" - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "e", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 2, - 4 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js deleted file mode 100644 index 5d4b9d858619..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-dup-params.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Argument name clash" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js deleted file mode 100644 index 310984a68740..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-missing-paren.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Unexpected token (" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js deleted file mode 100644 index 9b47c568d591..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-not-arrow.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 26, - "lineNumber": 1, - "column": 27, - "message": "Unexpected token )" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js deleted file mode 100644 index fc83515848ba..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param-multi.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Assigning to rvalue" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js deleted file mode 100644 index fc83515848ba..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-numeric-param.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Assigning to rvalue" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js deleted file mode 100644 index 90dd78ab9316..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-reverse-arrow.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Unexpected token )" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js deleted file mode 100644 index 431716c65020..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-default-param-eval.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Assigning to eval in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js deleted file mode 100644 index c3f08bb3211b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-dup-params.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 18, - "lineNumber": 1, - "column": 19, - "message": "Argument name clash" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js deleted file mode 100644 index d7e7dda5f6bf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval-return.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Binding eval in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js deleted file mode 100644 index f542ae32a6ad..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-eval.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Binding eval in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js deleted file mode 100644 index 6eedac5c9740..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-octal.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 21, - "lineNumber": 1, - "column": 22, - "message": "Invalid number" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js deleted file mode 100644 index 875b7471a522..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-arguments.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Binding arguments in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js deleted file mode 100644 index d7e7dda5f6bf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-eval.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Binding eval in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js deleted file mode 100644 index d7e7dda5f6bf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-names.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Binding eval in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js deleted file mode 100644 index bbdeb9a4725a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Binding arguments in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js deleted file mode 100644 index 1d1998fa3780..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-strict-param-no-paren-eval.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Binding eval in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js deleted file mode 100644 index a74418b697cd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-two-lines.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Unexpected token )" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js deleted file mode 100644 index dce37a901455..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/error-wrapped-param.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Unexpected token (" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js deleted file mode 100644 index 8014aabbf5e1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/expression.result.js +++ /dev/null @@ -1,206 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 1, - 7 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "x" - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 3, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js deleted file mode 100644 index 0cdd0ed3813b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/iife.result.js +++ /dev/null @@ -1,337 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "e" - } - ], - "body": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 6, - 22 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 8, - 20 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 8, - 16 - ], - "name": "property" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ], - "value": 42, - "raw": "42" - }, - "kind": "init" - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "e", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 2, - 4 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "property", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 8, - 16 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js deleted file mode 100644 index 788bb5d7334e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/multiple-params.result.js +++ /dev/null @@ -1,261 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "b" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "value": "test", - "raw": "\"test\"" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "String", - "value": "\"test\"", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js deleted file mode 100644 index e67c7e4b1285..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/no-auto-return.result.js +++ /dev/null @@ -1,351 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "b" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 10, - 17 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ], - "value": 42, - "raw": "42" - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js deleted file mode 100644 index 4e51fd377d09..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-arguments.result.js +++ /dev/null @@ -1,171 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "name": "arguments" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 13, - 15 - ], - "value": 42, - "raw": "42" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "arguments", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 13, - 15 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js deleted file mode 100644 index 78deb4f50ff7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval-params.result.js +++ /dev/null @@ -1,261 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 1, - 5 - ], - "name": "eval" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 13, - 15 - ], - "value": 42, - "raw": "42" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "eval", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 1, - 5 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 13, - 15 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js deleted file mode 100644 index 7060aeafefe5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-eval.result.js +++ /dev/null @@ -1,171 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 0, - 4 - ], - "name": "eval" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 8, - 10 - ], - "value": 42, - "raw": "42" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "eval", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 0, - 4 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 5, - 7 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 8, - 10 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js deleted file mode 100644 index 3a8c648439a6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/not-strict-octal.result.js +++ /dev/null @@ -1,207 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ], - "value": 0, - "raw": "00" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 4, - 6 - ] - }, - { - "type": "Numeric", - "value": "00", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js deleted file mode 100644 index 7353434d0cff..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-arrow-function.result.js +++ /dev/null @@ -1,248 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - } - ], - "body": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 5, - 12 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "y" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ], - "value": 42, - "raw": "42" - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 2, - 4 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js deleted file mode 100644 index ff147bd482c5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/return-sequence.result.js +++ /dev/null @@ -1,572 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "x" - } - ], - "body": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 8, - 27 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "y" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "z" - } - ], - "body": { - "type": "SequenceExpression", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 19, - 26 - ], - "expressions": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "x" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "name": "y" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "name": "z" - } - ] - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 4, - 6 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js deleted file mode 100644 index 2b3ebf0d83e5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-parens.result.js +++ /dev/null @@ -1,207 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "e" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 7, - 13 - ], - "value": "test", - "raw": "\"test\"" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "e", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 4, - 6 - ] - }, - { - "type": "String", - "value": "\"test\"", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 7, - 13 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js deleted file mode 100644 index 202b779f3699..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param-return-identifier.result.js +++ /dev/null @@ -1,206 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "sun" - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "name": "earth" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "sun", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ] - }, - { - "type": "Identifier", - "value": "earth", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js deleted file mode 100644 index 390c79528fda..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/single-param.result.js +++ /dev/null @@ -1,171 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "e" - } - ], - "body": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "value": "test", - "raw": "\"test\"" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "e", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 2, - 4 - ] - }, - { - "type": "String", - "value": "\"test\"", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js deleted file mode 100644 index 7790809d3e38..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/invalid.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Unexpected token 2" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js deleted file mode 100644 index 88fde0b28b5c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/lowercase.result.js +++ /dev/null @@ -1,94 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "value": 5, - "raw": "0b101" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Numeric", - "value": "0b101", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js deleted file mode 100644 index 257a1d018070..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/binaryLiterals/uppercase.result.js +++ /dev/null @@ -1,94 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "value": 5, - "raw": "0B101" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Numeric", - "value": "0B101", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js deleted file mode 100644 index b32ab6c2da7e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/const.result.js +++ /dev/null @@ -1,185 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 6, - 15 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ], - "name": "foo" - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ], - "name": "bar" - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js deleted file mode 100644 index cf99908240a7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let-in-switchcase.result.js +++ /dev/null @@ -1,477 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 0, - 47 - ], - "body": [ - { - "type": "SwitchStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 0, - 47 - ], - "discriminant": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 8, - 14 - ], - "name": "answer" - }, - "cases": [ - { - "type": "SwitchCase", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 18, - 45 - ], - "consequent": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 27, - 38 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 31, - 37 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ], - "name": "t" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 35, - 37 - ], - "value": 42, - "raw": "42" - } - } - ], - "kind": "let" - }, - { - "type": "BreakStatement", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 39, - 45 - ], - "label": null - } - ], - "test": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ], - "value": 42, - "raw": "42" - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "switch", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "answer", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 8, - 14 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Keyword", - "value": "case", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 18, - 22 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Keyword", - "value": "let", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 27, - 30 - ] - }, - { - "type": "Identifier", - "value": "t", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 35, - 37 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "Keyword", - "value": "break", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 39, - 44 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 44, - 45 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 46, - 47 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js deleted file mode 100644 index 1f25b12ca960..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/blockBindings/let.result.js +++ /dev/null @@ -1,185 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 4, - 13 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 10, - 13 - ], - "name": "bar" - } - } - ], - "kind": "let" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "let", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 10, - 13 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js deleted file mode 100644 index 9e2247dd45b7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-accessor-properties.result.js +++ /dev/null @@ -1,618 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "key": { - "type": "Identifier", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 16, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "body": [] - }, - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "get", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 19, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "key": { - "type": "Identifier", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "b" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 27, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "body": [] - }, - "range": [ - 24, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "c", - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "set", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "set", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js deleted file mode 100644 index 300d28a4698f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-computed-static-method.result.js +++ /dev/null @@ -1,428 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "key": { - "type": "Identifier", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 21, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "body": [] - }, - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "params": [] - }, - "computed": true, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js deleted file mode 100644 index 80b759f81f37..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-expression.result.js +++ /dev/null @@ -1,186 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "expression": { - "type": "ClassExpression", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ], - "id": null, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ], - "body": [] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 1, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js deleted file mode 100644 index 28b55cea2f29..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-prototype.result.js +++ /dev/null @@ -1,356 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "key": { - "type": "Identifier", - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "prototype" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 20, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "body": [] - }, - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "prototype", - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js deleted file mode 100644 index b0aa183ad181..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-static.result.js +++ /dev/null @@ -1,374 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "key": { - "type": "Identifier", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "static" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "body": [] - }, - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js deleted file mode 100644 index ff88f1a62248..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-method-named-with-space.result.js +++ /dev/null @@ -1,321 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "key": { - "type": "Identifier", - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "withSpace" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 22, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "body": [] - }, - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "withSpace", - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js deleted file mode 100644 index 19c9b6ff4f8b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method-super.result.js +++ /dev/null @@ -1,481 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 17, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 27, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 27, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "callee": { - "type": "Super", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - "arguments": [] - } - } - ] - }, - "range": [ - 15, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "super", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js deleted file mode 100644 index 92dd95517e3d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-one-method.result.js +++ /dev/null @@ -1,356 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "body": [] - }, - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js deleted file mode 100644 index 71c48ae7072c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-prototype.result.js +++ /dev/null @@ -1,411 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "key": { - "type": "Literal", - "range": [ - 17, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "value": "prototype", - "raw": "\"prototype\"" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 31, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "body": [] - }, - "range": [ - 29, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "params": [] - }, - "computed": true, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "String", - "value": "\"prototype\"", - "range": [ - 17, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js deleted file mode 100644 index 612ea03fe358..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method-named-static.result.js +++ /dev/null @@ -1,392 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "key": { - "type": "Identifier", - "range": [ - 16, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "static" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 24, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "body": [] - }, - "range": [ - 22, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "params": [] - }, - "computed": false, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 16, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js deleted file mode 100644 index 12ce22f9c7ce..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-method.result.js +++ /dev/null @@ -1,392 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "key": { - "type": "Identifier", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "body": [] - }, - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "params": [] - }, - "computed": false, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js deleted file mode 100644 index 28b4cffa4176..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-static-methods-and-accessor-properties.result.js +++ /dev/null @@ -1,824 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 59 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 58 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "key": { - "type": "Identifier", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "body": [] - }, - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "params": [] - }, - "computed": false, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 22, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "key": { - "type": "Identifier", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 36, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "body": [] - }, - "range": [ - 34, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "params": [] - }, - "computed": false, - "static": true, - "kind": "get", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 39, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "key": { - "type": "Identifier", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 54, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "body": [] - }, - "range": [ - 51, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "name": "b", - "decorators": [] - } - ] - }, - "computed": false, - "static": true, - "kind": "set", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 58 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 58 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 58 - }, - "end": { - "line": 1, - "column": 59 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 39, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - { - "type": "Identifier", - "value": "set", - "range": [ - 46, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 49 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 54 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 55 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 58 - }, - "end": { - "line": 1, - "column": 59 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js deleted file mode 100644 index c3a057915370..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-computed-static-methods.result.js +++ /dev/null @@ -1,652 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "key": { - "type": "Identifier", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 20, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "body": [] - }, - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "params": [] - }, - "computed": true, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 24, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "key": { - "type": "Identifier", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "name": "b" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 35, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "body": [] - }, - "range": [ - 33, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "params": [] - }, - "computed": true, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js deleted file mode 100644 index 498a86398f88..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-computed-constructor.result.js +++ /dev/null @@ -1,564 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "key": { - "type": "Literal", - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "value": "constructor", - "raw": "\"constructor\"" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 24, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "body": [] - }, - "range": [ - 22, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "constructor", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 27, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "key": { - "type": "Literal", - "range": [ - 28, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "value": "constructor", - "raw": "\"constructor\"" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 44, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "body": [] - }, - "range": [ - 42, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "params": [] - }, - "computed": true, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "String", - "value": "\"constructor\"", - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "String", - "value": "\"constructor\"", - "range": [ - 28, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js deleted file mode 100644 index a0ceb3a28ec3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-semi.result.js +++ /dev/null @@ -1,544 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "key": { - "type": "Identifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "body": [] - }, - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "key": { - "type": "Identifier", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "b" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "body": [] - }, - "range": [ - 16, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js deleted file mode 100644 index 396912856134..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-three-semi.result.js +++ /dev/null @@ -1,580 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "key": { - "type": "Identifier", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 13, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "body": [] - }, - "range": [ - 11, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "key": { - "type": "Identifier", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "b" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 19, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "body": [] - }, - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js deleted file mode 100644 index c5209f80a3c9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods-two-semi.result.js +++ /dev/null @@ -1,562 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "key": { - "type": "Identifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "body": [] - }, - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "key": { - "type": "Identifier", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "b" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "body": [] - }, - "range": [ - 16, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js deleted file mode 100644 index a02df3609e84..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-methods.result.js +++ /dev/null @@ -1,526 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "key": { - "type": "Identifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "a" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 12, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "body": [] - }, - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "b" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 17, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "body": [] - }, - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js deleted file mode 100644 index e96932563363..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-two-static-methods-named-constructor.result.js +++ /dev/null @@ -1,560 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "range": [ - 0, - 56 - ], - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 55 - } - }, - "range": [ - 0, - 55 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "A" - }, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 55 - } - }, - "range": [ - 8, - 55 - ], - "body": [ - { - "type": "MethodDefinition", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 9, - 31 - ], - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 16, - 27 - ], - "name": "constructor" - }, - "static": true, - "accessibility": null, - "kind": "method", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 27, - 31 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 29, - 31 - ], - "body": [] - } - } - }, - { - "type": "MethodDefinition", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 32, - 54 - ], - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "range": [ - 39, - 50 - ], - "name": "constructor" - }, - "accessibility": null, - "static": true, - "kind": "method", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 50, - 54 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 52, - 54 - ], - "body": [] - } - } - } - ] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "range": [ - 55, - 56 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Keyword", - "value": "static", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 9, - 15 - ] - }, - { - "type": "Identifier", - "value": "constructor", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 16, - 27 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Keyword", - "value": "static", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 32, - 38 - ] - }, - { - "type": "Identifier", - "value": "constructor", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "range": [ - 39, - 50 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "range": [ - 50, - 51 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 51, - 52 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 52, - 53 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 53, - 54 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 54 - }, - "end": { - "line": 1, - "column": 55 - } - }, - "range": [ - 54, - 55 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "range": [ - 55, - 56 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js deleted file mode 100644 index 0dea27c174db..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-parameters.result.js +++ /dev/null @@ -1,413 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 9, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "foo", - "decorators": [] - }, - { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "bar", - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 30, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "body": [] - }, - "range": [ - 20, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 8, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 9, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js deleted file mode 100644 index 1a392513161a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor-with-space.result.js +++ /dev/null @@ -1,355 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 9, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 9, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "body": [] - }, - "range": [ - 21, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 8, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "EmptyStatement", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 9, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js deleted file mode 100644 index 42a2a8ad14ab..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/class-with-constructor.result.js +++ /dev/null @@ -1,355 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "A" - }, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 8, - 25 - ], - "body": [ - { - "type": "MethodDefinition", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 9, - 24 - ], - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 9, - 20 - ], - "name": "constructor" - }, - "accessibility": null, - "static": false, - "kind": "constructor", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 20, - 24 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ], - "body": [] - } - } - } - ] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "constructor", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 9, - 20 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js deleted file mode 100644 index f0b4ffd4befd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-assign-to-var.result.js +++ /dev/null @@ -1,331 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 4, - 27 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "ClassExpression", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 8, - 27 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "A" - }, - "superClass": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ], - "value": 0, - "raw": "0" - }, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 25, - 27 - ], - "body": [] - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 8, - 13 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Keyword", - "value": "extends", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 16, - 23 - ] - }, - { - "type": "Numeric", - "value": "0", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js deleted file mode 100644 index 621b72c61cff..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/derived-class-expression.result.js +++ /dev/null @@ -1,240 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "expression": { - "type": "ClassExpression", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 1, - 18 - ], - "id": null, - "superClass": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "value": 0, - "raw": "0" - }, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ], - "body": [] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 1, - 6 - ] - }, - { - "type": "Keyword", - "value": "extends", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Numeric", - "value": "0", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js deleted file mode 100644 index 9060a7e27315..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-double-semi.result.js +++ /dev/null @@ -1,185 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "A" - }, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 8, - 10 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js deleted file mode 100644 index 4373315c19a7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class-semi.result.js +++ /dev/null @@ -1,203 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "A" - }, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js deleted file mode 100644 index 9060a7e27315..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-class.result.js +++ /dev/null @@ -1,185 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "A" - }, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 8, - 10 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js deleted file mode 100644 index 3d7aac182e26..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/empty-literal-derived-class.result.js +++ /dev/null @@ -1,239 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 0, - 21 - ], - "body": [ - { - "type": "ClassDeclaration", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "A" - }, - "superClass": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "value": 0, - "raw": "0" - }, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Keyword", - "value": "extends", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 8, - 15 - ] - }, - { - "type": "Numeric", - "value": "0", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js deleted file mode 100644 index f29098ce0d23..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-declaration.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Unexpected token {" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js deleted file mode 100644 index 89b2125e2f72..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-setter-declaration.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 17, - "lineNumber": 1, - "column": 18, - "message": "setter should have exactly one param" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js deleted file mode 100644 index ce2fc38ee726..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-class-expression.result.js +++ /dev/null @@ -1,221 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "ClassExpression", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 1, - 11 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "A" - }, - "superClass": null, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "body": [] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 1, - 6 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js deleted file mode 100644 index 29ae196c55a0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/named-derived-class-expression.result.js +++ /dev/null @@ -1,275 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "expression": { - "type": "ClassExpression", - "decorators": [], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 1, - 20 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "A" - }, - "superClass": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "value": 0, - "raw": "0" - }, - "implements": [], - "body": { - "type": "ClassBody", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ], - "body": [] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "class", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 1, - 6 - ] - }, - { - "type": "Identifier", - "value": "A", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Keyword", - "value": "extends", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 9, - 16 - ] - }, - { - "type": "Numeric", - "value": "0", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js deleted file mode 100644 index 97b08adae6ee..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-constructor.result.js +++ /dev/null @@ -1,430 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "AssignmentPattern", - "range": [ - 26, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "foo" - }, - "right": { - "type": "Literal", - "range": [ - 30, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "value": "bar", - "raw": "'bar'" - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 37, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 25, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 8, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "String", - "value": "'bar'", - "range": [ - 30, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js deleted file mode 100644 index e3d75fecfc78..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/class-method.result.js +++ /dev/null @@ -1,431 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 29, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 17, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "AssignmentPattern", - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "left": { - "type": "Identifier", - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "name": "bar" - }, - "right": { - "type": "Literal", - "range": [ - 22, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "value": "baz", - "raw": "'baz'" - }, - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "String", - "value": "'baz'", - "range": [ - 22, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js deleted file mode 100644 index fbd99e074ee4..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/declaration.result.js +++ /dev/null @@ -1,296 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "f" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 11, - 16 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "a" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "value": 1, - "raw": "1" - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ], - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js deleted file mode 100644 index f6ab67a40885..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/expression.result.js +++ /dev/null @@ -1,350 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - }, - "right": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 4, - 22 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 13, - 18 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "value": 1, - "raw": "1" - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 20, - 22 - ], - "body": [] - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js deleted file mode 100644 index c138b609103b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/method.result.js +++ /dev/null @@ -1,480 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 4, - 27 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 6, - 25 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "f" - }, - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 9, - 25 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 18, - 21 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "a" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "value": 1, - "raw": "1" - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ], - "body": [] - } - }, - "kind": "init" - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 9, - 17 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js deleted file mode 100644 index f7885b211aec..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/defaultParams/not-all-params.result.js +++ /dev/null @@ -1,496 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 0, - 36 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 0, - 36 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 4, - 35 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 10, - 35 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "a" - }, - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 22, - 28 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "name": "b" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 26, - 28 - ], - "value": 42, - "raw": "42" - } - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ], - "name": "c" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 33, - 35 - ], - "body": [] - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 10, - 18 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 26, - 28 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js deleted file mode 100644 index d546423880f6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-array.result.js +++ /dev/null @@ -1,261 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "y" - } - ] - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js deleted file mode 100644 index c75245c2a872..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-array.result.js +++ /dev/null @@ -1,370 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "y" - }, - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "x" - } - ] - } - ] - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 11, - 13 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js deleted file mode 100644 index 380c7ec73045..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object-named.result.js +++ /dev/null @@ -1,595 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 1, - 21 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 2, - 8 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 2, - 5 - ], - "name": "foo" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "y" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 10, - 20 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "a" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 12, - 20 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 13, - 19 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "x" - }, - "kind": "init" - } - ] - }, - "kind": "init" - } - ] - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 2, - 5 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js deleted file mode 100644 index e1953238fc58..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-nested-object.result.js +++ /dev/null @@ -1,523 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 1, - 11 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "y" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "y" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 5, - 10 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "x" - } - } - ] - }, - "kind": "init" - } - ] - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 13, - 15 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js deleted file mode 100644 index 52e007591737..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/arrow-param-object.result.js +++ /dev/null @@ -1,300 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "y" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "y" - } - } - ] - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js deleted file mode 100644 index 914227a99056..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-array.result.js +++ /dev/null @@ -1,315 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 2, - 8 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ], - "value": 10, - "raw": "10" - } - } - ] - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 11, - 13 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js deleted file mode 100644 index e78410ae1c4f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object-nested.result.js +++ /dev/null @@ -1,758 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 1, - 24 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 2, - 8 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 2, - 8 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ], - "value": 10, - "raw": "10" - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 10, - 23 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "y" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 13, - 23 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 15, - 21 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "z" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 15, - 21 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "z" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 19, - 21 - ], - "value": 10, - "raw": "10" - } - } - } - ] - }, - "kind": "init" - } - ] - } - ], - "body": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 29, - 35 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ], - "name": "x" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ], - "name": "z" - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 19, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 26, - 28 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js deleted file mode 100644 index 136e0c348797..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-arrowFunctions/param-defaults-object.result.js +++ /dev/null @@ -1,354 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "expression": { - "type": "ArrowFunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "id": null, - "generator": false, - "expression": true, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 2, - 8 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 2, - 8 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ], - "value": 10, - "raw": "10" - } - } - } - ] - } - ], - "body": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "=>", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 11, - 13 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js deleted file mode 100644 index 91f931042f3e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-const-undefined.result.js +++ /dev/null @@ -1,258 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 6, - 14 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - } - ] - }, - "init": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ], - "elements": [] - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js deleted file mode 100644 index 6fd4ac7144fa..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/array-let-undefined.result.js +++ /dev/null @@ -1,258 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - } - ] - }, - "init": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ], - "elements": [] - } - } - ], - "kind": "let" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "let", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js deleted file mode 100644 index d927cb064ea0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-named.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 6, - 16 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 6, - 11 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "b" - }, - "kind": "init" - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "properties": [] - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js deleted file mode 100644 index b28b4f18904f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-const-undefined.result.js +++ /dev/null @@ -1,297 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 6, - 14 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - } - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ], - "properties": [] - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js deleted file mode 100644 index 4409bcd08ff8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-named.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 4, - 14 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 4, - 9 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "b" - }, - "kind": "init" - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ], - "properties": [] - } - } - ], - "kind": "let" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "let", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js deleted file mode 100644 index 1b70558f8f2a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-blockBindings/object-let-undefined.result.js +++ /dev/null @@ -1,297 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - } - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ], - "properties": [] - } - } - ], - "kind": "let" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "let", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js deleted file mode 100644 index 47a9f6bc190f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-array.result.js +++ /dev/null @@ -1,441 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "f" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 11, - 20 - ], - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - } - ] - }, - "right": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 17, - 20 - ], - "elements": [ - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "value": 1, - "raw": "1" - } - ] - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js deleted file mode 100644 index 648d9c7c1ae3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-short.result.js +++ /dev/null @@ -1,650 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 1, - 22 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 2, - 21 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ], - "name": "f" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 3, - 21 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 4, - 17 - ], - "left": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - } - } - ] - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 10, - 17 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 11, - 16 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "x" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "value": 10, - "raw": "10" - }, - "kind": "init" - } - ] - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 19, - 21 - ], - "body": [] - } - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js deleted file mode 100644 index f7e1f373c444..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object-wrapped.result.js +++ /dev/null @@ -1,141 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - type: 'ExpressionStatement', - expression: { - type: 'ObjectExpression', - properties: [{ - type: 'Property', - key: { - type: 'Identifier', - name: 'f', - range: [2, 3], - loc: { - start: { line: 1, column: 2 }, - end: { line: 1, column: 3 } - } - }, - value: { - type: 'FunctionExpression', - id: null, - params: [{ - type: 'ObjectPattern', - properties: [{ - type: 'Property', - key: { - type: 'Identifier', - name: 'x', - range: [15, 16], - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - } - }, - value: { - type: 'Identifier', - name: 'x', - range: [15, 16], - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - } - }, - kind: 'init', - method: false, - shorthand: true, - computed: false, - range: [15, 16], - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - } - }], - range: [14, 17], - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 17 } - } - }], - defaults: [{ - type: 'ObjectExpression', - properties: [{ - type: 'Property', - key: { - type: 'Identifier', - name: 'x', - range: [21, 22], - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - } - }, - value: { - type: 'Literal', - value: 10, - raw: '10', - range: [24, 26], - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 26 } - } - }, - kind: 'init', - method: false, - shorthand: false, - computed: false, - range: [21, 26], - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 26 } - } - }], - range: [20, 27], - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 27 } - } - }], - body: { - type: 'BlockStatement', - body: [], - range: [29, 31], - loc: { - start: { line: 1, column: 29 }, - end: { line: 1, column: 31 } - } - }, - rest: null, - generator: false, - expression: false, - async: false, - range: [5, 31], - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 31 } - } - }, - kind: 'init', - method: false, - shorthand: false, - computed: false, - range: [2, 31], - loc: { - start: { line: 1, column: 2 }, - end: { line: 1, column: 31 } - } - }], - range: [1, 32], - loc: { - start: { line: 1, column: 1 }, - end: { line: 1, column: 32 } - } - }, - range: [0, 33], - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 33 } - } - } - ] -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js deleted file mode 100644 index be4e7abfff60..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-defaultParams/param-object.result.js +++ /dev/null @@ -1,592 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "f" - }, - "right": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 4, - 30 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 13, - 26 - ], - "left": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "x" - } - } - ] - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 19, - 26 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 20, - 25 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "name": "x" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ], - "value": 10, - "raw": "10" - }, - "kind": "init" - } - ] - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 28, - 30 - ], - "body": [] - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js deleted file mode 100644 index af1e17a5f770..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-forOf/loop.result.js +++ /dev/null @@ -1,273 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "ForOfStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "a" - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ], - "name": "foo" - }, - "body": { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "for", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "of", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js deleted file mode 100644 index 0e7696920c89..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/complex-destructured.result.js +++ /dev/null @@ -1,496 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 0, - 21 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 0, - 21 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "elements": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "a" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "b" - } - } - ] - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 11, - 15 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "c" - } - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "d" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Identifier", - "value": "d", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js deleted file mode 100644 index 0a7da17db3f7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructured-array-literal.result.js +++ /dev/null @@ -1,418 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 4, - 13 - ], - "argument": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 7, - 13 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "b" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "c" - } - ] - } - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "d" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "d", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js deleted file mode 100644 index 8b9c1f7ea974..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/destructuring-param.result.js +++ /dev/null @@ -1,512 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 11, - 26 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "a" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "b" - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 18, - 25 - ], - "argument": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 21, - 25 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ], - "name": "ok" - } - ] - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 28, - 30 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 18, - 21 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Identifier", - "value": "ok", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js deleted file mode 100644 index 5c1edf702962..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Comma is not permitted after the rest element" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js deleted file mode 100644 index 5c1edf702962..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/invalid-not-final-array-empty.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Comma is not permitted after the rest element" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js deleted file mode 100644 index e46fa0a227df..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/multi-destructured.result.js +++ /dev/null @@ -1,309 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 4, - 8 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "b" - } - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "c" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js deleted file mode 100644 index 5c1edf702962..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/not-final-array.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Comma is not permitted after the rest element" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js deleted file mode 100644 index 8d4b931447eb..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/single-destructured.result.js +++ /dev/null @@ -1,255 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "elements": [ - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 1, - 5 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "a" - } - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "b" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js deleted file mode 100644 index 085d47f4f9ab..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-complex-destructured.result.js +++ /dev/null @@ -1,516 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 4, - 24 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 4, - 20 - ], - "elements": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 5, - 13 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "b" - } - } - ] - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 15, - 19 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "c" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ], - "name": "d" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Identifier", - "value": "d", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js deleted file mode 100644 index 7610b6e98095..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-destructured-array-literal.result.js +++ /dev/null @@ -1,438 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 4, - 22 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 4, - 18 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 8, - 17 - ], - "argument": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 11, - 17 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "b" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "c" - } - ] - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ], - "name": "d" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Identifier", - "value": "d", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js deleted file mode 100644 index bf92133e4338..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-multi-destructured.result.js +++ /dev/null @@ -1,329 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 4, - 17 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 4, - 13 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 8, - 12 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "b" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "c" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js deleted file mode 100644 index cd58c3ae0e6e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring-and-spread/var-single-destructured.result.js +++ /dev/null @@ -1,275 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 4, - 14 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 4, - 10 - ], - "elements": [ - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 5, - 9 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "a" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "b" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js deleted file mode 100644 index 52d6ad89b4de..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-member.result.js +++ /dev/null @@ -1,293 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "elements": [ - { - "type": "MemberExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 1, - 5 - ], - "object": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 1, - 3 - ], - "name": "ok" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "v" - }, - "computed": false - } - ] - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 20, - "raw": "20" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "ok", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 1, - 3 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Identifier", - "value": "v", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "20", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js deleted file mode 100644 index 38d81c2f6a2b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-to-array.result.js +++ /dev/null @@ -1,383 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "b" - } - ] - }, - "right": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 9, - 15 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "b" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "a" - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js deleted file mode 100644 index a5a9465df657..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/array-var-undefined.result.js +++ /dev/null @@ -1,258 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - } - ] - }, - "init": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ], - "elements": [] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js deleted file mode 100644 index 8cacbe9822e3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-array.result.js +++ /dev/null @@ -1,468 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "name": "consturctor" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 38, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 25, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ArrayPattern", - "range": [ - 26, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "elements": [ - { - "type": "Identifier", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "foo" - }, - { - "type": "Identifier", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "bar" - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "consturctor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js deleted file mode 100644 index 8fb598ab6b57..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-array.result.js +++ /dev/null @@ -1,612 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "name": "consturctor" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 42, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 25, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ArrayPattern", - "range": [ - 26, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 30 - } - }, - "elements": [ - { - "type": "AssignmentPattern", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "left": { - "type": "Identifier", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "foo" - }, - "right": { - "type": "Literal", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "value": 3, - "raw": "3" - } - }, - { - "type": "AssignmentPattern", - "range": [ - 34, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "left": { - "type": "Identifier", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "name": "bar" - }, - "right": { - "type": "Literal", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "value": 4, - "raw": "4" - } - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "consturctor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Numeric", - "value": "4", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js deleted file mode 100644 index 12d9262f6bdf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-defaults-object.result.js +++ /dev/null @@ -1,690 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "name": "consturctor" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 42, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 25, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ObjectPattern", - "range": [ - 26, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 30 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "key": { - "type": "Identifier", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "foo" - }, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "foo" - }, - "right": { - "type": "Literal", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "value": 3, - "raw": "3" - }, - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - }, - { - "type": "Property", - "range": [ - 34, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "key": { - "type": "Identifier", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "name": "bar" - }, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "name": "bar" - }, - "right": { - "type": "Literal", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "value": 4, - "raw": "4" - }, - "range": [ - 34, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "consturctor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Numeric", - "value": "4", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js deleted file mode 100644 index 83c12f973c20..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-constructor-params-object.result.js +++ /dev/null @@ -1,546 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "name": "consturctor" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 38, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 25, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ObjectPattern", - "range": [ - 26, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "key": { - "type": "Identifier", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "foo" - }, - "value": { - "type": "Identifier", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "foo" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - }, - { - "type": "Property", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "key": { - "type": "Identifier", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "bar" - }, - "value": { - "type": "Identifier", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "bar" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "consturctor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js deleted file mode 100644 index 1848852ccf68..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-array.result.js +++ /dev/null @@ -1,468 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 17, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ArrayPattern", - "range": [ - 18, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "elements": [ - { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "bar" - }, - { - "type": "Identifier", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "baz" - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js deleted file mode 100644 index dee1037b507f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-array.result.js +++ /dev/null @@ -1,612 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 34, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 17, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ArrayPattern", - "range": [ - 18, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "elements": [ - { - "type": "AssignmentPattern", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "left": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "bar" - }, - "right": { - "type": "Literal", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "value": 3, - "raw": "3" - } - }, - { - "type": "AssignmentPattern", - "range": [ - 26, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "left": { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "baz" - }, - "right": { - "type": "Literal", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "value": 4, - "raw": "4" - } - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "4", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js deleted file mode 100644 index d298fa780e4e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-defaults-object.result.js +++ /dev/null @@ -1,690 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 34, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 17, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ObjectPattern", - "range": [ - 18, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "key": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "bar" - }, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "bar" - }, - "right": { - "type": "Literal", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "value": 3, - "raw": "3" - }, - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - }, - { - "type": "Property", - "range": [ - 26, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "key": { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "baz" - }, - "value": { - "type": "AssignmentPattern", - "left": { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "baz" - }, - "right": { - "type": "Literal", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "value": 3, - "raw": "3" - }, - "range": [ - 26, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js deleted file mode 100644 index 4782cb4415c1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/class-method-params-object.result.js +++ /dev/null @@ -1,546 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 17, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "ObjectPattern", - "range": [ - 18, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "key": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "bar" - }, - "value": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "bar" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - }, - { - "type": "Property", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "key": { - "type": "Identifier", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "baz" - }, - "value": { - "type": "Identifier", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "baz" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - } - ], - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js deleted file mode 100644 index ebcef30c72f8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-all.result.js +++ /dev/null @@ -1,564 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 4, - 30 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 4, - 26 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - }, - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 13, - 18 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "value": 5, - "raw": "5" - } - }, - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 20, - 25 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "name": "z" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ], - "value": 1, - "raw": "1" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Numeric", - "value": "5", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js deleted file mode 100644 index 02a44ef85d86..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-longform-nested-multi.result.js +++ /dev/null @@ -1,775 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 0, - 39 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 0, - 39 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 4, - 38 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 4, - 34 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 5, - 9 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "x" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 11, - 15 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "y" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "y" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 17, - 32 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "z" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 20, - 32 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 22, - 31 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "name": "a" - }, - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 25, - 31 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "name": "a" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 29, - 31 - ], - "value": 10, - "raw": "10" - } - }, - "kind": "init" - } - ] - }, - "kind": "init" - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 37, - 38 - ], - "name": "b" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 29, - 31 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js deleted file mode 100644 index 4b82bbdac83d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-multi.result.js +++ /dev/null @@ -1,420 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 4, - 22 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 4, - 18 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "z" - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js deleted file mode 100644 index 6623c7044922..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-all.result.js +++ /dev/null @@ -1,493 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 4, - 27 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 4, - 23 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - }, - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 13, - 22 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 15, - 21 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "z" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 19, - 21 - ], - "value": 10, - "raw": "10" - } - } - ] - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 19, - 21 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js deleted file mode 100644 index 75b4a2e9bfc3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array-nested-multi.result.js +++ /dev/null @@ -1,421 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 4, - 23 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 4, - 19 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - }, - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 13, - 18 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "z" - } - ] - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js deleted file mode 100644 index f54cdab8d108..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-array.result.js +++ /dev/null @@ -1,274 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 1, - 5 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 3, - 5 - ], - "value": 10, - "raw": "10" - } - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 3, - 5 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js deleted file mode 100644 index bfc0d019c324..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-all.result.js +++ /dev/null @@ -1,681 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 4, - 30 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 4, - 26 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 13, - 18 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 13, - 18 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "value": 5, - "raw": "5" - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 20, - 25 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "name": "z" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 20, - 25 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "name": "z" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ], - "value": 1, - "raw": "1" - } - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Numeric", - "value": "5", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js deleted file mode 100644 index 0759bf020d61..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-all.result.js +++ /dev/null @@ -1,789 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 0, - 42 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 0, - 42 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 4, - 41 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 4, - 37 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 5, - 14 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 8, - 14 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ], - "value": 10, - "raw": "10" - } - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 16, - 25 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "y" - }, - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 19, - 25 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "y" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ], - "value": 10, - "raw": "10" - } - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 27, - 36 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ], - "name": "z" - }, - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 30, - 36 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ], - "name": "z" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 34, - 36 - ], - "value": 10, - "raw": "10" - } - }, - "kind": "init" - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 34, - 36 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 41, - 42 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js deleted file mode 100644 index e718bf10620d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform-multi.result.js +++ /dev/null @@ -1,645 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 4, - 31 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 4, - 27 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 5, - 9 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "x" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 11, - 20 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "y" - }, - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 14, - 20 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "y" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ], - "value": 10, - "raw": "10" - } - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 22, - 26 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "name": "z" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "name": "z" - }, - "kind": "init" - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js deleted file mode 100644 index 84200af904d8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-longform.result.js +++ /dev/null @@ -1,387 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 4, - 21 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 4, - 17 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 6, - 15 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "x" - }, - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 9, - 15 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 13, - 15 - ], - "value": 10, - "raw": "10" - } - }, - "kind": "init" - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "name": "x" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 13, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js deleted file mode 100644 index a3e20a520368..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-mixed-multi.result.js +++ /dev/null @@ -1,573 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 4, - 25 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 4, - 21 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 8, - 17 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "y" - }, - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 11, - 17 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "y" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ], - "value": 10, - "raw": "10" - } - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "z" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "z" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js deleted file mode 100644 index f7540e0e8cd1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-multi.result.js +++ /dev/null @@ -1,537 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 4, - 22 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 4, - 18 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "z" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "z" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js deleted file mode 100644 index 7b4322f4f074..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-all.result.js +++ /dev/null @@ -1,646 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 4, - 30 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 4, - 26 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 13, - 25 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 16, - 25 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 18, - 24 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "z" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 18, - 24 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "z" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ], - "value": 10, - "raw": "10" - } - } - } - ] - }, - "kind": "init" - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js deleted file mode 100644 index f4fbd8d2b4df..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object-nested-multi.result.js +++ /dev/null @@ -1,574 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 4, - 26 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 4, - 22 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 13, - 21 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "y" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "z" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "z" - } - } - ] - }, - "kind": "init" - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js deleted file mode 100644 index e3c0d880e194..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/defaults-object.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ], - "value": 10, - "raw": "10" - } - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "x" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js deleted file mode 100644 index 502726529d9a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-array-catch.result.js +++ /dev/null @@ -1,918 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, - "range": [ - 0, - 72 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 0, - 71 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "a" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 16, - 71 - ], - "body": [ - { - "type": "TryStatement", - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 20, - 69 - ], - "block": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 24, - 46 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "range": [ - 30, - 42 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 34, - 41 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 34, - 37 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ], - "name": "b" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 40, - 41 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ] - }, - "handler": { - "type": "CatchClause", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 49, - 69 - ], - "param": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "range": [ - 55, - 62 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 56, - 61 - ], - "name": "stack" - } - ] - }, - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 64, - 69 - ], - "body": [] - } - }, - "finalizer": null - } - ] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - }, - "range": [ - 71, - 72 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Keyword", - "value": "try", - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 20, - 23 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 30, - 33 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "range": [ - 41, - 42 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Keyword", - "value": "catch", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "range": [ - 49, - 54 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 8 - } - }, - "range": [ - 54, - 55 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "range": [ - 55, - 56 - ] - }, - { - "type": "Identifier", - "value": "stack", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 56, - 61 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "range": [ - 61, - 62 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - }, - "range": [ - 62, - 63 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 18 - } - }, - "range": [ - 64, - 65 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 68, - 69 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 70, - 71 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - }, - "range": [ - 71, - 72 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js deleted file mode 100644 index 73a185eb11cc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/destructured-object-catch.result.js +++ /dev/null @@ -1,957 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 2 - } - }, - "range": [ - 0, - 72 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 0, - 71 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "a" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 16, - 71 - ], - "body": [ - { - "type": "TryStatement", - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 20, - 69 - ], - "block": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 24, - 46 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "range": [ - 30, - 42 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 34, - 41 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 34, - 37 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ], - "name": "b" - } - } - ] - }, - "init": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 40, - 41 - ], - "name": "a" - } - } - ], - "kind": "var" - } - ] - }, - "handler": { - "type": "CatchClause", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 49, - 69 - ], - "param": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "range": [ - 55, - 62 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 56, - 61 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 56, - 61 - ], - "name": "stack" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 56, - 61 - ], - "name": "stack" - } - } - ] - }, - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 64, - 69 - ], - "body": [] - } - }, - "finalizer": null - } - ] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - }, - "range": [ - 71, - 72 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Keyword", - "value": "try", - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 20, - 23 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 30, - 33 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "range": [ - 41, - 42 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Keyword", - "value": "catch", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "range": [ - 49, - 54 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 8 - } - }, - "range": [ - 54, - 55 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "range": [ - 55, - 56 - ] - }, - { - "type": "Identifier", - "value": "stack", - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 56, - 61 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "range": [ - 61, - 62 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - }, - "range": [ - 62, - 63 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 18 - } - }, - "range": [ - 64, - 65 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "range": [ - 68, - 69 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "range": [ - 70, - 71 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 2 - } - }, - "range": [ - 71, - 72 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js deleted file mode 100644 index 93be6358d304..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/invalid-defaults-object-assign.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - lineNumber: 1, - index: 9, - column: 10, - message: "Unexpected token =" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js deleted file mode 100644 index ea977284ac36..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.result.js +++ /dev/null @@ -1,331 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "operator": "=", - "left": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 1, - 23 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 3, - 21 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 3, - 15 - ], - "name": "responseText" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 17, - 21 - ], - "name": "text" - }, - "kind": "init" - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 27, - 30 - ], - "name": "res" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "responseText", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 3, - 15 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "text", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 17, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Identifier", - "value": "res", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 27, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js deleted file mode 100644 index f3fd16b810f8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-array.result.js +++ /dev/null @@ -1,663 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 4, - 30 - ], - "id": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - null, - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 10, - 15 - ], - "elements": [ - null, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "z" - } - ] - } - ] - }, - "init": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 19, - 30 - ], - "elements": [ - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "value": 1, - "raw": "1" - }, - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "value": 2, - "raw": "2" - }, - { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 24, - 29 - ], - "elements": [ - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "value": 3, - "raw": "3" - }, - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ], - "value": 4, - "raw": "4" - } - ] - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Numeric", - "value": "2", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Numeric", - "value": "3", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Numeric", - "value": "4", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js deleted file mode 100644 index c9ee5d14eb77..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/nested-object.result.js +++ /dev/null @@ -1,965 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 0, - 53 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 0, - 53 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 4, - 52 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 4, - 24 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 5, - 9 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "x" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "y" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 11, - 22 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "z" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 14, - 22 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 16, - 20 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "a" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "b" - }, - "kind": "init" - } - ] - }, - "kind": "init" - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 27, - 52 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 29, - 35 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ], - "name": "x" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 32, - 35 - ], - "value": "3", - "raw": "\"3\"" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "range": [ - 37, - 50 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 37, - 38 - ], - "name": "z" - }, - "value": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "range": [ - 40, - 50 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "range": [ - 42, - 48 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 42, - 43 - ], - "name": "a" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "range": [ - 45, - 48 - ], - "value": "b", - "raw": "\"b\"" - }, - "kind": "init" - } - ] - }, - "kind": "init" - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "String", - "value": "\"3\"", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 32, - 35 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 42, - 43 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 43, - 44 - ] - }, - { - "type": "String", - "value": "\"b\"", - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "range": [ - 45, - 48 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "range": [ - 49, - 50 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 51, - 52 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 52, - 53 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js deleted file mode 100644 index 7eaa658db5ae..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-named.result.js +++ /dev/null @@ -1,333 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 4, - 14 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 4, - 9 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "b" - }, - "kind": "init" - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ], - "properties": [] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js deleted file mode 100644 index 8b79126305a9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/object-var-undefined.result.js +++ /dev/null @@ -1,297 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "a" - } - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 10, - 12 - ], - "properties": [] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js deleted file mode 100644 index 002ada8ee2c3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-deafults-object.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 14, - "lineNumber": 1, - "column": 15, - "description": "Unexpected token =" -} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js deleted file mode 100644 index a5cb3a81ab39..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-array.result.js +++ /dev/null @@ -1,351 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 11, - 19 - ], - "elements": [ - { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 12, - 18 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ], - "value": 10, - "raw": "10" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 21, - 23 - ], - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js deleted file mode 100644 index dd8a72d66526..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object-nested.result.js +++ /dev/null @@ -1,720 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 0, - 39 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 0, - 38 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 11, - 34 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 12, - 18 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 12, - 18 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ], - "value": 10, - "raw": "10" - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 20, - 33 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "name": "y" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 23, - 33 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 25, - 31 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "name": "z" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 25, - 31 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "name": "z" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 29, - 31 - ], - "value": 10, - "raw": "10" - } - } - } - ] - }, - "kind": "init" - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 36, - 38 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 29, - 31 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js deleted file mode 100644 index 73ade897e53e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/param-defaults-object.result.js +++ /dev/null @@ -1,390 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 11, - 19 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 12, - 18 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "AssignmentPattern", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 12, - 18 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - }, - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ], - "value": 10, - "raw": "10" - } - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 21, - 23 - ], - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js deleted file mode 100644 index 7af6c21169d6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array-wrapped.result.js +++ /dev/null @@ -1,404 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 1, - 23 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "x" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 12, - 20 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "a" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "b" - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 21, - 23 - ], - "body": [] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js deleted file mode 100644 index 442ff1a57ef3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-array.result.js +++ /dev/null @@ -1,368 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 11, - 19 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "a" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "b" - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 20, - 22 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js deleted file mode 100644 index bdccf3486812..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-multi-object.result.js +++ /dev/null @@ -1,407 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "a" - }, - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 14, - 19 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "b" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 20, - 22 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js deleted file mode 100644 index 390ce67b6357..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-array.result.js +++ /dev/null @@ -1,461 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 11, - 23 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - }, - null, - { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 17, - 22 - ], - "elements": [ - null, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "name": "z" - } - ] - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 25, - 27 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js deleted file mode 100644 index c795570ae22b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-nested-object.result.js +++ /dev/null @@ -1,648 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 0, - 36 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 11, - 31 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 12, - 16 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "y" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 18, - 29 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "z" - }, - "value": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 21, - 29 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 23, - 27 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ], - "name": "a" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ], - "name": "b" - }, - "kind": "init" - } - ] - }, - "kind": "init" - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 33, - 35 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js deleted file mode 100644 index 54b73e8d9cc4..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object-wrapped.result.js +++ /dev/null @@ -1,482 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 1, - 23 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "x" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 12, - 20 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "a" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "b" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 21, - 23 - ], - "body": [] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js deleted file mode 100644 index 4b14534b0994..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/params-object.result.js +++ /dev/null @@ -1,446 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 11, - 19 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "a" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "name": "b" - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 20, - 22 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js deleted file mode 100644 index b694b8007caf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/sparse-array.result.js +++ /dev/null @@ -1,293 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "operator": "=", - "left": { - "type": "ArrayPattern", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "elements": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - null, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "b" - } - ] - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "name": "array" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "array", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js deleted file mode 100644 index c13485195ac3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-generators.result.js +++ /dev/null @@ -1,223 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "foo" - }, - "generator": true, - "expression": false, - "async": true, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 22, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "async", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js deleted file mode 100644 index abb80b360b52..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalAsyncIteration/async-iterator.result.js +++ /dev/null @@ -1,496 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "foo" - }, - "generator": false, - "expression": false, - "async": true, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 21, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ForOfStatement", - "range": [ - 27, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "left": { - "type": "VariableDeclaration", - "range": [ - 38, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 44, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "id": { - "type": "Identifier", - "range": [ - 44, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "item" - }, - "init": null - } - ], - "kind": "const" - }, - "right": { - "type": "Identifier", - "range": [ - 52, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "name": "items" - }, - "body": { - "type": "BlockStatement", - "range": [ - 59, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [] - }, - "await": true - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "async", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "for", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "await", - "range": [ - 31, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 38, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "item", - "range": [ - 44, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "of", - "range": [ - 49, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "items", - "range": [ - 52, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js deleted file mode 100644 index ca29de665400..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/arg-spread.result.js +++ /dev/null @@ -1,409 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "c" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 11, - 20 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "a" - } - }, - { - "type": "ExperimentalRestProperty", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 15, - 19 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ], - "name": "b" - }, - "shorthand": true, - "computed": false, - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ], - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js deleted file mode 100644 index 49acb2b8a96d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/destructuring-assign-mirror.result.js +++ /dev/null @@ -1,549 +0,0 @@ -module.exports = { - "type": "Program", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "ObjectPattern", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "ExperimentalRestProperty", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - "range": [ - 5, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - } - } - ], - "range": [ - 1, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - "right": { - "type": "ObjectExpression", - "properties": [ - { - "type": "Property", - "key": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "value": { - "type": "Identifier", - "name": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "kind": "init", - "method": false, - "shorthand": true, - "computed": false, - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "ExperimentalSpreadProperty", - "argument": { - "type": "Identifier", - "name": "b", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ], - "range": [ - 13, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 1, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js deleted file mode 100644 index 23c70b6e1de2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/function-parameter-object-spread.result.js +++ /dev/null @@ -1,316 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "foo" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "range": [ - 13, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "properties": [ - { - "type": "ExperimentalRestProperty", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "name": "bar" - }, - "computed": false, - "shorthand": true - } - ] - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 23, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js deleted file mode 100644 index 741ae54b1a61..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest-trailing-comma.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - index: 16, - lineNumber: 1, - column: 17, - message: "Unexpected trailing comma after rest property" -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js deleted file mode 100644 index c18a2de41f29..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/invalid-rest.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 18, - "lineNumber": 1, - "column": 19, - "message": "Unexpected token ." -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js deleted file mode 100644 index 8ee8eae3e9aa..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/object-rest.result.js +++ /dev/null @@ -1,984 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "range": [ - 0, - 48 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "range": [ - 0, - 48 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 4, - 47 - ], - "id": { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 4, - 18 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "x" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "x" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "y" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "y" - } - }, - { - "type": "ExperimentalRestProperty", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 12, - 16 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "name": "z" - }, - "shorthand": true, - "computed": false, - } - ] - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 21, - 47 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 23, - 27 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ], - "name": "x" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ], - "value": 1, - "raw": "1" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 29, - 33 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ], - "name": "y" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ], - "value": 2, - "raw": "2" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 35, - 39 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ], - "name": "a" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ], - "value": 3, - "raw": "3" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 41, - 45 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 41, - 42 - ], - "name": "b" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 44, - 45 - ], - "value": 4, - "raw": "4" - }, - "kind": "init" - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ] - }, - { - "type": "Identifier", - "value": "z", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Numeric", - "value": "2", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Numeric", - "value": "3", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 39, - 40 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 41, - 42 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 42, - 43 - ] - }, - { - "type": "Numeric", - "value": "4", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 44, - 45 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 46, - 47 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "range": [ - 47, - 48 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js deleted file mode 100644 index 25637c84f674..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/property-spread.result.js +++ /dev/null @@ -1,859 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 0, - 83 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 0, - 26 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "name": "get" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "name": "set" - }, - "init": null - } - ], - "kind": "var" - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 28, - 83 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 32, - 82 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 36, - 82 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 42, - 50 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "name": "foo" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 47, - 50 - ], - "name": "foo" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 12 - } - }, - "range": [ - 56, - 64 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 56, - 59 - ], - "name": "get" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - }, - "range": [ - 61, - 64 - ], - "name": "get" - }, - "kind": "init" - }, - { - "type": "ExperimentalSpreadProperty", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 14 - } - }, - "range": [ - 70, - 80 - ], - "argument": { - "type": "MemberExpression", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 14 - } - }, - "range": [ - 73, - 80 - ], - "object": { - "type": "Identifier", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 73, - 76 - ], - "name": "set" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 14 - } - }, - "range": [ - 77, - 80 - ], - "name": "foo" - }, - "computed": false - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 28, - 31 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 47, - 50 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "range": [ - 50, - 51 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 56, - 59 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 8 - } - }, - "range": [ - 59, - 60 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - }, - "range": [ - 61, - 64 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 13 - } - }, - "range": [ - 64, - 65 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 70, - 73 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 73, - 76 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 11 - } - }, - "range": [ - 76, - 77 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 14 - } - }, - "range": [ - 77, - 80 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 81, - 82 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 82, - 83 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js deleted file mode 100644 index 35e97e3f2d09..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-method-args.result.js +++ /dev/null @@ -1,629 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [0, 108], - "sourceType": "script", - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "name": "initialize", - "range": [ - 7, - 17 - ], - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "id": null, - "async": false, - "generator": false, - "expression": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 46 - } - }, - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "name": "someVar", - "range": [ - 19, - 26 - ], - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "name": "someVar", - "range": [ - 19, - 26 - ], - }, - "range": [ - 19, - 26 - ], - }, - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "name": "otherVar", - "range": [ - 28, - 36 - ], - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "name": "otherVar", - "range": [ - 28, - 36 - ], - }, - "range": [ - 28, - 36 - ], - }, - { - "type": "ExperimentalRestProperty", - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "name": "options", - "range": [ - 41, - 48 - ], - }, - "shorthand": true, - "computed": false, - "range": [ - 38, - 48 - ] - } - ], - "range": [ - 18, - 49 - ], - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [], - "range": [ - 51, - 104 - ], - }, - "range": [ - 17, - 104 - ], - }, - "range": [ - 7, - 104 - ], - } - ], - "range": [ - 1, - 106 - ], - }, - "range": [ - 0, - 108 - ], - } - ], - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "initialize", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 7, - 17 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "someVar", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 19, - 26 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Identifier", - "value": "otherVar", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "range": [ - 28, - 36 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "range": [ - 38, - 41 - ] - }, - { - "type": "Identifier", - "value": "options", - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "range": [ - 41, - 48 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 2, - "column": 45 - }, - "end": { - "line": 2, - "column": 46 - } - }, - "range": [ - 48, - 49 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 47 - } - }, - "range": [ - 49, - 50 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 2, - "column": 49 - } - }, - "range": [ - 51, - 52 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 103, - 104 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 105, - 106 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 106, - 107 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 107, - 108 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js deleted file mode 100644 index ce598f4e7662..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-methods.result.js +++ /dev/null @@ -1,688 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 0, - 114 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 0, - 114 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 4, - 113 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 8, - 113 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 14, - 111 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 14, - 24 - ], - "name": "initialize" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 24, - 111 - ], - "id": null, - "async": false, - "generator": false, - "expression": false, - "params": [ - { - "type": "ObjectPattern", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 46 - } - }, - "range": [ - 25, - 56 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 26, - 33 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 26, - 33 - ], - "name": "someVar" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 26, - 33 - ], - "name": "someVar" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "range": [ - 35, - 43 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "range": [ - 35, - 43 - ], - "name": "otherVar" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "range": [ - 35, - 43 - ], - "name": "otherVar" - } - }, - { - "type": "ExperimentalRestProperty", - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "range": [ - 45, - 55 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "range": [ - 48, - 55 - ], - "name": "options" - }, - "shorthand": true, - "computed": false, - } - ] - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 58, - 111 - ], - "body": [] - } - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "initialize", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 14, - 24 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Identifier", - "value": "someVar", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 26, - 33 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Identifier", - "value": "otherVar", - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "range": [ - 35, - 43 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "range": [ - 43, - 44 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "range": [ - 45, - 48 - ] - }, - { - "type": "Identifier", - "value": "options", - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "range": [ - 48, - 55 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 2, - "column": 45 - }, - "end": { - "line": 2, - "column": 46 - } - }, - "range": [ - 55, - 56 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 47 - } - }, - "range": [ - 56, - 57 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 2, - "column": 49 - } - }, - "range": [ - 58, - 59 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 110, - 111 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 112, - 113 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 113, - 114 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js deleted file mode 100644 index 9b861afb8421..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/shorthand-properties.result.js +++ /dev/null @@ -1,715 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 0, - 69 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 0, - 26 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "name": "get" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "name": "set" - }, - "init": null - } - ], - "kind": "var" - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 28, - 69 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 32, - 68 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 36, - 68 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "name": "foo" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "name": "foo" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ], - "name": "get" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ], - "name": "get" - } - }, - { - "type": "ExperimentalSpreadProperty", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 60, - 66 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 63, - 66 - ], - "name": "set" - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 28, - 31 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 8 - } - }, - "range": [ - 54, - 55 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 60, - 63 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 63, - 66 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 67, - 68 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 68, - 69 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js deleted file mode 100644 index f2afb48d3de8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/single-spread.result.js +++ /dev/null @@ -1,787 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 0, - 79 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 0, - 26 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "name": "get" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "name": "set" - }, - "init": null - } - ], - "kind": "var" - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 28, - 79 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 32, - 78 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 36, - 78 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 42, - 50 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "name": "foo" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 47, - 50 - ], - "name": "foo" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 12 - } - }, - "range": [ - 56, - 64 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 56, - 59 - ], - "name": "get" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - }, - "range": [ - 61, - 64 - ], - "name": "get" - }, - "kind": "init" - }, - { - "type": "ExperimentalSpreadProperty", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 70, - 76 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 73, - 76 - ], - "name": "set" - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 28, - 31 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 47, - 50 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "range": [ - 50, - 51 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 56, - 59 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 8 - } - }, - "range": [ - 59, - 60 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 12 - } - }, - "range": [ - 61, - 64 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 13 - } - }, - "range": [ - 64, - 65 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 70, - 73 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 73, - 76 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 77, - 78 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 78, - 79 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js deleted file mode 100644 index b882e2b5242e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/spread-trailing-comma.result.js +++ /dev/null @@ -1,405 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 1, - 16 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "a" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "a" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "b" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "b" - } - }, - { - "type": "ExperimentalSpreadProperty", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 9, - 13 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "c" - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ] - }, - { - "type": "Identifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js deleted file mode 100644 index 15a023481c19..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalObjectRestSpread/two-spread.result.js +++ /dev/null @@ -1,747 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 0, - 77 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 0, - 26 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "name": "get" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "name": "set" - }, - "init": null - } - ], - "kind": "var" - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 28, - 77 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 32, - 76 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 36, - 76 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 42, - 50 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "name": "foo" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 47, - 50 - ], - "name": "foo" - }, - "kind": "init" - }, - { - "type": "ExperimentalSpreadProperty", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 10 - } - }, - "range": [ - 56, - 62 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 10 - } - }, - "range": [ - 59, - 62 - ], - "name": "get" - } - }, - { - "type": "ExperimentalSpreadProperty", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 68, - 74 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 71, - 74 - ], - "name": "set" - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 28, - 31 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 47, - 50 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "range": [ - 50, - 51 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 56, - 59 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 10 - } - }, - "range": [ - 59, - 62 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 11 - } - }, - "range": [ - 62, - 63 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 68, - 71 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 10 - } - }, - "range": [ - 71, - 74 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 75, - 76 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 76, - 77 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js deleted file mode 100644 index 083e46e653c9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/exponentiationOperators/exponential-operators.result.js +++ /dev/null @@ -1,403 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 4, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "id": { - "type": "Identifier", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "x" - }, - "init": { - "type": "BinaryExpression", - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "operator": "**", - "left": { - "type": "Literal", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "value": 2, - "raw": "2" - }, - "right": { - "type": "Literal", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "value": 3, - "raw": "3" - } - } - } - ], - "kind": "var" - }, - { - "type": "ExpressionStatement", - "range": [ - 16, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "expression": { - "type": "BinaryExpression", - "range": [ - 16, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "operator": "**=", - "left": { - "type": "Identifier", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "name": "x" - }, - "right": { - "type": "Literal", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "value": 4, - "raw": "4" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Numeric", - "value": "2", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "**", - "range": [ - 10, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "**=", - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Numeric", - "value": "4", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - } - ] -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js deleted file mode 100644 index b82caacbaedd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-function-initializer.result.js +++ /dev/null @@ -1,711 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "range": [ - 0, - 64 - ], - "body": [ - { - "type": "ForOfStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "range": [ - 0, - 64 - ], - "left": { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 5, - 43 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 9, - 43 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "i" - }, - "init": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 13, - 43 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 24, - 43 - ], - "body": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 26, - 41 - ], - "argument": { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 33, - 41 - ], - "left": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 33, - 35 - ], - "value": 10, - "raw": "10" - }, - "operator": "in", - "right": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 39, - 41 - ], - "elements": [] - } - } - } - ] - } - } - } - ], - "kind": "var" - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "range": [ - 47, - 51 - ], - "name": "list" - }, - "body": { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "range": [ - 53, - 64 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 63 - } - }, - "range": [ - 53, - 63 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 60 - } - }, - "range": [ - 53, - 60 - ], - "name": "process" - }, - "arguments": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 62 - } - }, - "range": [ - 61, - 62 - ], - "name": "x" - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "for", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ] - }, - { - "type": "Identifier", - "value": "i", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 13, - 21 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 26, - 32 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 33, - 35 - ] - }, - { - "type": "Keyword", - "value": "in", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 36, - 38 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 39, - 40 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 42, - 43 - ] - }, - { - "type": "Identifier", - "value": "of", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 44, - 46 - ] - }, - { - "type": "Identifier", - "value": "list", - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "range": [ - 47, - 51 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 51, - 52 - ] - }, - { - "type": "Identifier", - "value": "process", - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 60 - } - }, - "range": [ - 53, - 60 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 61 - } - }, - "range": [ - 60, - 61 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 62 - } - }, - "range": [ - 61, - 62 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 63 - } - }, - "range": [ - 62, - 63 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 63 - }, - "end": { - "line": 1, - "column": 64 - } - }, - "range": [ - 63, - 64 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js deleted file mode 100644 index ce4f928359c9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-braces.result.js +++ /dev/null @@ -1,419 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 0, - 41 - ], - "body": [ - { - "type": "ForOfStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 0, - 41 - ], - "left": { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 5, - 10 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "init": null - } - ], - "kind": "var" - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 14, - 17 - ], - "name": "foo" - }, - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 19, - 41 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "range": [ - 25, - 39 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 25, - 38 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 25, - 36 - ], - "name": "doSomething" - }, - "arguments": [] - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "for", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "of", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 11, - 13 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 14, - 17 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Identifier", - "value": "doSomething", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 25, - 36 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 40, - 41 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js deleted file mode 100644 index 8d08ddec5272..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/for-of-with-var-and-no-braces.result.js +++ /dev/null @@ -1,364 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "range": [ - 0, - 37 - ], - "body": [ - { - "type": "ForOfStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "range": [ - 0, - 37 - ], - "left": { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 5, - 10 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "x" - }, - "init": null - } - ], - "kind": "var" - }, - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 14, - 17 - ], - "name": "foo" - }, - "body": { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "range": [ - 23, - 37 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 23, - 36 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 23, - 34 - ], - "name": "doSomething" - }, - "arguments": [] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "for", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "of", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 11, - 13 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 14, - 17 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Identifier", - "value": "doSomething", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 23, - 34 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "range": [ - 36, - 37 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js deleted file mode 100644 index d709253768ed..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-const-and-no-braces.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Unexpected token const" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js deleted file mode 100644 index 37b724046e5d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/forOf/invalid-for-of-with-let-and-no-braces.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Unexpected token let" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js deleted file mode 100644 index c7963c6f93a4..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/anonymous-generator.result.js +++ /dev/null @@ -1,331 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 1, - 25 - ], - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 14, - 25 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 16, - 23 - ], - "expression": { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 16, - 23 - ], - "delegate": false, - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "name": "v" - } - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ] - }, - { - "type": "Identifier", - "value": "v", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js deleted file mode 100644 index aca20ef842a1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-function.result.js +++ /dev/null @@ -1,223 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 1, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 1, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "foo" - }, - "generator": true, - "expression": false, - "async": true, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "async", - "range": [ - 1, - 6 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js deleted file mode 100644 index 79bad53b1b71..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/async-generator-method.result.js +++ /dev/null @@ -1,629 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "C" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "name": "f" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": true, - "expression": false, - "async": true, - "body": { - "type": "BlockStatement", - "range": [ - 26, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 36, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 29 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 42, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "id": { - "type": "Identifier", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "name": "x" - }, - "init": { - "type": "YieldExpression", - "range": [ - 46, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "delegate": true, - "argument": { - "type": "CallExpression", - "range": [ - 53, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 26 - } - }, - "name": "g" - }, - "arguments": [] - } - } - } - ], - "kind": "const" - } - ] - }, - "range": [ - 23, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "async", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 36, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "yield", - "range": [ - 46, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "g", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js deleted file mode 100644 index 3bf284be609f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/double-yield.result.js +++ /dev/null @@ -1,368 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 0, - 34 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 0, - 34 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 1, - 32 - ], - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 14, - 32 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 16, - 30 - ], - "expression": { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 16, - 30 - ], - "delegate": false, - "argument": { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 22, - 30 - ], - "delegate": false, - "argument": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 28, - 30 - ], - "value": 10, - "raw": "10" - } - } - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 22, - 27 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 28, - 30 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js deleted file mode 100644 index e79bfbff537e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/empty-generator-declaration.result.js +++ /dev/null @@ -1,240 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "t" - }, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "t", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js deleted file mode 100644 index 7f0e5cfdb0c6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/generator-declaration.result.js +++ /dev/null @@ -1,348 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 10, - 14 - ], - "name": "test" - }, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 18, - 30 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 20, - 28 - ], - "expression": { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 20, - 28 - ], - "delegate": true, - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ], - "name": "v" - } - } - } - ] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "test", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 10, - 14 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 20, - 25 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Identifier", - "value": "v", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js deleted file mode 100644 index 96c36879ee71..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-delegation.result.js +++ /dev/null @@ -1,349 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 1, - 26 - ], - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 14, - 26 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 16, - 24 - ], - "expression": { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 16, - 24 - ], - "delegate": true, - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ], - "name": "v" - } - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Identifier", - "value": "v", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js deleted file mode 100644 index 9e7af391f163..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-in-call.result.js +++ /dev/null @@ -1,405 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 1, - 28 - ], - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 14, - 28 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 16, - 26 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 16, - 25 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ], - "name": "fn" - }, - "arguments": [ - { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 19, - 24 - ], - "delegate": false, - "argument": null - } - ] - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "fn", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 19, - 24 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js deleted file mode 100644 index a367eecb575d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value-no-semi.result.js +++ /dev/null @@ -1,296 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 1, - 23 - ], - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 14, - 23 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "expression": { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "delegate": false, - "argument": null - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js deleted file mode 100644 index 08032f399e0d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/generators/yield-without-value.result.js +++ /dev/null @@ -1,314 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "expression": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 1, - 24 - ], - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 14, - 24 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 16, - 22 - ], - "expression": { - "type": "YieldExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "delegate": false, - "argument": null - } - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 1, - 9 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Keyword", - "value": "yield", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js deleted file mode 100644 index f6a7a06127eb..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-identifier.result.js +++ /dev/null @@ -1,111 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 7, - 11 - ], - "name": "fooz" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Identifier", - "value": "fooz", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 7, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js deleted file mode 100644 index 9eeaf9d8440c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-no-arg.result.js +++ /dev/null @@ -1,76 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 0, - 7 - ], - "body": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 0, - 7 - ], - "argument": null - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js deleted file mode 100644 index 612b75277c76..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/globalReturn/return-true.result.js +++ /dev/null @@ -1,112 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "argument": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 7, - 11 - ], - "value": true, - "raw": "true" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Boolean", - "value": "true", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 7, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js deleted file mode 100644 index 9eeb5c87a9bb..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-delete.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 19, - "lineNumber": 2, - "column": 1, - "message": "Deleting local variable in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js deleted file mode 100644 index 1ad46aabcb0d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-function.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 16, - "lineNumber": 2, - "column": 2, - "message": "'import' and 'export' may only appear at the top level" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js deleted file mode 100644 index 5a85a9686dcc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/error-strict.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 28, - "lineNumber": 3, - "column": 1, - "message": "'with' in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js deleted file mode 100644 index 6aec5680b6c5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-array.result.js +++ /dev/null @@ -1,147 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "body": [ - { - "type": "ExportDefaultDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "declaration": { - "type": "ArrayExpression", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ], - "elements": [] - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js deleted file mode 100644 index 68d9008a7cdc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-class.result.js +++ /dev/null @@ -1,168 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 15, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": null, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 21, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js deleted file mode 100644 index b9e8b977911f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-expression.result.js +++ /dev/null @@ -1,239 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "ExportDefaultDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "declaration": { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "left": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ], - "value": 1, - "raw": "1" - }, - "operator": "+", - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "value": 2, - "raw": "2" - } - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "+", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Numeric", - "value": "2", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js deleted file mode 100644 index 4cd2c26bfa9e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-function.result.js +++ /dev/null @@ -1,205 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "ExportDefaultDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "declaration": { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 15, - 29 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 27, - 29 - ], - "body": [] - } - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 15, - 23 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js deleted file mode 100644 index fa48618b6657..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-class.result.js +++ /dev/null @@ -1,203 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 15, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 21, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "name": "Test" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 26, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "Test", - "range": [ - 21, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js deleted file mode 100644 index 8e5b36233cd3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-named-function.result.js +++ /dev/null @@ -1,240 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "body": [ - { - "type": "ExportDefaultDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "declaration": { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 15, - 32 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "name": "foo" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 30, - 32 - ], - "body": [] - } - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 15, - 23 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js deleted file mode 100644 index e90a1fc1e114..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-number.result.js +++ /dev/null @@ -1,130 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "body": [ - { - "type": "ExportDefaultDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "declaration": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ], - "value": 42, - "raw": "42" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Numeric", - "value": "42", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js deleted file mode 100644 index fd5403f42af1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-object.result.js +++ /dev/null @@ -1,260 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "body": [ - { - "type": "ExportDefaultDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "declaration": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 15, - 25 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 17, - 23 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 17, - 20 - ], - "name": "foo" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ], - "value": 1, - "raw": "1" - }, - "kind": "init" - } - ] - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 17, - 20 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js deleted file mode 100644 index efb2f087ef15..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-default-value.result.js +++ /dev/null @@ -1,129 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExportDefaultDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "declaration": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ], - "name": "foo" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 7, - 14 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js deleted file mode 100644 index 389efcd3ef4c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-batch.result.js +++ /dev/null @@ -1,148 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "body": [ - { - "type": "ExportAllDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 14, - 19 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 9, - 13 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 14, - 19 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js deleted file mode 100644 index 3b80ac33fe4b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-default.result.js +++ /dev/null @@ -1,240 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 8, - 15 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 8, - 15 - ], - "name": "default" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 8, - 15 - ], - "name": "default" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 22, - 27 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 8, - 15 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 17, - 21 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 22, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js deleted file mode 100644 index 8ee014b07606..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-default.result.js +++ /dev/null @@ -1,276 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 8, - 22 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ], - "name": "default" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 29, - 34 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 24, - 28 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 29, - 34 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js deleted file mode 100644 index f9ab0f990889..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifier.result.js +++ /dev/null @@ -1,276 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 8, - 18 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ], - "name": "bar" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 25, - 30 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 20, - 24 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 25, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js deleted file mode 100644 index 136629250063..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-named-as-specifiers.result.js +++ /dev/null @@ -1,365 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 0, - 40 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 0, - 40 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 8, - 22 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ], - "name": "default" - } - }, - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "name": "bar" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "name": "bar" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 34, - 39 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 29, - 33 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 34, - 39 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 39, - 40 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js deleted file mode 100644 index 1d3a6b83a44f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifier.result.js +++ /dev/null @@ -1,240 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 18, - 23 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 13, - 17 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 18, - 23 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js deleted file mode 100644 index 9b2dc6fe608a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-from-specifiers.result.js +++ /dev/null @@ -1,329 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - } - }, - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 23, - 28 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 18, - 22 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 23, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js deleted file mode 100644 index 92e3721d06b5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-function.result.js +++ /dev/null @@ -1,224 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "declaration": { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 7, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 16, - 19 - ], - "name": "foo" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 23, - 25 - ], - "body": [] - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 7, - 15 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 16, - 19 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js deleted file mode 100644 index 86a57870d177..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-default.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 8, - 22 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ], - "name": "default" - } - } - ], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js deleted file mode 100644 index 66bf9005b102..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifier.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 8, - 18 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ], - "name": "bar" - } - } - ], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js deleted file mode 100644 index 6ac7d47a262a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-as-specifiers.result.js +++ /dev/null @@ -1,311 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 8, - 22 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ], - "name": "default" - } - }, - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "name": "bar" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "name": "bar" - } - } - ], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 15, - 22 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js deleted file mode 100644 index b265290529a7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-class.result.js +++ /dev/null @@ -1,188 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 7, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "Test" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "Test", - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; - diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js deleted file mode 100644 index 04d96aaf7c97..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-empty.result.js +++ /dev/null @@ -1,114 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "declaration": null, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js deleted file mode 100644 index 05e6245e5087..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifier.result.js +++ /dev/null @@ -1,186 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - } - } - ], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js deleted file mode 100644 index 75467b133c3a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers-comma.result.js +++ /dev/null @@ -1,293 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - } - }, - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - } - } - ], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js deleted file mode 100644 index eec1bef75d8e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-named-specifiers.result.js +++ /dev/null @@ -1,275 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "declaration": null, - "specifiers": [ - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "foo" - } - }, - { - "type": "ExportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - }, - "exported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - } - } - ], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js deleted file mode 100644 index a29d30917135..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-anonymous-function.result.js +++ /dev/null @@ -1,316 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "declaration": { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 7, - 32 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 11, - 31 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ], - "name": "foo" - }, - "init": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 17, - 31 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 29, - 31 - ], - "body": [] - } - } - } - ], - "kind": "var" - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 17, - 25 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js deleted file mode 100644 index 471bfa3b18e7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var-number.result.js +++ /dev/null @@ -1,223 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "declaration": { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 7, - 19 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 11, - 18 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ], - "name": "foo" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "value": 1, - "raw": "1" - } - } - ], - "kind": "var" - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Numeric", - "value": "1", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js deleted file mode 100644 index 25534f39cb7a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/export-var.result.js +++ /dev/null @@ -1,169 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "body": [ - { - "type": "ExportNamedDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "declaration": { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 7, - 15 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ], - "name": "bar" - }, - "init": null - } - ], - "kind": "var" - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js deleted file mode 100644 index 9f13762ed3bf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-named-specifiers.result.js +++ /dev/null @@ -1,310 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "name": "foo" - } - }, - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "bar" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 23, - 28 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 18, - 22 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 23, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js deleted file mode 100644 index 0a6962efb7ac..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-and-namespace-specifiers.result.js +++ /dev/null @@ -1,292 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "name": "foo" - } - }, - { - "type": "ImportNamespaceSpecifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 12, - 20 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 17, - 20 - ], - "name": "bar" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 26, - 31 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 17, - 20 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 21, - 25 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 26, - 31 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js deleted file mode 100644 index eebf0b855ff7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default-as.result.js +++ /dev/null @@ -1,275 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "specifiers": [ - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 8, - 22 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 8, - 15 - ], - "name": "default" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 19, - 22 - ], - "name": "foo" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 29, - 34 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Keyword", - "value": "default", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 8, - 15 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 16, - 18 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 19, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 24, - 28 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 29, - 34 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js deleted file mode 100644 index 302d67eaaa1b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-default.result.js +++ /dev/null @@ -1,185 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "name": "foo" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 11, - 15 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js deleted file mode 100644 index d9f86150c9b0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-jquery.result.js +++ /dev/null @@ -1,167 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "$" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 14, - 22 - ], - "value": "jquery", - "raw": "\"jquery\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Identifier", - "value": "$", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 9, - 13 - ] - }, - { - "type": "String", - "value": "\"jquery\"", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 14, - 22 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js deleted file mode 100644 index 3db364e76fd7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-module.result.js +++ /dev/null @@ -1,113 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "specifiers": [], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 7, - 12 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 7, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js deleted file mode 100644 index 0990b1ae8958..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifier.result.js +++ /dev/null @@ -1,275 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 0, - 31 - ], - "specifiers": [ - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 8, - 18 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ], - "name": "baz" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 25, - 30 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Identifier", - "value": "baz", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 20, - 24 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 25, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js deleted file mode 100644 index 29bc59fa5dff..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-as-specifiers.result.js +++ /dev/null @@ -1,364 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 0, - 36 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 0, - 36 - ], - "specifiers": [ - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 8, - 18 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ], - "name": "baz" - } - }, - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ], - "name": "xyz" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ], - "name": "xyz" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 30, - 35 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ] - }, - { - "type": "Identifier", - "value": "baz", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Identifier", - "value": "xyz", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 25, - 29 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 30, - 35 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js deleted file mode 100644 index eee15feb5e58..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-empty.result.js +++ /dev/null @@ -1,167 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 0, - 21 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 0, - 21 - ], - "specifiers": [], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 15, - 20 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 10, - 14 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 15, - 20 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js deleted file mode 100644 index 531a0c3ca71a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifier.result.js +++ /dev/null @@ -1,239 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "specifiers": [ - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 18, - 23 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 13, - 17 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 18, - 23 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js deleted file mode 100644 index da3b7c5fef29..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers-comma.result.js +++ /dev/null @@ -1,346 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 0, - 30 - ], - "specifiers": [ - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - } - }, - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "baz" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "baz" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 24, - 29 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "baz", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 19, - 23 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 24, - 29 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js deleted file mode 100644 index ae83c96e25b3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-named-specifiers.result.js +++ /dev/null @@ -1,328 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "specifiers": [ - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ], - "name": "bar" - } - }, - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "baz" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "name": "baz" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 23, - 28 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 8, - 11 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Identifier", - "value": "baz", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 18, - 22 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 23, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js deleted file mode 100644 index 442bcf2c392a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-namespace-specifier.result.js +++ /dev/null @@ -1,221 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "specifiers": [ - { - "type": "ImportNamespaceSpecifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 7, - 15 - ], - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ], - "name": "foo" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 21, - 26 - ], - "value": "foo", - "raw": "\"foo\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "*", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 9, - 11 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 12, - 15 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 16, - 20 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 21, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js deleted file mode 100644 index 51de8627bfee..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/import-null-as-nil.result.js +++ /dev/null @@ -1,257 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 0, - 33 - ], - "body": [ - { - "type": "ImportDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 0, - 33 - ], - "specifiers": [ - { - "type": "ImportSpecifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 9, - 20 - ], - "imported": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 9, - 13 - ], - "name": "null" - }, - "local": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 17, - 20 - ], - "name": "nil" - } - } - ], - "source": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 28, - 33 - ], - "value": "bar", - "raw": "\"bar\"" - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "import", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Null", - "value": "null", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 9, - 13 - ] - }, - { - "type": "Identifier", - "value": "as", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ] - }, - { - "type": "Identifier", - "value": "nil", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 17, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Identifier", - "value": "from", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 23, - 27 - ] - }, - { - "type": "String", - "value": "\"bar\"", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 28, - 33 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js deleted file mode 100644 index 17d1ba596975..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-await.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 11, - "lineNumber": 1, - "column": 12, - "message": "Unexpected token await" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js deleted file mode 100644 index 25e055bd7778..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-class.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Unexpected token class" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js deleted file mode 100644 index f2375cd29e10..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-missing-from-clause.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 9, - "lineNumber": 2, - "column": 1, - "message": "Unexpected token" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js deleted file mode 100644 index fa80be05a7cf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-batch-token.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Unexpected token +" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js deleted file mode 100644 index 2307539dc9c4..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-equal.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Unexpected token =" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js deleted file mode 100644 index 7d0e4da8a8bf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default-token.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "Unexpected token default" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js deleted file mode 100644 index 3bfa9d5e8484..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-default.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 20, - "lineNumber": 1, - "column": 21, - "message": "Unexpected token \"foo\"" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js deleted file mode 100644 index 7d0e4da8a8bf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-default.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "Unexpected token default" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js deleted file mode 100644 index 71fbc25e548b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-extra-comma.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 16, - "lineNumber": 1, - "column": 17, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js deleted file mode 100644 index 2650c22f80fd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-export-named-middle-comma.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js deleted file mode 100644 index 3840ae72d6f7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named-after-default.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 17, - "lineNumber": 1, - "column": 18, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js deleted file mode 100644 index 2650c22f80fd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-after-named.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js deleted file mode 100644 index 67cd07b5c473..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-missing-module-specifier.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 11, - "lineNumber": 2, - "column": 1, - "message": "Unexpected token" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js deleted file mode 100644 index 9b520a58fb3f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default-module-specifier.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 16, - "lineNumber": 1, - "column": 17, - "message": "Unexpected token bar" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js deleted file mode 100644 index b2c0d7d9d1ea..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-default.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Unexpected token default" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js deleted file mode 100644 index 56b2c92b4f4e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-missing-module-specifier.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 20, - "lineNumber": 2, - "column": 1, - "message": "Unexpected token" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js deleted file mode 100644 index 27e1b80c2af6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-module-specifier.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 18, - "lineNumber": 1, - "column": 19, - "message": "Unexpected token bar" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js deleted file mode 100644 index 2650c22f80fd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-named.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js deleted file mode 100644 index 397186ec4a3c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-after-namespace.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 15, - "lineNumber": 1, - "column": 16, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js deleted file mode 100644 index 1df2bf9e2061..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-as-missing-from.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 24, - "lineNumber": 2, - "column": 1, - "message": "Unexpected token" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js deleted file mode 100644 index 71fbc25e548b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-extra-comma.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 16, - "lineNumber": 1, - "column": 17, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js deleted file mode 100644 index 2650c22f80fd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-named-middle-comma.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js deleted file mode 100644 index 2650c22f80fd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-after-named.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js deleted file mode 100644 index cf21fb2c1ca6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/modules/invalid-import-namespace-missing-as.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Unexpected token from" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js deleted file mode 100644 index deaf3293e3c8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-new-target.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "new.target can only be used in functions" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js deleted file mode 100644 index 52de9c60e12a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/invalid-unknown-property.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 25, - "lineNumber": 1, - "column": 26, - "message": "The only valid meta property for new is new.target" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js deleted file mode 100644 index 3c6ea66d9678..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/newTarget/simple-new-target.result.js +++ /dev/null @@ -1,422 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 0, - 40 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 0, - 40 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "f" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 13, - 40 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 19, - 38 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 23, - 37 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 23, - 24 - ], - "name": "x" - }, - "init": { - "type": "MetaProperty", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 27, - 37 - ], - "meta": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 27, - 30 - ], - "name": "new" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 31, - 37 - ], - "name": "target" - } - } - } - ], - "kind": "var" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 19, - 22 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Keyword", - "value": "new", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 27, - 30 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Identifier", - "value": "target", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 31, - 37 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 39, - 40 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js deleted file mode 100644 index d9878c12dcbf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-addition-property.result.js +++ /dev/null @@ -1,425 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 0, - 29 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 4, - 28 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 8, - 28 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 14, - 26 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 15, - 20 - ], - "left": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 15, - 16 - ], - "value": 5, - "raw": "5" - }, - "operator": "+", - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 19, - 20 - ], - "value": 5, - "raw": "5" - } - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 23, - 26 - ], - "name": "foo" - }, - "kind": "init" - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Numeric", - "value": "5", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "+", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Numeric", - "value": "5", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 23, - 26 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js deleted file mode 100644 index 223995bf502d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-and-identifier.result.js +++ /dev/null @@ -1,426 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 1, - 17 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 2, - 9 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "x" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ], - "value": 10, - "raw": "10" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 11, - 16 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "y" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ], - "value": 20, - "raw": "20" - }, - "kind": "init" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Numeric", - "value": "20", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 14, - 16 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js deleted file mode 100644 index 1d335d907484..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-getter-and-setter.result.js +++ /dev/null @@ -1,649 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 1, - 30 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 2, - 14 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "x" - }, - "kind": "get", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 12, - 14 - ], - "body": [] - } - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 16, - 29 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ], - "name": "x" - }, - "kind": "set", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 23, - 29 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ], - "name": "v" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 27, - 29 - ], - "body": [] - } - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 2, - 5 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 16, - 19 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "v", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js deleted file mode 100644 index 758277ec25f5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-string-property.result.js +++ /dev/null @@ -1,352 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 0, - 29 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 4, - 28 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 8, - 28 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 14, - 26 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 15, - 20 - ], - "value": "hey", - "raw": "\"hey\"" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 23, - 26 - ], - "name": "foo" - }, - "kind": "init" - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "String", - "value": "\"hey\"", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 15, - 20 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 23, - 26 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js deleted file mode 100644 index fa5f0d5e35cc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/computed-variable-property.result.js +++ /dev/null @@ -1,351 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 0, - 27 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 4, - 26 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 8, - 26 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 14, - 24 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 15, - 18 - ], - "name": "bar" - }, - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 21, - 24 - ], - "name": "foo" - }, - "kind": "init" - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 21, - 24 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js deleted file mode 100644 index e253e4bfaa90..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-computed-variable-property.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 20, - "lineNumber": 3, - "column": 1, - "message": "Unexpected token }" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js deleted file mode 100644 index f7180132d444..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Unexpected token }" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js deleted file mode 100644 index 750041c1bd0c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-addition.result.js +++ /dev/null @@ -1,370 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 1, - 18 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 2, - 17 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 3, - 12 - ], - "left": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 3, - 6 - ], - "value": "x", - "raw": "\"x\"" - }, - "operator": "+", - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "value": "y", - "raw": "\"y\"" - } - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ], - "value": 10, - "raw": "10" - }, - "kind": "init" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "String", - "value": "\"x\"", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 3, - 6 - ] - }, - { - "type": "Punctuator", - "value": "+", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "String", - "value": "\"y\"", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 15, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js deleted file mode 100644 index fa34bcf6dcb7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression-with-method.result.js +++ /dev/null @@ -1,389 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 1, - 21 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 2, - 20 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "x" - }, - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 7, - 20 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 18, - 20 - ], - "body": [] - } - }, - "kind": "init" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 7, - 15 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js deleted file mode 100644 index e970140d196a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralComputedProperties/standalone-expression.result.js +++ /dev/null @@ -1,296 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "expression": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 1, - 10 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 2, - 9 - ], - "method": false, - "shorthand": false, - "computed": true, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "x" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ], - "value": 10, - "raw": "10" - }, - "kind": "init" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "[", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "]", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Numeric", - "value": "10", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 7, - 9 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.result.js deleted file mode 100644 index 976511e12ea8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-property.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 62, - "lineNumber": 7, - "column": 2, - "message": "Redefinition of __proto__ property" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.result.js deleted file mode 100644 index 4d43f85c9697..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 64, - "lineNumber": 7, - "column": 2, - "message": "Redefinition of __proto__ property" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js deleted file mode 100644 index 9747c26c100f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.result.js +++ /dev/null @@ -1,518 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, - "range": [ - 0, - 53 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "value": "use strict", - "raw": "\"use strict\"" - } - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, - "range": [ - 15, - 53 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "range": [ - 19, - 52 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 19, - 20 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "range": [ - 23, - 52 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 11 - } - }, - "range": [ - 26, - 36 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 26, - 27 - ], - "name": "y" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 11 - } - }, - "range": [ - 29, - 36 - ], - "value": "first", - "raw": "'first'" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "range": [ - 39, - 50 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 39, - 40 - ], - "name": "y" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "range": [ - 42, - 50 - ], - "value": "second", - "raw": "'second'" - }, - "kind": "init" - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "String", - "value": "\"use strict\"", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "String", - "value": "'first'", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 11 - } - }, - "range": [ - 29, - 36 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Identifier", - "value": "y", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 39, - 40 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "String", - "value": "'second'", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 12 - } - }, - "range": [ - 42, - 50 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "range": [ - 51, - 52 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - }, - "range": [ - 52, - 53 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js deleted file mode 100644 index 128460a5dbbc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.result.js +++ /dev/null @@ -1,520 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, - "range": [ - 0, - 57 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "value": "use strict", - "raw": "\"use strict\"" - } - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 6, - "column": 2 - } - }, - "range": [ - 15, - 57 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "range": [ - 19, - 56 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 19, - 20 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "range": [ - 23, - 56 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 13 - } - }, - "range": [ - 26, - 38 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Literal", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - }, - "range": [ - 26, - 29 - ], - "value": "y", - "raw": "\"y\"" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 13 - } - }, - "range": [ - 31, - 38 - ], - "value": "first", - "raw": "\"first\"" - }, - "kind": "init" - }, - { - "type": "Property", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 41, - 54 - ], - "method": false, - "shorthand": false, - "computed": false, - "key": { - "type": "Literal", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - }, - "range": [ - 41, - 44 - ], - "value": "y", - "raw": "\"y\"" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 46, - 54 - ], - "value": "second", - "raw": "\"second\"" - }, - "kind": "init" - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "String", - "value": "\"use strict\"", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - }, - "range": [ - 15, - 18 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "String", - "value": "\"y\"", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 4 - } - }, - "range": [ - 26, - 29 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "String", - "value": "\"first\"", - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 13 - } - }, - "range": [ - 31, - 38 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "String", - "value": "\"y\"", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 4 - } - }, - "range": [ - 41, - 44 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 44, - 45 - ] - }, - { - "type": "String", - "value": "\"second\"", - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "range": [ - 46, - 54 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "range": [ - 55, - 56 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 6, - "column": 1 - }, - "end": { - "line": 6, - "column": 2 - } - }, - "range": [ - 56, - 57 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js deleted file mode 100644 index f8f2ba979254..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/invalid-method-no-braces.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 19, - "lineNumber": 2, - "column": 14, - "message": "Unexpected token 42" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js deleted file mode 100644 index 467de21ae9c1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/method-property.result.js +++ /dev/null @@ -1,463 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 0, - 50 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 0, - 50 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 4, - 49 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 8, - 49 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 14, - 47 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 14, - 17 - ], - "name": "foo" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 17, - 47 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 20, - 47 - ], - "body": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "range": [ - 30, - 41 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "range": [ - 37, - 40 - ], - "name": "bar" - } - } - ] - } - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 14, - 17 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "range": [ - 30, - 36 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "range": [ - 37, - 40 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 46, - 47 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 48, - 49 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 49, - 50 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js deleted file mode 100644 index f5175f8102b3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-get.result.js +++ /dev/null @@ -1,388 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 0, - 26 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 0, - 25 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 4, - 25 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 10, - 23 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 10, - 13 - ], - "name": "get" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 13, - 23 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 16, - 23 - ], - "body": [] - } - } - } - ] - } - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 26, - 27 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 10, - 13 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js deleted file mode 100644 index 996338a39c9e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-named-set.result.js +++ /dev/null @@ -1,388 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 0, - 26 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 0, - 25 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 4, - 25 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 10, - 23 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 10, - 13 - ], - "name": "set" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 13, - 23 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 16, - 23 - ], - "body": [] - } - } - } - ] - } - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 26, - 27 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 10, - 13 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js deleted file mode 100644 index 03e0de7b3c85..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-argument.result.js +++ /dev/null @@ -1,425 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 0, - 35 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 0, - 34 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 0, - 33 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 4, - 33 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 10, - 31 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 10, - 16 - ], - "name": "method" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 16, - 31 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 17, - 21 - ], - "name": "test" - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 23, - 31 - ], - "body": [] - } - } - } - ] - } - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 34, - 35 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "method", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 10, - 16 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "test", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 17, - 21 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 34, - 35 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js deleted file mode 100644 index 7f6591f4f304..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method-with-string-name.result.js +++ /dev/null @@ -1,389 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 0, - 32 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 0, - 31 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 0, - 30 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 4, - 30 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 10, - 28 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 10, - 18 - ], - "value": "method", - "raw": "\"method\"" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 18, - 28 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 21, - 28 - ], - "body": [] - } - } - } - ] - } - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 31, - 32 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "String", - "value": "\"method\"", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 10, - 18 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 31, - 32 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js deleted file mode 100644 index b21677ae955a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/simple-method.result.js +++ /dev/null @@ -1,388 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 0, - 30 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 0, - 29 - ], - "expression": { - "type": "AssignmentExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 0, - 28 - ], - "operator": "=", - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ], - "name": "x" - }, - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 4, - 28 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 10, - 26 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 10, - 16 - ], - "name": "method" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 16, - 26 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 19, - 26 - ], - "body": [] - } - } - } - ] - } - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 29, - 30 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Identifier", - "value": "method", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 10, - 16 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 2 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 29, - 30 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js deleted file mode 100644 index 20df529cdd99..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandMethods/string-name-method-property.result.js +++ /dev/null @@ -1,464 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 0, - 52 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 0, - 52 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 4, - 51 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 8, - 51 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 14, - 49 - ], - "method": true, - "shorthand": false, - "computed": false, - "key": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 14, - 19 - ], - "value": "foo", - "raw": "\"foo\"" - }, - "kind": "init", - "value": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 19, - 49 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 22, - 49 - ], - "body": [ - { - "type": "ReturnStatement", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "range": [ - 32, - 43 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "range": [ - 39, - 42 - ], - "name": "bar" - } - } - ] - } - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "String", - "value": "\"foo\"", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 14, - 19 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Keyword", - "value": "return", - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "range": [ - 32, - 38 - ] - }, - { - "type": "Identifier", - "value": "bar", - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "range": [ - 39, - 42 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "range": [ - 42, - 43 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "range": [ - 48, - 49 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "range": [ - 50, - 51 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "range": [ - 51, - 52 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js deleted file mode 100644 index a27872be18e3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/objectLiteralShorthandProperties/shorthand-properties.result.js +++ /dev/null @@ -1,719 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 0, - 66 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 0, - 26 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ], - "name": "get" - }, - "init": null - }, - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ], - "name": "set" - }, - "init": null - } - ], - "kind": "var" - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 28, - 66 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 32, - 65 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ], - "name": "x" - }, - "init": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 36, - 65 - ], - "properties": [ - { - "type": "Property", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "name": "foo" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ], - "name": "foo" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ], - "name": "get" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ], - "name": "get" - } - }, - { - "type": "Property", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 60, - 63 - ], - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 60, - 63 - ], - "name": "set" - }, - "kind": "init", - "value": { - "type": "Identifier", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 60, - 63 - ], - "name": "set" - } - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "range": [ - 22, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 3 - } - }, - "range": [ - 28, - 31 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "range": [ - 42, - 45 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Identifier", - "value": "get", - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "range": [ - 51, - 54 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 8 - } - }, - "range": [ - 54, - 55 - ] - }, - { - "type": "Identifier", - "value": "set", - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "range": [ - 60, - 63 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "range": [ - 64, - 65 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 2 - } - }, - "range": [ - 65, - 66 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js deleted file mode 100644 index 59ae7eea0e5a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/invalid.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Identifier directly after number" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js deleted file mode 100644 index 7631534de4c5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/lowercase.result.js +++ /dev/null @@ -1,94 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "value": 463, - "raw": "0o717" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Numeric", - "value": "0o717", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js deleted file mode 100644 index 49739987e6ac..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/strict-uppercase.result.js +++ /dev/null @@ -1,166 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 0, - 20 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "value": "use strict", - "raw": "\"use strict\"" - } - }, - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 14, - 20 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 14, - 19 - ], - "value": 463, - "raw": "0O717" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "String", - "value": "\"use strict\"", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Numeric", - "value": "0O717", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 14, - 19 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - }, - "range": [ - 19, - 20 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js deleted file mode 100644 index 72f01ff29ada..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/octalLiterals/uppercase.result.js +++ /dev/null @@ -1,94 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "value": 463, - "raw": "0O717" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Numeric", - "value": "0O717", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js deleted file mode 100644 index e1d4f35dab99..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regex/regexp-simple.result.js +++ /dev/null @@ -1,194 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "value": {}, - "raw": "/foo./", - "regex": { - "pattern": "foo.", - "flags": "" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "RegularExpression", - "value": "/foo./", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "regex": { - "flags": "", - "pattern": "foo." - } - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js deleted file mode 100644 index 739842f0675a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.supported.result.js +++ /dev/null @@ -1,194 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 0, - 41 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 0, - 41 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 4, - 40 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 8, - 40 - ], - "value": {}, - "raw": "/[\\u{0000000000000061}-\\u{7A}]/u", - "regex": { - "pattern": "[\\u{0000000000000061}-\\u{7A}]", - "flags": "u" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "RegularExpression", - "value": "/[\\u{0000000000000061}-\\u{7A}]/u", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 8, - 40 - ], - "regex": { - "flags": "u", - "pattern": "[\\u{0000000000000061}-\\u{7A}]" - } - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.unsupported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.unsupported.result.js deleted file mode 100644 index f111ee8a1d00..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-extended-escape.unsupported.result.js +++ /dev/null @@ -1,194 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 0, - 41 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 0, - 41 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 4, - 40 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 8, - 40 - ], - "value": null, - "raw": "/[\\u{0000000000000061}-\\u{7A}]/u", - "regex": { - "pattern": "[\\u{0000000000000061}-\\u{7A}]", - "flags": "u" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "RegularExpression", - "value": "/[\\u{0000000000000061}-\\u{7A}]/u", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 8, - 40 - ], - "regex": { - "flags": "u", - "pattern": "[\\u{0000000000000061}-\\u{7A}]" - } - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js deleted file mode 100644 index 8370cfa6b1c6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-invalid-extended-escape.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 12, - "lineNumber": 1, - "column": 13, - "message": "Code point out of bounds" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js deleted file mode 100644 index 8a2cb69f3120..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.supported.result.js +++ /dev/null @@ -1,194 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "value": {}, - "raw": "/foo/u", - "regex": { - "pattern": "foo", - "flags": "u" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "RegularExpression", - "value": "/foo/u", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "regex": { - "flags": "u", - "pattern": "foo" - } - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.unsupported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.unsupported.result.js deleted file mode 100644 index ba8560d75785..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexUFlag/regex-u-simple.unsupported.result.js +++ /dev/null @@ -1,194 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "value": null, - "raw": "/foo/u", - "regex": { - "pattern": "foo", - "flags": "u" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "RegularExpression", - "value": "/foo/u", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "regex": { - "flags": "u", - "pattern": "foo" - } - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js deleted file mode 100644 index cf9a4251e2bc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.supported.result.js +++ /dev/null @@ -1,194 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "value": {}, - "raw": "/foo/y", - "regex": { - "pattern": "foo", - "flags": "y" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "RegularExpression", - "value": "/foo/y", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "regex": { - "flags": "y", - "pattern": "foo" - } - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.unsupported.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.unsupported.result.js deleted file mode 100644 index e0bf35b6db6a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/regexYFlag/regexp-y-simple.unsupported.result.js +++ /dev/null @@ -1,194 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 0, - 17 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 4, - 16 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ], - "name": "foo" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "value": null, - "raw": "/foo/y", - "regex": { - "pattern": "foo", - "flags": "y" - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "RegularExpression", - "value": "/foo/y", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 10, - 16 - ], - "regex": { - "flags": "y", - "pattern": "foo" - } - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js deleted file mode 100644 index 144b07404179..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/basic-rest.result.js +++ /dev/null @@ -1,348 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 0, - 22 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "f" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "a" - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 14, - 18 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "b" - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 20, - 22 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 14, - 17 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js deleted file mode 100644 index ef7b72e38b49..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-constructor.result.js +++ /dev/null @@ -1,393 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "RestElement", - "range": [ - 26, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "name": "foo" - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 34, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 25, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 8, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js deleted file mode 100644 index ecac0c2355cc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/class-method.result.js +++ /dev/null @@ -1,394 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 26, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 17, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "params": [ - { - "type": "RestElement", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "name": "bar" - }, - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 8, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js deleted file mode 100644 index dd0b8fb48e86..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-no-default.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 19, - "lineNumber": 1, - "column": 20, - "message": "Unexpected token =" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js deleted file mode 100644 index 4e7e97af3379..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/error-not-last.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 18, - "lineNumber": 1, - "column": 19, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js deleted file mode 100644 index f3c1b5059652..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression-multi.result.js +++ /dev/null @@ -1,405 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 0, - 29 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 4, - 28 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 8, - 28 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "a" - }, - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 20, - 24 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ], - "name": "b" - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 26, - 28 - ], - "body": [] - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 8, - 16 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js deleted file mode 100644 index 0fe11596943c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/func-expression.result.js +++ /dev/null @@ -1,351 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 4, - 26 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "x" - }, - "init": { - "type": "FunctionExpression", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 8, - 26 - ], - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 18, - 22 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ], - "name": "a" - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 24, - 26 - ], - "body": [] - } - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 8, - 16 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 18, - 21 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js deleted file mode 100644 index ea9373dbbadf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/invalid-rest-param.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Unexpected token {" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js deleted file mode 100644 index 93bd3ca7d4a2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/restParams/single-rest.result.js +++ /dev/null @@ -1,294 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 0, - 20 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "f" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "RestElement", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 11, - 15 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ], - "name": "b" - } - } - ], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 17, - 19 - ], - "body": [] - } - }, - { - "type": "EmptyStatement", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 11, - 14 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js deleted file mode 100644 index 95e30f8bb00c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-if.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Unexpected token ..." -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js deleted file mode 100644 index ef21dc079721..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/error-invalid-sequence.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Unexpected token ..." -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js deleted file mode 100644 index 20380ab57b60..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/multi-function-call.result.js +++ /dev/null @@ -1,273 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "name": "foo" - }, - "arguments": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "a" - }, - { - "type": "SpreadElement", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 7, - 11 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ], - "name": "b" - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js deleted file mode 100644 index 6830f04256f9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/not-final-param.result.js +++ /dev/null @@ -1,273 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 0, - 4 - ], - "name": "func" - }, - "arguments": [ - { - "type": "SpreadElement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 5, - 9 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "name": "a" - } - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "b" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "func", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 0, - 4 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ",", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js deleted file mode 100644 index 4030fd79916e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/spread/simple-function-call.result.js +++ /dev/null @@ -1,219 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "callee": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "name": "foo" - }, - "arguments": [ - { - "type": "SpreadElement", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 4, - 8 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 4, - 7 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js deleted file mode 100644 index d437f9863c12..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/deeply-nested.result.js +++ /dev/null @@ -1,462 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 0, - 45 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 0, - 45 - ], - "expression": { - "type": "TaggedTemplateExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 0, - 44 - ], - "tag": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "name": "raw" - }, - "quasi": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 3, - 44 - ], - "expressions": [ - { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 12, - 42 - ], - "expressions": [ - { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 22, - 35 - ], - "left": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 22, - 30 - ], - "expressions": [], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 22, - 30 - ], - "value": { - "raw": "deeply", - "cooked": "deeply" - }, - "tail": true - } - ] - }, - "operator": "+", - "right": { - "type": "ObjectExpression", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 33, - 35 - ], - "properties": [] - } - } - ], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 12, - 22 - ], - "value": { - "raw": "nested ", - "cooked": "nested " - }, - "tail": false - }, - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 35, - 42 - ], - "value": { - "raw": " blah", - "cooked": " blah" - }, - "tail": true - } - ] - } - ], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 3, - 12 - ], - "value": { - "raw": "hello ", - "cooked": "hello " - }, - "tail": false - }, - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 42, - 44 - ], - "value": { - "raw": "", - "cooked": "" - }, - "tail": true - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "raw", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Template", - "value": "`hello ${", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 3, - 12 - ] - }, - { - "type": "Template", - "value": "`nested ${", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 12, - 22 - ] - }, - { - "type": "Template", - "value": "`deeply`", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 22, - 30 - ] - }, - { - "type": "Punctuator", - "value": "+", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Template", - "value": "} blah`", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 35, - 42 - ] - }, - { - "type": "Template", - "value": "}`", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 42, - 44 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 44, - 45 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.result.js deleted file mode 100644 index 40993c99c26f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/error-octal-literal.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Octal literal in strict mode" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js deleted file mode 100644 index 451d26cd09c0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/escape-characters.result.js +++ /dev/null @@ -1,209 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 0, - 40 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 0, - 40 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 4, - 39 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 4, - 6 - ], - "name": "ts" - }, - "init": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 9, - 39 - ], - "expressions": [], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 9, - 39 - ], - "value": { - "raw": "\\\\n\\\\r\\\\b\\\\v\\\\t\\\\f\\\\\\n\\\\\\r\\n", - "cooked": "\\n\\r\\b\\v\\t\\f\\\n\\\r\n" - }, - "tail": true - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "ts", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 4, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Template", - "value": "`\\\\n\\\\r\\\\b\\\\v\\\\t\\\\f\\\\\\n\\\\\\r\\n`", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 9, - 39 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 39, - 40 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js deleted file mode 100644 index 1061023870a1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/expressions.result.js +++ /dev/null @@ -1,671 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 0, - 59 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 4, - 9 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ], - "name": "a" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ], - "value": 5, - "raw": "5" - } - } - ], - "kind": "var" - }, - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 11, - 26 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 15, - 25 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 15, - 16 - ], - "name": "b" - }, - "init": { - "type": "Literal", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 19, - 25 - ], - "value": "Fred", - "raw": "'Fred'" - } - } - ], - "kind": "var" - }, - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 28, - 59 - ], - "expression": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 30 - } - }, - "range": [ - 28, - 58 - ], - "expressions": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - }, - "range": [ - 37, - 38 - ], - "name": "b" - }, - { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "range": [ - 51, - 56 - ], - "left": { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "range": [ - 51, - 52 - ], - "name": "a" - }, - "operator": "+", - "right": { - "type": "Literal", - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "range": [ - 55, - 56 - ], - "value": 5, - "raw": "5" - } - } - ], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - }, - "range": [ - 28, - 37 - ], - "value": { - "raw": "Hello ", - "cooked": "Hello " - }, - "tail": false - }, - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "range": [ - 38, - 51 - ], - "value": { - "raw": ". a + 5 = ", - "cooked": ". a + 5 = " - }, - "tail": false - }, - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 30 - } - }, - "range": [ - 56, - 58 - ], - "value": { - "raw": "", - "cooked": "" - }, - "tail": true - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Numeric", - "value": "5", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "range": [ - 11, - 14 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "String", - "value": "'Fred'", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "range": [ - 19, - 25 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Template", - "value": "`Hello ${", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 9 - } - }, - "range": [ - 28, - 37 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "Template", - "value": "}. a + 5 = ${", - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "range": [ - 38, - 51 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "range": [ - 51, - 52 - ] - }, - { - "type": "Punctuator", - "value": "+", - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 26 - } - }, - "range": [ - 53, - 54 - ] - }, - { - "type": "Numeric", - "value": "5", - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "range": [ - 55, - 56 - ] - }, - { - "type": "Template", - "value": "}`", - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 30 - } - }, - "range": [ - 56, - 58 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 58, - 59 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js deleted file mode 100644 index 9787eece8597..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/multi-line-template-string.result.js +++ /dev/null @@ -1,117 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "range": [ - 0, - 111 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "range": [ - 0, - 111 - ], - "expression": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 0, - 110 - ], - "expressions": [], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 0, - 110 - ], - "value": { - "raw": "The last man on Earth\n sat alone in a room.\n There was\n a knock\n on the\n door...", - "cooked": "The last man on Earth\n sat alone in a room.\n There was\n a knock\n on the\n door..." - }, - "tail": true - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Template", - "value": "`The last man on Earth\n sat alone in a room.\n There was\n a knock\n on the\n door...`", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "range": [ - 0, - 110 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "range": [ - 110, - 111 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js deleted file mode 100644 index ea4f6ec12f71..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/simple-template-string.result.js +++ /dev/null @@ -1,117 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "expression": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 0, - 4 - ], - "expressions": [], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 0, - 4 - ], - "value": { - "raw": "42", - "cooked": "42" - }, - "tail": true - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Template", - "value": "`42`", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 0, - 4 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js deleted file mode 100644 index d574fb3dc025..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/single-dollar-sign.result.js +++ /dev/null @@ -1,209 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "body": [ - { - "type": "VariableDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "declarations": [ - { - "type": "VariableDeclarator", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 4, - 12 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 4, - 6 - ], - "name": "ts" - }, - "init": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "expressions": [], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "value": { - "raw": "$", - "cooked": "$" - }, - "tail": true - } - ] - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Identifier", - "value": "ts", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 4, - 6 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Template", - "value": "`$`", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js deleted file mode 100644 index ee2f2ec36922..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-no-placeholders.result.js +++ /dev/null @@ -1,170 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "expression": { - "type": "TaggedTemplateExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ], - "tag": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "name": "foo" - }, - "quasi": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 3, - 8 - ], - "expressions": [], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 3, - 8 - ], - "value": { - "raw": "foo", - "cooked": "foo" - }, - "tail": true - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ] - }, - { - "type": "Template", - "value": "`foo`", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 3, - 8 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js deleted file mode 100644 index 63037b1d5c66..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/templateStrings/tagged-template-string.result.js +++ /dev/null @@ -1,723 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 32 - } - }, - "range": [ - 0, - 76 - ], - "body": [ - { - "type": "FunctionDeclaration", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 0, - 43 - ], - "id": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "name": "tag" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 15, - 43 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "range": [ - 18, - 41 - ], - "expression": { - "type": "CallExpression", - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 18, - 40 - ], - "callee": { - "type": "MemberExpression", - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 18, - 29 - ], - "object": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 18, - 25 - ], - "name": "console" - }, - "property": { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 26, - 29 - ], - "name": "log" - }, - "computed": false - }, - "arguments": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 30, - 39 - ], - "name": "arguments" - } - ] - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 32 - } - }, - "range": [ - 44, - 76 - ], - "expression": { - "type": "TaggedTemplateExpression", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 44, - 75 - ], - "tag": { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 44, - 47 - ], - "name": "tag" - }, - "quasi": { - "type": "TemplateLiteral", - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 47, - 75 - ], - "expressions": [ - { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "range": [ - 55, - 56 - ], - "name": "a" - }, - { - "type": "Identifier", - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "range": [ - 71, - 72 - ], - "name": "b" - } - ], - "quasis": [ - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 11 - } - }, - "range": [ - 47, - 55 - ], - "value": { - "raw": "a is ", - "cooked": "a is " - }, - "tail": false - }, - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 27 - } - }, - "range": [ - 56, - 71 - ], - "value": { - "raw": " while b is ", - "cooked": " while b is " - }, - "tail": false - }, - { - "type": "TemplateElement", - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 72, - 75 - ], - "value": { - "raw": ".", - "cooked": "." - }, - "tail": true - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 0, - 8 - ] - }, - { - "type": "Identifier", - "value": "tag", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Identifier", - "value": "console", - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "range": [ - 18, - 25 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Identifier", - "value": "log", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "range": [ - 26, - 29 - ] - }, - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Identifier", - "value": "arguments", - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 30, - 39 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "range": [ - 39, - 40 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "range": [ - 42, - 43 - ] - }, - { - "type": "Identifier", - "value": "tag", - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 3 - } - }, - "range": [ - 44, - 47 - ] - }, - { - "type": "Template", - "value": "`a is ${", - "loc": { - "start": { - "line": 4, - "column": 3 - }, - "end": { - "line": 4, - "column": 11 - } - }, - "range": [ - 47, - 55 - ] - }, - { - "type": "Identifier", - "value": "a", - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "range": [ - 55, - 56 - ] - }, - { - "type": "Template", - "value": "} while b is ${", - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 27 - } - }, - "range": [ - 56, - 71 - ] - }, - { - "type": "Identifier", - "value": "b", - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "range": [ - 71, - 72 - ] - }, - { - "type": "Template", - "value": "}.`", - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "range": [ - 72, - 75 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 4, - "column": 31 - }, - "end": { - "line": 4, - "column": 32 - } - }, - "range": [ - 75, - 76 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js deleted file mode 100644 index e7d4cba5afe2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/basic-string-literal.result.js +++ /dev/null @@ -1,94 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "value": "煎茶", - "raw": "\"\\u{714E}\\u{8336}\"" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "String", - "value": "\"\\u{714E}\\u{8336}\"", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js deleted file mode 100644 index a83ca4e1bc43..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/complex-string-literal.result.js +++ /dev/null @@ -1,94 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ], - "value": "𠮷􏿿\u0001", - "raw": "\"\\u{20BB7}\\u{10FFFF}\\u{1}\"" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "String", - "value": "\"\\u{20BB7}\\u{10FFFF}\\u{1}\"", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 0, - 26 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js deleted file mode 100644 index 7ddaf9353c7a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-empty-escape.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Bad character escape sequence" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js deleted file mode 100644 index c8a3a66dfb10..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/unicodeCodePointEscapes/invalid-too-large-escape.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Code point out of bounds" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js deleted file mode 100644 index 50f3a5235009..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/self-closing-tag-inside-tag.result.js +++ /dev/null @@ -1,458 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "expression": { - "type": "JSXElement", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "selfClosing": false, - "name": { - "type": "JSXIdentifier", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, - "attributes": [] - }, - "closingElement": { - "type": "JSXClosingElement", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "name": "div" - } - }, - "children": [ - { - "type": "JSXText", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 2, - "column": 4 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "selfClosing": true, - "name": { - "type": "JSXIdentifier", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "foo" - }, - "attributes": [] - }, - "closingElement": null, - "children": [] - }, - { - "type": "JSXText", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "value": "\n", - "raw": "\n" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "JSXIdentifier", - "value": "foo", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "JSXText", - "value": "\n", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 3, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js deleted file mode 100644 index d3dc1df9a3a4..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx-useJSXTextNode/test-content.result.js +++ /dev/null @@ -1,311 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "div" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 18, - 24 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ], - "name": "div" - } - }, - "children": [ - { - "type": "JSXText", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 5, - 18 - ], - "value": "@test content", - "raw": "@test content" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "JSXText", - "value": "@test content", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 5, - 18 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.result.js deleted file mode 100644 index aa44d4fe490b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.result.js +++ /dev/null @@ -1,740 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "expression": { - "type": "JSXElement", - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 0, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "selfClosing": false, - "name": { - "type": "JSXIdentifier", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "foo" - }, - "attributes": [ - { - "type": "JSXAttribute", - "range": [ - 5, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "bar" - }, - "value": { - "type": "Literal", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "value": "baz", - "raw": "\"baz\"" - } - }, - { - "type": "JSXAttribute", - "range": [ - 15, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "qux" - }, - "value": { - "type": "JSXExpressionContainer", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "name": "quz" - } - } - }, - { - "type": "JSXAttribute", - "range": [ - 25, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "name": "spread" - }, - "value": { - "type": "JSXExpressionContainer", - "range": [ - 32, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 36, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "name": "rest" - } - } - } - ] - }, - "closingElement": { - "type": "JSXClosingElement", - "range": [ - 46, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "name": "foo" - } - }, - "children": [ - { - "type": "Literal", - "range": [ - 42, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "value": "test", - "raw": "test" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "JSXIdentifier", - "value": "foo", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "JSXIdentifier", - "value": "bar", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "JSXText", - "value": "\"baz\"", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "JSXIdentifier", - "value": "qux", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "quz", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "JSXIdentifier", - "value": "spread", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 33, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "rest", - "range": [ - 36, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "JSXText", - "value": "test", - "range": [ - 42, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - } - }, - { - "type": "JSXIdentifier", - "value": "foo", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 51 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.result.js deleted file mode 100644 index d27c45476bea..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-comment.result.js +++ /dev/null @@ -1,344 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 0, - 33 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 0, - 33 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 0, - 32 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 28, - 32 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ], - "name": "a" - } - }, - "children": [ - { - "type": "JSXExpressionContainer", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 3, - 28 - ], - "expression": { - "type": "JSXEmptyExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 4, - 27 - ] - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.result.js deleted file mode 100644 index e0109e5cf36b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-conditional.result.js +++ /dev/null @@ -1,655 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 0, - 28 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 0, - 27 - ], - "attributes": [ - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 3, - 24 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "b" - }, - "value": { - "type": "JSXExpressionContainer", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 5, - 24 - ], - "expression": { - "type": "ConditionalExpression", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 6, - 23 - ], - "test": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ], - "name": "x" - }, - "consequent": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 10, - 15 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 10, - 15 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "c" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - }, - "alternate": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 18, - 23 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 18, - 23 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ], - "name": "d" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "?", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "JSXIdentifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "JSXIdentifier", - "value": "d", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.result.js deleted file mode 100644 index ceb36c2efde0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-invalid-js-identifier.result.js +++ /dev/null @@ -1,439 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 0, - 42 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 0, - 42 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 0, - 41 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "div" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 35, - 41 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 37, - 40 - ], - "name": "div" - } - }, - "children": [ - { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ], - "name": "br" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - }, - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 11, - 35 - ], - "value": "7x invalid-js-identifier", - "raw": "7x invalid-js-identifier" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "JSXIdentifier", - "value": "br", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 6, - 8 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "JSXText", - "value": "7x invalid-js-identifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 11, - 35 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 37, - 40 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "range": [ - 41, - 42 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.result.js deleted file mode 100644 index 696360b6dfb7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/embedded-tags.result.js +++ /dev/null @@ -1,710 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, - "range": [ - 0, - 58 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 58 - } - }, - "range": [ - 0, - 58 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, - "range": [ - 0, - 57 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 57 - } - }, - "range": [ - 0, - 57 - ], - "attributes": [ - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 11, - 21 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 11, - 15 - ], - "name": "left" - }, - "value": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 16, - 21 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "a" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 22, - 54 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 22, - 27 - ], - "name": "right" - }, - "value": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 28, - 54 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 28, - 31 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ], - "name": "b" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 50, - 54 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 52, - 53 - ], - "name": "b" - } - }, - "children": [ - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "range": [ - 31, - 50 - ], - "value": "monkeys /> gorillas", - "raw": "monkeys /> gorillas" - } - ] - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 1, - 10 - ], - "name": "LeftRight" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "LeftRight", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 1, - 10 - ] - }, - { - "type": "JSXIdentifier", - "value": "left", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 11, - 15 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "JSXIdentifier", - "value": "right", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 22, - 27 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "range": [ - 29, - 30 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "JSXText", - "value": "monkeys /> gorillas", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 50 - } - }, - "range": [ - 31, - 50 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 50 - }, - "end": { - "line": 1, - "column": 51 - } - }, - "range": [ - 50, - 51 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 51, - 52 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 52, - 53 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 53, - 54 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - } - }, - "range": [ - 55, - 56 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 57 - } - }, - "range": [ - 56, - 57 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 57 - }, - "end": { - "line": 1, - "column": 58 - } - }, - "range": [ - 57, - 58 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.result.js deleted file mode 100644 index 163a34226558..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/empty-placeholder.result.js +++ /dev/null @@ -1,344 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 0, - 10 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 0, - 9 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 5, - 9 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - } - }, - "children": [ - { - "type": "JSXExpressionContainer", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 3, - 5 - ], - "expression": { - "type": "JSXEmptyExpression", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 4, - 4 - ] - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.result.js deleted file mode 100644 index a21e5ebd998d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/escape-patterns.result.js +++ /dev/null @@ -1,995 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 84 - } - }, - "range": [ - 0, - 84 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 84 - } - }, - "range": [ - 0, - 84 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 83 - } - }, - "range": [ - 0, - 83 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 83 - } - }, - "range": [ - 0, - 83 - ], - "attributes": [ - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 3, - 10 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "b" - }, - "value": { - "type": "JSXExpressionContainer", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 5, - 10 - ], - "expression": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ], - "value": " ", - "raw": "\" \"" - } - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 11, - 16 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "c" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ], - "value": " ", - "raw": "\" \"" - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 17, - 26 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "name": "d" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 19, - 26 - ], - "value": "&", - "raw": "\"&\"" - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 27, - 43 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ], - "name": "e" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 29, - 43 - ], - "value": "id=1&group=2", - "raw": "\"id=1&group=2\"" - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 59 - } - }, - "range": [ - 44, - 59 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 44, - 45 - ], - "name": "f" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 59 - } - }, - "range": [ - 46, - 59 - ], - "value": "�", - "raw": "\"�\"" - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 71 - } - }, - "range": [ - 60, - 71 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 61 - } - }, - "range": [ - 60, - 61 - ], - "name": "g" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 71 - } - }, - "range": [ - 62, - 71 - ], - "value": "{*;", - "raw": "\"{*;\"" - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 72 - }, - "end": { - "line": 1, - "column": 80 - } - }, - "range": [ - 72, - 80 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 72 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "range": [ - 72, - 73 - ], - "name": "h" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 74 - }, - "end": { - "line": 1, - "column": 80 - } - }, - "range": [ - 74, - 80 - ], - "value": "&#x;", - "raw": "\"&#x;\"" - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "String", - "value": "\" \"", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "JSXIdentifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "JSXText", - "value": "\" \"", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 13, - 16 - ] - }, - { - "type": "JSXIdentifier", - "value": "d", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "JSXText", - "value": "\"&\"", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 19, - 26 - ] - }, - { - "type": "JSXIdentifier", - "value": "e", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "JSXText", - "value": "\"id=1&group=2\"", - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 29, - 43 - ] - }, - { - "type": "JSXIdentifier", - "value": "f", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 44, - 45 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "JSXText", - "value": "\"�\"", - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 59 - } - }, - "range": [ - 46, - 59 - ] - }, - { - "type": "JSXIdentifier", - "value": "g", - "loc": { - "start": { - "line": 1, - "column": 60 - }, - "end": { - "line": 1, - "column": 61 - } - }, - "range": [ - 60, - 61 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 62 - } - }, - "range": [ - 61, - 62 - ] - }, - { - "type": "JSXText", - "value": "\"{*;\"", - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 71 - } - }, - "range": [ - 62, - 71 - ] - }, - { - "type": "JSXIdentifier", - "value": "h", - "loc": { - "start": { - "line": 1, - "column": 72 - }, - "end": { - "line": 1, - "column": 73 - } - }, - "range": [ - 72, - 73 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 73 - }, - "end": { - "line": 1, - "column": 74 - } - }, - "range": [ - 73, - 74 - ] - }, - { - "type": "JSXText", - "value": "\"&#x;\"", - "loc": { - "start": { - "line": 1, - "column": 74 - }, - "end": { - "line": 1, - "column": 80 - } - }, - "range": [ - 74, - 80 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 81 - }, - "end": { - "line": 1, - "column": 82 - } - }, - "range": [ - 81, - 82 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 82 - }, - "end": { - "line": 1, - "column": 83 - } - }, - "range": [ - 82, - 83 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 83 - }, - "end": { - "line": 1, - "column": 84 - } - }, - "range": [ - 83, - 84 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.result.js deleted file mode 100644 index f9489fcc874e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute-missing-equals.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 14, - "lineNumber": 1, - "column": 15, - "message": "Unexpected token \"app\"" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.result.js deleted file mode 100644 index 3cea2521d1ce..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-attribute.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "JSX value should be either an expression or a quoted JSX text" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.result.js deleted file mode 100644 index ace1f56b029d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-broken-tag.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Unterminated string constant" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.result.js deleted file mode 100644 index 674267de5c7e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-end-tag-name.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Unexpected token [" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.result.js deleted file mode 100644 index 674267de5c7e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-computed-string-end-tag-name.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 2, - "lineNumber": 1, - "column": 3, - "message": "Unexpected token [" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.result.js deleted file mode 100644 index efba70a02b42..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-embedded-expression.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Unexpected token ;" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.result.js deleted file mode 100644 index 1550ffb84edd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-leading-dot-tag-name.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Unexpected token ." -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.result.js deleted file mode 100644 index 24994140cbb3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-matching-placeholder-in-closing-tag.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 27, - "lineNumber": 1, - "column": 28, - "message": "Unexpected token {" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.result.js deleted file mode 100644 index 19d15dbd4ad1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tag.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Expected corresponding JSX closing tag for " -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.result.js deleted file mode 100644 index b8926778fa64..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-closing-tags.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 8, - "lineNumber": 1, - "column": 9, - "message": "Unterminated JSX contents" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.result.js deleted file mode 100644 index 6d1e78bfdd7a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-dot-tag-name.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 7, - "lineNumber": 1, - "column": 8, - "message": "Expected corresponding JSX closing tag for " -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.result.js deleted file mode 100644 index 96c689a0cb21..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-mismatched-namespace-tag.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Expected corresponding JSX closing tag for " -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js deleted file mode 100644 index c6715eabcaf4..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag-attribute-placeholder.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "JSX attributes must only be assigned a non-empty expression" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.result.js deleted file mode 100644 index 801a1aa2a434..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-closing-tag.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Unterminated JSX contents" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.result.js deleted file mode 100644 index d6f5dfb0fae0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-name.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Unexpected token :" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.result.js deleted file mode 100644 index 2b0fd9e782cf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-namespace-value.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 5, - "lineNumber": 1, - "column": 6, - "message": "Unterminated regular expression" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.result.js deleted file mode 100644 index b2f52e846266..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-missing-spread-operator.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 6, - "lineNumber": 1, - "column": 7, - "message": "Unexpected token props" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.result.js deleted file mode 100644 index 03f355f8b8f6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-name-with-docts.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 4, - "lineNumber": 1, - "column": 5, - "message": "Unexpected token :" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.result.js deleted file mode 100644 index 465439f35d02..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-namespace-value-with-dots.result.js +++ /dev/null @@ -1,557 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 0, - 7 - ], - "attributes": [], - "name": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 1, - 6 - ], - "object": { - "type": "JSXNamespacedName", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "namespace": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "b" - } - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "c" - } - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 7, - 15 - ], - "name": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "object": { - "type": "JSXNamespacedName", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "namespace": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "b" - } - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "c" - } - } - }, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "JSXIdentifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "JSXIdentifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.result.js deleted file mode 100644 index bf2e5e6ebb2f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent-with-comment.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 49, - "lineNumber": 1, - "column": 50, - "message": "Adjacent JSX elements must be wrapped in an enclosing tag" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.result.js deleted file mode 100644 index c453466eb5a3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-common-parent.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 22, - "lineNumber": 1, - "column": 23, - "message": "Adjacent JSX elements must be wrapped in an enclosing tag" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.result.js deleted file mode 100644 index 5f0ea4d3c6e6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-no-tag-name.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 1, - "lineNumber": 1, - "column": 2, - "message": "Unexpected token /" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.result.js deleted file mode 100644 index b4d7ad288279..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-placeholder-in-closing-tag.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 16, - "lineNumber": 1, - "column": 17, - "message": "Unexpected token {" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.result.js deleted file mode 100644 index 9412307c135a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-trailing-dot-tag-name.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Unexpected token >" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.result.js deleted file mode 100644 index d24f10ca484f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/invalid-unexpected-comma.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 19, - "lineNumber": 1, - "column": 20, - "message": "Unexpected token ," -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.result.js deleted file mode 100644 index d3f1e2ca243a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/japanese-characters.result.js +++ /dev/null @@ -1,273 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "日本語" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "name": "日本語" - } - }, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "日本語", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "JSXIdentifier", - "value": "日本語", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.result.js deleted file mode 100644 index 6be31bd84662..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/less-than-operator.result.js +++ /dev/null @@ -1,293 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 0, - 14 - ], - "expression": { - "type": "BinaryExpression", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 0, - 13 - ], - "left": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 1, - 8 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 1, - 8 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 2, - 5 - ], - "name": "div" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - }, - "operator": "<", - "right": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ], - "name": "x" - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 2, - 5 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ")", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Identifier", - "value": "x", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js deleted file mode 100644 index 2df3406de0c1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.result.js +++ /dev/null @@ -1,327 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "expression": { - "type": "JSXElement", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "selfClosing": true, - "name": { - "type": "JSXMemberExpression", - "range": [ - 1, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "object": { - "type": "JSXMemberExpression", - "range": [ - 1, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "object": { - "type": "JSXIdentifier", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "this" - }, - "property": { - "type": "JSXIdentifier", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "state" - } - }, - "property": { - "type": "JSXIdentifier", - "range": [ - 12, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "Component" - } - }, - "attributes": [] - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 1, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "JSXIdentifier", - "value": "state", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "JSXIdentifier", - "value": "Component", - "range": [ - 12, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js deleted file mode 100644 index a69bd2696379..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression.result.js +++ /dev/null @@ -1,397 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "expression": { - "type": "JSXElement", - "range": [ - 0, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "selfClosing": false, - "name": { - "type": "JSXMemberExpression", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "object": { - "type": "JSXIdentifier", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "a" - }, - "property": { - "type": "JSXIdentifier", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "b" - } - }, - "attributes": [] - }, - "closingElement": { - "type": "JSXClosingElement", - "range": [ - 5, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": { - "type": "JSXMemberExpression", - "range": [ - 7, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "object": { - "type": "JSXIdentifier", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "a" - }, - "property": { - "type": "JSXIdentifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "b" - } - } - }, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "JSXIdentifier", - "value": "a", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "JSXIdentifier", - "value": "b", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "JSXIdentifier", - "value": "a", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "JSXIdentifier", - "value": "b", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.result.js deleted file mode 100644 index fa4913638a97..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/multiple-blank-spaces.result.js +++ /dev/null @@ -1,311 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 0, - 3 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 7, - 11 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - } - }, - "children": [ - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 3, - 7 - ], - "value": " ", - "raw": " " - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "JSXText", - "value": " ", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 3, - 7 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.result.js deleted file mode 100644 index d2a62e5c6c5c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-attribute-and-value-inserted.result.js +++ /dev/null @@ -1,962 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 0, - 41 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 0, - 41 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 0, - 40 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "attributes": [ - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 3, - 14 - ], - "name": { - "type": "JSXNamespacedName", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 3, - 8 - ], - "namespace": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "n" - }, - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "name": "foo" - } - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "value": "bar", - "raw": "\"bar\"" - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 36, - 40 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ], - "name": "a" - } - }, - "children": [ - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ], - "value": " ", - "raw": " " - }, - { - "type": "JSXExpressionContainer", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 16, - 23 - ], - "expression": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 17, - 22 - ], - "name": "value" - } - }, - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ], - "value": " ", - "raw": " " - }, - { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 24, - 36 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 24, - 27 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ], - "name": "b" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 32, - 36 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ], - "name": "b" - } - }, - "children": [ - { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 27, - 32 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 27, - 32 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ], - "name": "c" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - ] - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "JSXIdentifier", - "value": "n", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "JSXIdentifier", - "value": "foo", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "JSXText", - "value": "\"bar\"", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "JSXText", - "value": " ", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Identifier", - "value": "value", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 17, - 22 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "JSXText", - "value": " ", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "range": [ - 25, - 26 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "range": [ - 26, - 27 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 27, - 28 - ] - }, - { - "type": "JSXIdentifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "range": [ - 30, - 31 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 31, - 32 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 37, - 38 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "range": [ - 38, - 39 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 39, - 40 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 40, - 41 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.result.js deleted file mode 100644 index 49e53910114c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/namespaced-name-and-attribute.result.js +++ /dev/null @@ -1,382 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "attributes": [ - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "name": { - "type": "JSXNamespacedName", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "namespace": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "n" - }, - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "v" - } - }, - "value": null - } - ], - "name": { - "type": "JSXNamespacedName", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "namespace": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "n" - }, - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "a" - } - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "n", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "JSXIdentifier", - "value": "n", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ":", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "JSXIdentifier", - "value": "v", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.result.js deleted file mode 100644 index 5664539c5e5a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/newslines-and-entities.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 9, - "lineNumber": 1, - "column": 10, - "message": "Expecting Unicode escape sequence \\uXXXX" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.result.js deleted file mode 100644 index 9cb593f48c32..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-inside-tag.result.js +++ /dev/null @@ -1,458 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "expression": { - "type": "JSXElement", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "selfClosing": false, - "name": { - "type": "JSXIdentifier", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "div" - }, - "attributes": [] - }, - "closingElement": { - "type": "JSXClosingElement", - "range": [ - 18, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - }, - "name": { - "type": "JSXIdentifier", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "name": "div" - } - }, - "children": [ - { - "type": "Literal", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 2, - "column": 4 - } - }, - "value": "\n ", - "raw": "\n " - }, - { - "type": "JSXElement", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "openingElement": { - "type": "JSXOpeningElement", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "selfClosing": true, - "name": { - "type": "JSXIdentifier", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "foo" - }, - "attributes": [] - }, - "closingElement": null, - "children": [] - }, - { - "type": "Literal", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "value": "\n", - "raw": "\n" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "JSXText", - "value": "\n ", - "range": [ - 5, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "JSXIdentifier", - "value": "foo", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "JSXText", - "value": "\n", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 3, - "column": 0 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "JSXIdentifier", - "value": "div", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.result.js deleted file mode 100644 index 2941702078d2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag-with-newline.result.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - "index": 3, - "lineNumber": 1, - "column": 4, - "message": "Expecting Unicode escape sequence \\uXXXX" -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.result.js deleted file mode 100644 index a44cbb89d871..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/self-closing-tag.result.js +++ /dev/null @@ -1,185 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 0, - 6 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.result.js deleted file mode 100644 index 52d352cf28e3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attribute-and-regular-attribute.result.js +++ /dev/null @@ -1,401 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 0, - 36 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 0, - 36 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 0, - 35 - ], - "attributes": [ - { - "type": "JSXSpreadAttribute", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 5, - 15 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "name": "props" - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 16, - 32 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 16, - 20 - ], - "name": "post" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 21, - 32 - ], - "value": "attribute", - "raw": "\"attribute\"" - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "div" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ] - }, - { - "type": "Identifier", - "value": "props", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "JSXIdentifier", - "value": "post", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 16, - 20 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ] - }, - { - "type": "JSXText", - "value": "\"attribute\"", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 21, - 32 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "range": [ - 33, - 34 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 34, - 35 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 35, - 36 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.result.js deleted file mode 100644 index 62b59ca383c0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-operator-attributes.result.js +++ /dev/null @@ -1,293 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 0, - 19 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 0, - 18 - ], - "attributes": [ - { - "type": "JSXSpreadAttribute", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 5, - 15 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "name": "props" - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "div" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 6, - 9 - ] - }, - { - "type": "Identifier", - "value": "props", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "range": [ - 16, - 17 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.result.js deleted file mode 100644 index f70ee28065a9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-dots.result.js +++ /dev/null @@ -1,415 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 0, - 12 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 0, - 11 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "attributes": [], - "name": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "object": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "b" - } - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 5, - 11 - ], - "name": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 7, - 10 - ], - "object": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "name": "a" - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "b" - } - } - }, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.result.js deleted file mode 100644 index ce3d3aed1b20..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/tag-names-with-multi-dots.result.js +++ /dev/null @@ -1,557 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 0, - 16 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 0, - 15 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 0, - 7 - ], - "attributes": [], - "name": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 1, - 6 - ], - "object": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "object": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "b" - } - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ], - "name": "c" - } - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 7, - 15 - ], - "name": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "object": { - "type": "JSXMemberExpression", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 9, - 12 - ], - "object": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ], - "name": "a" - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "name": "b" - } - }, - "property": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ], - "name": "c" - } - } - }, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "range": [ - 2, - 3 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "JSXIdentifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "range": [ - 5, - 6 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "range": [ - 6, - 7 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "range": [ - 9, - 10 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "range": [ - 10, - 11 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ] - }, - { - "type": "Punctuator", - "value": ".", - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "range": [ - 12, - 13 - ] - }, - { - "type": "JSXIdentifier", - "value": "c", - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 13, - 14 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 14, - 15 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "range": [ - 15, - 16 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.result.js deleted file mode 100644 index 5d7495063e3f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/test-content.result.js +++ /dev/null @@ -1,311 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 0, - 25 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 0, - 5 - ], - "attributes": [], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "div" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 18, - 24 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ], - "name": "div" - } - }, - "children": [ - { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 5, - 18 - ], - "value": "@test content", - "raw": "@test content" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "JSXText", - "value": "@test content", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 5, - 18 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "range": [ - 18, - 19 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 19, - 20 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 20, - 23 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 24, - 25 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.result.js deleted file mode 100644 index 2179b523b439..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/trailing-spread-operator-attribute.result.js +++ /dev/null @@ -1,597 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 0, - 54 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 0, - 54 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 0, - 53 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 0, - 47 - ], - "attributes": [ - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 5, - 18 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ], - "name": "pre" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 9, - 18 - ], - "value": "leading", - "raw": "\"leading\"" - } - }, - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 19, - 35 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 19, - 23 - ], - "name": "pre2" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 24, - 35 - ], - "value": "attribute", - "raw": "\"attribute\"" - } - }, - { - "type": "JSXSpreadAttribute", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 36, - 46 - ], - "argument": { - "type": "Identifier", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 40, - 45 - ], - "name": "props" - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ], - "name": "div" - }, - "selfClosing": false - }, - "closingElement": { - "type": "JSXClosingElement", - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 47, - 53 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 49, - 52 - ], - "name": "div" - } - }, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 1, - 4 - ] - }, - { - "type": "JSXIdentifier", - "value": "pre", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 5, - 8 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "range": [ - 8, - 9 - ] - }, - { - "type": "JSXText", - "value": "\"leading\"", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 9, - 18 - ] - }, - { - "type": "JSXIdentifier", - "value": "pre2", - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 19, - 23 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - }, - { - "type": "JSXText", - "value": "\"attribute\"", - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "range": [ - 24, - 35 - ] - }, - { - "type": "Punctuator", - "value": "{", - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 36, - 37 - ] - }, - { - "type": "Punctuator", - "value": "...", - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 37, - 40 - ] - }, - { - "type": "Identifier", - "value": "props", - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 40, - 45 - ] - }, - { - "type": "Punctuator", - "value": "}", - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 45, - 46 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "range": [ - 46, - 47 - ] - }, - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "range": [ - 47, - 48 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 49 - } - }, - "range": [ - 48, - 49 - ] - }, - { - "type": "JSXIdentifier", - "value": "div", - "loc": { - "start": { - "line": 1, - "column": 49 - }, - "end": { - "line": 1, - "column": 52 - } - }, - "range": [ - 49, - 52 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 52 - }, - "end": { - "line": 1, - "column": 53 - } - }, - "range": [ - 52, - 53 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 53 - }, - "end": { - "line": 1, - "column": 54 - } - }, - "range": [ - 53, - 54 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.result.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.result.js deleted file mode 100644 index 4e6a8873f192..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/unknown-escape-pattern.result.js +++ /dev/null @@ -1,294 +0,0 @@ -module.exports = { - "type": "Program", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "body": [ - { - "type": "ExpressionStatement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 0, - 24 - ], - "expression": { - "type": "JSXElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "openingElement": { - "type": "JSXOpeningElement", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 0, - 23 - ], - "attributes": [ - { - "type": "JSXAttribute", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 3, - 20 - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ], - "name": "b" - }, - "value": { - "type": "Literal", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 5, - 20 - ], - "value": "¬anentity;", - "raw": "\"¬anentity;\"" - } - } - ], - "name": { - "type": "JSXIdentifier", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ], - "name": "a" - }, - "selfClosing": true - }, - "closingElement": null, - "children": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - }, - "range": [ - 0, - 1 - ] - }, - { - "type": "JSXIdentifier", - "value": "a", - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "range": [ - 1, - 2 - ] - }, - { - "type": "JSXIdentifier", - "value": "b", - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "range": [ - 3, - 4 - ] - }, - { - "type": "Punctuator", - "value": "=", - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "range": [ - 4, - 5 - ] - }, - { - "type": "JSXText", - "value": "\"¬anentity;\"", - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "range": [ - 5, - 20 - ] - }, - { - "type": "Punctuator", - "value": "/", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ] - }, - { - "type": "Punctuator", - "value": ">", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 22, - 23 - ] - }, - { - "type": "Punctuator", - "value": ";", - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 23, - 24 - ] - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json b/packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json deleted file mode 100644 index fafe95db8d50..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/parse/all-pieces.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - "init": { - "type": "Identifier", - "name": "bar", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - "range": [ - 4, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 13 - } - } - } - ], - "kind": "let", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ], - "sourceType": "script", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "comments": [], - "tokens": [ - { - "type": "Keyword", - "value": "let", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ] -} diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js deleted file mode 100644 index 3e5f133c6955..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/const-result.tokens.js +++ /dev/null @@ -1,93 +0,0 @@ -// const foo = bar; -module.exports = [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js deleted file mode 100644 index 1e2cfafc27f1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/let-result.tokens.js +++ /dev/null @@ -1,93 +0,0 @@ -// let foo = bar; -module.exports = [ - { - "type": "Keyword", - "value": "let", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js deleted file mode 100644 index 96b8e9bb1454..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regex-in-parens-result.tokens.js +++ /dev/null @@ -1,169 +0,0 @@ -// (/foo/).test(bar); -module.exports = [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "RegularExpression", - "value": "/foo/", - "range": [ - 1, - 6 - ], - "regex": { - "flags": "", - "pattern": "foo" - }, - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "test", - "range": [ - 8, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js deleted file mode 100644 index d56f27eb9b19..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-result.tokens.js +++ /dev/null @@ -1,97 +0,0 @@ -// var foo = /foo/u; -module.exports = [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "RegularExpression", - "value": "/foo/u", - "regex": { - "pattern": "foo", - "flags": "u" - }, - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js deleted file mode 100644 index 9b1d612c0db3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-u-unicode-escape-result.tokens.js +++ /dev/null @@ -1,37 +0,0 @@ -module.exports = [{ - type: 'Keyword', - value: 'var', - range: [0, 3], - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 3 } - } - }, { - type: 'Identifier', - value: 'x', - range: [4, 5], - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 5 } - } - }, { - type: 'Punctuator', - value: '=', - range: [6, 7], - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 7 } - } - }, { - type: 'RegularExpression', - value: '/[\\u{0000000000000061}-\\u{7A}]/u', - regex: { - pattern: '[\\u{0000000000000061}-\\u{7A}]', - flags: 'u' - }, - range: [8, 40], - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 40 } - } - }]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js deleted file mode 100644 index aae8a5eead1c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/regexp-y-result.tokens.js +++ /dev/null @@ -1,97 +0,0 @@ -// var foo = /foo/y; -module.exports = [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "RegularExpression", - "value": "/foo/y", - "regex": { - "pattern": "foo", - "flags": "y" - }, - "range": [ - 10, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js deleted file mode 100644 index 762b943eaada..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded-result.tokens.js +++ /dev/null @@ -1,129 +0,0 @@ -// var foo = `hi${bar}`; -module.exports = [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Template", - "value": "`hi${", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js deleted file mode 100644 index 88768bf3c644..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-embedded2-result.tokens.js +++ /dev/null @@ -1,255 +0,0 @@ -// var a; console.log(`${a}`, "a"); -module.exports = [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "console", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "log", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Template", - "value": "`${", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 23, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "String", - "value": "\"a\"", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js deleted file mode 100644 index 9532fafaf16f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-expressions-result.tokens.js +++ /dev/null @@ -1,201 +0,0 @@ -// var foo = `Hello ${b}. a + 5 = ${a + 5}`; -module.exports = [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Template", - "value": "`Hello ${", - "range": [ - 10, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Template", - "value": "}. a + 5 = ${", - "range": [ - 20, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Numeric", - "value": "5", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Template", - "value": "}`", - "range": [ - 38, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 41 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js b/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js deleted file mode 100644 index f2525c747b05..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/tokenize/template-string-simple-result.tokens.js +++ /dev/null @@ -1,93 +0,0 @@ -// var foo = `hi`; -module.exports = [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Template", - "value": "`hi`", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } -]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js deleted file mode 100644 index a9b9530c4b81..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-constructor.result.js +++ /dev/null @@ -1,358 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "TSAbstractClassDeclaration", - "range": [ - 16, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "name": "AbstractSocket" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "TSAbstractMethodDefinition", - "range": [ - 43, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 43, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [], - "generator": false, - "expression": false, - "async": false, - "body": null, - "range": [ - 63, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 37, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "AbstractSocket", - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 43, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 52, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 67, - 68 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js deleted file mode 100644 index 15450fe68ec5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js +++ /dev/null @@ -1,555 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 86 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "TSAbstractClassDeclaration", - "range": [ - 16, - 86 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "name": "AbstractSocket" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "TSAbstractMethodDefinition", - "range": [ - 43, - 84 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "key": { - "type": "Identifier", - "range": [ - 52, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "createSocket" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": null, - "range": [ - 64, - 84 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 44 - } - }, - "range": [ - 68, - 83 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 68, - 83 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 44 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 68, - 75 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 36 - } - }, - "name": "Promise" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 75, - 83 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 44 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 43 - } - }, - "id": { - "type": "TSStringKeyword", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - "typeParameters": null - } - ] - } - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 37, - 86 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 86 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "AbstractSocket", - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 43, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "createSocket", - "range": [ - 52, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "Promise", - "range": [ - 68, - 75 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 75, - 76 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 82, - 83 - ], - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 44 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 85, - 86 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js deleted file mode 100644 index f79e2ef90c0e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-properties.result.js +++ /dev/null @@ -1,415 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 62 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "TSAbstractClassDeclaration", - "range": [ - 0, - 62 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "TSAbstractClassProperty", - "range": [ - 25, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "key": { - "type": "Identifier", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "name": "bar" - }, - "value": null, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [], - "typeAnnotation": null - }, - { - "type": "TSAbstractClassProperty", - "range": [ - 43, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 21 - } - }, - "key": { - "type": "Identifier", - "range": [ - 52, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "name": "baz" - }, - "value": { - "type": "Literal", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "value": 3, - "raw": "3" - }, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [], - "typeAnnotation": null - } - ], - "range": [ - 19, - 62 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "abstract", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 25, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 43, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 52, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Numeric", - "value": "3", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js deleted file mode 100644 index 0c7160a845cc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-abstract-readonly-property.result.js +++ /dev/null @@ -1,355 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSAbstractClassDeclaration", - "range": [ - 0, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "TSAbstractClassProperty", - "range": [ - 23, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 42 - } - }, - "key": { - "type": "Identifier", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 30 - } - }, - "name": "foo" - }, - "value": { - "type": "Literal", - "range": [ - 54, - 62 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 41 - } - }, - "value": "string", - "raw": "'string'" - }, - "computed": false, - "static": false, - "accessibility": "public", - "readonly": true, - "decorators": [], - "typeAnnotation": null - } - ], - "range": [ - 19, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "abstract", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 30, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 39, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "String", - "value": "'string'", - "range": [ - 54, - 62 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js deleted file mode 100644 index 96da715c9704..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-class-with-optional-method.result.js +++ /dev/null @@ -1,556 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 78 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "TSAbstractClassDeclaration", - "range": [ - 16, - 78 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "name": "AbstractSocket" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 43, - 76 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 37 - } - }, - "key": { - "type": "Identifier", - "range": [ - 43, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "name": "createSocket", - "optional": true - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": null, - "range": [ - 56, - 76 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 37 - } - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 36 - } - }, - "range": [ - 60, - 75 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 60, - 75 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 36 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 60, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 28 - } - }, - "name": "Promise" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 67, - 75 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 36 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 68, - 74 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "id": { - "type": "TSStringKeyword", - "range": [ - 68, - 74 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - "typeParameters": null - } - ] - } - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 37, - 78 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 78 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 16, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "AbstractSocket", - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Identifier", - "value": "createSocket", - "range": [ - 43, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "Promise", - "range": [ - 60, - 67 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 67, - 68 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 68, - 74 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 75, - 76 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 77, - 78 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js deleted file mode 100644 index e7576a7cfd6d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/abstract-interface.result.js +++ /dev/null @@ -1,204 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "TSInterfaceDeclaration", - "range": [ - 16, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "abstract": true, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 28, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "name": "I" - }, - "heritage": [] - }, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "abstract", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "interface", - "range": [ - 16, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "I", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js deleted file mode 100644 index 1780343c1efc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js +++ /dev/null @@ -1,564 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "expression": { - "type": "ArrowFunctionExpression", - "range": [ - 0, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "generator": false, - "id": null, - "params": [ - { - "type": "Identifier", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "b", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "range": [ - 7, - 8 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "X" - } - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 16, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 22, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "b" - } - } - ] - }, - "async": false, - "expression": false, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "range": [ - 11, - 12 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "X" - } - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - }, - "name": "X", - "constraint": null - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "<", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 1, - 2 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 2, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 2 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 13, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js deleted file mode 100644 index f0961045153c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-expression.result.js +++ /dev/null @@ -1,330 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 4 - } - }, - "callee": { - "type": "FunctionExpression", - "range": [ - 1, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 16, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "name": "test" - }, - "generator": false, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 23, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "body": [] - }, - "async": true, - "expression": false - }, - "arguments": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "(", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "async", - "range": [ - 1, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 7, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "test", - "range": [ - 16, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 2 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js deleted file mode 100644 index 6f08a71a34e5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/async-function-with-var-declaration.result.js +++ /dev/null @@ -1,698 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 96 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 96 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "test" - }, - "generator": false, - "expression": false, - "async": true, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 22, - 96 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 28, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 32, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "id": { - "type": "Identifier", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "name": "foo" - }, - "init": { - "type": "Literal", - "range": [ - 38, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "value": "foo", - "raw": "'foo'" - } - } - ], - "kind": "var" - }, - { - "type": "VariableDeclaration", - "range": [ - 49, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 53, - 64 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "id": { - "type": "Identifier", - "range": [ - 53, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "name": "bar" - }, - "init": { - "type": "Literal", - "range": [ - 59, - 64 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "value": "bar", - "raw": "'bar'" - } - } - ], - "kind": "let" - }, - { - "type": "VariableDeclaration", - "range": [ - 70, - 94 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 76, - 93 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 27 - } - }, - "id": { - "type": "Identifier", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 16 - } - }, - "name": "fooBar" - }, - "init": { - "type": "Literal", - "range": [ - 85, - 93 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 27 - } - }, - "value": "fooBar", - "raw": "'fooBar'" - } - } - ], - "kind": "const" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "async", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "test", - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "var", - "range": [ - 28, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "String", - "value": "'foo'", - "range": [ - 38, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 49, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 53, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "String", - "value": "'bar'", - "range": [ - 59, - 64 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "const", - "range": [ - 70, - 75 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "fooBar", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "String", - "value": "'fooBar'", - "range": [ - 85, - 93 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 93, - 94 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js deleted file mode 100644 index 8ab949f5e88d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-accessibility-modifiers.result.js +++ /dev/null @@ -1,1359 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 173 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 173 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 14, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "key": { - "type": "Identifier", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "name": "bar" - }, - "value": null, - "computed": false, - "static": false, - "accessibility": "private", - "readonly": false, - "decorators": [], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "range": [ - 28, - 34 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 28, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } - } - } - }, - { - "type": "ClassProperty", - "range": [ - 38, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 29 - } - }, - "key": { - "type": "Identifier", - "range": [ - 52, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "name": "baz" - }, - "value": null, - "computed": false, - "static": true, - "accessibility": "public", - "readonly": false, - "decorators": [], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "range": [ - 58, - 64 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 58, - 64 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 28 - } - } - } - } - }, - { - "type": "MethodDefinition", - "range": [ - 68, - 111 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "key": { - "type": "Identifier", - "range": [ - 75, - 81 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - }, - "name": "getBar" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 85, - 111 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 91, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 20 - } - }, - "argument": { - "type": "MemberExpression", - "range": [ - 98, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 19 - } - }, - "object": { - "type": "ThisExpression", - "range": [ - 98, - 102 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "property": { - "type": "Identifier", - "range": [ - 103, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 19 - } - }, - "name": "bar" - }, - "computed": false - } - } - ] - }, - "range": [ - 82, - 111 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 6, - "column": 3 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": "public", - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 114, - 171 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 9, - "column": 3 - } - }, - "key": { - "type": "Identifier", - "range": [ - 124, - 130 - ], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 18 - } - }, - "name": "setBar" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 146, - 171 - ], - "loc": { - "start": { - "line": 7, - "column": 34 - }, - "end": { - "line": 9, - "column": 3 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 152, - 167 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 19 - } - }, - "expression": { - "type": "AssignmentExpression", - "range": [ - 152, - 166 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 18 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "range": [ - 152, - 160 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 12 - } - }, - "object": { - "type": "ThisExpression", - "range": [ - 152, - 156 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "range": [ - 157, - 160 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 12 - } - }, - "name": "bar" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "range": [ - 163, - 166 - ], - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 18 - } - }, - "name": "bar" - } - } - } - ] - }, - "range": [ - 131, - 171 - ], - "loc": { - "start": { - "line": 7, - "column": 18 - }, - "end": { - "line": 9, - "column": 3 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 132, - 135 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 23 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 7, - "column": 26 - }, - "end": { - "line": 7, - "column": 32 - } - }, - "range": [ - 138, - 144 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 138, - 144 - ], - "loc": { - "start": { - "line": 7, - "column": 26 - }, - "end": { - "line": 7, - "column": 32 - } - } - } - }, - "decorators": [] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": "protected", - "decorators": [] - } - ], - "range": [ - 10, - 173 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 10, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 28, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 45, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 52, - 55 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 58, - 64 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 68, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "getBar", - "range": [ - 75, - 81 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 82, - 83 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 85, - 86 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 91, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 98, - 102 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 103, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 106, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 3 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 114, - 123 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "setBar", - "range": [ - 124, - 130 - ], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 131, - 132 - ], - "loc": { - "start": { - "line": 7, - "column": 19 - }, - "end": { - "line": 7, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 132, - 135 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 138, - 144 - ], - "loc": { - "start": { - "line": 7, - "column": 26 - }, - "end": { - "line": 7, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 144, - 145 - ], - "loc": { - "start": { - "line": 7, - "column": 32 - }, - "end": { - "line": 7, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 146, - 147 - ], - "loc": { - "start": { - "line": 7, - "column": 34 - }, - "end": { - "line": 7, - "column": 35 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 152, - 156 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 156, - 157 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 157, - 160 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 161, - 162 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 163, - 166 - ], - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 166, - 167 - ], - "loc": { - "start": { - "line": 8, - "column": 18 - }, - "end": { - "line": 8, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 172, - 173 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js deleted file mode 100644 index c531a48ef050..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-export-parameter-properties.result.js +++ /dev/null @@ -1,467 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 16, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 16, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "TSParameterProperty", - "range": [ - 28, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": true, - "parameter": { - "type": "Identifier", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "name": "a", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "range": [ - 38, - 44 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - } - } - } - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 46, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 27, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 10, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 16, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "export", - "range": [ - 28, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js deleted file mode 100644 index 090134c2d87e..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic-multiple.result.js +++ /dev/null @@ -1,563 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 10, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "A", - "constraint": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "range": [ - 20, - 21 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "B" - } - } - } - } - ] - }, - "superTypeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 34, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "id": { - "type": "Identifier", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "name": "C" - }, - "typeParameters": null - }, - { - "type": "GenericTypeAnnotation", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "id": { - "type": "Identifier", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "name": "D" - }, - "typeParameters": null - } - ] - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 41, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": { - "type": "Identifier", - "range": [ - 31, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "name": "Bar" - }, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 12, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "B", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 23, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 31, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Identifier", - "value": "D", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js deleted file mode 100644 index f6bd1399d9f7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-generic.result.js +++ /dev/null @@ -1,404 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "A", - "constraint": null - } - ] - }, - "superTypeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "id": { - "type": "Identifier", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "B" - }, - "typeParameters": null - } - ] - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 28, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "Bar" - }, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 13, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "B", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js deleted file mode 100644 index dc79f2d6f717..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method-default.result.js +++ /dev/null @@ -1,484 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "getBar" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 32, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "body": [] - }, - "range": [ - 29, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "params": [], - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 20, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 21, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "name": "T", - "constraint": null, - "default": { - "type": "TSTypeReference", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "name": "Bar" - } - } - } - ] - } - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 10, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "getBar", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js deleted file mode 100644 index 82cb9077f6a7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-generic-method.result.js +++ /dev/null @@ -1,413 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "getBar" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 26, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "body": [] - }, - "range": [ - 23, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "params": [], - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "name": "T", - "constraint": null - } - ] - } - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 10, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "getBar", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js deleted file mode 100644 index af2a4722ed62..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic-multiple.result.js +++ /dev/null @@ -1,403 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 31, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [ - { - "type": "ClassImplements", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 21, - 24 - ], - "id": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "Bar" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "id": { - "type": "Identifier", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "S" - }, - "typeParameters": null - }, - { - "type": "GenericTypeAnnotation", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "id": { - "type": "Identifier", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "T" - }, - "typeParameters": null - } - ] - } - } - ], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "implements", - "range": [ - 10, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "S", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js deleted file mode 100644 index 2a5f27c831ce..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-generic.result.js +++ /dev/null @@ -1,331 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 28, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [ - { - "type": "ClassImplements", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 21, - 24 - ], - "id": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "Bar" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "id": { - "type": "Identifier", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "S" - }, - "typeParameters": null - } - ] - } - } - ], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "implements", - "range": [ - 10, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "S", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js deleted file mode 100644 index 5388d10ba5ec..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 25, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [ - { - "type": "ClassImplements", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 21, - 24 - ], - "id": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "Bar" - } - } - ], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "implements", - "range": [ - 10, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js deleted file mode 100644 index 02b1f01d6bcd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-mixin.result.js +++ /dev/null @@ -1,2082 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 206 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 48 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 84 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "M" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 38, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "name": "Base", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 44, - 45 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "name": "T" - } - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 47, - 84 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 53, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "argument": { - "type": "ClassExpression", - "range": [ - 60, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "id": null, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 79, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - "superClass": { - "type": "Identifier", - "range": [ - 74, - 78 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "name": "Base" - }, - "implements": [], - "decorators": [] - } - } - ] - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 10, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 11, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "name": "T", - "constraint": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 21, - 36 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 21, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 21, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "name": "Constructor" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 32, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 33, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "id": { - "type": "TSTypeLiteral", - "range": [ - 33, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "members": [] - }, - "typeParameters": null - } - ] - } - } - } - } - ] - } - }, - { - "type": "ClassDeclaration", - "range": [ - 86, - 128 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 42 - } - }, - "id": { - "type": "Identifier", - "range": [ - 92, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - }, - "name": "X" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 125, - 128 - ], - "loc": { - "start": { - "line": 5, - "column": 39 - }, - "end": { - "line": 5, - "column": 42 - } - } - }, - "superClass": { - "type": "CallExpression", - "range": [ - 102, - 111 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 25 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - }, - "name": "M" - }, - "arguments": [ - { - "type": "Identifier", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 24 - } - }, - "name": "C" - } - ], - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 103, - 108 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 22 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 104, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 21 - } - }, - "id": { - "type": "TSAnyKeyword", - "range": [ - 104, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - "typeParameters": null - } - ] - } - }, - "implements": [ - { - "type": "ClassImplements", - "loc": { - "start": { - "line": 5, - "column": 37 - }, - "end": { - "line": 5, - "column": 38 - } - }, - "range": [ - 123, - 124 - ], - "id": { - "type": "Identifier", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 5, - "column": 37 - }, - "end": { - "line": 5, - "column": 38 - } - }, - "name": "I" - } - } - ], - "decorators": [] - }, - { - "type": "ClassDeclaration", - "range": [ - 130, - 141 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 11 - } - }, - "id": { - "type": "Identifier", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 7 - } - }, - "name": "C" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 138, - 141 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 11 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - { - "type": "TSInterfaceDeclaration", - "range": [ - 142, - 157 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 15 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 154, - 157 - ], - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 15 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 152, - 153 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 11 - } - }, - "name": "I" - }, - "heritage": [] - }, - { - "type": "VariableDeclaration", - "range": [ - 158, - 206 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 48 - } - }, - "kind": "type", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "range": [ - 163, - 174 - ], - "loc": { - "start": { - "line": 9, - "column": 5 - }, - "end": { - "line": 9, - "column": 16 - } - }, - "name": "Constructor" - }, - "init": { - "type": "TSConstructorType", - "range": [ - 180, - 205 - ], - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 47 - } - }, - "typeParameters": null, - "parameters": [ - { - "type": "RestElement", - "range": [ - 185, - 199 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 41 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 188, - 192 - ], - "loc": { - "start": { - "line": 9, - "column": 30 - }, - "end": { - "line": 9, - "column": 34 - } - }, - "name": "args", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 9, - "column": 36 - }, - "end": { - "line": 9, - "column": 41 - } - }, - "range": [ - 194, - 199 - ], - "typeAnnotation": { - "type": "TSArrayType", - "range": [ - 194, - 199 - ], - "loc": { - "start": { - "line": 9, - "column": 36 - }, - "end": { - "line": 9, - "column": 41 - } - }, - "elementType": { - "type": "TSAnyKeyword", - "range": [ - 194, - 197 - ], - "loc": { - "start": { - "line": 9, - "column": 36 - }, - "end": { - "line": 9, - "column": 39 - } - } - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 9, - "column": 46 - }, - "end": { - "line": 9, - "column": 47 - } - }, - "range": [ - 204, - 205 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 9, - "column": 46 - }, - "end": { - "line": 9, - "column": 47 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 9, - "column": 46 - }, - "end": { - "line": 9, - "column": 47 - } - }, - "name": "T" - } - } - } - }, - "range": [ - 163, - 206 - ], - "loc": { - "start": { - "line": 9, - "column": 5 - }, - "end": { - "line": 9, - "column": 48 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 174, - 177 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 19 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 175, - 176 - ], - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 18 - } - }, - "name": "T", - "constraint": null - } - ] - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "M", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 13, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "Constructor", - "range": [ - 21, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Identifier", - "value": "Base", - "range": [ - 38, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 53, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 60, - 65 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 66, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "Base", - "range": [ - 74, - 78 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 86, - 91 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 92, - 93 - ], - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 94, - 101 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "M", - "range": [ - 102, - 103 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 103, - 104 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "any", - "range": [ - 104, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 107, - 108 - ], - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 108, - 109 - ], - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 110, - 111 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 25 - } - } - }, - { - "type": "Keyword", - "value": "implements", - "range": [ - 112, - 122 - ], - "loc": { - "start": { - "line": 5, - "column": 26 - }, - "end": { - "line": 5, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "I", - "range": [ - 123, - 124 - ], - "loc": { - "start": { - "line": 5, - "column": 37 - }, - "end": { - "line": 5, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 125, - 126 - ], - "loc": { - "start": { - "line": 5, - "column": 39 - }, - "end": { - "line": 5, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 127, - 128 - ], - "loc": { - "start": { - "line": 5, - "column": 41 - }, - "end": { - "line": 5, - "column": 42 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 130, - 135 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 138, - 139 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 140, - 141 - ], - "loc": { - "start": { - "line": 7, - "column": 10 - }, - "end": { - "line": 7, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "interface", - "range": [ - 142, - 151 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "I", - "range": [ - 152, - 153 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 154, - 155 - ], - "loc": { - "start": { - "line": 8, - "column": 12 - }, - "end": { - "line": 8, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 156, - 157 - ], - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "type", - "range": [ - 158, - 162 - ], - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "Constructor", - "range": [ - 163, - 174 - ], - "loc": { - "start": { - "line": 9, - "column": 5 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 174, - 175 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 175, - 176 - ], - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 176, - 177 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 178, - 179 - ], - "loc": { - "start": { - "line": 9, - "column": 20 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "new", - "range": [ - 180, - 183 - ], - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 184, - 185 - ], - "loc": { - "start": { - "line": 9, - "column": 26 - }, - "end": { - "line": 9, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 185, - 188 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "args", - "range": [ - 188, - 192 - ], - "loc": { - "start": { - "line": 9, - "column": 30 - }, - "end": { - "line": 9, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 192, - 193 - ], - "loc": { - "start": { - "line": 9, - "column": 34 - }, - "end": { - "line": 9, - "column": 35 - } - } - }, - { - "type": "Identifier", - "value": "any", - "range": [ - 194, - 197 - ], - "loc": { - "start": { - "line": 9, - "column": 36 - }, - "end": { - "line": 9, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 197, - 198 - ], - "loc": { - "start": { - "line": 9, - "column": 39 - }, - "end": { - "line": 9, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 198, - 199 - ], - "loc": { - "start": { - "line": 9, - "column": 40 - }, - "end": { - "line": 9, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 199, - 200 - ], - "loc": { - "start": { - "line": 9, - "column": 41 - }, - "end": { - "line": 9, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 201, - 203 - ], - "loc": { - "start": { - "line": 9, - "column": 43 - }, - "end": { - "line": 9, - "column": 45 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 9, - "column": 46 - }, - "end": { - "line": 9, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 205, - 206 - ], - "loc": { - "start": { - "line": 9, - "column": 47 - }, - "end": { - "line": 9, - "column": 48 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js deleted file mode 100644 index 2c07fbe305ca..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-computed-property.result.js +++ /dev/null @@ -1,356 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "X" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 14, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "key": { - "type": "Literal", - "range": [ - 23, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "value": "foo", - "raw": "'foo'" - }, - "value": { - "type": "Identifier", - "range": [ - 33, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "name": "undefined" - }, - "computed": true, - "static": false, - "accessibility": "private", - "readonly": false, - "decorators": [], - "typeAnnotation": null, - "optional": true - } - ], - "range": [ - 8, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "String", - "value": "'foo'", - "range": [ - 23, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "undefined", - "range": [ - 33, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js deleted file mode 100644 index 01de5727e4dd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-methods.result.js +++ /dev/null @@ -1,771 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 67 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 67 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "name": "foo", - "optional": true - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": null, - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 24, - 39 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 17 - } - }, - "key": { - "type": "Identifier", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "name": "bar", - "optional": true - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": null, - "range": [ - 28, - 39 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 17 - } - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "range": [ - 32, - 38 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - }, - { - "type": "MethodDefinition", - "range": [ - 42, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "key": { - "type": "Identifier", - "range": [ - 50, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 13 - } - }, - "name": "baz", - "optional": true - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": null, - "range": [ - 54, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "range": [ - 58, - 64 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 58, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 24 - } - } - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": "private", - "decorators": [] - } - ], - "range": [ - 10, - 67 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 42, - 49 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 50, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 58, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js deleted file mode 100644 index f2196145d9d5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-properties.result.js +++ /dev/null @@ -1,598 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 63 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 63 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 14, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - }, - "name": "foo", - "optional": true - }, - "value": null, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [], - "typeAnnotation": null - }, - { - "type": "ClassProperty", - "range": [ - 22, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "key": { - "type": "Identifier", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - }, - "name": "bar", - "optional": true - }, - "value": null, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - }, - "range": [ - 29, - 35 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 29, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - } - } - }, - { - "type": "ClassProperty", - "range": [ - 39, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "key": { - "type": "Identifier", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 13 - } - }, - "name": "baz", - "optional": true - }, - "value": null, - "computed": false, - "static": false, - "accessibility": "private", - "readonly": false, - "decorators": [], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "range": [ - 54, - 60 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 23 - } - } - } - } - } - ], - "range": [ - 10, - 63 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 29, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 39, - 46 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 47, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 54, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js deleted file mode 100644 index 029d97d093d0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-optional-property-undefined.result.js +++ /dev/null @@ -1,319 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "X" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 12, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 27 - } - }, - "key": { - "type": "Identifier", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "name": "foo", - "optional": true - }, - "value": { - "type": "Identifier", - "range": [ - 27, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "name": "undefined" - }, - "computed": false, - "static": false, - "accessibility": "private", - "readonly": false, - "decorators": [], - "typeAnnotation": null - } - ], - "range": [ - 8, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 12, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "undefined", - "range": [ - 27, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js deleted file mode 100644 index 6239f463a464..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-private-parameter-properties.result.js +++ /dev/null @@ -1,1139 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 203 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 203 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 201 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 5, - "column": 59 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "TSParameterProperty", - "range": [ - 26, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 39 - } - }, - "accessibility": "private", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 34, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 31 - } - }, - "name": "firstName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 39 - } - }, - "range": [ - 45, - 51 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 45, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 39 - } - } - } - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 67, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 47 - } - }, - "accessibility": "private", - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 84, - 92 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 39 - } - }, - "name": "lastName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - }, - "range": [ - 94, - 100 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 94, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - } - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 116, - 140 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 38 - } - }, - "accessibility": "private", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "AssignmentPattern", - "range": [ - 116, - 140 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 38 - } - }, - "left": { - "type": "Identifier", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 25 - } - }, - "name": "age", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 33 - } - }, - "range": [ - 129, - 135 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 129, - 135 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 33 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 138, - 140 - ], - "loc": { - "start": { - "line": 4, - "column": 36 - }, - "end": { - "line": 4, - "column": 38 - } - }, - "value": 30, - "raw": "30" - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 156, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 55 - } - }, - "accessibility": "private", - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "AssignmentPattern", - "range": [ - 156, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 55 - } - }, - "left": { - "type": "Identifier", - "range": [ - 173, - 180 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 38 - } - }, - "name": "student", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 47 - } - }, - "range": [ - 182, - 189 - ], - "typeAnnotation": { - "type": "TSBooleanKeyword", - "range": [ - 182, - 189 - ], - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 47 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 192, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 50 - }, - "end": { - "line": 5, - "column": 55 - } - }, - "value": false, - "raw": "false" - } - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 199, - 201 - ], - "loc": { - "start": { - "line": 5, - "column": 57 - }, - "end": { - "line": 5, - "column": 59 - } - }, - "body": [] - }, - "range": [ - 25, - 201 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 5, - "column": 59 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 10, - 203 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 26, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "firstName", - "range": [ - 34, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 45, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 67, - 74 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 75, - 83 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "lastName", - "range": [ - 84, - 92 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 92, - 93 - ], - "loc": { - "start": { - "line": 3, - "column": 39 - }, - "end": { - "line": 3, - "column": 40 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 94, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 100, - 101 - ], - "loc": { - "start": { - "line": 3, - "column": 47 - }, - "end": { - "line": 3, - "column": 48 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 116, - 123 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "age", - "range": [ - 124, - 127 - ], - "loc": { - "start": { - "line": 4, - "column": 22 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 127, - 128 - ], - "loc": { - "start": { - "line": 4, - "column": 25 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 129, - 135 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 136, - 137 - ], - "loc": { - "start": { - "line": 4, - "column": 34 - }, - "end": { - "line": 4, - "column": 35 - } - } - }, - { - "type": "Numeric", - "value": "30", - "range": [ - 138, - 140 - ], - "loc": { - "start": { - "line": 4, - "column": 36 - }, - "end": { - "line": 4, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 140, - 141 - ], - "loc": { - "start": { - "line": 4, - "column": 38 - }, - "end": { - "line": 4, - "column": 39 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 156, - 163 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 164, - 172 - ], - "loc": { - "start": { - "line": 5, - "column": 22 - }, - "end": { - "line": 5, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "student", - "range": [ - 173, - 180 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 180, - 181 - ], - "loc": { - "start": { - "line": 5, - "column": 38 - }, - "end": { - "line": 5, - "column": 39 - } - } - }, - { - "type": "Identifier", - "value": "boolean", - "range": [ - 182, - 189 - ], - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 190, - 191 - ], - "loc": { - "start": { - "line": 5, - "column": 48 - }, - "end": { - "line": 5, - "column": 49 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 192, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 50 - }, - "end": { - "line": 5, - "column": 55 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 197, - 198 - ], - "loc": { - "start": { - "line": 5, - "column": 55 - }, - "end": { - "line": 5, - "column": 56 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 199, - 200 - ], - "loc": { - "start": { - "line": 5, - "column": 57 - }, - "end": { - "line": 5, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 200, - 201 - ], - "loc": { - "start": { - "line": 5, - "column": 58 - }, - "end": { - "line": 5, - "column": 59 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js deleted file mode 100644 index 0d44bed7a09c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-protected-parameter-properties.result.js +++ /dev/null @@ -1,1139 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 211 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 211 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 209 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 5, - "column": 61 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "TSParameterProperty", - "range": [ - 26, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 41 - } - }, - "accessibility": "protected", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 36, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "name": "firstName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - }, - "range": [ - 47, - 53 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 69, - 104 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 49 - } - }, - "accessibility": "protected", - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 88, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 41 - } - }, - "name": "lastName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 43 - }, - "end": { - "line": 3, - "column": 49 - } - }, - "range": [ - 98, - 104 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 98, - 104 - ], - "loc": { - "start": { - "line": 3, - "column": 43 - }, - "end": { - "line": 3, - "column": 49 - } - } - } - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 120, - 146 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 40 - } - }, - "accessibility": "protected", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "AssignmentPattern", - "range": [ - 120, - 146 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 40 - } - }, - "left": { - "type": "Identifier", - "range": [ - 130, - 133 - ], - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 27 - } - }, - "name": "age", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 35 - } - }, - "range": [ - 135, - 141 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 135, - 141 - ], - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 35 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 144, - 146 - ], - "loc": { - "start": { - "line": 4, - "column": 38 - }, - "end": { - "line": 4, - "column": 40 - } - }, - "value": 30, - "raw": "30" - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 162, - 205 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 57 - } - }, - "accessibility": "protected", - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "AssignmentPattern", - "range": [ - 162, - 205 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 57 - } - }, - "left": { - "type": "Identifier", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 5, - "column": 40 - } - }, - "name": "student", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 5, - "column": 42 - }, - "end": { - "line": 5, - "column": 49 - } - }, - "range": [ - 190, - 197 - ], - "typeAnnotation": { - "type": "TSBooleanKeyword", - "range": [ - 190, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 42 - }, - "end": { - "line": 5, - "column": 49 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 200, - 205 - ], - "loc": { - "start": { - "line": 5, - "column": 52 - }, - "end": { - "line": 5, - "column": 57 - } - }, - "value": false, - "raw": "false" - } - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 207, - 209 - ], - "loc": { - "start": { - "line": 5, - "column": 59 - }, - "end": { - "line": 5, - "column": 61 - } - }, - "body": [] - }, - "range": [ - 25, - 209 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 5, - "column": 61 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 10, - 211 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 26, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "firstName", - "range": [ - 36, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 47, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 42 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 69, - 78 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 79, - 87 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "lastName", - "range": [ - 88, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 42 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 98, - 104 - ], - "loc": { - "start": { - "line": 3, - "column": 43 - }, - "end": { - "line": 3, - "column": 49 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 104, - 105 - ], - "loc": { - "start": { - "line": 3, - "column": 49 - }, - "end": { - "line": 3, - "column": 50 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 120, - 129 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "age", - "range": [ - 130, - 133 - ], - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 133, - 134 - ], - "loc": { - "start": { - "line": 4, - "column": 27 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 135, - 141 - ], - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 142, - 143 - ], - "loc": { - "start": { - "line": 4, - "column": 36 - }, - "end": { - "line": 4, - "column": 37 - } - } - }, - { - "type": "Numeric", - "value": "30", - "range": [ - 144, - 146 - ], - "loc": { - "start": { - "line": 4, - "column": 38 - }, - "end": { - "line": 4, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 146, - 147 - ], - "loc": { - "start": { - "line": 4, - "column": 40 - }, - "end": { - "line": 4, - "column": 41 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 162, - 171 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 172, - 180 - ], - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "student", - "range": [ - 181, - 188 - ], - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 5, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 188, - 189 - ], - "loc": { - "start": { - "line": 5, - "column": 40 - }, - "end": { - "line": 5, - "column": 41 - } - } - }, - { - "type": "Identifier", - "value": "boolean", - "range": [ - 190, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 42 - }, - "end": { - "line": 5, - "column": 49 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 198, - 199 - ], - "loc": { - "start": { - "line": 5, - "column": 50 - }, - "end": { - "line": 5, - "column": 51 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 200, - 205 - ], - "loc": { - "start": { - "line": 5, - "column": 52 - }, - "end": { - "line": 5, - "column": 57 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 205, - 206 - ], - "loc": { - "start": { - "line": 5, - "column": 57 - }, - "end": { - "line": 5, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 207, - 208 - ], - "loc": { - "start": { - "line": 5, - "column": 59 - }, - "end": { - "line": 5, - "column": 60 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 208, - 209 - ], - "loc": { - "start": { - "line": 5, - "column": 60 - }, - "end": { - "line": 5, - "column": 61 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 210, - 211 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js deleted file mode 100644 index 8c8c738c7477..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-public-parameter-properties.result.js +++ /dev/null @@ -1,1139 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 199 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 199 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 197 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 5, - "column": 58 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "TSParameterProperty", - "range": [ - 26, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "accessibility": "public", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 33, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 30 - } - }, - "name": "firstName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "range": [ - 44, - 50 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 44, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 38 - } - } - } - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 66, - 98 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 46 - } - }, - "accessibility": "public", - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 82, - 90 - ], - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 38 - } - }, - "name": "lastName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 40 - }, - "end": { - "line": 3, - "column": 46 - } - }, - "range": [ - 92, - 98 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 92, - 98 - ], - "loc": { - "start": { - "line": 3, - "column": 40 - }, - "end": { - "line": 3, - "column": 46 - } - } - } - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 114, - 137 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 37 - } - }, - "accessibility": "public", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "AssignmentPattern", - "range": [ - 114, - 137 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 37 - } - }, - "left": { - "type": "Identifier", - "range": [ - 121, - 124 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "name": "age", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 32 - } - }, - "range": [ - 126, - 132 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 126, - 132 - ], - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 32 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 135, - 137 - ], - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 37 - } - }, - "value": 30, - "raw": "30" - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 153, - 193 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 54 - } - }, - "accessibility": "public", - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "AssignmentPattern", - "range": [ - 153, - 193 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 54 - } - }, - "left": { - "type": "Identifier", - "range": [ - 169, - 176 - ], - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 37 - } - }, - "name": "student", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 5, - "column": 39 - }, - "end": { - "line": 5, - "column": 46 - } - }, - "range": [ - 178, - 185 - ], - "typeAnnotation": { - "type": "TSBooleanKeyword", - "range": [ - 178, - 185 - ], - "loc": { - "start": { - "line": 5, - "column": 39 - }, - "end": { - "line": 5, - "column": 46 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 188, - 193 - ], - "loc": { - "start": { - "line": 5, - "column": 49 - }, - "end": { - "line": 5, - "column": 54 - } - }, - "value": false, - "raw": "false" - } - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 195, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 56 - }, - "end": { - "line": 5, - "column": 58 - } - }, - "body": [] - }, - "range": [ - 25, - 197 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 5, - "column": 58 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 10, - 199 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 26, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "firstName", - "range": [ - 33, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 44, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 39 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 66, - 72 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 73, - 81 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "lastName", - "range": [ - 82, - 90 - ], - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 90, - 91 - ], - "loc": { - "start": { - "line": 3, - "column": 38 - }, - "end": { - "line": 3, - "column": 39 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 92, - 98 - ], - "loc": { - "start": { - "line": 3, - "column": 40 - }, - "end": { - "line": 3, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 3, - "column": 46 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 114, - 120 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "age", - "range": [ - 121, - 124 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 124, - 125 - ], - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 126, - 132 - ], - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 133, - 134 - ], - "loc": { - "start": { - "line": 4, - "column": 33 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - { - "type": "Numeric", - "value": "30", - "range": [ - 135, - 137 - ], - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 137, - 138 - ], - "loc": { - "start": { - "line": 4, - "column": 37 - }, - "end": { - "line": 4, - "column": 38 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 153, - 159 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 160, - 168 - ], - "loc": { - "start": { - "line": 5, - "column": 21 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "student", - "range": [ - 169, - 176 - ], - "loc": { - "start": { - "line": 5, - "column": 30 - }, - "end": { - "line": 5, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 176, - 177 - ], - "loc": { - "start": { - "line": 5, - "column": 37 - }, - "end": { - "line": 5, - "column": 38 - } - } - }, - { - "type": "Identifier", - "value": "boolean", - "range": [ - 178, - 185 - ], - "loc": { - "start": { - "line": 5, - "column": 39 - }, - "end": { - "line": 5, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 186, - 187 - ], - "loc": { - "start": { - "line": 5, - "column": 47 - }, - "end": { - "line": 5, - "column": 48 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 188, - 193 - ], - "loc": { - "start": { - "line": 5, - "column": 49 - }, - "end": { - "line": 5, - "column": 54 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 193, - 194 - ], - "loc": { - "start": { - "line": 5, - "column": 54 - }, - "end": { - "line": 5, - "column": 55 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 195, - 196 - ], - "loc": { - "start": { - "line": 5, - "column": 56 - }, - "end": { - "line": 5, - "column": 57 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 196, - 197 - ], - "loc": { - "start": { - "line": 5, - "column": 57 - }, - "end": { - "line": 5, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 198, - 199 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js deleted file mode 100644 index 33c39799dd33..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-parameter-properties.result.js +++ /dev/null @@ -1,703 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 109 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 109 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 107 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 3, - "column": 53 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "TSParameterProperty", - "range": [ - 26, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 40 - } - }, - "accessibility": null, - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 35, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "name": "firstName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 40 - } - }, - "range": [ - 46, - 52 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 46, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 40 - } - } - } - } - }, - "decorators": [] - }, - { - "type": "TSParameterProperty", - "range": [ - 68, - 103 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 49 - } - }, - "accessibility": null, - "readonly": true, - "static": false, - "export": false, - "parameter": { - "type": "AssignmentPattern", - "range": [ - 68, - 103 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 49 - } - }, - "left": { - "type": "Identifier", - "range": [ - 77, - 85 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "name": "lastName", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 39 - } - }, - "range": [ - 87, - 93 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 39 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 96, - 103 - ], - "loc": { - "start": { - "line": 3, - "column": 42 - }, - "end": { - "line": 3, - "column": 49 - } - }, - "value": "Smith", - "raw": "'Smith'" - } - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 105, - 107 - ], - "loc": { - "start": { - "line": 3, - "column": 51 - }, - "end": { - "line": 3, - "column": 53 - } - }, - "body": [] - }, - "range": [ - 25, - 107 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 3, - "column": 53 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 10, - 109 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "firstName", - "range": [ - 35, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 46, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 68, - 76 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "lastName", - "range": [ - 77, - 85 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 85, - 86 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 3, - "column": 40 - }, - "end": { - "line": 3, - "column": 41 - } - } - }, - { - "type": "String", - "value": "'Smith'", - "range": [ - 96, - 103 - ], - "loc": { - "start": { - "line": 3, - "column": 42 - }, - "end": { - "line": 3, - "column": 49 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 103, - 104 - ], - "loc": { - "start": { - "line": 3, - "column": 49 - }, - "end": { - "line": 3, - "column": 50 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 3, - "column": 51 - }, - "end": { - "line": 3, - "column": 52 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 106, - 107 - ], - "loc": { - "start": { - "line": 3, - "column": 52 - }, - "end": { - "line": 3, - "column": 53 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 108, - 109 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js deleted file mode 100644 index 0776637a1bf8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-readonly-property.result.js +++ /dev/null @@ -1,319 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 16, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "key": { - "type": "Identifier", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "name": "foo" - }, - "value": { - "type": "Literal", - "range": [ - 38, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "value": "string", - "raw": "'string'" - }, - "computed": false, - "static": false, - "accessibility": "public", - "readonly": true, - "decorators": [], - "typeAnnotation": null - } - ], - "range": [ - 10, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 16, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 23, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "String", - "value": "'string'", - "range": [ - 38, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js deleted file mode 100644 index 5ebfa84546d7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-static-parameter-properties.result.js +++ /dev/null @@ -1,467 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 16, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 16, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "TSParameterProperty", - "range": [ - 28, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "accessibility": null, - "readonly": false, - "static": true, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "name": "a", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "range": [ - 38, - 44 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - } - } - } - }, - "decorators": [] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 46, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [] - }, - "range": [ - 27, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 10, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 16, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 28, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 38, - 44 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js deleted file mode 100644 index 3e17f6d5c471..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-default.result.js +++ /dev/null @@ -1,313 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 9, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "T", - "constraint": null, - "default": { - "type": "TSTypeReference", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "Bar" - } - } - } - ] - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 19, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js deleted file mode 100644 index 1de1663afee2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter-underscore.result.js +++ /dev/null @@ -1,242 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "__P", - "constraint": null - } - ] - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 13, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "__P", - "range": [ - 8, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js deleted file mode 100644 index d7bee944cff7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-type-parameter.result.js +++ /dev/null @@ -1,242 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "T", - "constraint": null - } - ] - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 13, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js deleted file mode 100644 index a31dfd9a1724..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-class-with-optional-method.result.js +++ /dev/null @@ -1,393 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 24, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "key": { - "type": "Identifier", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "bar", - "optional": true - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": null, - "range": [ - 28, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 32, - 35 - ], - "typeAnnotation": { - "type": "TSAnyKeyword", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - } - } - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 18, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "declare", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "any", - "range": [ - 32, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js deleted file mode 100644 index efe5741818a1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/declare-function.result.js +++ /dev/null @@ -1,347 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "body": [ - { - "type": "DeclareFunction", - "range": [ - 0, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "id": { - "type": "Identifier", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "name": "foo" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "range": [ - 26, - 32 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 26, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - } - } - ], - "body": null, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "range": [ - 35, - 41 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 35, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "declare", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 8, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 26, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 35, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js deleted file mode 100644 index d0c567253c04..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-generic.result.js +++ /dev/null @@ -1,260 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 15, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "T", - "constraint": null - } - ] - }, - "id": null, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 24, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js deleted file mode 100644 index 837c99f7a05b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-class-with-multiple-generics.result.js +++ /dev/null @@ -1,315 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 15, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 20, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "T", - "constraint": null - }, - { - "type": "TypeParameter", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "name": "U", - "constraint": null - } - ] - }, - "id": null, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 27, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 7, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 15, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "U", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js deleted file mode 100644 index a8d41197ad74..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-generic.result.js +++ /dev/null @@ -1,279 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 7, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "T", - "constraint": null - } - ] - }, - "id": { - "type": "Identifier", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 20, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js deleted file mode 100644 index ae3b317cae75..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-class-with-multiple-generics.result.js +++ /dev/null @@ -1,334 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 7, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 16, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "T", - "constraint": null - }, - { - "type": "TypeParameter", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "U", - "constraint": null - } - ] - }, - "id": { - "type": "Identifier", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 23, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "U", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js deleted file mode 100644 index cc0f111c26d5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-alias-declaration.result.js +++ /dev/null @@ -1,293 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "range": [ - 7, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "kind": "type", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "range": [ - 12, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "TestAlias" - }, - "init": { - "type": "TSUnionType", - "range": [ - 24, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "types": [ - { - "type": "TSStringKeyword", - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "TSNumberKeyword", - "range": [ - 33, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } - } - ] - }, - "range": [ - 12, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] - }, - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "type", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "TestAlias", - "range": [ - 12, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 24, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "|", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 33, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js deleted file mode 100644 index 1aea65ba4e10..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-class-declaration.result.js +++ /dev/null @@ -1,371 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "range": [ - 7, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "kind": "type", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "range": [ - 12, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "TestClassProps" - }, - "init": { - "type": "TSTypeLiteral", - "range": [ - 29, - 50 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "members": [ - { - "type": "TSPropertySignature", - "range": [ - 35, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 35, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "name": "count" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "range": [ - 42, - 48 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 42, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ] - }, - "range": [ - 12, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 3, - "column": 2 - } - } - } - ] - }, - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "type", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "TestClassProps", - "range": [ - 12, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "count", - "range": [ - 35, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 42, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js deleted file mode 100644 index cbae7e5b8ad1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-type-function-declaration.result.js +++ /dev/null @@ -1,418 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "range": [ - 7, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "kind": "type", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "range": [ - 12, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "TestCallback" - }, - "init": { - "type": "TSFunctionType", - "range": [ - 27, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "typeParameters": null, - "parameters": [ - { - "type": "Identifier", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "a", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 31, - 37 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 31, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "range": [ - 42, - 46 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 42, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 46 - } - } - } - } - }, - "range": [ - 12, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 47 - } - } - } - ] - }, - "range": [ - 0, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 47 - } - }, - "specifiers": [], - "source": null - } - ], - "sourceType": "module", - "tokens": [ - { - "type": "Keyword", - "value": "export", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "type", - "range": [ - 7, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "TestCallback", - "range": [ - 12, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 31, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 39, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 42, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js deleted file mode 100644 index a4f575c241bf..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-await.result.js +++ /dev/null @@ -1,349 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "hope" - }, - "generator": false, - "expression": false, - "async": true, - "params": [ - { - "type": "Identifier", - "range": [ - 20, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "future" - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 28, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 34, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "expression": { - "type": "AwaitExpression", - "range": [ - 34, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 40, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "name": "future" - } - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "async", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 6, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "hope", - "range": [ - 15, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "future", - "range": [ - 20, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "await", - "range": [ - 34, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "future", - "range": [ - 40, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js deleted file mode 100644 index 71cb2fa4b2dc..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-with-optional-properties.result.js +++ /dev/null @@ -1,746 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "foo" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "range": [ - 13, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "bar" - }, - "value": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "bar" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - }, - { - "type": "Property", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "key": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "baz" - }, - "value": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "baz" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "range": [ - 25, - 45 - ], - "typeAnnotation": { - "type": "TSTypeLiteral", - "range": [ - 25, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 45 - } - }, - "members": [ - { - "type": "TSPropertySignature", - "range": [ - 26, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "optional": true, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "bar" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 32, - 38 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 40, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "optional": true, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 40, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "name": "baz" - }, - "typeAnnotation": null, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ] - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 47, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 38 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 40, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 40 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 47 - }, - "end": { - "line": 1, - "column": 48 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js deleted file mode 100644 index 07e565ffe5c1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-object-type-without-annotation.result.js +++ /dev/null @@ -1,710 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "foo" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "range": [ - 13, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "key": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "bar" - }, - "value": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "bar" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - }, - { - "type": "Property", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "key": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "baz" - }, - "value": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "baz" - }, - "computed": false, - "method": false, - "shorthand": true, - "kind": "init" - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "range": [ - 25, - 43 - ], - "typeAnnotation": { - "type": "TSTypeLiteral", - "range": [ - 25, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "members": [ - { - "type": "TSPropertySignature", - "range": [ - 26, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "bar" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "range": [ - 31, - 37 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 31, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 39, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 39, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "name": "baz" - }, - "typeAnnotation": null, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ] - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 45, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 31, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 39, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 45 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js deleted file mode 100644 index 6b925ea897a2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-that-have-comments.result.js +++ /dev/null @@ -1,279 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "compare" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 33, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "body": [] - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 16, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "T", - "constraint": null - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "compare", - "range": [ - 9, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js deleted file mode 100644 index 1e7df8cc0750..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters-with-constraint.result.js +++ /dev/null @@ -1,670 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "b", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 28, - 29 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "X" - } - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 34, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 40, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "b" - } - } - ] - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 32, - 33 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "name": "X" - } - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 10, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 11, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "name": "X", - "constraint": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 21, - 23 - ], - "typeAnnotation": { - "type": "TSTypeLiteral", - "range": [ - 21, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "members": [] - } - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 13, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 40, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js deleted file mode 100644 index 1eb54056a311..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-type-parameters.result.js +++ /dev/null @@ -1,582 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "a" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "b", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "range": [ - 17, - 18 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "name": "X" - } - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 23, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 29, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "b" - } - } - ] - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "range": [ - 21, - 22 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "X" - } - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "X", - "constraint": null - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "X", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 29, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js deleted file mode 100644 index f6383aff9e62..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types-assignation.result.js +++ /dev/null @@ -1,935 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 96 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 96 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "message" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "name", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 22, - 28 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - } - }, - { - "type": "AssignmentPattern", - "range": [ - 30, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "range": [ - 30, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "name": "age", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "range": [ - 34, - 40 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 34, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - } - } - } - }, - "right": { - "type": "Literal", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - } - }, - "value": 100, - "raw": "100" - } - }, - { - "type": "RestElement", - "range": [ - 48, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 69 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 51, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 55 - } - }, - "name": "args", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 69 - } - }, - "range": [ - 56, - 69 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 56, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 69 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 61 - } - }, - "name": "Array" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 61, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 69 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 68 - } - }, - "id": { - "type": "TSStringKeyword", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 68 - } - } - }, - "typeParameters": null - } - ] - } - } - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 78, - 96 - ], - "loc": { - "start": { - "line": 1, - "column": 78 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 82, - 94 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 89, - 93 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "name": "name" - } - } - ] - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 71 - }, - "end": { - "line": 1, - "column": 77 - } - }, - "range": [ - 71, - 77 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 1, - "column": 71 - }, - "end": { - "line": 1, - "column": 77 - } - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "message", - "range": [ - 9, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "age", - "range": [ - 30, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 34, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "Numeric", - "value": "100", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 46 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, - "column": 47 - } - } - }, - { - "type": "Punctuator", - "value": "...", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 51 - } - } - }, - { - "type": "Identifier", - "value": "args", - "range": [ - 51, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 51 - }, - "end": { - "line": 1, - "column": 55 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 55 - }, - "end": { - "line": 1, - "column": 56 - } - } - }, - { - "type": "Identifier", - "value": "Array", - "range": [ - 56, - 61 - ], - "loc": { - "start": { - "line": 1, - "column": 56 - }, - "end": { - "line": 1, - "column": 61 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 1, - "column": 61 - }, - "end": { - "line": 1, - "column": 62 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 1, - "column": 62 - }, - "end": { - "line": 1, - "column": 68 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 1, - "column": 68 - }, - "end": { - "line": 1, - "column": 69 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 1, - "column": 69 - }, - "end": { - "line": 1, - "column": 70 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 1, - "column": 70 - }, - "end": { - "line": 1, - "column": 71 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 71, - 77 - ], - "loc": { - "start": { - "line": 1, - "column": 71 - }, - "end": { - "line": 1, - "column": 77 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 1, - "column": 78 - }, - "end": { - "line": 1, - "column": 79 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 89, - 93 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 93, - 94 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js deleted file mode 100644 index bccbe7bef3fb..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/function-with-types.result.js +++ /dev/null @@ -1,454 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 57 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 57 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "message" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "name", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 22, - 28 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 37, - 57 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 43, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "argument": { - "type": "Identifier", - "range": [ - 50, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "name": "name" - } - } - ] - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - }, - "range": [ - 30, - 36 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "message", - "range": [ - 9, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 43, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 50, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js deleted file mode 100644 index 0ea4e1e2e8b8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends-multiple.result.js +++ /dev/null @@ -1,292 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 30, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Foo" - }, - "heritage": [ - { - "type": "TSInterfaceHeritage", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 22, - 25 - ], - "id": { - "type": "Identifier", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "name": "Bar" - } - }, - { - "type": "TSInterfaceHeritage", - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "range": [ - 26, - 29 - ], - "id": { - "type": "Identifier", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "name": "Baz" - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "Baz", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js deleted file mode 100644 index b89896899d28..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-extends.result.js +++ /dev/null @@ -1,221 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 26, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Foo" - }, - "heritage": [ - { - "type": "TSInterfaceHeritage", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "range": [ - 22, - 25 - ], - "id": { - "type": "Identifier", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "name": "Bar" - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 22, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js deleted file mode 100644 index fd51c55b8040..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-type-parameters.result.js +++ /dev/null @@ -1,241 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "T", - "constraint": null - } - ] - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 17, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Foo" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js deleted file mode 100644 index 72601f01d7ed..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-all-property-types.result.js +++ /dev/null @@ -1,3338 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 295 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 295 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "TSPropertySignature", - "range": [ - 20, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "baa" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 25, - 31 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 37, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 17 - } - }, - "optional": true, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 37, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "name": "bar" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "range": [ - 43, - 49 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 43, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 55, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 18 - } - }, - "optional": false, - "computed": true, - "key": { - "type": "Identifier", - "range": [ - 56, - 59 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - }, - "name": "bax" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 17 - } - }, - "range": [ - 62, - 68 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 17 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 74, - 89 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 19 - } - }, - "optional": true, - "computed": true, - "key": { - "type": "Identifier", - "range": [ - 75, - 78 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 8 - } - }, - "name": "baz" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 18 - } - }, - "range": [ - 82, - 88 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 18 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSIndexSignature", - "range": [ - 94, - 116 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 26 - } - }, - "index": { - "type": "Identifier", - "range": [ - 95, - 98 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - }, - "name": "eee", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 16 - } - }, - "range": [ - 100, - 106 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 100, - 106 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 16 - } - } - } - } - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 25 - } - }, - "range": [ - 109, - 115 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 109, - 115 - ], - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 25 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSIndexSignature", - "range": [ - 121, - 144 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 27 - } - }, - "index": { - "type": "Identifier", - "range": [ - 122, - 125 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - }, - "name": "fff", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 17 - } - }, - "range": [ - 128, - 134 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 128, - 134 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 17 - } - } - } - }, - "optional": true - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 26 - } - }, - "range": [ - 137, - 143 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 137, - 143 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 26 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 149, - 161 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 16 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 149, - 152 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - }, - "name": "doo" - }, - "params": [], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 15 - } - }, - "range": [ - 156, - 160 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 156, - 160 - ], - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 15 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 166, - 186 - ], - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 24 - } - }, - "optional": true, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 166, - 169 - ], - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 7 - } - }, - "name": "doo" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 171, - 172 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - }, - "name": "a" - }, - { - "type": "Identifier", - "range": [ - 174, - 175 - ], - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - }, - "name": "b" - }, - { - "type": "Identifier", - "range": [ - 177, - 178 - ], - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 16 - } - }, - "name": "c" - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 23 - } - }, - "range": [ - 181, - 185 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 181, - 185 - ], - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 23 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 191, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 26 - } - }, - "optional": true, - "computed": true, - "key": { - "type": "Identifier", - "range": [ - 192, - 195 - ], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 8 - } - }, - "name": "loo" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 198, - 199 - ], - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 12 - } - }, - "name": "a" - }, - { - "type": "Identifier", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 15 - } - }, - "name": "b" - }, - { - "type": "Identifier", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 18 - } - }, - "name": "c" - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 10, - "column": 21 - }, - "end": { - "line": 10, - "column": 25 - } - }, - "range": [ - 208, - 212 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 208, - 212 - ], - "loc": { - "start": { - "line": 10, - "column": 21 - }, - "end": { - "line": 10, - "column": 25 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 218, - 240 - ], - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 26 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 218, - 221 - ], - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 7 - } - }, - "name": "boo" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 225, - 226 - ], - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 12 - } - }, - "name": "a" - }, - { - "type": "Identifier", - "range": [ - 228, - 229 - ], - "loc": { - "start": { - "line": 11, - "column": 14 - }, - "end": { - "line": 11, - "column": 15 - } - }, - "name": "b" - }, - { - "type": "Identifier", - "range": [ - 231, - 232 - ], - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 18 - } - }, - "name": "c" - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 25 - } - }, - "range": [ - 235, - 239 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 235, - 239 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 25 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 221, - 224 - ], - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 10 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 222, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 9 - } - }, - "name": "J", - "constraint": null - } - ] - } - }, - { - "type": "TSConstructSignature", - "range": [ - 245, - 265 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 24 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 250, - 251 - ], - "loc": { - "start": { - "line": 12, - "column": 9 - }, - "end": { - "line": 12, - "column": 10 - } - }, - "name": "a" - }, - { - "type": "Identifier", - "range": [ - 253, - 254 - ], - "loc": { - "start": { - "line": 12, - "column": 12 - }, - "end": { - "line": 12, - "column": 13 - } - }, - "name": "b", - "optional": true - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 23 - } - }, - "range": [ - 258, - 264 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 258, - 264 - ], - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 23 - } - } - } - } - }, - { - "type": "TSConstructSignature", - "range": [ - 270, - 293 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 27 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 278, - 279 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 13 - } - }, - "name": "a" - }, - { - "type": "Identifier", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 13, - "column": 16 - } - }, - "name": "b", - "optional": true - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 26 - } - }, - "range": [ - 286, - 292 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 286, - 292 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 26 - } - } - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 274, - 277 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 11 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 275, - 276 - ], - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 10 - } - }, - "name": "F", - "constraint": null - } - ] - } - } - ], - "range": [ - 14, - 295 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 14, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Foo" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "baa", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 37, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 43, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "bax", - "range": [ - 56, - 59 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 62, - 68 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 75, - 78 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 82, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 88, - 89 - ], - "loc": { - "start": { - "line": 5, - "column": 18 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "eee", - "range": [ - 95, - 98 - ], - "loc": { - "start": { - "line": 6, - "column": 5 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 100, - 106 - ], - "loc": { - "start": { - "line": 6, - "column": 10 - }, - "end": { - "line": 6, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 106, - 107 - ], - "loc": { - "start": { - "line": 6, - "column": 16 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 107, - 108 - ], - "loc": { - "start": { - "line": 6, - "column": 17 - }, - "end": { - "line": 6, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 109, - 115 - ], - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 115, - 116 - ], - "loc": { - "start": { - "line": 6, - "column": 25 - }, - "end": { - "line": 6, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 121, - 122 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "fff", - "range": [ - 122, - 125 - ], - "loc": { - "start": { - "line": 7, - "column": 5 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 125, - 126 - ], - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 126, - 127 - ], - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 128, - 134 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 134, - 135 - ], - "loc": { - "start": { - "line": 7, - "column": 17 - }, - "end": { - "line": 7, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 135, - 136 - ], - "loc": { - "start": { - "line": 7, - "column": 18 - }, - "end": { - "line": 7, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 137, - 143 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 143, - 144 - ], - "loc": { - "start": { - "line": 7, - "column": 26 - }, - "end": { - "line": 7, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "doo", - "range": [ - 149, - 152 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 152, - 153 - ], - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 153, - 154 - ], - "loc": { - "start": { - "line": 8, - "column": 8 - }, - "end": { - "line": 8, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 154, - 155 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 10 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 156, - 160 - ], - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 160, - 161 - ], - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "doo", - "range": [ - 166, - 169 - ], - "loc": { - "start": { - "line": 9, - "column": 4 - }, - "end": { - "line": 9, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 169, - 170 - ], - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 170, - 171 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 171, - 172 - ], - "loc": { - "start": { - "line": 9, - "column": 9 - }, - "end": { - "line": 9, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 172, - 173 - ], - "loc": { - "start": { - "line": 9, - "column": 10 - }, - "end": { - "line": 9, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 174, - 175 - ], - "loc": { - "start": { - "line": 9, - "column": 12 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 175, - 176 - ], - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 177, - 178 - ], - "loc": { - "start": { - "line": 9, - "column": 15 - }, - "end": { - "line": 9, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 178, - 179 - ], - "loc": { - "start": { - "line": 9, - "column": 16 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 179, - 180 - ], - "loc": { - "start": { - "line": 9, - "column": 17 - }, - "end": { - "line": 9, - "column": 18 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 181, - 185 - ], - "loc": { - "start": { - "line": 9, - "column": 19 - }, - "end": { - "line": 9, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 185, - 186 - ], - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 191, - 192 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "loo", - "range": [ - 192, - 195 - ], - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 195, - 196 - ], - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 196, - 197 - ], - "loc": { - "start": { - "line": 10, - "column": 9 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 197, - 198 - ], - "loc": { - "start": { - "line": 10, - "column": 10 - }, - "end": { - "line": 10, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 198, - 199 - ], - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 199, - 200 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 204, - 205 - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 205, - 206 - ], - "loc": { - "start": { - "line": 10, - "column": 18 - }, - "end": { - "line": 10, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 206, - 207 - ], - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 208, - 212 - ], - "loc": { - "start": { - "line": 10, - "column": 21 - }, - "end": { - "line": 10, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 212, - 213 - ], - "loc": { - "start": { - "line": 10, - "column": 25 - }, - "end": { - "line": 10, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "boo", - "range": [ - 218, - 221 - ], - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 221, - 222 - ], - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "J", - "range": [ - 222, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 223, - 224 - ], - "loc": { - "start": { - "line": 11, - "column": 9 - }, - "end": { - "line": 11, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 224, - 225 - ], - "loc": { - "start": { - "line": 11, - "column": 10 - }, - "end": { - "line": 11, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 225, - 226 - ], - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 226, - 227 - ], - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 228, - 229 - ], - "loc": { - "start": { - "line": 11, - "column": 14 - }, - "end": { - "line": 11, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 229, - 230 - ], - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 231, - 232 - ], - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 232, - 233 - ], - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 233, - 234 - ], - "loc": { - "start": { - "line": 11, - "column": 19 - }, - "end": { - "line": 11, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 235, - 239 - ], - "loc": { - "start": { - "line": 11, - "column": 21 - }, - "end": { - "line": 11, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 239, - 240 - ], - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 26 - } - } - }, - { - "type": "Keyword", - "value": "new", - "range": [ - 245, - 248 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 249, - 250 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 250, - 251 - ], - "loc": { - "start": { - "line": 12, - "column": 9 - }, - "end": { - "line": 12, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 251, - 252 - ], - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 253, - 254 - ], - "loc": { - "start": { - "line": 12, - "column": 12 - }, - "end": { - "line": 12, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 254, - 255 - ], - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 255, - 256 - ], - "loc": { - "start": { - "line": 12, - "column": 14 - }, - "end": { - "line": 12, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 256, - 257 - ], - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 258, - 264 - ], - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 264, - 265 - ], - "loc": { - "start": { - "line": 12, - "column": 23 - }, - "end": { - "line": 12, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "new", - "range": [ - 270, - 273 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 274, - 275 - ], - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "F", - "range": [ - 275, - 276 - ], - "loc": { - "start": { - "line": 13, - "column": 9 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 276, - 277 - ], - "loc": { - "start": { - "line": 13, - "column": 10 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 277, - 278 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 278, - 279 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 279, - 280 - ], - "loc": { - "start": { - "line": 13, - "column": 13 - }, - "end": { - "line": 13, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 281, - 282 - ], - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 282, - 283 - ], - "loc": { - "start": { - "line": 13, - "column": 16 - }, - "end": { - "line": 13, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 283, - 284 - ], - "loc": { - "start": { - "line": 13, - "column": 17 - }, - "end": { - "line": 13, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 284, - 285 - ], - "loc": { - "start": { - "line": 13, - "column": 18 - }, - "end": { - "line": 13, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 286, - 292 - ], - "loc": { - "start": { - "line": 13, - "column": 20 - }, - "end": { - "line": 13, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 292, - 293 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 294, - 295 - ], - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 14, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js deleted file mode 100644 index 4fb6325935f9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.result.js +++ /dev/null @@ -1,410 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "TSConstructSignature", - "range": [ - 21, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 30 - } - }, - "params": [ - { - "type": "TSParameterProperty", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "accessibility": "public", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "x" - } - }, - { - "type": "TSParameterProperty", - "range": [ - 36, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 28 - } - }, - "accessibility": "private", - "readonly": false, - "static": false, - "export": false, - "parameter": { - "type": "Identifier", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - }, - "name": "y" - } - } - ], - "typeAnnotation": null - } - ], - "range": [ - 15, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "Test" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Test", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "new", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 26, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 36, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 29 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js deleted file mode 100644 index 6f098834322c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-extends-type-parameters.result.js +++ /dev/null @@ -1,422 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 13, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "T", - "constraint": null - } - ] - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 32, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Foo" - }, - "heritage": [ - { - "type": "TSInterfaceHeritage", - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "range": [ - 25, - 28 - ], - "id": { - "type": "Identifier", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "name": "Bar" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 28, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "id": { - "type": "Identifier", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "name": "J" - }, - "typeParameters": null - } - ] - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 17, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "J", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js deleted file mode 100644 index ab72816c2983..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-generic.result.js +++ /dev/null @@ -1,241 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - }, - "name": "T", - "constraint": null - } - ] - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 2, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "Test" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Test", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js deleted file mode 100644 index 140dbae83120..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-jsdoc.result.js +++ /dev/null @@ -1,680 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 87 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 87 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "TSMethodSignature", - "range": [ - 76, - 85 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 13 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 76, - 79 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - }, - "name": "foo" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 80, - 83 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 11 - } - }, - "name": "bar" - } - ], - "typeAnnotation": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ], - "range": [ - 15, - 87 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 7, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "Test" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Test", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 76, - 22 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 30, - 25 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 0 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 30, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 32, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "Comment", - "range": [ - 32, - 39 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 40, - 40 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "Line", - "range": [ - 40, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 45, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "1", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 52, - 47 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 0 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 52, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "Identifier", - "value": "", - "range": [ - 54, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 55, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 59, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "*", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "/", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 5, - "column": 6 - }, - "end": { - "line": 5, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 76, - 79 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 80, - 83 - ], - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 84, - 85 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 86, - 87 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js deleted file mode 100644 index 5af78ee6053c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-with-optional-properties.result.js +++ /dev/null @@ -1,799 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 81 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 81 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "TSPropertySignature", - "range": [ - 21, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "optional": true, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "typeAnnotation": null, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 31, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 17 - } - }, - "optional": true, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 31, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - }, - "name": "bar" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "range": [ - 37, - 43 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 49, - 79 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 34 - } - }, - "optional": true, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 49, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - } - }, - "name": "baz" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "name": "foo" - }, - { - "type": "Identifier", - "range": [ - 59, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 17 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 26 - } - }, - "range": [ - 65, - 71 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 65, - 71 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 26 - } - } - } - }, - "optional": true - }, - { - "type": "Identifier", - "range": [ - 73, - 76 - ], - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "name": "baz", - "optional": true - } - ], - "typeAnnotation": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ], - "range": [ - 15, - 81 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "test" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "test", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 31, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 37, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 49, - 52 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 54, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 59, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 65, - 71 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 71, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 73, - 76 - ], - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 76, - 77 - ], - "loc": { - "start": { - "line": 4, - "column": 31 - }, - "end": { - "line": 4, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 77, - 78 - ], - "loc": { - "start": { - "line": 4, - "column": 32 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 78, - 79 - ], - "loc": { - "start": { - "line": 4, - "column": 33 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js deleted file mode 100644 index e307ccc38dcd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/interface-without-type-annotation.result.js +++ /dev/null @@ -1,229 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "TSPropertySignature", - "range": [ - 21, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "foo" - }, - "typeAnnotation": null, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ], - "range": [ - 15, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "test" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "test", - "range": [ - 10, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js deleted file mode 100644 index 8d9cd85d32e1..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/nested-type-arguments.result.js +++ /dev/null @@ -1,526 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 4, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "id": { - "type": "Identifier", - "range": [ - 4, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "nestedArray", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "range": [ - 17, - 44 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 17, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 17, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "Array" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 22, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 44 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 23, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "id": { - "type": "Identifier", - "range": [ - 23, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "name": "Array" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 28, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 43 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 29, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "id": { - "type": "Identifier", - "range": [ - 29, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "name": "Array" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 34, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 42 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 35, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - }, - "id": { - "type": "TSStringKeyword", - "range": [ - 35, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - "typeParameters": null - } - ] - } - } - ] - } - } - ] - } - } - } - }, - "init": null - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "nestedArray", - "range": [ - 4, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "Array", - "range": [ - 17, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "Array", - "range": [ - 23, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "Array", - "range": [ - 29, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 34 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 35, - 41 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 1, - "column": 42 - }, - "end": { - "line": 1, - "column": 43 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 1, - "column": 43 - }, - "end": { - "line": 1, - "column": 44 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js deleted file mode 100644 index 1655eddaf037..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/non-null-assertion-operator.result.js +++ /dev/null @@ -1,764 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 82 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 82 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - }, - "name": "processEntity" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "e", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "range": [ - 27, - 33 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 27, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 27, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "name": "Entity" - } - } - }, - "optional": true - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 35, - 82 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 41, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 41, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 41, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "name": "validateEntity" - }, - "arguments": [ - { - "type": "Identifier", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "name": "e" - } - ] - } - }, - { - "type": "VariableDeclaration", - "range": [ - 64, - 80 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 68, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "id": { - "type": "Identifier", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "name": "s" - }, - "init": { - "type": "MemberExpression", - "range": [ - 72, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "object": { - "type": "TSNonNullExpression", - "range": [ - 72, - 74 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "name": "e" - } - }, - "property": { - "type": "Identifier", - "range": [ - 75, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "name": "name" - }, - "computed": false - } - } - ], - "kind": "let" - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "processEntity", - "range": [ - 9, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Identifier", - "value": "e", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "?", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "Entity", - "range": [ - 27, - 33 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "validateEntity", - "range": [ - 41, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "e", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "let", - "range": [ - 64, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "s", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "e", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "!", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 75, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js deleted file mode 100644 index 062b16c62ed7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration-with-constrained-type-parameter.result.js +++ /dev/null @@ -1,563 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "kind": "type", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "range": [ - 5, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "Result" - }, - "init": { - "type": "TSUnionType", - "range": [ - 28, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "types": [ - { - "type": "TSTypeReference", - "range": [ - 28, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - }, - "name": "Success" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 35, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "id": { - "type": "Identifier", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "name": "T" - }, - "typeParameters": null - } - ] - } - }, - { - "type": "TSTypeReference", - "range": [ - 41, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 41, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "name": "Failure" - } - } - ] - }, - "range": [ - 5, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 48 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 11, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 12, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "T", - "constraint": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 22, - 24 - ], - "typeAnnotation": { - "type": "TSTypeLiteral", - "range": [ - 22, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "members": [] - } - } - } - ] - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "type", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "Result", - "range": [ - 5, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "Success", - "range": [ - 28, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 35 - }, - "end": { - "line": 1, - "column": 36 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 36 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "|", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Identifier", - "value": "Failure", - "range": [ - 41, - 48 - ], - "loc": { - "start": { - "line": 1, - "column": 41 - }, - "end": { - "line": 1, - "column": 48 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js deleted file mode 100644 index 53891226c4a0..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-declaration.result.js +++ /dev/null @@ -1,475 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "kind": "type", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "range": [ - 5, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "Result" - }, - "init": { - "type": "TSUnionType", - "range": [ - 17, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "types": [ - { - "type": "TSTypeReference", - "range": [ - 17, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 17, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "name": "Success" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 24, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "id": { - "type": "Identifier", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "name": "T" - }, - "typeParameters": null - } - ] - } - }, - { - "type": "TSTypeReference", - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "name": "Failure" - } - } - ] - }, - "range": [ - 5, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "typeParameters": { - "type": "TypeParameterDeclaration", - "range": [ - 11, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "params": [ - { - "type": "TypeParameter", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "T", - "constraint": null - } - ] - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "type", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "Result", - "range": [ - 5, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "Success", - "range": [ - 17, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "T", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "|", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "Failure", - "range": [ - 30, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 37 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js deleted file mode 100644 index 986ef4578e50..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-alias-object-without-annotation.result.js +++ /dev/null @@ -1,413 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 30 - } - }, - "kind": "type", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "foo" - }, - "init": { - "type": "TSTypeLiteral", - "range": [ - 11, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "members": [ - { - "type": "TSPropertySignature", - "range": [ - 12, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "bar" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - }, - "range": [ - 17, - 23 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 17, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "name": "baz" - }, - "typeAnnotation": null, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ] - }, - "range": [ - 5, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "type", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 5, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 12, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 17, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js deleted file mode 100644 index 9f7066551998..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-guard.result.js +++ /dev/null @@ -1,634 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 75 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "FunctionDeclaration", - "range": [ - 0, - 75 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "isString" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "x", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - }, - "range": [ - 21, - 24 - ], - "typeAnnotation": { - "type": "TSAnyKeyword", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - } - } - } - ], - "body": { - "type": "BlockStatement", - "range": [ - 39, - 75 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 45, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "argument": { - "type": "BinaryExpression", - "range": [ - 52, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "operator": "===", - "left": { - "type": "UnaryExpression", - "range": [ - 52, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "operator": "typeof", - "prefix": true, - "argument": { - "type": "Identifier", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "x" - } - }, - "right": { - "type": "Literal", - "range": [ - 65, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "value": "string", - "raw": "'string'" - } - } - } - ] - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 27, - 38 - ], - "typeAnnotation": { - "type": "TSTypePredicate", - "range": [ - 27, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "parameterName": { - "type": "Identifier", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "name": "x" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "range": [ - 32, - 38 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } - } - } - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "function", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "isString", - "range": [ - 9, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "any", - "range": [ - 21, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "is", - "range": [ - 29, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 45, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Keyword", - "value": "typeof", - "range": [ - 52, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "===", - "range": [ - 61, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "String", - "value": "'string'", - "range": [ - 65, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js deleted file mode 100644 index 2b8a61ba4989..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/typed-this.result.js +++ /dev/null @@ -1,780 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 89 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 89 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "TSMethodSignature", - "range": [ - 23, - 87 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 65 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 23, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "addClickListener" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 40, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "onclick", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 57 - } - }, - "range": [ - 49, - 79 - ], - "typeAnnotation": { - "type": "TSFunctionType", - "range": [ - 49, - 79 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 57 - } - }, - "typeParameters": null, - "parameters": [ - { - "type": "Identifier", - "range": [ - 50, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "name": "this", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "range": [ - 56, - 60 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 56, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 38 - } - } - } - } - }, - { - "type": "Identifier", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 2, - "column": 41 - } - }, - "name": "e", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 48 - } - }, - "range": [ - 65, - 70 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 65, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 48 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 65, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 48 - } - }, - "name": "Event" - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 57 - } - }, - "range": [ - 75, - 79 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 75, - 79 - ], - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 57 - } - } - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 60 - }, - "end": { - "line": 2, - "column": 64 - } - }, - "range": [ - 82, - 86 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 82, - 86 - ], - "loc": { - "start": { - "line": 2, - "column": 60 - }, - "end": { - "line": 2, - "column": 64 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - } - ], - "range": [ - 20, - 89 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "UIElement" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "UIElement", - "range": [ - 10, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "addClickListener", - "range": [ - 23, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "onclick", - "range": [ - 40, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 50, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 56, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 38 - }, - "end": { - "line": 2, - "column": 39 - } - } - }, - { - "type": "Identifier", - "value": "e", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 40 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 42 - } - } - }, - { - "type": "Identifier", - "value": "Event", - "range": [ - 65, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 48 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 70, - 71 - ], - "loc": { - "start": { - "line": 2, - "column": 48 - }, - "end": { - "line": 2, - "column": 49 - } - } - }, - { - "type": "Punctuator", - "value": "=>", - "range": [ - 72, - 74 - ], - "loc": { - "start": { - "line": 2, - "column": 50 - }, - "end": { - "line": 2, - "column": 52 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 75, - 79 - ], - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 57 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 2, - "column": 57 - }, - "end": { - "line": 2, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 2, - "column": 58 - }, - "end": { - "line": 2, - "column": 59 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 82, - 86 - ], - "loc": { - "start": { - "line": 2, - "column": 60 - }, - "end": { - "line": 2, - "column": 64 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 86, - 87 - ], - "loc": { - "start": { - "line": 2, - "column": 64 - }, - "end": { - "line": 2, - "column": 65 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 88, - 89 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js deleted file mode 100644 index 64bb25a08c3a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-dotted-type.result.js +++ /dev/null @@ -1,362 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 4, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "id": { - "type": "Identifier", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "foo", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "range": [ - 9, - 14 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "typeName": { - "type": "TSQualifiedName", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "left": { - "type": "TSQualifiedName", - "range": [ - 9, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "left": { - "type": "Identifier", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "A" - }, - "right": { - "type": "Identifier", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "B" - } - }, - "right": { - "type": "Identifier", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "C" - } - } - } - } - }, - "init": null - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 4, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 9, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "B", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js deleted file mode 100644 index 5c3b66e19638..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.result.js +++ /dev/null @@ -1,256 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 4, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "id": { - "type": "Identifier", - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "name": "name", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "range": [ - 9, - 15 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - } - } - }, - "init": { - "type": "Literal", - "range": [ - 18, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "value": "Nicholas", - "raw": "\"Nicholas\"" - } - } - ], - "kind": "var" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "var", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 4, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 9, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "String", - "value": "\"Nicholas\"", - "range": [ - 18, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js deleted file mode 100644 index 64514375e7e7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.result.js +++ /dev/null @@ -1,664 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 72 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 72 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "Point" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 18, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "key": { - "type": "Identifier", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "name": "x" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 51, - 70 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 53, - 68 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 29 - } - }, - "argument": { - "type": "MemberExpression", - "range": [ - 60, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "object": { - "type": "ThisExpression", - "range": [ - 60, - 64 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - "property": { - "type": "Identifier", - "range": [ - 65, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "name": "_x" - }, - "computed": false - } - } - ] - }, - "range": [ - 48, - 70 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "get", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 18, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 19, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "configurable" - }, - "arguments": [ - { - "type": "Literal", - "range": [ - 32, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "value": false, - "raw": "false" - } - ] - } - } - ] - } - ], - "range": [ - 12, - 72 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Point", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "configurable", - "range": [ - 19, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 32, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 43, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 53, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 60, - 64 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "_x", - "range": [ - 65, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 67, - 68 - ], - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 71, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js deleted file mode 100644 index f70c4444ba7a..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.result.js +++ /dev/null @@ -1,812 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 82 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 82 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "Other" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 18, - 80 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 42 - } - }, - "key": { - "type": "Identifier", - "range": [ - 53, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "name": "bar" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 59, - 80 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 42 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 61, - 78 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 40 - } - }, - "argument": { - "type": "MemberExpression", - "range": [ - 68, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 39 - } - }, - "object": { - "type": "ThisExpression", - "range": [ - 68, - 72 - ], - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - "property": { - "type": "Identifier", - "range": [ - 73, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 39 - } - }, - "name": "_bar" - }, - "computed": false - } - } - ] - }, - "range": [ - 56, - 80 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 42 - } - }, - "params": [] - }, - "computed": false, - "static": true, - "kind": "get", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 18, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 19, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "foo" - }, - "arguments": [ - { - "type": "ObjectExpression", - "range": [ - 23, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 25, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "key": { - "type": "Identifier", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "name": "baz" - }, - "value": { - "type": "Literal", - "range": [ - 30, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "value": true, - "raw": "true" - }, - "computed": false, - "method": false, - "shorthand": false, - "kind": "init" - } - ] - } - ] - } - } - ] - } - ], - "range": [ - 12, - 82 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Other", - "range": [ - 6, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 19, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 25, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Boolean", - "value": "true", - "range": [ - 30, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 42, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 49, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 53, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 61, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 68, - 72 - ], - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 3, - "column": 34 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - { - "type": "Identifier", - "value": "_bar", - "range": [ - 73, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 77, - 78 - ], - "loc": { - "start": { - "line": 3, - "column": 39 - }, - "end": { - "line": 3, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 79, - 80 - ], - "loc": { - "start": { - "line": 3, - "column": 41 - }, - "end": { - "line": 3, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js deleted file mode 100644 index 2ef1aefad54c..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.result.js +++ /dev/null @@ -1,572 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "P" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "key": { - "type": "Identifier", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - }, - "name": "z" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 34, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 36, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 29 - } - }, - "argument": { - "type": "MemberExpression", - "range": [ - 43, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "object": { - "type": "ThisExpression", - "range": [ - 43, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - "property": { - "type": "Identifier", - "range": [ - 48, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "name": "_z" - }, - "computed": false - } - } - ] - }, - "range": [ - 31, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 31 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "get", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 15, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "name": "hidden" - } - } - ] - } - ], - "range": [ - 8, - 55 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "P", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "hidden", - "range": [ - 15, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "get", - "range": [ - 26, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "z", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 3, - "column": 10 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 36, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 43, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 3, - "column": 25 - }, - "end": { - "line": 3, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "_z", - "range": [ - 48, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 30 - }, - "end": { - "line": 3, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 54, - 55 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js deleted file mode 100644 index 3dc323f46609..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/accessor-decorators/accessor-decorator-static-member.result.js +++ /dev/null @@ -1,682 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 78 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 78 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "User" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 17, - 76 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - }, - "name": "y" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 48, - 76 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 58, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 20 - } - }, - "expression": { - "type": "AssignmentExpression", - "range": [ - 58, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 19 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "range": [ - 58, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 15 - } - }, - "object": { - "type": "ThisExpression", - "range": [ - 58, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "range": [ - 63, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 15 - } - }, - "name": "_y" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 19 - } - }, - "name": "a" - } - } - } - ] - }, - "range": [ - 44, - 76 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 5, - "column": 5 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "name": "a", - "decorators": [] - } - ] - }, - "computed": false, - "static": true, - "kind": "set", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 17, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "name": "adminonly" - } - } - ] - } - ], - "range": [ - 11, - 78 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "User", - "range": [ - 6, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "adminonly", - "range": [ - 18, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "set", - "range": [ - 39, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 58, - 62 - ], - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "_y", - "range": [ - 63, - 65 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 68, - 69 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 75, - 76 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 77, - 78 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js deleted file mode 100644 index d1c7b207e7a9..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator-factory.result.js +++ /dev/null @@ -1,462 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 58 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 21 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 58 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "range": [ - 43, - 55 - ], - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 18 - } - }, - "name": "FooComponent" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 56, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [ - { - "type": "Decorator", - "range": [ - 0, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 1, - 36 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 1, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - }, - "name": "Component" - }, - "arguments": [ - { - "type": "ObjectExpression", - "range": [ - 11, - 35 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "properties": [ - { - "type": "Property", - "range": [ - 17, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "key": { - "type": "Identifier", - "range": [ - 17, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "name": "selector" - }, - "value": { - "type": "Literal", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "value": "foo", - "raw": "'foo'" - }, - "computed": false, - "method": false, - "shorthand": false, - "kind": "init" - } - ] - } - ] - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "@", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "Component", - "range": [ - 1, - 10 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 11, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 11 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "selector", - "range": [ - 17, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "String", - "value": "'foo'", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ",", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 34, - 35 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 2 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 37, - 42 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "FooComponent", - "range": [ - 43, - 55 - ], - "loc": { - "start": { - "line": 4, - "column": 6 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 57, - 58 - ], - "loc": { - "start": { - "line": 4, - "column": 20 - }, - "end": { - "line": 4, - "column": 21 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js deleted file mode 100644 index ae8c6fd208f3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/class-decorators/class-decorator.result.js +++ /dev/null @@ -1,222 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "id": { - "type": "Identifier", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "name": "Qux" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [ - { - "type": "Decorator", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "sealed" - } - } - ] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "@", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "sealed", - "range": [ - 1, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 8, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Qux", - "range": [ - 14, - 17 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js deleted file mode 100644 index 4edc70c3c59d..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-instance-member.result.js +++ /dev/null @@ -1,485 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "B" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "key": { - "type": "Identifier", - "range": [ - 35, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "name": "instanceMethod" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 52, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "body": [] - }, - "range": [ - 49, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 15, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 20 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "name": "onlyRead" - }, - "arguments": [ - { - "type": "Literal", - "range": [ - 24, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "value": false, - "raw": "false" - } - ] - } - } - ] - } - ], - "range": [ - 8, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "B", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "onlyRead", - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 24, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "instanceMethod", - "range": [ - 35, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js deleted file mode 100644 index 12b5e6918957..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-factory-static-member.result.js +++ /dev/null @@ -1,503 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "C" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "key": { - "type": "Identifier", - "range": [ - 37, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "name": "staticMethod" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 52, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "body": [] - }, - "range": [ - 49, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "params": [] - }, - "computed": false, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 15, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "Foo" - }, - "arguments": [ - { - "type": "Literal", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "value": false, - "raw": "false" - } - ] - } - } - ] - } - ], - "range": [ - 8, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 19, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 30, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "staticMethod", - "range": [ - 37, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js deleted file mode 100644 index ae988b28bd49..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-instance-member.result.js +++ /dev/null @@ -1,393 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "key": { - "type": "Identifier", - "range": [ - 28, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "name": "instanceMethod" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 45, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "body": [] - }, - "range": [ - 42, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "name": "onlyRead" - } - } - ] - } - ], - "range": [ - 8, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "onlyRead", - "range": [ - 15, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "instanceMethod", - "range": [ - 28, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js deleted file mode 100644 index 1910238b7c15..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/method-decorators/method-decorator-static-member.result.js +++ /dev/null @@ -1,411 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "D" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 14, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "key": { - "type": "Identifier", - "range": [ - 30, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "name": "staticMethod" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 45, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "body": [] - }, - "range": [ - 42, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "params": [] - }, - "computed": false, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "Foo" - } - } - ] - } - ], - "range": [ - 8, - 49 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 4, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "D", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 23, - 29 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "staticMethod", - "range": [ - 30, - 42 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 3, - "column": 23 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 43, - 44 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js deleted file mode 100644 index b3d7dbca4ae7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-constructor.result.js +++ /dev/null @@ -1,896 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 115 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 115 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Service" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 20, - 113 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "name": "constructor", - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - "value": { - "type": "FunctionExpression", - "id": null, - "params": [ - { - "type": "Identifier", - "range": [ - 52, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 42 - } - }, - "name": "config", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 53 - } - }, - "range": [ - 60, - 69 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 60, - 69 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 53 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 60, - 69 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 53 - } - }, - "name": "AppConfig" - } - } - }, - "decorators": [ - { - "type": "Decorator", - "range": [ - 32, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 33, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 33, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "name": "Inject" - }, - "arguments": [ - { - "type": "Identifier", - "range": [ - 40, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "name": "APP_CONFIG" - } - ] - } - } - ] - } - ], - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 71, - 113 - ], - "loc": { - "start": { - "line": 2, - "column": 55 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 81, - 107 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 34 - } - }, - "expression": { - "type": "AssignmentExpression", - "range": [ - 81, - 106 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "range": [ - 81, - 91 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "object": { - "type": "ThisExpression", - "range": [ - 81, - 85 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "range": [ - 86, - 91 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 18 - } - }, - "name": "title" - }, - "computed": false - }, - "right": { - "type": "MemberExpression", - "range": [ - 94, - 106 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "range": [ - 94, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 27 - } - }, - "name": "config" - }, - "property": { - "type": "Identifier", - "range": [ - 101, - 106 - ], - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "name": "title" - }, - "computed": false - } - } - } - ] - }, - "range": [ - 31, - 113 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - "computed": false, - "accessibility": null, - "static": false, - "kind": "constructor" - } - ], - "range": [ - 14, - 115 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Service", - "range": [ - 6, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "constructor", - "range": [ - 20, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "Inject", - "range": [ - 33, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "APP_CONFIG", - "range": [ - 40, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Identifier", - "value": "config", - "range": [ - 52, - 58 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - { - "type": "Identifier", - "value": "AppConfig", - "range": [ - 60, - 69 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 53 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 69, - 70 - ], - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 54 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 71, - 72 - ], - "loc": { - "start": { - "line": 2, - "column": 55 - }, - "end": { - "line": 2, - "column": 56 - } - } - }, - { - "type": "Keyword", - "value": "this", - "range": [ - 81, - 85 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 85, - 86 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "title", - "range": [ - 86, - 91 - ], - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 92, - 93 - ], - "loc": { - "start": { - "line": 3, - "column": 19 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "config", - "range": [ - 94, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ".", - "range": [ - 100, - 101 - ], - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "title", - "range": [ - 101, - 106 - ], - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 106, - 107 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 112, - 113 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 114, - 115 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js deleted file mode 100644 index 63803ab73443..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.result.js +++ /dev/null @@ -1,593 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 16, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "key": { - "type": "Identifier", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "bar" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 48, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "body": [] - }, - "range": [ - 19, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 35, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "range": [ - 40, - 46 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 40, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - } - }, - "decorators": [ - { - "type": "Decorator", - "range": [ - 20, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 21, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 21, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "name": "special" - }, - "arguments": [ - { - "type": "Literal", - "range": [ - 29, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "value": true, - "raw": "true" - } - ] - } - } - ] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 10, - 52 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 16, - 19 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "special", - "range": [ - 21, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 28, - 29 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Boolean", - "value": "true", - "range": [ - 29, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 35, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 40, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js deleted file mode 100644 index dcb0c6d37db8..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.result.js +++ /dev/null @@ -1,611 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "StaticFoo" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 22, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "key": { - "type": "Identifier", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "name": "bar" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 61, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "body": [] - }, - "range": [ - 32, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 45 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - }, - "range": [ - 53, - 59 - ], - "typeAnnotation": { - "type": "TSNumberKeyword", - "range": [ - 53, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - }, - "decorators": [ - { - "type": "Decorator", - "range": [ - 33, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 34, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 29 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 34, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "name": "special" - }, - "arguments": [ - { - "type": "Literal", - "range": [ - 42, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 28 - } - }, - "value": true, - "raw": "true" - } - ] - } - } - ] - } - ] - }, - "computed": false, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 16, - 65 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "StaticFoo", - "range": [ - 6, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 22, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "special", - "range": [ - 34, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 41, - 42 - ], - "loc": { - "start": { - "line": 2, - "column": 23 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Boolean", - "value": "true", - "range": [ - 42, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 28 - }, - "end": { - "line": 2, - "column": 29 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 48, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 30 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 53, - 59 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 2, - "column": 43 - }, - "end": { - "line": 2, - "column": 44 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 45 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js deleted file mode 100644 index 12a897c8d2d7..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.result.js +++ /dev/null @@ -1,737 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Greeter" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 20, - 95 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 20, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - }, - "name": "greet" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 50, - 95 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 60, - 89 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 37 - } - }, - "argument": { - "type": "BinaryExpression", - "range": [ - 67, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "operator": "+", - "left": { - "type": "BinaryExpression", - "range": [ - 67, - 82 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "operator": "+", - "left": { - "type": "Literal", - "range": [ - 67, - 75 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "value": "Hello ", - "raw": "\"Hello \"" - }, - "right": { - "type": "Identifier", - "range": [ - 78, - 82 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "name": "name" - } - }, - "right": { - "type": "Literal", - "range": [ - 85, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "value": "!", - "raw": "\"!\"" - } - } - } - ] - }, - "range": [ - 25, - 95 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 36, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "name": "name", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "range": [ - 42, - 48 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 42, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - } - } - }, - "decorators": [ - { - "type": "Decorator", - "range": [ - 26, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 27, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - } - }, - "name": "required" - } - } - ] - } - ] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 14, - 97 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Greeter", - "range": [ - 6, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "greet", - "range": [ - 20, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "required", - "range": [ - 27, - 35 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 36, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 20 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 42, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 26 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 48, - 49 - ], - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 2, - "column": 34 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 60, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "String", - "value": "\"Hello \"", - "range": [ - 67, - 75 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 76, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 78, - 82 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - { - "type": "String", - "value": "\"!\"", - "range": [ - 85, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 88, - 89 - ], - "loc": { - "start": { - "line": 3, - "column": 36 - }, - "end": { - "line": 3, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 94, - 95 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js deleted file mode 100644 index fa9c94fe0750..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/parameter-decorators/parameter-decorator-static-member.result.js +++ /dev/null @@ -1,755 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 110 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 110 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "StaticGreeter" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 26, - 108 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "key": { - "type": "Identifier", - "range": [ - 33, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 16 - } - }, - "name": "greet" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 63, - 108 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "body": [ - { - "type": "ReturnStatement", - "range": [ - 73, - 102 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 37 - } - }, - "argument": { - "type": "BinaryExpression", - "range": [ - 80, - 101 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "operator": "+", - "left": { - "type": "BinaryExpression", - "range": [ - 80, - 95 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "operator": "+", - "left": { - "type": "Literal", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 23 - } - }, - "value": "Hello ", - "raw": "\"Hello \"" - }, - "right": { - "type": "Identifier", - "range": [ - 91, - 95 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 30 - } - }, - "name": "name" - } - }, - "right": { - "type": "Literal", - "range": [ - 98, - 101 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "value": "!", - "raw": "\"!\"" - } - } - } - ] - }, - "range": [ - 38, - 108 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "params": [ - { - "type": "Identifier", - "range": [ - 49, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 31 - } - }, - "name": "name", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 39 - } - }, - "range": [ - 55, - 61 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 39 - } - } - } - }, - "decorators": [ - { - "type": "Decorator", - "range": [ - 39, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 40, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "name": "required" - } - } - ] - } - ] - }, - "computed": false, - "static": true, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 20, - 110 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "StaticGreeter", - "range": [ - 6, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 26, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "greet", - "range": [ - 33, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "required", - "range": [ - 40, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 49, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 55, - 61 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 39 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 61, - 62 - ], - "loc": { - "start": { - "line": 2, - "column": 39 - }, - "end": { - "line": 2, - "column": 40 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 63, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 42 - } - } - }, - { - "type": "Keyword", - "value": "return", - "range": [ - 73, - 79 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "String", - "value": "\"Hello \"", - "range": [ - 80, - 88 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 89, - 90 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "name", - "range": [ - 91, - 95 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 3, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": "+", - "range": [ - 96, - 97 - ], - "loc": { - "start": { - "line": 3, - "column": 31 - }, - "end": { - "line": 3, - "column": 32 - } - } - }, - { - "type": "String", - "value": "\"!\"", - "range": [ - 98, - 101 - ], - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 101, - 102 - ], - "loc": { - "start": { - "line": 3, - "column": 36 - }, - "end": { - "line": 3, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 107, - 108 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js deleted file mode 100644 index e210bea07bb6..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-instance-member.result.js +++ /dev/null @@ -1,684 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 88 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 88 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - }, - "name": "SomeComponent" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 26, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "key": { - "type": "Identifier", - "range": [ - 35, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "data" - }, - "value": null, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 26, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 27, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "name": "Input" - }, - "arguments": [] - } - } - ], - "typeAnnotation": null - }, - { - "type": "ClassProperty", - "range": [ - 45, - 86 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 4, - "column": 31 - } - }, - "key": { - "type": "Identifier", - "range": [ - 59, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 9 - } - }, - "name": "click" - }, - "value": { - "type": "NewExpression", - "range": [ - 67, - 85 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 30 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 71, - 83 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 28 - } - }, - "name": "EventEmitter" - }, - "arguments": [] - }, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 45, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 46, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 13 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 46, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "name": "Output" - }, - "arguments": [] - } - } - ], - "typeAnnotation": null - } - ], - "range": [ - 20, - 88 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "SomeComponent", - "range": [ - 6, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Input", - "range": [ - 27, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "data", - "range": [ - 35, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 39, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 45, - 46 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Output", - "range": [ - 46, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "click", - "range": [ - 59, - 64 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 10 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": "Keyword", - "value": "new", - "range": [ - 67, - 70 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "EventEmitter", - "range": [ - 71, - 83 - ], - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 4, - "column": 28 - }, - "end": { - "line": 4, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 84, - 85 - ], - "loc": { - "start": { - "line": 4, - "column": 29 - }, - "end": { - "line": 4, - "column": 30 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 85, - 86 - ], - "loc": { - "start": { - "line": 4, - "column": 30 - }, - "end": { - "line": 4, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 87, - 88 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js deleted file mode 100644 index bb41d9b136bd..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-factory-static-member.result.js +++ /dev/null @@ -1,671 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 93 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 93 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "A" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 14, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 37 - } - }, - "key": { - "type": "Identifier", - "range": [ - 41, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 36 - } - }, - "name": "prop1" - }, - "value": null, - "computed": false, - "static": true, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 15, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 23 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 15, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "configurable" - }, - "arguments": [ - { - "type": "Literal", - "range": [ - 28, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "value": true, - "raw": "true" - } - ] - } - } - ], - "typeAnnotation": null - }, - { - "type": "ClassProperty", - "range": [ - 53, - 91 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 5, - "column": 17 - } - }, - "key": { - "type": "Identifier", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 16 - } - }, - "name": "prop2" - }, - "value": null, - "computed": false, - "static": true, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 53, - 73 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 54, - 73 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 54, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 17 - } - }, - "name": "configurable" - }, - "arguments": [ - { - "type": "Literal", - "range": [ - 67, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 23 - } - }, - "value": false, - "raw": "false" - } - ] - } - } - ], - "typeAnnotation": null - } - ], - "range": [ - 8, - 93 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "configurable", - "range": [ - 15, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Boolean", - "value": "true", - "range": [ - 28, - 32 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 34, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - { - "type": "Identifier", - "value": "prop1", - "range": [ - 41, - 46 - ], - "loc": { - "start": { - "line": 2, - "column": 31 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 46, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 36 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "configurable", - "range": [ - 54, - 66 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": "Boolean", - "value": "false", - "range": [ - 67, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 78, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "prop2", - "range": [ - 85, - 90 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 90, - 91 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 92, - 93 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js deleted file mode 100644 index f4f9f9ffd1ba..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-instance-member.result.js +++ /dev/null @@ -1,451 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "B" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "key": { - "type": "Identifier", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "name": "x" - }, - "value": null, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "foo" - } - } - ], - "typeAnnotation": null - }, - { - "type": "ClassProperty", - "range": [ - 26, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 4, - "column": 6 - } - }, - "key": { - "type": "Identifier", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "name": "y" - }, - "value": null, - "computed": false, - "static": false, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 26, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "name": "bar" - } - } - ], - "typeAnnotation": null - } - ], - "range": [ - 8, - 39 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "B", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "x", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 27, - 30 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "y", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 4, - "column": 5 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 38, - 39 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js deleted file mode 100644 index 8b161b2af00b..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/decorators/property-decorators/property-decorator-static-member.result.js +++ /dev/null @@ -1,487 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "C" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "ClassProperty", - "range": [ - 14, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 18 - } - }, - "key": { - "type": "Identifier", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - }, - "name": "a" - }, - "value": null, - "computed": false, - "static": true, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 14, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - }, - "name": "baz" - } - } - ], - "typeAnnotation": null - }, - { - "type": "ClassProperty", - "range": [ - 33, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 4, - "column": 13 - } - }, - "key": { - "type": "Identifier", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "name": "b" - }, - "value": null, - "computed": false, - "static": true, - "accessibility": null, - "readonly": false, - "decorators": [ - { - "type": "Decorator", - "range": [ - 33, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 8 - } - }, - "name": "qux" - } - } - ], - "typeAnnotation": null - } - ], - "range": [ - 8, - 53 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 5, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 19, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 26, - 27 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 27, - 28 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "@", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "qux", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 42, - 48 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 49, - 50 - ], - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 52, - 53 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js deleted file mode 100644 index 1c3776e12866..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends-implements.result.js +++ /dev/null @@ -1,204 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 33, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Keyword", - "value": "implements", - "range": [ - 18, - 28 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 29, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js deleted file mode 100644 index cc88e51b9720..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-empty-extends.result.js +++ /dev/null @@ -1,168 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 18, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js deleted file mode 100644 index 2b6254959084..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/class-extends-empty-implements.result.js +++ /dev/null @@ -1,221 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ClassDeclaration", - "range": [ - 0, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "name": "Foo" - }, - "body": { - "type": "ClassBody", - "body": [], - "range": [ - 33, - 37 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "superClass": { - "type": "Identifier", - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "name": "Bar" - }, - "implements": [], - "decorators": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "class", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 6, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 10, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "Bar", - "range": [ - 18, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "implements", - "range": [ - 22, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 33, - 34 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 36, - 37 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js deleted file mode 100644 index 8db1d4d6f5e2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-enum-declaration.result.js +++ /dev/null @@ -1,203 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "body": [ - { - "type": "TSEnumDeclaration", - "range": [ - 0, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "decorators": [ - { - "type": "Decorator", - "range": [ - 0, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "expression": { - "type": "Identifier", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - }, - "name": "dec" - } - } - ], - "name": { - "type": "Identifier", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "name": "E" - }, - "members": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Punctuator", - "value": "@", - "range": [ - 0, - 1 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 1 - } - } - }, - { - "type": "Identifier", - "value": "dec", - "range": [ - 1, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 1 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Keyword", - "value": "enum", - "range": [ - 5, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "E", - "range": [ - 10, - 11 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 12, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js deleted file mode 100644 index 9481511e7f84..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-empty-extends.result.js +++ /dev/null @@ -1,167 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [], - "range": [ - 22, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 3, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Foo" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Keyword", - "value": "extends", - "range": [ - 14, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 22 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 25, - 26 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js deleted file mode 100644 index 96d62353ce35..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/interface-property-modifiers.result.js +++ /dev/null @@ -1,4816 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 594 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 23, - "column": 1 - } - }, - "body": [ - { - "type": "TSInterfaceDeclaration", - "range": [ - 0, - 594 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 23, - "column": 1 - } - }, - "abstract": false, - "body": { - "type": "TSInterfaceBody", - "body": [ - { - "type": "TSPropertySignature", - "range": [ - 20, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - }, - "name": "bar" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - }, - "range": [ - 25, - 31 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - } - }, - "initializer": { - "type": "Literal", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "value": "a", - "raw": "'a'" - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 43, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 21 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "name": "a" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - }, - "range": [ - 53, - 59 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 53, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - } - }, - "initializer": null, - "accessibility": "public", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 65, - 83 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 22 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - }, - "name": "b" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 21 - } - }, - "range": [ - 76, - 82 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 21 - } - } - } - }, - "initializer": null, - "accessibility": "private", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 88, - 108 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 24 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - }, - "name": "c" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 23 - } - }, - "range": [ - 101, - 107 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 101, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 23 - } - } - } - }, - "initializer": null, - "accessibility": "protected", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 113, - 130 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 21 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 120, - 121 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 12 - } - }, - "name": "d" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 20 - } - }, - "range": [ - 123, - 129 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 123, - 129 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 20 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": true, - "export": false - }, - { - "type": "TSPropertySignature", - "range": [ - 135, - 152 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 21 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 142, - 143 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 12 - } - }, - "name": "e" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 20 - } - }, - "range": [ - 145, - 151 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 145, - 151 - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 20 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": false, - "static": false, - "export": true - }, - { - "type": "TSPropertySignature", - "range": [ - 157, - 176 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 23 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 166, - 167 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 14 - } - }, - "name": "f" - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 22 - } - }, - "range": [ - 169, - 175 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 169, - 175 - ], - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 22 - } - } - } - }, - "initializer": null, - "accessibility": null, - "readonly": true, - "static": false, - "export": false - }, - { - "type": "TSIndexSignature", - "range": [ - 182, - 211 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 33 - } - }, - "index": { - "type": "Identifier", - "range": [ - 190, - 193 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 15 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 23 - } - }, - "range": [ - 195, - 201 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 195, - 201 - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 23 - } - } - } - } - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 10, - "column": 26 - }, - "end": { - "line": 10, - "column": 32 - } - }, - "range": [ - 204, - 210 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 204, - 210 - ], - "loc": { - "start": { - "line": 10, - "column": 26 - }, - "end": { - "line": 10, - "column": 32 - } - } - } - }, - "accessibility": "public", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSIndexSignature", - "range": [ - 216, - 246 - ], - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 34 - } - }, - "index": { - "type": "Identifier", - "range": [ - 225, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 16 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 24 - } - }, - "range": [ - 230, - 236 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 230, - 236 - ], - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 24 - } - } - } - } - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 11, - "column": 27 - }, - "end": { - "line": 11, - "column": 33 - } - }, - "range": [ - 239, - 245 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 239, - 245 - ], - "loc": { - "start": { - "line": 11, - "column": 27 - }, - "end": { - "line": 11, - "column": 33 - } - } - } - }, - "accessibility": "private", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSIndexSignature", - "range": [ - 251, - 283 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 36 - } - }, - "index": { - "type": "Identifier", - "range": [ - 262, - 265 - ], - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 18 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 26 - } - }, - "range": [ - 267, - 273 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 267, - 273 - ], - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 26 - } - } - } - } - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 35 - } - }, - "range": [ - 276, - 282 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 276, - 282 - ], - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 35 - } - } - } - }, - "accessibility": "protected", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSIndexSignature", - "range": [ - 288, - 317 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 33 - } - }, - "index": { - "type": "Identifier", - "range": [ - 296, - 299 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 15 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 13, - "column": 17 - }, - "end": { - "line": 13, - "column": 23 - } - }, - "range": [ - 301, - 307 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 301, - 307 - ], - "loc": { - "start": { - "line": 13, - "column": 17 - }, - "end": { - "line": 13, - "column": 23 - } - } - } - } - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - }, - "range": [ - 310, - 316 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 310, - 316 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": true, - "export": false - }, - { - "type": "TSIndexSignature", - "range": [ - 322, - 351 - ], - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 33 - } - }, - "index": { - "type": "Identifier", - "range": [ - 330, - 333 - ], - "loc": { - "start": { - "line": 14, - "column": 12 - }, - "end": { - "line": 14, - "column": 15 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 23 - } - }, - "range": [ - 335, - 341 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 335, - 341 - ], - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 23 - } - } - } - } - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 14, - "column": 26 - }, - "end": { - "line": 14, - "column": 32 - } - }, - "range": [ - 344, - 350 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 344, - 350 - ], - "loc": { - "start": { - "line": 14, - "column": 26 - }, - "end": { - "line": 14, - "column": 32 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": true - }, - { - "type": "TSIndexSignature", - "range": [ - 356, - 387 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 35 - } - }, - "index": { - "type": "Identifier", - "range": [ - 366, - 369 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 17 - } - }, - "name": "baz", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 25 - } - }, - "range": [ - 371, - 377 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 371, - 377 - ], - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 25 - } - } - } - } - }, - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 15, - "column": 28 - }, - "end": { - "line": 15, - "column": 34 - } - }, - "range": [ - 380, - 386 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 380, - 386 - ], - "loc": { - "start": { - "line": 15, - "column": 28 - }, - "end": { - "line": 15, - "column": 34 - } - } - } - }, - "accessibility": null, - "readonly": true, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 393, - 421 - ], - "loc": { - "start": { - "line": 17, - "column": 4 - }, - "end": { - "line": 17, - "column": 32 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 400, - 401 - ], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 12 - } - }, - "name": "g" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 402, - 405 - ], - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 16 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - }, - "range": [ - 407, - 413 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 407, - 413 - ], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - }, - "range": [ - 416, - 420 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 416, - 420 - ], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - } - } - }, - "accessibility": "public", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 426, - 455 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 33 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 434, - 435 - ], - "loc": { - "start": { - "line": 18, - "column": 12 - }, - "end": { - "line": 18, - "column": 13 - } - }, - "name": "h" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 436, - 439 - ], - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 17 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 25 - } - }, - "range": [ - 441, - 447 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 441, - 447 - ], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 25 - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 32 - } - }, - "range": [ - 450, - 454 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 450, - 454 - ], - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 32 - } - } - } - }, - "accessibility": "private", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 460, - 491 - ], - "loc": { - "start": { - "line": 19, - "column": 4 - }, - "end": { - "line": 19, - "column": 35 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 470, - 471 - ], - "loc": { - "start": { - "line": 19, - "column": 14 - }, - "end": { - "line": 19, - "column": 15 - } - }, - "name": "i" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 472, - 475 - ], - "loc": { - "start": { - "line": 19, - "column": 16 - }, - "end": { - "line": 19, - "column": 19 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 27 - } - }, - "range": [ - 477, - 483 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 477, - 483 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 27 - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 34 - } - }, - "range": [ - 486, - 490 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 486, - 490 - ], - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 34 - } - } - } - }, - "accessibility": "protected", - "readonly": false, - "static": false, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 496, - 524 - ], - "loc": { - "start": { - "line": 20, - "column": 4 - }, - "end": { - "line": 20, - "column": 32 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 503, - 504 - ], - "loc": { - "start": { - "line": 20, - "column": 11 - }, - "end": { - "line": 20, - "column": 12 - } - }, - "name": "j" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 505, - 508 - ], - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 20, - "column": 16 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - }, - "range": [ - 510, - 516 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 510, - 516 - ], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 20, - "column": 27 - }, - "end": { - "line": 20, - "column": 31 - } - }, - "range": [ - 519, - 523 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 519, - 523 - ], - "loc": { - "start": { - "line": 20, - "column": 27 - }, - "end": { - "line": 20, - "column": 31 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": true, - "export": false - }, - { - "type": "TSMethodSignature", - "range": [ - 529, - 557 - ], - "loc": { - "start": { - "line": 21, - "column": 4 - }, - "end": { - "line": 21, - "column": 32 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 536, - 537 - ], - "loc": { - "start": { - "line": 21, - "column": 11 - }, - "end": { - "line": 21, - "column": 12 - } - }, - "name": "k" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 538, - 541 - ], - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 16 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - }, - "range": [ - 543, - 549 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 543, - 549 - ], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 21, - "column": 27 - }, - "end": { - "line": 21, - "column": 31 - } - }, - "range": [ - 552, - 556 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 552, - 556 - ], - "loc": { - "start": { - "line": 21, - "column": 27 - }, - "end": { - "line": 21, - "column": 31 - } - } - } - }, - "accessibility": null, - "readonly": false, - "static": false, - "export": true - }, - { - "type": "TSMethodSignature", - "range": [ - 562, - 592 - ], - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 34 - } - }, - "optional": false, - "computed": false, - "key": { - "type": "Identifier", - "range": [ - 571, - 572 - ], - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 14 - } - }, - "name": "l" - }, - "params": [ - { - "type": "Identifier", - "range": [ - 573, - 576 - ], - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 18 - } - }, - "name": "bar", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 22, - "column": 20 - }, - "end": { - "line": 22, - "column": 26 - } - }, - "range": [ - 578, - 584 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 578, - 584 - ], - "loc": { - "start": { - "line": 22, - "column": 20 - }, - "end": { - "line": 22, - "column": 26 - } - } - } - } - } - ], - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 33 - } - }, - "range": [ - 587, - 591 - ], - "typeAnnotation": { - "type": "TSVoidKeyword", - "range": [ - 587, - 591 - ], - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 33 - } - } - } - }, - "accessibility": null, - "readonly": true, - "static": false, - "export": false - } - ], - "range": [ - 14, - 594 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 23, - "column": 1 - } - } - }, - "id": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "Foo" - }, - "heritage": [] - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "interface", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "Foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 20, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 32, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 16 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "String", - "value": "'a'", - "range": [ - 34, - 37 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 37, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 43, - 49 - ], - "loc": { - "start": { - "line": 3, - "column": 4 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 50, - 51 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 53, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 65, - 72 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "b", - "range": [ - 73, - 74 - ], - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 74, - 75 - ], - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 76, - 82 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 82, - 83 - ], - "loc": { - "start": { - "line": 4, - "column": 21 - }, - "end": { - "line": 4, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 88, - 97 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "c", - "range": [ - 98, - 99 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 99, - 100 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 101, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 107, - 108 - ], - "loc": { - "start": { - "line": 5, - "column": 23 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 113, - 119 - ], - "loc": { - "start": { - "line": 6, - "column": 4 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "d", - "range": [ - 120, - 121 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 121, - 122 - ], - "loc": { - "start": { - "line": 6, - "column": 12 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 123, - 129 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 129, - 130 - ], - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 21 - } - } - }, - { - "type": "Keyword", - "value": "export", - "range": [ - 135, - 141 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "e", - "range": [ - 142, - 143 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 143, - 144 - ], - "loc": { - "start": { - "line": 7, - "column": 12 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 145, - 151 - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 151, - 152 - ], - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 157, - 165 - ], - "loc": { - "start": { - "line": 8, - "column": 4 - }, - "end": { - "line": 8, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "f", - "range": [ - 166, - 167 - ], - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 167, - 168 - ], - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 169, - 175 - ], - "loc": { - "start": { - "line": 8, - "column": 16 - }, - "end": { - "line": 8, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 175, - 176 - ], - "loc": { - "start": { - "line": 8, - "column": 22 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 182, - 188 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 189, - 190 - ], - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 190, - 193 - ], - "loc": { - "start": { - "line": 10, - "column": 12 - }, - "end": { - "line": 10, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 193, - 194 - ], - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 195, - 201 - ], - "loc": { - "start": { - "line": 10, - "column": 17 - }, - "end": { - "line": 10, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 201, - 202 - ], - "loc": { - "start": { - "line": 10, - "column": 23 - }, - "end": { - "line": 10, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 202, - 203 - ], - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 204, - 210 - ], - "loc": { - "start": { - "line": 10, - "column": 26 - }, - "end": { - "line": 10, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 210, - 211 - ], - "loc": { - "start": { - "line": 10, - "column": 32 - }, - "end": { - "line": 10, - "column": 33 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 216, - 223 - ], - "loc": { - "start": { - "line": 11, - "column": 4 - }, - "end": { - "line": 11, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 224, - 225 - ], - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 225, - 228 - ], - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 228, - 229 - ], - "loc": { - "start": { - "line": 11, - "column": 16 - }, - "end": { - "line": 11, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 230, - 236 - ], - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 236, - 237 - ], - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 237, - 238 - ], - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 26 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 239, - 245 - ], - "loc": { - "start": { - "line": 11, - "column": 27 - }, - "end": { - "line": 11, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 245, - 246 - ], - "loc": { - "start": { - "line": 11, - "column": 33 - }, - "end": { - "line": 11, - "column": 34 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 251, - 260 - ], - "loc": { - "start": { - "line": 12, - "column": 4 - }, - "end": { - "line": 12, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 261, - 262 - ], - "loc": { - "start": { - "line": 12, - "column": 14 - }, - "end": { - "line": 12, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 262, - 265 - ], - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 265, - 266 - ], - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 267, - 273 - ], - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 273, - 274 - ], - "loc": { - "start": { - "line": 12, - "column": 26 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 274, - 275 - ], - "loc": { - "start": { - "line": 12, - "column": 27 - }, - "end": { - "line": 12, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 276, - 282 - ], - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 282, - 283 - ], - "loc": { - "start": { - "line": 12, - "column": 35 - }, - "end": { - "line": 12, - "column": 36 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 288, - 294 - ], - "loc": { - "start": { - "line": 13, - "column": 4 - }, - "end": { - "line": 13, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 295, - 296 - ], - "loc": { - "start": { - "line": 13, - "column": 11 - }, - "end": { - "line": 13, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 296, - 299 - ], - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 299, - 300 - ], - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 13, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 301, - 307 - ], - "loc": { - "start": { - "line": 13, - "column": 17 - }, - "end": { - "line": 13, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 307, - 308 - ], - "loc": { - "start": { - "line": 13, - "column": 23 - }, - "end": { - "line": 13, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 308, - 309 - ], - "loc": { - "start": { - "line": 13, - "column": 24 - }, - "end": { - "line": 13, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 310, - 316 - ], - "loc": { - "start": { - "line": 13, - "column": 26 - }, - "end": { - "line": 13, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 316, - 317 - ], - "loc": { - "start": { - "line": 13, - "column": 32 - }, - "end": { - "line": 13, - "column": 33 - } - } - }, - { - "type": "Keyword", - "value": "export", - "range": [ - 322, - 328 - ], - "loc": { - "start": { - "line": 14, - "column": 4 - }, - "end": { - "line": 14, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 329, - 330 - ], - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 330, - 333 - ], - "loc": { - "start": { - "line": 14, - "column": 12 - }, - "end": { - "line": 14, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 333, - 334 - ], - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 335, - 341 - ], - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 341, - 342 - ], - "loc": { - "start": { - "line": 14, - "column": 23 - }, - "end": { - "line": 14, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 342, - 343 - ], - "loc": { - "start": { - "line": 14, - "column": 24 - }, - "end": { - "line": 14, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 344, - 350 - ], - "loc": { - "start": { - "line": 14, - "column": 26 - }, - "end": { - "line": 14, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 350, - 351 - ], - "loc": { - "start": { - "line": 14, - "column": 32 - }, - "end": { - "line": 14, - "column": 33 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 356, - 364 - ], - "loc": { - "start": { - "line": 15, - "column": 4 - }, - "end": { - "line": 15, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "[", - "range": [ - 365, - 366 - ], - "loc": { - "start": { - "line": 15, - "column": 13 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "baz", - "range": [ - 366, - 369 - ], - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 369, - 370 - ], - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 371, - 377 - ], - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": "]", - "range": [ - 377, - 378 - ], - "loc": { - "start": { - "line": 15, - "column": 25 - }, - "end": { - "line": 15, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 378, - 379 - ], - "loc": { - "start": { - "line": 15, - "column": 26 - }, - "end": { - "line": 15, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 380, - 386 - ], - "loc": { - "start": { - "line": 15, - "column": 28 - }, - "end": { - "line": 15, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 386, - 387 - ], - "loc": { - "start": { - "line": 15, - "column": 34 - }, - "end": { - "line": 15, - "column": 35 - } - } - }, - { - "type": "Keyword", - "value": "public", - "range": [ - 393, - 399 - ], - "loc": { - "start": { - "line": 17, - "column": 4 - }, - "end": { - "line": 17, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "g", - "range": [ - 400, - 401 - ], - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 401, - 402 - ], - "loc": { - "start": { - "line": 17, - "column": 12 - }, - "end": { - "line": 17, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 402, - 405 - ], - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 405, - 406 - ], - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 407, - 413 - ], - "loc": { - "start": { - "line": 17, - "column": 18 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 413, - 414 - ], - "loc": { - "start": { - "line": 17, - "column": 24 - }, - "end": { - "line": 17, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 414, - 415 - ], - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 416, - 420 - ], - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 420, - 421 - ], - "loc": { - "start": { - "line": 17, - "column": 31 - }, - "end": { - "line": 17, - "column": 32 - } - } - }, - { - "type": "Keyword", - "value": "private", - "range": [ - 426, - 433 - ], - "loc": { - "start": { - "line": 18, - "column": 4 - }, - "end": { - "line": 18, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "h", - "range": [ - 434, - 435 - ], - "loc": { - "start": { - "line": 18, - "column": 12 - }, - "end": { - "line": 18, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 435, - 436 - ], - "loc": { - "start": { - "line": 18, - "column": 13 - }, - "end": { - "line": 18, - "column": 14 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 436, - 439 - ], - "loc": { - "start": { - "line": 18, - "column": 14 - }, - "end": { - "line": 18, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 439, - 440 - ], - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 18 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 441, - 447 - ], - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 447, - 448 - ], - "loc": { - "start": { - "line": 18, - "column": 25 - }, - "end": { - "line": 18, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 448, - 449 - ], - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 450, - 454 - ], - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 454, - 455 - ], - "loc": { - "start": { - "line": 18, - "column": 32 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, - { - "type": "Keyword", - "value": "protected", - "range": [ - 460, - 469 - ], - "loc": { - "start": { - "line": 19, - "column": 4 - }, - "end": { - "line": 19, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "i", - "range": [ - 470, - 471 - ], - "loc": { - "start": { - "line": 19, - "column": 14 - }, - "end": { - "line": 19, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 471, - 472 - ], - "loc": { - "start": { - "line": 19, - "column": 15 - }, - "end": { - "line": 19, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 472, - 475 - ], - "loc": { - "start": { - "line": 19, - "column": 16 - }, - "end": { - "line": 19, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 475, - 476 - ], - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 20 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 477, - 483 - ], - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 483, - 484 - ], - "loc": { - "start": { - "line": 19, - "column": 27 - }, - "end": { - "line": 19, - "column": 28 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 484, - 485 - ], - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 29 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 486, - 490 - ], - "loc": { - "start": { - "line": 19, - "column": 30 - }, - "end": { - "line": 19, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 490, - 491 - ], - "loc": { - "start": { - "line": 19, - "column": 34 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - { - "type": "Keyword", - "value": "static", - "range": [ - 496, - 502 - ], - "loc": { - "start": { - "line": 20, - "column": 4 - }, - "end": { - "line": 20, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "j", - "range": [ - 503, - 504 - ], - "loc": { - "start": { - "line": 20, - "column": 11 - }, - "end": { - "line": 20, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 504, - 505 - ], - "loc": { - "start": { - "line": 20, - "column": 12 - }, - "end": { - "line": 20, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 505, - 508 - ], - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 20, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 508, - 509 - ], - "loc": { - "start": { - "line": 20, - "column": 16 - }, - "end": { - "line": 20, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 510, - 516 - ], - "loc": { - "start": { - "line": 20, - "column": 18 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 516, - 517 - ], - "loc": { - "start": { - "line": 20, - "column": 24 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 517, - 518 - ], - "loc": { - "start": { - "line": 20, - "column": 25 - }, - "end": { - "line": 20, - "column": 26 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 519, - 523 - ], - "loc": { - "start": { - "line": 20, - "column": 27 - }, - "end": { - "line": 20, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 523, - 524 - ], - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 32 - } - } - }, - { - "type": "Keyword", - "value": "export", - "range": [ - 529, - 535 - ], - "loc": { - "start": { - "line": 21, - "column": 4 - }, - "end": { - "line": 21, - "column": 10 - } - } - }, - { - "type": "Identifier", - "value": "k", - "range": [ - 536, - 537 - ], - "loc": { - "start": { - "line": 21, - "column": 11 - }, - "end": { - "line": 21, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 537, - 538 - ], - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 538, - 541 - ], - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 541, - 542 - ], - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 543, - 549 - ], - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 549, - 550 - ], - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 550, - 551 - ], - "loc": { - "start": { - "line": 21, - "column": 25 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 552, - 556 - ], - "loc": { - "start": { - "line": 21, - "column": 27 - }, - "end": { - "line": 21, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 556, - 557 - ], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 32 - } - } - }, - { - "type": "Identifier", - "value": "readonly", - "range": [ - 562, - 570 - ], - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 12 - } - } - }, - { - "type": "Identifier", - "value": "l", - "range": [ - 571, - 572 - ], - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 572, - 573 - ], - "loc": { - "start": { - "line": 22, - "column": 14 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 573, - 576 - ], - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 576, - 577 - ], - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 19 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 578, - 584 - ], - "loc": { - "start": { - "line": 22, - "column": 20 - }, - "end": { - "line": 22, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 584, - 585 - ], - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 585, - 586 - ], - "loc": { - "start": { - "line": 22, - "column": 27 - }, - "end": { - "line": 22, - "column": 28 - } - } - }, - { - "type": "Keyword", - "value": "void", - "range": [ - 587, - 591 - ], - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 591, - 592 - ], - "loc": { - "start": { - "line": 22, - "column": 33 - }, - "end": { - "line": 22, - "column": 34 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 593, - 594 - ], - "loc": { - "start": { - "line": 23, - "column": 0 - }, - "end": { - "line": 23, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js deleted file mode 100644 index f8a47b5721a5..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/call-expression-type-arguments.result.js +++ /dev/null @@ -1,489 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "range": [ - 0, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 9 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 0, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - }, - "name": "foo" - }, - "arguments": [], - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 3, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 6 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "id": { - "type": "Identifier", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - }, - "name": "A" - }, - "typeParameters": null - } - ] - } - } - }, - { - "type": "ExpressionStatement", - "range": [ - 10, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 14 - } - }, - "expression": { - "type": "CallExpression", - "range": [ - 10, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - }, - "name": "foo" - }, - "arguments": [], - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 13, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - }, - "id": { - "type": "TSNumberKeyword", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - "typeParameters": null - } - ] - } - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "foo", - "range": [ - 0, - 3 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 3, - 4 - ], - "loc": { - "start": { - "line": 1, - "column": 3 - }, - "end": { - "line": 1, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 4, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 4 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 5, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 5 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 7, - 8 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Identifier", - "value": "foo", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 3 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 2, - "column": 3 - }, - "end": { - "line": 2, - "column": 4 - } - } - }, - { - "type": "Identifier", - "value": "number", - "range": [ - 14, - 20 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 2, - "column": 10 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 22, - 23 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 23, - 24 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 14 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js deleted file mode 100644 index 459bac2e5388..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/new-expression-type-arguments.result.js +++ /dev/null @@ -1,366 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "range": [ - 0, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 21 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "range": [ - 6, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "id": { - "type": "Identifier", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - }, - "name": "a" - }, - "init": { - "type": "NewExpression", - "range": [ - 10, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "callee": { - "type": "Identifier", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - }, - "name": "A" - }, - "arguments": [], - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 15, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "id": { - "type": "Identifier", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - }, - "name": "B" - }, - "typeParameters": null - } - ] - } - } - } - ], - "kind": "const" - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Keyword", - "value": "const", - "range": [ - 0, - 5 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 5 - } - } - }, - { - "type": "Identifier", - "value": "a", - "range": [ - 6, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 6 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Punctuator", - "value": "=", - "range": [ - 8, - 9 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 9 - } - } - }, - { - "type": "Keyword", - "value": "new", - "range": [ - 10, - 13 - ], - "loc": { - "start": { - "line": 1, - "column": 10 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": "Identifier", - "value": "A", - "range": [ - 14, - 15 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 15, - 16 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 16 - } - } - }, - { - "type": "Identifier", - "value": "B", - "range": [ - 16, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 17, - 18 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 18, - 19 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 19, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 20, - 21 - ], - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 21 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js deleted file mode 100644 index da04e376a0c2..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/ambient-module-declaration-with-import.result.js +++ /dev/null @@ -1,349 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSModuleDeclaration", - "range": [ - 0, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "modifiers": [ - { - "type": "TSDeclareKeyword", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "name": { - "type": "Literal", - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "value": "i-use-things", - "raw": "\"i-use-things\"" - }, - "body": { - "type": "TSModuleBlock", - "range": [ - 30, - 56 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ImportDeclaration", - "range": [ - 34, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "source": { - "type": "Literal", - "range": [ - 49, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 21 - } - }, - "value": "fs", - "raw": "'fs'" - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "range": [ - 41, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "range": [ - 41, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "name": "fs" - } - } - ] - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "declare", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "module", - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "String", - "value": "\"i-use-things\"", - "range": [ - 15, - 29 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 30, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 30 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Keyword", - "value": "import", - "range": [ - 34, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Identifier", - "value": "fs", - "range": [ - 41, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": "Identifier", - "value": "from", - "range": [ - 44, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": "String", - "value": "'fs'", - "range": [ - 49, - 53 - ], - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 53, - 54 - ], - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 55, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js deleted file mode 100644 index 178d5e737ed3..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/declare-namespace-with-exported-function.result.js +++ /dev/null @@ -1,655 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 84 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "TSModuleDeclaration", - "range": [ - 0, - 84 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "modifiers": [ - { - "type": "TSDeclareKeyword", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "name": { - "type": "Identifier", - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - }, - "name": "d3" - }, - "body": { - "type": "TSModuleBlock", - "range": [ - 21, - 84 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 3, - "column": 1 - } - }, - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "TSNamespaceFunctionDeclaration", - "range": [ - 32, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 59 - } - }, - "id": { - "type": "Identifier", - "range": [ - 41, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "name": "select" - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "name": "selector", - "typeAnnotation": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - }, - "range": [ - 58, - 64 - ], - "typeAnnotation": { - "type": "TSStringKeyword", - "range": [ - 58, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - } - } - } - } - ], - "body": null, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 58 - } - }, - "range": [ - 67, - 81 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 67, - 81 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 58 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 67, - 76 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 53 - } - }, - "name": "Selection" - }, - "typeParameters": { - "type": "TypeParameterInstantiation", - "range": [ - 76, - 81 - ], - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 58 - } - }, - "params": [ - { - "type": "GenericTypeAnnotation", - "range": [ - 77, - 80 - ], - "loc": { - "start": { - "line": 2, - "column": 54 - }, - "end": { - "line": 2, - "column": 57 - } - }, - "id": { - "type": "TSAnyKeyword", - "range": [ - 77, - 80 - ], - "loc": { - "start": { - "line": 2, - "column": 54 - }, - "end": { - "line": 2, - "column": 57 - } - } - }, - "typeParameters": null - } - ] - } - } - } - }, - "range": [ - 25, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 59 - } - }, - "specifiers": [], - "source": null - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "declare", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "namespace", - "range": [ - 8, - 17 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "d3", - "range": [ - 18, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 18 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 21, - 22 - ], - "loc": { - "start": { - "line": 1, - "column": 21 - }, - "end": { - "line": 1, - "column": 22 - } - } - }, - { - "type": "Keyword", - "value": "export", - "range": [ - 25, - 31 - ], - "loc": { - "start": { - "line": 2, - "column": 2 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 32, - 40 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "select", - "range": [ - 41, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 47, - 48 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "Identifier", - "value": "selector", - "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": "Identifier", - "value": "string", - "range": [ - 58, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 41 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 2, - "column": 41 - }, - "end": { - "line": 2, - "column": 42 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 2, - "column": 42 - }, - "end": { - "line": 2, - "column": 43 - } - } - }, - { - "type": "Identifier", - "value": "Selection", - "range": [ - 67, - 76 - ], - "loc": { - "start": { - "line": 2, - "column": 44 - }, - "end": { - "line": 2, - "column": 53 - } - } - }, - { - "type": "Punctuator", - "value": "<", - "range": [ - 76, - 77 - ], - "loc": { - "start": { - "line": 2, - "column": 53 - }, - "end": { - "line": 2, - "column": 54 - } - } - }, - { - "type": "Identifier", - "value": "any", - "range": [ - 77, - 80 - ], - "loc": { - "start": { - "line": 2, - "column": 54 - }, - "end": { - "line": 2, - "column": 57 - } - } - }, - { - "type": "Punctuator", - "value": ">", - "range": [ - 80, - 81 - ], - "loc": { - "start": { - "line": 2, - "column": 57 - }, - "end": { - "line": 2, - "column": 58 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 81, - 82 - ], - "loc": { - "start": { - "line": 2, - "column": 58 - }, - "end": { - "line": 2, - "column": 59 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 83, - 84 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 1 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js deleted file mode 100644 index 8b9adfd89192..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/module-with-default-exports.result.js +++ /dev/null @@ -1,825 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 112 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "body": [ - { - "type": "TSModuleDeclaration", - "range": [ - 0, - 112 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "name": { - "type": "Literal", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "value": "foo", - "raw": "\"foo\"" - }, - "body": { - "type": "TSModuleBlock", - "range": [ - 13, - 112 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "body": [ - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "ClassDeclaration", - "range": [ - 34, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 4, - "column": 5 - } - }, - "id": { - "type": "Identifier", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "name": "C" - }, - "body": { - "type": "ClassBody", - "body": [ - { - "type": "MethodDefinition", - "range": [ - 52, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 22 - } - }, - "key": { - "type": "Identifier", - "range": [ - 52, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - }, - "name": "method" - }, - "value": { - "type": "FunctionExpression", - "id": null, - "generator": false, - "expression": false, - "async": false, - "body": { - "type": "BlockStatement", - "range": [ - 64, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 22 - } - }, - "body": [] - }, - "range": [ - 58, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - }, - "returnType": { - "type": "TypeAnnotation", - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "range": [ - 62, - 63 - ], - "typeAnnotation": { - "type": "TSTypeReference", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "typeName": { - "type": "Identifier", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - }, - "name": "C" - } - } - }, - "params": [] - }, - "computed": false, - "static": false, - "kind": "method", - "accessibility": null, - "decorators": [] - } - ], - "range": [ - 42, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - "superClass": null, - "implements": [], - "decorators": [] - }, - "range": [ - 19, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "ExportDefaultDeclaration", - "declaration": { - "type": "TSNamespaceFunctionDeclaration", - "range": [ - 93, - 110 - ], - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 36 - } - }, - "id": { - "type": "Identifier", - "range": [ - 102, - 105 - ], - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 5, - "column": 31 - } - }, - "name": "bar" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "range": [ - 108, - 110 - ], - "loc": { - "start": { - "line": 5, - "column": 34 - }, - "end": { - "line": 5, - "column": 36 - } - }, - "body": [] - } - }, - "range": [ - 78, - 110 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 36 - } - } - } - ] - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "module", - "range": [ - 0, - 6 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": "String", - "value": "\"foo\"", - "range": [ - 7, - 12 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 13, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "Keyword", - "value": "export", - "range": [ - 19, - 25 - ], - "loc": { - "start": { - "line": 2, - "column": 4 - }, - "end": { - "line": 2, - "column": 10 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 26, - 33 - ], - "loc": { - "start": { - "line": 2, - "column": 11 - }, - "end": { - "line": 2, - "column": 18 - } - } - }, - { - "type": "Keyword", - "value": "class", - "range": [ - 34, - 39 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 42, - 43 - ], - "loc": { - "start": { - "line": 2, - "column": 27 - }, - "end": { - "line": 2, - "column": 28 - } - } - }, - { - "type": "Identifier", - "value": "method", - "range": [ - 52, - 58 - ], - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 58, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 59, - 60 - ], - "loc": { - "start": { - "line": 3, - "column": 15 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": "Punctuator", - "value": ":", - "range": [ - 60, - 61 - ], - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": "Identifier", - "value": "C", - "range": [ - 62, - 63 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 64, - 65 - ], - "loc": { - "start": { - "line": 3, - "column": 20 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 65, - 66 - ], - "loc": { - "start": { - "line": 3, - "column": 21 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 66, - 67 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 72, - 73 - ], - "loc": { - "start": { - "line": 4, - "column": 4 - }, - "end": { - "line": 4, - "column": 5 - } - } - }, - { - "type": "Keyword", - "value": "export", - "range": [ - 78, - 84 - ], - "loc": { - "start": { - "line": 5, - "column": 4 - }, - "end": { - "line": 5, - "column": 10 - } - } - }, - { - "type": "Keyword", - "value": "default", - "range": [ - 85, - 92 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": "Keyword", - "value": "function", - "range": [ - 93, - 101 - ], - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 27 - } - } - }, - { - "type": "Identifier", - "value": "bar", - "range": [ - 102, - 105 - ], - "loc": { - "start": { - "line": 5, - "column": 28 - }, - "end": { - "line": 5, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 32 - } - } - }, - { - "type": "Punctuator", - "value": ")", - "range": [ - 106, - 107 - ], - "loc": { - "start": { - "line": 5, - "column": 32 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - { - "type": "Punctuator", - "value": "{", - "range": [ - 108, - 109 - ], - "loc": { - "start": { - "line": 5, - "column": 34 - }, - "end": { - "line": 5, - "column": 35 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 109, - 110 - ], - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 36 - } - } - }, - { - "type": "Punctuator", - "value": "}", - "range": [ - 111, - 112 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - } - ] -}; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js deleted file mode 100644 index 13218657800f..000000000000 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.result.js +++ /dev/null @@ -1,149 +0,0 @@ -module.exports = { - "type": "Program", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "body": [ - { - "type": "TSModuleDeclaration", - "range": [ - 0, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "modifiers": [ - { - "type": "TSDeclareKeyword", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - } - ], - "name": { - "type": "Literal", - "range": [ - 15, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 31 - } - }, - "value": "hot-new-module", - "raw": "\"hot-new-module\"" - } - } - ], - "sourceType": "script", - "tokens": [ - { - "type": "Identifier", - "value": "declare", - "range": [ - 0, - 7 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 7 - } - } - }, - { - "type": "Identifier", - "value": "module", - "range": [ - 8, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "String", - "value": "\"hot-new-module\"", - "range": [ - 15, - 31 - ], - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 31 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 31, - 32 - ], - "loc": { - "start": { - "line": 1, - "column": 31 - }, - "end": { - "line": 1, - "column": 32 - } - } - } - ] -}; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap new file mode 100644 index 000000000000..b6f81770e6a0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap @@ -0,0 +1,1450 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`basics fixtures/delete-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 14, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "delete", + "prefix": true, + "range": Array [ + 0, + 14, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/do-while-statements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "EmptyStatement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "DoWhileStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "i", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 25, + ], + "type": "VariableDeclaration", + }, + Object { + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "i", + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "operator": "+=", + "range": Array [ + 34, + 40, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 29, + 43, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 58, + ], + "test": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "i", + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "operator": "<", + "range": Array [ + 51, + 56, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + "type": "DoWhileStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/identifiers-double-underscore.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "__test", + "range": Array [ + 4, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "raw": "'ff'", + "type": "Literal", + "value": "ff", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "__Foo", + "range": Array [ + 26, + 31, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 36, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 55, + 59, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "__Bar", + "range": Array [ + 47, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "params": Array [], + "range": Array [ + 38, + 59, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/instanceof.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "instanceof", + "range": Array [ + 0, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Set", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/new-with-member-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 4, + 11, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "NewExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/new-without-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 16, + ], + "type": "FunctionDeclaration", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "X", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "NewExpression", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/typeof-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "'str'", + "type": "Literal", + "value": "str", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 0, + 12, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/update-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "i", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "i", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 28, + 31, + ], + "type": "UpdateExpression", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 24, + 34, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "f", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 11, + 34, + ], + "type": "FunctionDeclaration", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "name": "f", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`basics fixtures/void-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "void", + "prefix": true, + "range": Array [ + 0, + 6, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "void", + "prefix": true, + "range": Array [ + 8, + 15, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "type": "Program", +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap new file mode 100644 index 000000000000..920218ab9335 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap @@ -0,0 +1,3039 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Comments fixtures/block-trailing-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "BlockStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/comment-within-condition.src 1`] = ` +Object { + "body": Array [ + Object { + "alternate": null, + "consequent": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 30, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "type": "IfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 30, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/export-default-anonymous-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "method1", + "range": Array [ + 103, + 110, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 103, + 119, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 112, + 119, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "params": Array [], + "range": Array [ + 110, + 119, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 57, + 121, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 51, + 121, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 121, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 121, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-block-comment.src 1`] = `"Unterminated regular expression literal."`; + +exports[`Comments fixtures/jsx-tag-comments.src 1`] = `"Type expected."`; + +exports[`Comments fixtures/line-comment-with-block-syntax.src 1`] = ` +Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 12, + 0, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/mix-line-and-block-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "zzz", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "raw": "777", + "type": "Literal", + "value": 777, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 6, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 6, + 28, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/no-comment-regex.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "regex", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 33, + ], + "raw": "/no comment\\\\/**foo/", + "regex": Object { + "flags": "", + "pattern": "no comment\\\\/**foo", + }, + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 33, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/no-comment-template.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "str", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "__dirname", + "range": Array [ + 15, + 24, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 36, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "/test/*.js", + "raw": "/test/*.js", + }, + }, + ], + "range": Array [ + 12, + 36, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 36, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-call-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "foo", + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 60, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 60, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-debugger-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 45, + ], + "type": "DebuggerStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-return-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 61, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-throw-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 44, + ], + "raw": "55", + "type": "Literal", + "value": 55, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 45, + ], + "type": "ThrowStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-while-loop-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 46, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 41, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "name": "each", + "range": Array [ + 61, + 65, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 66, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 68, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 68, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-fallthrough-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 29, + 36, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "doIt", + "range": Array [ + 82, + 86, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 89, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 66, + 89, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-fallthrough-comment-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 61, + 68, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "doIt", + "range": Array [ + 126, + 130, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 126, + 133, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 106, + 133, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 139, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 141, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 141, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-no-default-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 39, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-no-default-comment-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 43, + 69, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 104, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 131, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 133, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 133, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 133, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-no-default-comment-in-nested-functions.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "module", + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "exports", + "range": Array [ + 7, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 14, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 286, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "argument": Object { + "arguments": Array [ + Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 79, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 50, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "name": "node", + "range": Array [ + 172, + 176, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 6, + }, + "start": Object { + "column": 39, + "line": 6, + }, + }, + "name": "expressions", + "range": Array [ + 177, + 188, + ], + "type": "Identifier", + }, + "range": Array [ + 172, + 188, + ], + "type": "MemberExpression", + }, + "property": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 74, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 67, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "name": "node", + "range": Array [ + 189, + 193, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 6, + }, + "start": Object { + "column": 56, + "line": 6, + }, + }, + "name": "expressions", + "range": Array [ + 194, + 205, + ], + "type": "Identifier", + }, + "range": Array [ + 189, + 205, + ], + "type": "MemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 6, + }, + "start": Object { + "column": 68, + "line": 6, + }, + }, + "name": "length", + "range": Array [ + 206, + 212, + ], + "type": "Identifier", + }, + "range": Array [ + 189, + 212, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 78, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "operator": "-", + "range": Array [ + 189, + 216, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 6, + }, + "start": Object { + "column": 77, + "line": 6, + }, + }, + "range": Array [ + 215, + 216, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "range": Array [ + 172, + 217, + ], + "type": "MemberExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": "isConstant", + "range": Array [ + 161, + 171, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 80, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 161, + 218, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 81, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 154, + 219, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 81, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 219, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 116, + 136, + ], + "raw": "\\"SequenceExpression\\"", + "type": "Literal", + "value": "SequenceExpression", + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "node", + "range": Array [ + 86, + 90, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "name": "type", + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + }, + "range": Array [ + 86, + 95, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 78, + 255, + ], + "type": "SwitchStatement", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 271, + 276, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 264, + 277, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 283, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "isConstant", + "range": Array [ + 51, + 61, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "node", + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 42, + 283, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 286, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "context", + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 17, + 286, + ], + "type": "FunctionExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 287, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 287, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`Comments fixtures/template-string-block.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 3, + 7, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 0, + 9, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "operator": "+", + "range": Array [ + 56, + 61, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 64, + ], + "type": "BlockStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "sourceType": "script", + "type": "Program", +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap new file mode 100644 index 000000000000..27aaffe008d2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -0,0 +1,93995 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ecmaFeatures REGEXP FLAG - NODE VERSION <6: fixtures/regexUFlag/regex-u-extended-escape.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + }, + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 40, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + }, + "type": "RegularExpression", + "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures REGEXP FLAG - NODE VERSION <6: fixtures/regexUFlag/regex-u-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo/u", + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "RegularExpression", + "value": "/foo/u", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures REGEXP FLAG - NODE VERSION <6: fixtures/regexYFlag/regexp-y-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo/y", + "regex": Object { + "flags": "y", + "pattern": "foo", + }, + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "y", + "pattern": "foo", + }, + "type": "RegularExpression", + "value": "/foo/y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures REGEXP FLAG - NODE VERSION >=6: fixtures/regexUFlag/regex-u-extended-escape.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 40, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + }, + "type": "RegularExpression", + "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures REGEXP FLAG - NODE VERSION >=6: fixtures/regexUFlag/regex-u-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo/u", + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "RegularExpression", + "value": "/foo/u", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures REGEXP FLAG - NODE VERSION >=6: fixtures/regexYFlag/regexp-y-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo/y", + "regex": Object { + "flags": "y", + "pattern": "foo", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "y", + "pattern": "foo", + }, + "type": "RegularExpression", + "value": "/foo/y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/as-param.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 4, + 12, + ], + "type": "ArrowFunctionExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/as-param-with-params.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 4, + 16, + ], + "type": "ArrowFunctionExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/basic.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 12, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/block-body.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 12, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/block-body-not-object.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "body": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "ExpressionStatement", + }, + "label": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "label", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "LabeledStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 18, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "label", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 1, + 7, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/iife.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "property", + "range": Array [ + 8, + 16, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 8, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + }, + ], + "range": Array [ + 6, + 22, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 23, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Identifier", + "value": "property", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/multiple-params.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 16, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/no-auto-return.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 17, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "arguments", + "range": Array [ + 0, + 9, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Identifier", + "value": "arguments", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "eval", + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 10, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 7, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval-params.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "eval", + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-octal.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "00", + "type": "Literal", + "value": 0, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 9, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "00", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/return-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 5, + 12, + ], + "type": "ArrowFunctionExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 12, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/return-sequence.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "async": false, + "body": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "SequenceExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 8, + 27, + ], + "type": "ArrowFunctionExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 28, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/single-param.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 11, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/single-param-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 13, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/single-param-return-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "earth", + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sun", + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 14, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "value": "sun", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "earth", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/binaryLiterals/invalid.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/binaryLiterals/lowercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0b101", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0b101", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/binaryLiterals/uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0B101", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0B101", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/blockBindings/const.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/blockBindings/let.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/blockBindings/let-in-switchcase.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "t", + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 38, + ], + "type": "VariableDeclaration", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 45, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "answer", + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "answer", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "t", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-accessor-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 14, + 18, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 29, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 24, + 29, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 31, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-computed-static-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 23, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 19, + 23, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "superClass": null, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-method-named-prototype.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "prototype", + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 18, + 22, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + "value": "prototype", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-method-named-static.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "static", + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 19, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 19, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-method-named-with-space.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "withSpace", + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 24, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 19, + 24, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + "value": "withSpace", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-one-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 15, + 19, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-one-method-super.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Super", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 41, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 15, + 41, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Keyword", + "value": "super", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-static-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 21, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 21, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-static-method-named-prototype.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 28, + ], + "raw": "\\"prototype\\"", + "type": "Literal", + "value": "prototype", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 33, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 29, + 33, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 34, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 28, + ], + "type": "String", + "value": "\\"prototype\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-static-method-named-static.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "static", + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 26, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 22, + 26, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 28, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-static-methods-and-accessor-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 21, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 21, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 38, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 34, + 38, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 56, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 56, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 51, + 56, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 58, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 49, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-computed-static-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 18, + 22, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 37, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 33, + 37, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 38, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 14, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 19, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 19, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 20, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-methods-computed-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 26, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 22, + 26, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 41, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 46, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 46, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 42, + 46, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 41, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-methods-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 14, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 16, + 20, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-methods-three-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 15, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 15, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 21, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-methods-two-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 14, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 16, + 20, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 22, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-static-methods-named-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 27, + 31, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 54, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 50, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 55, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-with-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 24, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 20, + 24, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-with-constructor-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 32, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 32, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 20, + 32, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 33, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-with-constructor-with-space.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 25, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 21, + 25, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 26, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/derived-class-assign-to-var.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 27, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/derived-class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 18, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/empty-class.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/empty-class-double-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/empty-class-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/empty-literal-derived-class.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/named-class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 11, + ], + "superClass": null, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/named-derived-class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 20, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/class-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 44, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 44, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 35, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 25, + 44, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 46, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/class-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 36, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 27, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 27, + ], + "raw": "'baz'", + "type": "Literal", + "value": "baz", + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 17, + 36, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 38, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "String", + "value": "'baz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 0, + 20, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 22, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 4, + 22, + ], + "type": "FunctionExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/method.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 27, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 9, + 25, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 4, + 27, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/not-all-params.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "type": "AssignmentPattern", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 10, + 35, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/array-member.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "ok", + "range": Array [ + 1, + 3, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "range": Array [ + 1, + 5, + ], + "type": "MemberExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 3, + ], + "type": "Identifier", + "value": "ok", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "20", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/array-to-array.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 15, + ], + "right": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/array-var-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "ArrayPattern", + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-array.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 45, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 45, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 36, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 25, + 45, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 40, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 25, + 49, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 51, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 27, + 32, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 34, + 39, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 26, + 40, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 25, + 49, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 51, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-object.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 45, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 45, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 27, + 30, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 32, + 35, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 26, + 36, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 25, + 45, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-method-params-array.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 37, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 17, + 37, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-method-params-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 17, + 41, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-method-params-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 19, + 24, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 26, + 31, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 18, + 32, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 17, + 41, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-method-params-object.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 37, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 24, + 27, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 18, + 28, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 17, + 37, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 10, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentPattern", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-longform-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 15, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 22, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 20, + 32, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 34, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 38, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 18, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-nested-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 22, + ], + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 23, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 19, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 12, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 20, + 25, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 26, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 15, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 17, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 14, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 27, + 36, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 37, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 22, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 27, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-mixed-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 8, + 17, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 19, + 20, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 21, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 18, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-nested-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 18, + 24, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 16, + 25, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 26, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 18, + 19, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 16, + 21, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 22, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/destructured-array-catch.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "block": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "method": false, + "range": Array [ + 35, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 34, + 37, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "param": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "ArrayPattern", + }, + "range": Array [ + 49, + 69, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 69, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 71, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 71, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "stack", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/destructured-object-catch.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "block": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "method": false, + "range": Array [ + 35, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 34, + 37, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "param": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "method": false, + "range": Array [ + 56, + 61, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 55, + 62, + ], + "type": "ObjectPattern", + }, + "range": Array [ + 49, + 69, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 69, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 71, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 71, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "stack", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/named-param.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "responseText", + "range": Array [ + 3, + 15, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "text", + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 30, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "res", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 15, + ], + "type": "Identifier", + "value": "responseText", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "text", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "res", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/nested-array.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + null, + Object { + "elements": Array [ + null, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 15, + ], + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "ArrayPattern", + }, + "init": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "ArrayExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 30, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/nested-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 22, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 14, + 22, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 24, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 29, + 35, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "raw": "\\"3\\"", + "type": "Literal", + "value": "3", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 37, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 42, + 48, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 48, + ], + "raw": "\\"b\\"", + "type": "Literal", + "value": "b", + }, + }, + ], + "range": Array [ + 40, + 50, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 27, + 52, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 52, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "String", + "value": "\\"3\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "String", + "value": "\\"b\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/object-var-named.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 8, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 9, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/object-var-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 10, + 12, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/param-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 23, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/param-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 11, + 19, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 23, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/param-defaults-object-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 20, + 33, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 25, + 31, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 23, + 33, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 11, + 34, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 38, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 22, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-array-wrapped.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-multi-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 14, + 19, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 22, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-nested-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + null, + Object { + "elements": Array [ + null, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 23, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 27, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-nested-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 16, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 18, + 29, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 23, + 27, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 21, + 29, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 11, + 31, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 35, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 11, + 19, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 22, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-object-wrapped.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 17, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/sparse-array.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + null, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "array", + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "array", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-array.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 10, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-array.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-object.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 10, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 8, + 9, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 1, + 11, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 17, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 2, + 5, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 8, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 10, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 19, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 1, + 21, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 27, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-object.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 1, + 4, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 10, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 1, + 9, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-object-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "ArrayExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 10, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 15, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 13, + 23, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 1, + 24, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 35, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/array-const-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "ArrayPattern", + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/array-let-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "ArrayPattern", + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-const-named.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 7, + 10, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 6, + 11, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 14, + 16, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-const-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 7, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 6, + 9, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-let-named.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 8, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 9, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-let-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 10, + 12, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 20, + ], + "right": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 0, + 24, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-object.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 30, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 26, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 20, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 19, + 26, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 4, + 30, + ], + "type": "FunctionExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-object-short.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": true, + "range": Array [ + 2, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 16, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 10, + 17, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 3, + 21, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 1, + 22, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-forOf/loop.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", + }, + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/complex-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 1, + 9, + ], + "type": "ObjectPattern", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/destructured-array-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/destructuring-param.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "ok", + "range": Array [ + 22, + 24, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 26, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 30, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Identifier", + "value": "ok", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/multi-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 13, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/single-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 10, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-complex-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 7, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 10, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 5, + 13, + ], + "type": "ObjectPattern", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 20, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 24, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-destructured-array-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 17, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 18, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-multi-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-single-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 10, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalAsyncIteration/async-generators.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 26, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalAsyncIteration/async-iterator.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "await": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 59, + 67, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "item", + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 27, + 67, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "name": "items", + "range": Array [ + 52, + 57, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 69, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 69, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 69, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 38, + 43, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + "value": "item", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 49, + 51, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 52, + 57, + ], + "type": "Identifier", + "value": "items", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/arg-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 11, + 20, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 24, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/destructuring-assign-mirror.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 1, + 10, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 22, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 13, + 22, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/function-parameter-object-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 13, + 21, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 26, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/object-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 9, + 10, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 16, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 4, + 18, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 23, + 27, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 29, + 33, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 35, + 39, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 41, + 45, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + }, + ], + "range": Array [ + 21, + 47, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/property-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 42, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 56, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "name": "foo", + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + }, + "range": Array [ + 73, + 80, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 80, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 36, + 82, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 82, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 83, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 83, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 73, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-method-args.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "initialize", + "range": Array [ + 7, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 7, + 104, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 51, + 104, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 19, + 26, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 28, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "name": "options", + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 38, + 48, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 18, + 49, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 17, + 104, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 1, + 106, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 108, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 108, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "Identifier", + "value": "initialize", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "value": "someVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + "value": "otherVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "value": "options", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 45, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 46, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "initialize", + "range": Array [ + 14, + 24, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 14, + 111, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 58, + 111, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 26, + 33, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 35, + 43, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "name": "options", + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 45, + 55, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 25, + 56, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 24, + 111, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 8, + 113, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 113, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 114, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 114, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 24, + ], + "type": "Identifier", + "value": "initialize", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + "value": "someVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + "value": "otherVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "value": "options", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 45, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 46, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 42, + 45, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 51, + 54, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 63, + 66, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 36, + 68, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 68, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 69, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 69, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 63, + 66, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/single-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 42, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 56, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 76, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 36, + 78, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 78, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 79, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 79, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 73, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/spread-trailing-comma.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 1, + 16, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/two-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 42, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "ExperimentalSpreadProperty", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 36, + 76, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 76, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 77, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 77, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 68, + 71, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/exponentiationOperators/exponential-operators.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "**", + "range": Array [ + 8, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "**=", + "range": Array [ + 16, + 23, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Punctuator", + "value": "**", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "**=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/forOf/for-of-with-function-initializer.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 61, + 62, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "name": "process", + "range": Array [ + 53, + 60, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 63, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "i", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "operator": "in", + "range": Array [ + 33, + 41, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 41, + ], + "type": "ArrayExpression", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 41, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 43, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 43, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 43, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "list", + "range": Array [ + 47, + 51, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 46, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "Identifier", + "value": "list", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 60, + ], + "type": "Identifier", + "value": "process", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-braces.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "range": Array [ + 25, + 36, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 38, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 39, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 41, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 36, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-no-braces.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "range": Array [ + 23, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 36, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 34, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/anonymous-generator.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 25, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/async-generator-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 1, + 27, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/async-generator-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "f", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 63, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "init": Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "name": "g", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "CallExpression", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 56, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 56, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 57, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 65, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 51, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/double-yield.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "type": "YieldExpression", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 32, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 32, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/empty-generator-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "t", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 16, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "t", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/generator-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 30, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/yield-delegation.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/yield-without-value.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 24, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/yield-without-value-in-call.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "YieldExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "fn", + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 25, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 26, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 28, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 28, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/yield-without-value-no-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 23, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-array.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 25, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 16, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 29, + ], + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-named-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 30, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-named-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 32, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 32, + ], + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-number.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 17, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + ], + "range": Array [ + 15, + 25, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-value.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-from-batch.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "type": "ExportAllDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-from-default.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 15, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-from-named-as-default.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-from-named-as-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 18, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-from-named-as-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 39, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "range": Array [ + 24, + 27, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-from-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-from-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 25, + ], + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-as-default.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-as-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 18, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-as-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "range": Array [ + 24, + 27, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 22, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-specifiers-comma.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-var.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-var-anonymous-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 31, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 32, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-var-number.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 19, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-default.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 10, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-default-and-named-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 10, + ], + "type": "ImportDefaultSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-default-and-namespace-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 10, + ], + "type": "ImportDefaultSpecifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 20, + ], + "type": "ImportNamespaceSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-default-as.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 22, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-jquery.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 22, + ], + "raw": "\\"jquery\\"", + "type": "Literal", + "value": "jquery", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "$", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 8, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "$", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "String", + "value": "\\"jquery\\"", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-module.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-named-as-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 18, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-named-as-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 18, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "xyz", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "xyz", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 23, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "xyz", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-named-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-named-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-named-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-named-specifiers-comma.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-namespace-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 15, + ], + "type": "ImportNamespaceSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-null-as-nil.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "raw": "\\"bar\\"", + "type": "Literal", + "value": "bar", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "null", + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "nil", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "range": Array [ + 9, + 20, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Null", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "nil", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "type": "String", + "value": "\\"bar\\"", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/newTarget/simple-new-target.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "new", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "target", + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + }, + "range": Array [ + 27, + 37, + ], + "type": "MetaProperty", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 40, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 40, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "target", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-addition-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "operator": "+", + "range": Array [ + 15, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 14, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 8, + 28, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-and-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 16, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + }, + ], + "range": Array [ + 1, + 17, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Numeric", + "value": "20", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-getter-and-setter.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 14, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 9, + 14, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 29, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 23, + 29, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 1, + 30, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-string-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 20, + ], + "raw": "\\"hey\\"", + "type": "Literal", + "value": "hey", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 14, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 8, + 28, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "String", + "value": "\\"hey\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-variable-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 14, + 24, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 8, + 26, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 1, + 10, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression-with-addition.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 3, + 12, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "type": "BinaryExpression", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 17, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 1, + 18, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "String", + "value": "\\"x\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression-with-method.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 20, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 1, + 21, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/strict-duplicate-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "y", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "method": false, + "range": Array [ + 26, + 36, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 29, + 36, + ], + "raw": "'first'", + "type": "Literal", + "value": "first", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "name": "y", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "method": false, + "range": Array [ + 39, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 42, + 50, + ], + "raw": "'second'", + "type": "Literal", + "value": "second", + }, + }, + ], + "range": Array [ + 23, + 52, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 52, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 53, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "String", + "value": "'first'", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 42, + 50, + ], + "type": "String", + "value": "'second'", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 26, + 29, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "method": false, + "range": Array [ + 26, + 38, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 31, + 38, + ], + "raw": "\\"first\\"", + "type": "Literal", + "value": "first", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 41, + 44, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "method": false, + "range": Array [ + 41, + 54, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 46, + 54, + ], + "raw": "\\"second\\"", + "type": "Literal", + "value": "second", + }, + }, + ], + "range": Array [ + 23, + 56, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 56, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 57, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "String", + "value": "\\"first\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "String", + "value": "\\"second\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/method-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 14, + 47, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 41, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 17, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 8, + 49, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 49, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/simple-method.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "method", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 10, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 16, + 26, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 4, + 28, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/simple-method-named-get.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 10, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 13, + 23, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 4, + 25, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/simple-method-named-set.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "set", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 10, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 13, + 23, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 4, + 25, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/simple-method-with-argument.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 33, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "method", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 10, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "test", + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 16, + 31, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 4, + 33, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/simple-method-with-string-name.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 30, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 18, + ], + "raw": "\\"method\\"", + "type": "Literal", + "value": "method", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 10, + 28, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 28, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 4, + 30, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "String", + "value": "\\"method\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/string-name-method-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 14, + 49, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 32, + 43, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 19, + 49, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 8, + 51, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 51, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralShorthandProperties/shorthand-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 42, + 45, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 51, + 54, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "method": false, + "range": Array [ + 60, + 63, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 36, + 65, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 66, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/octalLiterals/invalid.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/octalLiterals/lowercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0o717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0o717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/octalLiterals/strict-uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "0O717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Numeric", + "value": "0O717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/octalLiterals/uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0O717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0O717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/regex/regexp-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo./", + "regex": Object { + "flags": "", + "pattern": "foo.", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "", + "pattern": "foo.", + }, + "type": "RegularExpression", + "value": "/foo./", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/basic-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 0, + 22, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/class-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 25, + 41, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/class-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 33, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 17, + 33, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 35, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/func-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 8, + 26, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/func-expression-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 8, + 28, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/single-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 0, + 19, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/spread/multi-function-call.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "SpreadElement", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/spread/not-final-param.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "SpreadElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "func", + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "func", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/spread/simple-function-call.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "SpreadElement", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/deeply-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasi": Object { + "expressions": Array [ + Object { + "expressions": Array [ + Object { + "left": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "deeply", + "raw": "deeply", + }, + }, + ], + "range": Array [ + 22, + 30, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 22, + 35, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 33, + 35, + ], + "type": "ObjectExpression", + }, + "type": "BinaryExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 22, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "nested ", + "raw": "nested ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": " blah", + "raw": " blah", + }, + }, + ], + "range": Array [ + 12, + 42, + ], + "type": "TemplateLiteral", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 12, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "hello ", + "raw": "hello ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 44, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 3, + 44, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 0, + 44, + ], + "tag": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "raw", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "type": "TaggedTemplateExpression", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "raw", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 12, + ], + "type": "Template", + "value": "\`hello \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 22, + ], + "type": "Template", + "value": "\`nested \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "type": "Template", + "value": "\`deeply\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "Template", + "value": "} blah\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 44, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/escape-characters.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "ts", + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + }, + "init": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 39, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "\\\\n\\\\r\\\\b\\\\v\\\\t\\\\f\\\\ +\\\\ +", + "raw": "\\\\\\\\n\\\\\\\\r\\\\\\\\b\\\\\\\\v\\\\\\\\t\\\\\\\\f\\\\\\\\\\\\n\\\\\\\\\\\\r\\\\n", + }, + }, + ], + "range": Array [ + 9, + 39, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 39, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "value": "ts", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 39, + ], + "type": "Template", + "value": "\`\\\\\\\\n\\\\\\\\r\\\\\\\\b\\\\\\\\v\\\\\\\\t\\\\\\\\f\\\\\\\\\\\\n\\\\\\\\\\\\r\\\\n\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/expressions.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "raw": "'Fred'", + "type": "Literal", + "value": "Fred", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 15, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": "a", + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "operator": "+", + "range": Array [ + 51, + 56, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 28, + 37, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "Hello ", + "raw": "Hello ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 38, + 51, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": ". a + 5 = ", + "raw": ". a + 5 = ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 28, + 58, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 28, + 59, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "String", + "value": "'Fred'", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 28, + 37, + ], + "type": "Template", + "value": "\`Hello \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 38, + 51, + ], + "type": "Template", + "value": "}. a + 5 = \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/multi-line-template-string.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "The last man on Earth + sat alone in a room. + There was + a knock + on the + door...", + "raw": "The last man on Earth + sat alone in a room. + There was + a knock + on the + door...", + }, + }, + ], + "range": Array [ + 0, + 110, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "type": "Template", + "value": "\`The last man on Earth + sat alone in a room. + There was + a knock + on the + door...\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/simple-template-string.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "42", + "raw": "42", + }, + }, + ], + "range": Array [ + 0, + 4, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Template", + "value": "\`42\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/single-dollar-sign.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "ts", + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + }, + "init": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "$", + "raw": "$", + }, + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "value": "ts", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Template", + "value": "\`$\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/tagged-no-placeholders.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasi": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 8, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "foo", + "raw": "foo", + }, + }, + ], + "range": Array [ + 3, + 8, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 0, + 8, + ], + "tag": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "type": "TaggedTemplateExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 8, + ], + "type": "Template", + "value": "\`foo\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/templateStrings/tagged-template-string.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "arguments", + "range": Array [ + 30, + 39, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "console", + "range": Array [ + 18, + 25, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "log", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "range": Array [ + 18, + 29, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 18, + 40, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 18, + 41, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 43, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "tag", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 43, + ], + "type": "FunctionDeclaration", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "quasi": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "a", + "range": Array [ + 55, + 56, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 71, + 72, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 47, + 55, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "a is ", + "raw": "a is ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 56, + 71, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": " while b is ", + "raw": " while b is ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 72, + 75, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": ".", + "raw": ".", + }, + }, + ], + "range": Array [ + 47, + 75, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 44, + 75, + ], + "tag": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "name": "tag", + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + }, + "type": "TaggedTemplateExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 44, + 76, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 76, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "tag", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "Identifier", + "value": "console", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "log", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 30, + 39, + ], + "type": "Identifier", + "value": "arguments", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "tag", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 47, + 55, + ], + "type": "Template", + "value": "\`a is \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 56, + 71, + ], + "type": "Template", + "value": "} while b is \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 72, + 75, + ], + "type": "Template", + "value": "}.\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/unicodeCodePointEscapes/basic-string-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "raw": "\\"\\\\u{714E}\\\\u{8336}\\"", + "type": "Literal", + "value": "煎茶", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "String", + "value": "\\"\\\\u{714E}\\\\u{8336}\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/unicodeCodePointEscapes/complex-string-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "raw": "\\"\\\\u{20BB7}\\\\u{10FFFF}\\\\u{1}\\"", + "type": "Literal", + "value": "𠮷􏿿", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "String", + "value": "\\"\\\\u{20BB7}\\\\u{10FFFF}\\\\u{1}\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap new file mode 100644 index 000000000000..7ec2ae783a7d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -0,0 +1,9529 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`JSX useJSXTextNode: false fixtures/attributes.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "raw": "test", + "type": "Literal", + "value": "test", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 48, + 51, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 46, + 52, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 14, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "raw": "\\"baz\\"", + "type": "Literal", + "value": "baz", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "qux", + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 15, + 24, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "quz", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "spread", + "range": Array [ + 25, + 31, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 25, + 41, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": "rest", + "range": Array [ + 36, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 41, + ], + "type": "JSXExpressionContainer", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 42, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 52, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXText", + "value": "\\"baz\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "quz", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "JSXIdentifier", + "value": "spread", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 36, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 40, + ], + "type": "Identifier", + "value": "rest", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "JSXText", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/embedded-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "JSXEmptyExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 28, + ], + "type": "JSXExpressionContainer", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 28, + 32, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 3, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 32, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/embedded-conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 24, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "alternate": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 19, + 20, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 23, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 18, + 23, + ], + "type": "JSXElement", + }, + "consequent": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 15, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 10, + 15, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 23, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "type": "ConditionalExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 24, + ], + "type": "JSXExpressionContainer", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 27, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 27, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/embedded-invalid-js-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "br", + "range": Array [ + 6, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 11, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "raw": "7x invalid-js-identifier", + "type": "Literal", + "value": "7x invalid-js-identifier", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 35, + 41, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 41, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "JSXIdentifier", + "value": "br", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "type": "JSXText", + "value": "7x invalid-js-identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/empty-placeholder.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 4, + ], + "type": "JSXEmptyExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "JSXExpressionContainer", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 9, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 3, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 9, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/escape-patterns.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 83, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 10, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "raw": "\\" \\"", + "type": "Literal", + "value": " ", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 11, + 16, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "raw": "\\" \\"", + "type": "Literal", + "value": " ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 17, + 18, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 17, + 26, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 26, + ], + "raw": "\\"&\\"", + "type": "Literal", + "value": "&", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 27, + 28, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 27, + 43, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 43, + ], + "raw": "\\"id=1&group=2\\"", + "type": "Literal", + "value": "id=1&group=2", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 44, + 45, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 44, + 59, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 59, + ], + "raw": "\\"�\\"", + "type": "Literal", + "value": "�", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "name": "g", + "range": Array [ + 60, + 61, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 60, + 71, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 71, + ], + "raw": "\\"{*;\\"", + "type": "Literal", + "value": "{*;", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "name": "h", + "range": Array [ + 72, + 73, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 72, + 80, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 74, + "line": 1, + }, + }, + "range": Array [ + 74, + 80, + ], + "raw": "\\"&#x;\\"", + "type": "Literal", + "value": "&#x;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 83, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 83, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 83, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 84, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 84, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "String", + "value": "\\" \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "JSXText", + "value": "\\" \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "JSXText", + "value": "\\"&\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 43, + ], + "type": "JSXText", + "value": "\\"id=1&group=2\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "JSXIdentifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 59, + ], + "type": "JSXText", + "value": "\\"�\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "JSXIdentifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 71, + ], + "type": "JSXText", + "value": "\\"{*;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "JSXIdentifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 73, + "line": 1, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 74, + "line": 1, + }, + }, + "range": Array [ + 74, + 80, + ], + "type": "JSXText", + "value": "\\"&#x;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 1, + }, + "start": Object { + "column": 81, + "line": 1, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 1, + }, + "start": Object { + "column": 82, + "line": 1, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 84, + "line": 1, + }, + "start": Object { + "column": 83, + "line": 1, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-attribute.src 1`] = `"'{' expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-attribute-missing-equals.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-broken-tag.src 1`] = `"Unterminated string literal."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-computed-end-tag-name.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-computed-string-end-tag-name.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-embedded-expression.src 1`] = `"'}' expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-leading-dot-tag-name.src 1`] = `"Expression expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-matching-placeholder-in-closing-tag.src 1`] = `"'>' expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-mismatched-closing-tag.src 1`] = `"Expected corresponding JSX closing tag for 'a'."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-mismatched-closing-tags.src 1`] = `"JSX element 'a' has no corresponding closing tag."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-mismatched-dot-tag-name.src 1`] = `"Expected corresponding JSX closing tag for 'a.b.c'."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-mismatched-namespace-tag.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-missing-closing-tag.src 1`] = `"JSX element 'a' has no corresponding closing tag."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-missing-closing-tag-attribute-placeholder.src 1`] = `"JSX element 'a' has no corresponding closing tag."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-missing-namespace-name.src 1`] = `"Expression expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-missing-namespace-value.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-missing-spread-operator.src 1`] = `"'...' expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-namespace-name-with-docts.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-no-common-parent.src 1`] = `"JSX expressions must have one parent element."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-no-common-parent-with-comment.src 1`] = `"JSX expressions must have one parent element."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-no-tag-name.src 1`] = `"Declaration or statement expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-placeholder-in-closing-tag.src 1`] = `"'>' expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-trailing-dot-tag-name.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/invalid-unexpected-comma.src 1`] = `"Identifier expected."`; + +exports[`JSX useJSXTextNode: false fixtures/japanese-characters.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "日本語", + "range": Array [ + 7, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "日本語", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "日本語", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "JSXIdentifier", + "value": "日本語", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/less-than-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 2, + 5, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 8, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 1, + 8, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 0, + 13, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/member-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 7, + 10, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/member-expression-this.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "this", + "range": Array [ + 1, + 5, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "state", + "range": Array [ + 6, + 11, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 11, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Component", + "range": Array [ + 12, + 21, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 21, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 24, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "JSXIdentifier", + "value": "state", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 21, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/multiple-blank-spaces.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "raw": " ", + "type": "Literal", + "value": " ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 7, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 3, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "JSXText", + "value": " ", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/newslines-and-entities.src 1`] = `"Invalid character."`; + +exports[`JSX useJSXTextNode: false fixtures/self-closing-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 5, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/self-closing-tag-inside-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": " +", + "type": "Literal", + "value": " +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "JSXText", + "value": " +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/self-closing-tag-with-newline.src 1`] = `"Invalid character."`; + +exports[`JSX useJSXTextNode: false fixtures/spread-operator-attribute-and-regular-attribute.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "props", + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 15, + ], + "type": "JSXSpreadAttribute", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "post", + "range": Array [ + 16, + 20, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 16, + 32, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 32, + ], + "raw": "\\"attribute\\"", + "type": "Literal", + "value": "attribute", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 35, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 35, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "JSXIdentifier", + "value": "post", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 32, + ], + "type": "JSXText", + "value": "\\"attribute\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/spread-operator-attributes.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "props", + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 15, + ], + "type": "JSXSpreadAttribute", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 18, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 18, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/tag-names-with-dots.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 7, + 10, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/tag-names-with-multi-dots.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 12, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 7, + 15, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 6, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 7, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 15, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/test-content.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "raw": "@test content", + "type": "Literal", + "value": "@test content", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "type": "JSXText", + "value": "@test content", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/trailing-spread-operator-attribute.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 47, + 53, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "pre", + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 18, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "raw": "\\"leading\\"", + "type": "Literal", + "value": "leading", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "pre2", + "range": Array [ + 19, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 19, + 35, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 35, + ], + "raw": "\\"attribute\\"", + "type": "Literal", + "value": "attribute", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "props", + "range": Array [ + 40, + 45, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 46, + ], + "type": "JSXSpreadAttribute", + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 47, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 53, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + "value": "pre", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "type": "JSXText", + "value": "\\"leading\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "JSXIdentifier", + "value": "pre2", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 35, + ], + "type": "JSXText", + "value": "\\"attribute\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 45, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: false fixtures/unknown-escape-pattern.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 20, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "raw": "\\"¬anentity;\\"", + "type": "Literal", + "value": "¬anentity;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 23, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 23, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "JSXText", + "value": "\\"¬anentity;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: true fixtures/self-closing-tag-inside-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": " +", + "type": "JSXText", + "value": " +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "JSXText", + "value": " +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + +exports[`JSX useJSXTextNode: true fixtures/test-content.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "raw": "@test content", + "type": "JSXText", + "value": "@test content", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "type": "JSXText", + "value": "@test content", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap new file mode 100644 index 000000000000..ae6a9a339e17 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap @@ -0,0 +1,190 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`parse() general output tokens, comments, locs, and ranges when called with those options 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap new file mode 100644 index 000000000000..a079b243a575 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -0,0 +1,26518 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript fixtures/basics/abstract-class-with-abstract-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 43, + 51, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 66, + ], + "static": false, + "type": "TSAbstractMethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 63, + 66, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 68, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "AbstractSocket", + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 68, + ], + "superClass": null, + "type": "TSAbstractClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/abstract-class-with-abstract-method.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "createSocket", + "range": Array [ + 52, + 64, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 84, + ], + "static": false, + "type": "TSAbstractMethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 64, + 84, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 83, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 83, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "name": "Promise", + "range": Array [ + 68, + 75, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 75, + 83, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 86, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "AbstractSocket", + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 86, + ], + "superClass": null, + "type": "TSAbstractClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/abstract-class-with-abstract-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 38, + ], + "readonly": false, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "baz", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 60, + ], + "readonly": false, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 62, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "superClass": null, + "type": "TSAbstractClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/abstract-class-with-abstract-readonly-property.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 63, + ], + "readonly": true, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 54, + 62, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 65, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "TSAbstractClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/abstract-class-with-optional-method.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "createSocket", + "optional": true, + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 76, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 56, + 76, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 60, + 75, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 60, + 75, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "Promise", + "range": Array [ + 60, + 67, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 67, + 75, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 78, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "AbstractSocket", + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 78, + ], + "superClass": null, + "type": "TSAbstractClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/abstract-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "I", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 31, + ], + "type": "TSInterfaceDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/arrow-function-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 31, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 33, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 33, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 1, + 2, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 0, + 3, + ], + "type": "TypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 38, + 43, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 32, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 28, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 59, + 64, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 65, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "fooBar", + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 93, + ], + "raw": "'fooBar'", + "type": "Literal", + "value": "fooBar", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 76, + 93, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 70, + 94, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 96, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 96, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 96, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-accessibility-modifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 35, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "baz", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 38, + 65, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSNumberKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "getBar", + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 68, + 111, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 102, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 98, + 106, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 91, + 107, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 111, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 82, + 111, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "setBar", + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 114, + 171, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 156, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "name": "bar", + "range": Array [ + 157, + 160, + ], + "type": "Identifier", + }, + "range": Array [ + 152, + 160, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "operator": "=", + "range": Array [ + 152, + 166, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "name": "bar", + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 167, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 7, + }, + }, + "range": Array [ + 146, + 171, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 132, + 135, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 138, + 144, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 138, + 144, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 131, + 171, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 173, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 173, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 173, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 54, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": null, + "decorators": Array [], + "export": true, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 28, + 44, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 27, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 56, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-extends-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 10, + 11, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-extends-generic-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "D", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 34, + 40, + ], + "type": "TypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 10, + 21, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 9, + 22, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-generic-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "getBar", + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 28, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 28, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 30, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-generic-method-default.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "getBar", + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 34, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 29, + 34, + ], + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": null, + "default": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "Bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 21, + 28, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 20, + 29, + ], + "type": "TypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 36, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "ClassImplements", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "ClassImplements", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "S", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements-generic-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "ClassImplements", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "S", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 24, + 30, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-mixin.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 79, + 82, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 60, + 82, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "Base", + "range": Array [ + 74, + 78, + ], + "type": "Identifier", + }, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 53, + 82, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 84, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "M", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "Base", + "range": Array [ + 38, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 84, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 36, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 36, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Constructor", + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 33, + 35, + ], + "type": "TSTypeLiteral", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 32, + 36, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 11, + 36, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 10, + 37, + ], + "type": "TypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 125, + 128, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "X", + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "name": "I", + "range": Array [ + 123, + 124, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "ClassImplements", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 86, + 128, + ], + "superClass": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "name": "C", + "range": Array [ + 109, + 110, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "M", + "range": Array [ + 102, + 103, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 102, + 111, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "TSAnyKeyword", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 103, + 108, + ], + "type": "TypeParameterInstantiation", + }, + }, + "type": "ClassDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 138, + 141, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "C", + "range": Array [ + 136, + 137, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 130, + 141, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 154, + 157, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "name": "I", + "range": Array [ + 152, + 153, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 142, + 157, + ], + "type": "TSInterfaceDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "name": "Constructor", + "range": Array [ + 163, + 174, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "parameters": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 9, + }, + "start": Object { + "column": 30, + "line": 9, + }, + }, + "name": "args", + "range": Array [ + 188, + 192, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 199, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 197, + ], + "type": "TSAnyKeyword", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 199, + ], + "type": "TSArrayType", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 27, + "line": 9, + }, + }, + "range": Array [ + 185, + 199, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 180, + 205, + ], + "type": "TSConstructorType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "name": "T", + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + }, + }, + }, + "typeParameters": null, + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 163, + 206, + ], + "type": "VariableDeclarator", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "name": "T", + "range": Array [ + 175, + 176, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 174, + 177, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 158, + 206, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 206, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-computed-property.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "range": Array [ + 14, + 43, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "undefined", + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 45, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "optional": true, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 21, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 24, + 39, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 28, + 39, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 50, + 53, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 42, + 65, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 54, + 65, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 67, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 67, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 67, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "optional": true, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 22, + 36, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 39, + 61, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 63, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-property-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "foo", + "optional": true, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 37, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "undefined", + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-private-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 201, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 199, + 201, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 34, + 43, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 51, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 84, + 92, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 67, + 100, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 124, + 127, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 116, + 140, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 138, + 140, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 116, + 140, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 173, + 180, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 156, + 197, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 192, + 197, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 156, + 197, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 201, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 203, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 203, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 203, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-protected-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 209, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 59, + "line": 5, + }, + }, + "range": Array [ + 207, + 209, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 36, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 53, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 88, + 96, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 69, + 104, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 120, + 146, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 144, + 146, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 120, + 146, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 181, + 188, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 162, + 205, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 52, + "line": 5, + }, + }, + "range": Array [ + 200, + 205, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 162, + 205, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 209, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 211, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 211, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 211, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-public-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 197, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 195, + 197, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 50, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 82, + 90, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 66, + 98, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 114, + 137, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 135, + 137, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 114, + 137, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 169, + 176, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 153, + 193, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 5, + }, + }, + "range": Array [ + 188, + 193, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 153, + 193, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 197, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 199, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 199, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 199, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-readonly-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 107, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 51, + "line": 3, + }, + }, + "range": Array [ + 105, + 107, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": null, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 52, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": null, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 77, + 85, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 68, + 103, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "raw": "'Smith'", + "type": "Literal", + "value": "Smith", + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 68, + 103, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 107, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 109, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-readonly-property.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 47, + ], + "readonly": true, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 49, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-static-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 54, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": null, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 28, + 44, + ], + "readonly": false, + "static": true, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 27, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 56, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-type-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 11, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-type-parameter-default.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "default": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 17, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 9, + 18, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-type-parameter-underscore.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "__P", + "range": Array [ + 8, + 11, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 7, + 12, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 36, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 28, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 38, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/declare-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + }, + "type": "DeclareFunction", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 28, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "TypeParameter", + }, + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 24, + 25, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 20, + 26, + ], + "type": "TypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 24, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 16, + 19, + ], + "type": "TypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 27, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "TypeParameter", + }, + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 20, + 21, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 16, + 22, + ], + "type": "TypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestAlias", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 39, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "TSNumberKeyword", + }, + ], + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 40, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 40, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-type-class-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestClassProps", + "range": Array [ + 12, + 26, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "count", + "range": Array [ + 35, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 35, + 48, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 29, + 50, + ], + "type": "TSTypeLiteral", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 51, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 51, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-type-function-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestCallback", + "range": Array [ + 12, + 24, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameters": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 27, + 46, + ], + "type": "TSFunctionType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "TSVoidKeyword", + }, + }, + "typeParameters": null, + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 47, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "module", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "future", + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 46, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "hope", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "future", + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 13, + 23, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 45, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 26, + 39, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 40, + 44, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + ], + "range": Array [ + 25, + 45, + ], + "type": "TSTypeLiteral", + }, + }, + }, + ], + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 13, + 23, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 43, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 26, + 38, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 39, + 42, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + ], + "range": Array [ + 25, + 43, + ], + "type": "TSTypeLiteral", + }, + }, + }, + ], + "range": Array [ + 0, + 49, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 38, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 40, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 40, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 10, + 13, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "compare", + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 35, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 28, + 29, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 16, + 30, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 40, + 49, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 51, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 51, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 21, + 23, + ], + "type": "TSTypeLiteral", + }, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 23, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 10, + 24, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-types.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 57, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "message", + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 57, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 89, + 93, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 82, + 94, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 96, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "message", + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "age", + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 46, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "raw": "100", + "type": "Literal", + "value": 100, + }, + "type": "AssignmentPattern", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "name": "args", + "range": Array [ + 51, + 55, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 69, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 61, + 69, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + }, + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 69, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 0, + 96, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 96, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 34, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "Baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "TSInterfaceHeritage", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 14, + 15, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "baa", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 20, + 32, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, + "range": Array [ + 37, + 50, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": true, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "bax", + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 55, + 69, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": true, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "baz", + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "optional": true, + "range": Array [ + 74, + 89, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "name": "eee", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 94, + 116, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 109, + 115, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 109, + 115, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "name": "fff", + "optional": true, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 134, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 134, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 121, + 144, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 137, + 143, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 137, + 143, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "doo", + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "optional": false, + "params": Array [], + "range": Array [ + 149, + 161, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 156, + 160, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 156, + 160, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "name": "doo", + "range": Array [ + 166, + 169, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "optional": true, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "name": "a", + "range": Array [ + 171, + 172, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "name": "b", + "range": Array [ + 174, + 175, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "name": "c", + "range": Array [ + 177, + 178, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 166, + 186, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 181, + 185, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 181, + 185, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": true, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "name": "loo", + "range": Array [ + 192, + 195, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "optional": true, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "name": "a", + "range": Array [ + 198, + 199, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "name": "b", + "range": Array [ + 201, + 202, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "name": "c", + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 191, + 213, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 10, + }, + }, + "range": Array [ + 208, + 212, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 10, + }, + }, + "range": Array [ + 208, + 212, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "name": "boo", + "range": Array [ + 218, + 221, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "name": "a", + "range": Array [ + 225, + 226, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "name": "b", + "range": Array [ + 228, + 229, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "name": "c", + "range": Array [ + 231, + 232, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 218, + 240, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 11, + }, + "start": Object { + "column": 21, + "line": 11, + }, + }, + "range": Array [ + 235, + 239, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 11, + }, + "start": Object { + "column": 21, + "line": 11, + }, + }, + "range": Array [ + 235, + 239, + ], + "type": "TSVoidKeyword", + }, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "J", + "range": Array [ + 222, + 223, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 221, + 224, + ], + "type": "TypeParameterDeclaration", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "name": "a", + "range": Array [ + 250, + 251, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 253, + 254, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 245, + 265, + ], + "type": "TSConstructSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 258, + 264, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 258, + 264, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 13, + }, + }, + "name": "a", + "range": Array [ + 278, + 279, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "start": Object { + "column": 15, + "line": 13, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 281, + 282, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 270, + 293, + ], + "type": "TSConstructSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 286, + 292, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 286, + 292, + ], + "type": "TSStringKeyword", + }, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 9, + "line": 13, + }, + }, + "name": "F", + "range": Array [ + 275, + 276, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 274, + 277, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 295, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 295, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 295, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "public", + "export": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "range": Array [ + 26, + 34, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "export": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "range": Array [ + 36, + 45, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 21, + 47, + ], + "type": "TSConstructSignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 49, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-extends-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSInterfaceHeritage", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "J", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 28, + 31, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 14, + 15, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 15, + 16, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 14, + 17, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-jsdoc.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 76, + 85, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 87, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "range": Array [ + 21, + 26, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, + "range": Array [ + 31, + 44, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "baz", + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": true, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "foo", + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 49, + 79, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 81, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-without-type-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 21, + 25, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "nestedArray", + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 43, + ], + "type": "GenericTypeAnnotation", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "GenericTypeAnnotation", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 28, + 43, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 22, + 44, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "validateEntity", + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 58, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 59, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "init": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "e", + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "TSNonNullExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + }, + "range": Array [ + 72, + 79, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 79, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 82, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processEntity", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "e", + "optional": true, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "Entity", + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 37, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "Failure", + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + }, + }, + ], + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 37, + ], + "type": "VariableDeclarator", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 48, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 35, + 38, + ], + "type": "TypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "Failure", + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + }, + }, + ], + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 48, + ], + "type": "VariableDeclarator", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 22, + 24, + ], + "type": "TSTypeLiteral", + }, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 24, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 11, + 25, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 24, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 25, + 28, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + ], + "range": Array [ + 11, + 29, + ], + "type": "TSTypeLiteral", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-guard.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 52, + 60, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "===", + "range": Array [ + 52, + 73, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 45, + 73, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 75, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "isString", + "range": Array [ + 9, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "range": Array [ + 27, + 38, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 75, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-this.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "addClickListener", + "range": Array [ + 23, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 65, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "onclick", + "range": Array [ + 40, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 49, + 79, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "name": "Event", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 49, + 79, + ], + "type": "TSFunctionType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TSVoidKeyword", + }, + }, + "typeParameters": null, + }, + }, + }, + ], + "range": Array [ + 23, + 87, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "TSVoidKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 89, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "UIElement", + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/var-with-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "raw": "\\"Nicholas\\"", + "type": "Literal", + "value": "Nicholas", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 38, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 70, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_x", + "range": Array [ + 65, + 67, + ], + "type": "Identifier", + }, + "range": Array [ + 60, + 67, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 68, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 70, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 48, + 70, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 72, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Point", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 25, + 34, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 34, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + }, + ], + "range": Array [ + 23, + 36, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 37, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 80, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "name": "_bar", + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + }, + "range": Array [ + 68, + 77, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 78, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 80, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 56, + 80, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 82, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Other", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "hidden", + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "z", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 53, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_z", + "range": Array [ + 48, + 50, + ], + "type": "Identifier", + }, + "range": Array [ + 43, + 50, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 51, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 53, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 31, + 53, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 55, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "P", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "adminonly", + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "y", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 76, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "_y", + "range": Array [ + 63, + 65, + ], + "type": "Identifier", + }, + "range": Array [ + 58, + 65, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "operator": "=", + "range": Array [ + 58, + 69, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "a", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 70, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 48, + 76, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 44, + 76, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 78, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "User", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sealed", + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "Qux", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "ClassBody", + }, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "selector", + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + }, + ], + "range": Array [ + 11, + 35, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "Component", + "range": Array [ + 1, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 36, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "Decorator", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "FooComponent", + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 30, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 30, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "range": Array [ + 35, + 49, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 54, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 49, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 56, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 25, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "staticMethod", + "range": Array [ + 37, + 49, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 54, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 49, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 56, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "staticMethod", + "range": Array [ + 30, + 42, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "D", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 113, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + "range": Array [ + 81, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "config", + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 94, + 106, + ], + "type": "MemberExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 113, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "APP_CONFIG", + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "Inject", + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 51, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 51, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "AppConfig", + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 31, + 113, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 115, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Service", + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 50, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 19, + 50, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 52, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 63, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 47, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 32, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 65, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticFoo", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "greet", + "range": Array [ + 20, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 95, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 82, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 88, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 60, + 89, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 95, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "required", + "range": Array [ + 27, + 35, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 35, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 36, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 25, + 95, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 97, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Greeter", + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "greet", + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 108, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 95, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 101, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 102, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 108, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "required", + "range": Array [ + 40, + 48, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 49, + 53, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 38, + 108, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 110, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticGreeter", + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Input", + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "data", + "range": Array [ + 35, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 40, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Output", + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 54, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "click", + "range": Array [ + 59, + 64, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 86, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "EventEmitter", + "range": Array [ + 71, + 83, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 67, + 85, + ], + "type": "NewExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 88, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 32, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 15, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 33, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 33, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "prop1", + "range": Array [ + 41, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 67, + 72, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "configurable", + "range": Array [ + 54, + 66, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 54, + 73, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 73, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "prop2", + "range": Array [ + 85, + 90, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 91, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 93, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 93, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 93, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "y", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 37, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 28, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "qux", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 51, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 53, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "dec", + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "E", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 14, + ], + "type": "TSEnumDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/interface-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/interface-property-modifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "raw": "'a'", + "type": "Literal", + "value": "a", + }, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 20, + 38, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 43, + 60, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "private", + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 65, + 83, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "name": "c", + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 88, + 108, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "d", + "range": Array [ + 120, + 121, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 113, + 130, + ], + "readonly": false, + "static": true, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 123, + 129, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 123, + 129, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": true, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "name": "e", + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "optional": false, + "range": Array [ + 135, + 152, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 145, + 151, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 145, + 151, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "name": "f", + "range": Array [ + 166, + 167, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "optional": false, + "range": Array [ + 157, + 176, + ], + "readonly": true, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 169, + 175, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 169, + 175, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "public", + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "name": "baz", + "range": Array [ + 190, + 193, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 195, + 201, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 195, + 201, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 182, + 211, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 10, + }, + "start": Object { + "column": 26, + "line": 10, + }, + }, + "range": Array [ + 204, + 210, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 10, + }, + "start": Object { + "column": 26, + "line": 10, + }, + }, + "range": Array [ + 204, + 210, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "private", + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 13, + "line": 11, + }, + }, + "name": "baz", + "range": Array [ + 225, + 228, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 216, + 246, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 11, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 11, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "protected", + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "name": "baz", + "range": Array [ + 262, + 265, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 267, + 273, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 267, + 273, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "range": Array [ + 251, + 283, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 12, + }, + "start": Object { + "column": 29, + "line": 12, + }, + }, + "range": Array [ + 276, + 282, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 12, + }, + "start": Object { + "column": 29, + "line": 12, + }, + }, + "range": Array [ + 276, + 282, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 13, + }, + }, + "name": "baz", + "range": Array [ + 296, + 299, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 17, + "line": 13, + }, + }, + "range": Array [ + 301, + 307, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 17, + "line": 13, + }, + }, + "range": Array [ + 301, + 307, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 288, + 317, + ], + "readonly": false, + "static": true, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 13, + }, + "start": Object { + "column": 26, + "line": 13, + }, + }, + "range": Array [ + 310, + 316, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 13, + }, + "start": Object { + "column": 26, + "line": 13, + }, + }, + "range": Array [ + 310, + 316, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": true, + "index": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 12, + "line": 14, + }, + }, + "name": "baz", + "range": Array [ + 330, + 333, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 335, + 341, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 335, + 341, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 322, + 351, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 14, + }, + "start": Object { + "column": 26, + "line": 14, + }, + }, + "range": Array [ + 344, + 350, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 14, + }, + "start": Object { + "column": 26, + "line": 14, + }, + }, + "range": Array [ + 344, + 350, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 15, + }, + "start": Object { + "column": 14, + "line": 15, + }, + }, + "name": "baz", + "range": Array [ + 366, + 369, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 15, + }, + "start": Object { + "column": 19, + "line": 15, + }, + }, + "range": Array [ + 371, + 377, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 15, + }, + "start": Object { + "column": 19, + "line": 15, + }, + }, + "range": Array [ + 371, + 377, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 15, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "range": Array [ + 356, + 387, + ], + "readonly": true, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 15, + }, + "start": Object { + "column": 28, + "line": 15, + }, + }, + "range": Array [ + 380, + 386, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 15, + }, + "start": Object { + "column": 28, + "line": 15, + }, + }, + "range": Array [ + 380, + 386, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 17, + }, + "start": Object { + "column": 11, + "line": 17, + }, + }, + "name": "g", + "range": Array [ + 400, + 401, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "start": Object { + "column": 13, + "line": 17, + }, + }, + "name": "bar", + "range": Array [ + 402, + 405, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 18, + "line": 17, + }, + }, + "range": Array [ + 407, + 413, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 18, + "line": 17, + }, + }, + "range": Array [ + 407, + 413, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 393, + 421, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 17, + }, + "start": Object { + "column": 27, + "line": 17, + }, + }, + "range": Array [ + 416, + 420, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 17, + }, + "start": Object { + "column": 27, + "line": 17, + }, + }, + "range": Array [ + 416, + 420, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": "private", + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 18, + }, + "start": Object { + "column": 12, + "line": 18, + }, + }, + "name": "h", + "range": Array [ + 434, + 435, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 18, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 18, + }, + "start": Object { + "column": 14, + "line": 18, + }, + }, + "name": "bar", + "range": Array [ + 436, + 439, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 441, + 447, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 441, + 447, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 426, + 455, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 18, + }, + "start": Object { + "column": 28, + "line": 18, + }, + }, + "range": Array [ + 450, + 454, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 18, + }, + "start": Object { + "column": 28, + "line": 18, + }, + }, + "range": Array [ + 450, + 454, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 14, + "line": 19, + }, + }, + "name": "i", + "range": Array [ + 470, + 471, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 19, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 16, + "line": 19, + }, + }, + "name": "bar", + "range": Array [ + 472, + 475, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 19, + }, + "start": Object { + "column": 21, + "line": 19, + }, + }, + "range": Array [ + 477, + 483, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 19, + }, + "start": Object { + "column": 21, + "line": 19, + }, + }, + "range": Array [ + 477, + 483, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 460, + 491, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 19, + }, + "start": Object { + "column": 30, + "line": 19, + }, + }, + "range": Array [ + 486, + 490, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 19, + }, + "start": Object { + "column": 30, + "line": 19, + }, + }, + "range": Array [ + 486, + 490, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 20, + }, + "start": Object { + "column": 11, + "line": 20, + }, + }, + "name": "j", + "range": Array [ + 503, + 504, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 20, + }, + "start": Object { + "column": 4, + "line": 20, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 20, + }, + "start": Object { + "column": 13, + "line": 20, + }, + }, + "name": "bar", + "range": Array [ + 505, + 508, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 20, + }, + "start": Object { + "column": 18, + "line": 20, + }, + }, + "range": Array [ + 510, + 516, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 20, + }, + "start": Object { + "column": 18, + "line": 20, + }, + }, + "range": Array [ + 510, + 516, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 496, + 524, + ], + "readonly": false, + "static": true, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 20, + }, + "start": Object { + "column": 27, + "line": 20, + }, + }, + "range": Array [ + 519, + 523, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 20, + }, + "start": Object { + "column": 27, + "line": 20, + }, + }, + "range": Array [ + 519, + 523, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 21, + }, + "start": Object { + "column": 11, + "line": 21, + }, + }, + "name": "k", + "range": Array [ + 536, + 537, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 21, + }, + "start": Object { + "column": 4, + "line": 21, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 21, + }, + "start": Object { + "column": 13, + "line": 21, + }, + }, + "name": "bar", + "range": Array [ + 538, + 541, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 21, + }, + "start": Object { + "column": 18, + "line": 21, + }, + }, + "range": Array [ + 543, + 549, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 21, + }, + "start": Object { + "column": 18, + "line": 21, + }, + }, + "range": Array [ + 543, + 549, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 529, + 557, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 21, + }, + "start": Object { + "column": 27, + "line": 21, + }, + }, + "range": Array [ + 552, + 556, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 21, + }, + "start": Object { + "column": 27, + "line": 21, + }, + }, + "range": Array [ + 552, + 556, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 22, + }, + "start": Object { + "column": 13, + "line": 22, + }, + }, + "name": "l", + "range": Array [ + 571, + 572, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 22, + }, + "start": Object { + "column": 4, + "line": 22, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 22, + }, + "start": Object { + "column": 15, + "line": 22, + }, + }, + "name": "bar", + "range": Array [ + 573, + 576, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 22, + }, + "start": Object { + "column": 20, + "line": 22, + }, + }, + "range": Array [ + 578, + 584, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 22, + }, + "start": Object { + "column": 20, + "line": 22, + }, + }, + "range": Array [ + 578, + 584, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 562, + 592, + ], + "readonly": true, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 22, + }, + "start": Object { + "column": 29, + "line": 22, + }, + }, + "range": Array [ + 587, + 591, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 22, + }, + "start": Object { + "column": 29, + "line": 22, + }, + }, + "range": Array [ + 587, + 591, + ], + "type": "TSVoidKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 23, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 594, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 23, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 594, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 23, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 594, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/expressions/call-expression-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 3, + 6, + ], + "type": "TypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 23, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "TSNumberKeyword", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 13, + 21, + ], + "type": "TypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/expressions/new-expression-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 20, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 15, + 18, + ], + "type": "TypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/ambient-module-declaration-with-import.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 34, + 54, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 49, + 53, + ], + "raw": "'fs'", + "type": "Literal", + "value": "fs", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "fs", + "range": Array [ + 41, + 43, + ], + "type": "Identifier", + }, + "range": Array [ + 41, + 43, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 56, + ], + "type": "TSModuleBlock", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "modifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "TSDeclareKeyword", + }, + ], + "name": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 29, + ], + "raw": "\\"i-use-things\\"", + "type": "Literal", + "value": "i-use-things", + }, + "range": Array [ + 0, + 56, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/declare-namespace-with-exported-function.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "declaration": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "select", + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "selector", + "range": Array [ + 48, + 56, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 32, + 82, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 67, + 81, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 67, + 81, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "Selection", + "range": Array [ + 67, + 76, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "TSAnyKeyword", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 76, + 81, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + "type": "TSNamespaceFunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 25, + 82, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 84, + ], + "type": "TSModuleBlock", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "modifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "TSDeclareKeyword", + }, + ], + "name": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "d3", + "range": Array [ + 18, + 20, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 84, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/module-with-default-exports.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "method", + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 52, + 66, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 64, + 66, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 58, + 66, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "C", + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + }, + }, + }, + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 42, + 73, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "C", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 34, + 73, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 73, + ], + "type": "ExportDefaultDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 34, + "line": 5, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 93, + 110, + ], + "type": "TSNamespaceFunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 78, + 110, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 112, + ], + "type": "TSModuleBlock", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "range": Array [ + 0, + 112, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 112, + ], + "sourceType": "script", + "type": "Program", +} +`; + +exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "modifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "TSDeclareKeyword", + }, + ], + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "raw": "\\"hot-new-module\\"", + "type": "Literal", + "value": "hot-new-module", + }, + "range": Array [ + 0, + 32, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "type": "Program", +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index a5ab496744fe..31d9d73ecbf4 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -12,7 +12,6 @@ //------------------------------------------------------------------------------ const path = require("path"), - parser = require("../../parser"), shelljs = require("shelljs"), testUtils = require("../../tools/test-utils"); @@ -46,35 +45,10 @@ describe("basics", () => { }); testFiles.forEach(filename => { - // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - - it("should parse correctly", () => { - const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); - let result; - - try { - result = parser.parse(code, config); - result = testUtils.getRaw(result); - } catch (ex) { - - // format of error isn't exactly the same, just check if it's expected - if (expected.message) { - return; - } - throw ex; - - - } - - // console.log(JSON.stringify(result, null, 4)); - expect(result).toEqual(expected); - - }); - + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); - }); diff --git a/packages/typescript-eslint-parser/tests/lib/comments.js b/packages/typescript-eslint-parser/tests/lib/comments.js index eeac34fc84ed..376877b70bb1 100644 --- a/packages/typescript-eslint-parser/tests/lib/comments.js +++ b/packages/typescript-eslint-parser/tests/lib/comments.js @@ -31,7 +31,6 @@ //------------------------------------------------------------------------------ const path = require("path"), - parser = require("../../parser"), shelljs = require("shelljs"), testUtils = require("../../tools/test-utils"); @@ -68,28 +67,7 @@ describe("Comments", () => { testFiles.forEach(filename => { const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - - it("should produce correct AST when parsed with comment", () => { - const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); - let result; - - try { - result = parser.parse(code, config); - result = testUtils.getRaw(result); - } catch (ex) { - - // format of error isn't exactly the same, just check if it's expected - if (expected.message) { - return; - } - throw ex; - - - } - expect(result).toEqual(expected); - }); - + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); - }); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index b5f9609c680e..8d51513e5680 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -12,7 +12,6 @@ //------------------------------------------------------------------------------ const path = require("path"), - parser = require("../../parser"), shelljs = require("shelljs"), testUtils = require("../../tools/test-utils"); @@ -22,28 +21,17 @@ const path = require("path"), const FIXTURES_DIR = "./tests/fixtures/ecma-features"; -// var FIXTURES_MIX_DIR = "./tests/fixtures/ecma-features-mix"; - const testFiles = shelljs.find(FIXTURES_DIR) .filter(filename => filename.indexOf(".src.js") > -1) // strip off ".src.js" .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)) .filter(filename => !(/error-|invalid-|globalReturn/.test(filename))); -// var moduleTestFiles = testFiles.filter(function(filename) { -// return !/jsx|globalReturn|invalid|experimental|generators|not\-strict/.test(filename); -// }); - -// var mixFiles = shelljs.find(FIXTURES_MIX_DIR).filter(function(filename) { -// return filename.indexOf(".src.js") > -1; -// }).map(function(filename) { -// return filename.substring(FIXTURES_MIX_DIR.length - 1, filename.length - 7); // strip off ".src.js" -// // }).filter(function(filename) { -// // return /template/.test(filename); -// }); - -// console.dir(moduleTestFiles); -// return; +const regexFilenames = [ + "regexYFlag/regexp-y-simple", + "regexUFlag/regex-u-simple", + "regexUFlag/regex-u-extended-escape" +]; //------------------------------------------------------------------------------ // Tests @@ -70,116 +58,43 @@ describe("ecmaFeatures", () => { const feature = path.dirname(filename), code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - it(`should parse correctly when ${feature} is true ${filename}`, () => { - config.ecmaFeatures[feature] = true; - let expected = null; - - const regexFilenames = [ - "regexYFlag/regexp-y-simple", - "regexUFlag/regex-u-simple", - "regexUFlag/regex-u-extended-escape" - ]; - if (regexFilenames.indexOf(filename) !== -1) { - const nodeVersions = process.versions; - const nodeVersionParts = nodeVersions.node.split("."); - const nodeMajorVersion = parseInt(nodeVersionParts[0], 10); - - if (nodeMajorVersion >= 6) { - expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.supported.result.js`); - } else { - expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.unsupported.result.js`); - } - } else { - expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); - } - let result; - - try { - result = parser.parse(code, config); - result = testUtils.getRaw(result); - } catch (ex) { - - // format of error isn't exactly the same, just check if it's expected - if (expected.message) { - return; - } - throw ex; - - - } - expect(result).toEqual(expected); - }); + if (regexFilenames.indexOf(filename) === -1) { + test(`fixtures/${filename}.src`, () => { + config.ecmaFeatures[feature] = true; + testUtils.createSnapshotTestBlock(code, config)(); + }); + return; + } + + /** + * Some regexp flags have different ASTs depending on the current node version, + * so we need to account for this in our test cases. + * + * NOTE: When running the tests for node v5, for example, the snapshots for node v6 + * are irrelevant. Therefore, in order to prevent Jest from marking them as obsolete + * (which would cause the tests to exit with code 1), we make use of `test.skip`. + */ + const nodeVersions = process.versions; + const nodeVersionParts = nodeVersions.node.split("."); + const nodeMajorVersion = parseInt(nodeVersionParts[0], 10); + const NODE_6_AND_ABOVE = `REGEXP FLAG - NODE VERSION >=6: fixtures/${filename}.src`; + const NODE_PRE_6 = `REGEXP FLAG - NODE VERSION <6: fixtures/${filename}.src`; + + if (nodeMajorVersion >= 6) { + test.skip(NODE_PRE_6); + test(NODE_6_AND_ABOVE, () => { + config.ecmaFeatures[feature] = true; + testUtils.createSnapshotTestBlock(code, config)(); + }); + } else { + test.skip(NODE_6_AND_ABOVE); + test(NODE_PRE_6, () => { + config.ecmaFeatures[feature] = true; + testUtils.createSnapshotTestBlock(code, config)(); + }); + } }); - // describe("Modules", function() { - - // leche.withData(moduleTestFiles, function(filename) { - - // var code = shelljs.cat(path.resolve(FIXTURES_DIR, filename) + ".src.js"); - - // it("should parse correctly when sourceType is module", function() { - // var expected = require(path.resolve(__dirname, "../../", FIXTURES_DIR, filename) + ".result.js"); - // var result; - - // config.sourceType = "module"; - - // // set sourceType of program node to module - // if (expected.type === "Program") { - // expected.sourceType = "module"; - // } - - // try { - // result = getRaw(parser.parse(code, config)); - // } catch (ex) { - - // // if the result is an error, create an error object so deepEqual works - // if (expected.message || expected.description) { - // result = getRaw(ex); - // result.message = ex.message; - // } else { - // throw ex; - // } - - // } - - // assert.deepEqual(result, expected); - // }); - - // }); - // }); - - - - // leche.withData(mixFiles, function(filename) { - - // var features = path.dirname(filename), - // code = shelljs.cat(path.resolve(FIXTURES_MIX_DIR, filename) + ".src.js"); - - // it("should parse correctly when " + features + " are true", function() { - // config.ecmaFeatures = require(path.resolve(__dirname, "../../", FIXTURES_MIX_DIR, filename) + ".config.js"); - - // var expected = require(path.resolve(__dirname, "../../", FIXTURES_MIX_DIR, filename) + ".result.js"); - // var result; - - // try { - // result = parser.parse(code, config); - // result = getRaw(result); - // } catch (ex) { - - // // if the result is an error, create an error object so deepEqual works - // if (expected.message || expected.description) { - // result = getRaw(ex); - // result.message = ex.message; - // } else { - // throw ex; - // } - // } - - // assert.deepEqual(result, expected); - // }); - - // }); - }); diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.js b/packages/typescript-eslint-parser/tests/lib/jsx.js index 44812c95c9d6..60e0bdb2562b 100644 --- a/packages/typescript-eslint-parser/tests/lib/jsx.js +++ b/packages/typescript-eslint-parser/tests/lib/jsx.js @@ -12,7 +12,6 @@ //------------------------------------------------------------------------------ const path = require("path"), - parser = require("../../parser"), shelljs = require("shelljs"), testUtils = require("../../tools/test-utils"); @@ -48,20 +47,6 @@ const jsxTextTestFiles = shelljs.find(JSX_JSXTEXT_FIXTURES_DIR) describe("JSX", () => { - let config; - - beforeEach(() => { - config = { - loc: true, - range: true, - tokens: true, - errorOnUnknownASTType: true, - ecmaFeatures: { - jsx: true - } - }; - }); - /** * Test each fixture file * @param {string} fixturesDir Fixtures Directory @@ -75,26 +60,18 @@ describe("JSX", () => { // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const code = shelljs.cat(`${path.resolve(fixturesDir, filename)}.src.js`); - it(`should parse correctly when ${filename} is true`, () => { - config.useJSXTextNode = useJSXTextNode; - const expected = require(`${path.resolve(__dirname, "../../", fixturesDir, filename)}.result.js`); - let result; - - try { - result = parser.parse(code, config); - result = testUtils.getRaw(result); - } catch (ex) { - - // format of error isn't exactly the same, just check if it's expected - if (expected.message) { - return; - } - throw ex; - - + const config = { + loc: true, + range: true, + tokens: true, + errorOnUnknownASTType: true, + useJSXTextNode, + ecmaFeatures: { + jsx: true } - expect(result).toEqual(expected); - }); + }; + + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }; } diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index 5b30bec1c74f..edeeaa892f40 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -44,19 +44,18 @@ describe("parse()", () => { describe("general", () => { - it("should output tokens, comments, locs, and ranges when called with those options", () => { - const ast = parser.parse("let foo = bar;", { - ecmaFeatures: { - blockBindings: true - }, - comment: true, - tokens: true, - range: true, - loc: true - }); - - expect(testUtils.getRaw(ast)).toEqual(require("../fixtures/parse/all-pieces.json")); - }); + const code = "let foo = bar;"; + const config = { + ecmaFeatures: { + blockBindings: true + }, + comment: true, + tokens: true, + range: true, + loc: true + }; + + test("output tokens, comments, locs, and ranges when called with those options", testUtils.createSnapshotTestBlock(code, config)); }); diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index e0d30b05ad92..8e8540eb2c6f 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -12,7 +12,6 @@ //------------------------------------------------------------------------------ const path = require("path"), - parser = require("../../parser"), shelljs = require("shelljs"), testUtils = require("../../tools/test-utils"); @@ -46,35 +45,10 @@ describe("typescript", () => { }); testFiles.forEach(filename => { - // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`); - - it("should parse correctly", () => { - const expected = require(`${path.resolve(__dirname, "../../", FIXTURES_DIR, filename)}.result.js`); - let result; - - try { - result = parser.parse(code, config); - result = testUtils.getRaw(result); - } catch (ex) { - - // format of error isn't exactly the same, just check if it's expected - if (expected.message) { - return; - } - throw ex; - - - } - - // console.log(JSON.stringify(result, null, 4)); - expect(result).toEqual(expected); - - }); - + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); - }); diff --git a/packages/typescript-eslint-parser/tools/test-utils.js b/packages/typescript-eslint-parser/tools/test-utils.js index aa14f38c3845..b93dbc90e902 100644 --- a/packages/typescript-eslint-parser/tools/test-utils.js +++ b/packages/typescript-eslint-parser/tools/test-utils.js @@ -7,6 +7,14 @@ "use strict"; +/* global expect */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const parser = require("../parser"); + //------------------------------------------------------------------------------ // Private //-------------------------------------------------------------------------------- @@ -26,6 +34,35 @@ function getRaw(ast) { })); } +/** + * Returns a function which can be used as the callback of a Jest test() block, + * and which performs an assertion on the snapshot for the given code and config. + * @param {string} code The source code to parse + * @param {*} config the parser configuration + * @returns {Function} callback for Jest test() block + */ +function createSnapshotTestBlock(code, config) { + + /** + * @returns {Object} the AST object + */ + function parse() { + const ast = parser.parse(code, config); + return getRaw(ast); + } + + return () => { + try { + const result = parse(); + expect(result).toMatchSnapshot(); + } catch (e) { + expect(parse).toThrowErrorMatchingSnapshot(); + } + }; + +} + module.exports = { - getRaw + getRaw, + createSnapshotTestBlock }; diff --git a/packages/typescript-eslint-parser/tools/update-typescript-tests.js b/packages/typescript-eslint-parser/tools/update-typescript-tests.js deleted file mode 100644 index 8f3b8b3e5914..000000000000 --- a/packages/typescript-eslint-parser/tools/update-typescript-tests.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @fileoverview A simple script to update existing tests to reflect new - * parser changes. - * @author Nicholas C. Zakas - */ -"use strict"; - - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const shelljs = require("shelljs"), - parser = require("../parser"), - testUtils = require("./test-utils"), - path = require("path"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Returns a raw copy of the given AST - * @param {Object} ast the AST object - * @returns {Object} copy of the AST object - */ -function getRaw(ast) { - return JSON.parse(JSON.stringify(ast)); -} - -/** - * Returns the expected AST - * @param {string} code the source code - * @param {Object} config the parser config - * @returns {Object} the expected AST object - */ -function getExpectedResult(code, config) { - try { - return testUtils.getRaw(parser.parse(code, config)); - } catch (ex) { - const raw = getRaw(ex); - raw.message = ex.message; - return raw; - } -} - -/** - * Returns an array of relevant filenames within the directory - * @param {string} directory path of the directory to scan - * @returns {string[]} list of relevant filenames - */ -function getTestFilenames(directory) { - return shelljs.find(directory).filter(filename => filename.indexOf(".src.ts") > -1).map(filename => filename.substring(directory.length - 1, filename.length - 7) // strip off ".src.ts" - ); -} - -/** - * Writes the given AST to the given filename - * @param {*} result the AST to write to a file - * @param {*} testResultFilename name of the file to write to - * @returns {void} - */ -function outputResult(result, testResultFilename) { - shelljs.echo(`module.exports = ${JSON.stringify(result, null, " ")};`).to(testResultFilename); -} - -//------------------------------------------------------------------------------ -// Setup -//------------------------------------------------------------------------------ - -const FIXTURES_DIR = "./tests/fixtures/typescript"; -const testFiles = getTestFilenames(FIXTURES_DIR); - -testFiles.forEach(filename => { - - const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`), - config = { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {}, - errorOnUnknownASTType: true - }; - - const testResultFilename = `${path.resolve(__dirname, "..", FIXTURES_DIR, filename)}.result.js`; - const result = getExpectedResult(code, config); - - outputResult(result, testResultFilename); - -}); From b7bfe58caf43fb9c66f8f7ddca2c717169a5e311 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 5 Jun 2017 13:26:51 +0100 Subject: [PATCH 166/326] Chore: Add node 8 to .travis.yml (#312) --- packages/typescript-eslint-parser/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index c7e7112d7336..4649f0356776 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -5,5 +5,6 @@ node_js: - "5" - "6" - "7" + - "8" after_success: - npm run coveralls From 634bb2d3bd7e1f24f46860a17021a932ff4d04dd Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 6 Jun 2017 13:17:52 +0100 Subject: [PATCH 167/326] Fix: Use TSNullKeyword for null type instead of Literal (#313) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 19 +- .../lib/node-utils.js | 13 +- ...null-and-undefined-type-annotations.src.ts | 2 + .../lib/__snapshots__/typescript.js.snap | 203 ++++++++++++++++++ 5 files changed, 231 insertions(+), 7 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 10adc1cb4d22..0dc90341c6ae 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -118,6 +118,7 @@ module.exports = { TSModuleDeclaration: "TSModuleDeclaration", TSNamespaceFunctionDeclaration: "TSNamespaceFunctionDeclaration", TSNonNullExpression: "TSNonNullExpression", + TSNullKeyword: "TSNullKeyword", TSNumberKeyword: "TSNumberKeyword", TSParameterProperty: "TSParameterProperty", TSPropertySignature: "TSPropertySignature", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 1d55359f7824..ec939bbb09af 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1574,13 +1574,20 @@ module.exports = function convert(config) { }); break; - case SyntaxKind.NullKeyword: - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - value: null, - raw: "null" - }); + case SyntaxKind.NullKeyword: { + if (nodeUtils.isWithinTypeAnnotation(node)) { + Object.assign(result, { + type: AST_NODE_TYPES.TSNullKeyword + }); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.Literal, + value: null, + raw: "null" + }); + } break; + } case SyntaxKind.EmptyStatement: case SyntaxKind.DebuggerStatement: diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 60fcd64b4ae4..f1b61c3ac6a7 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -197,7 +197,8 @@ module.exports = { getTokenType, convertToken, convertTokens, - getNodeContainer + getNodeContainer, + isWithinTypeAnnotation }; /* eslint-enable no-use-before-define */ @@ -472,6 +473,16 @@ function isOptional(node) { ? (node.questionToken.kind === SyntaxKind.QuestionToken) : false; } +/** + * Returns true if the given TSNode is within the context of a "typeAnnotation", + * which effectively means - is it coming from its parent's `type` or `types` property + * @param {TSNode} node TSNode to be checked + * @returns {boolean} is within "typeAnnotation context" + */ +function isWithinTypeAnnotation(node) { + return node.parent.type === node || (node.parent.types && node.parent.types.indexOf(node) > -1); +} + /** * Fixes the exports of the given TSNode * @param {TSNode} node the TSNode diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts new file mode 100644 index 000000000000..7d6b5821f389 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/null-and-undefined-type-annotations.src.ts @@ -0,0 +1,2 @@ +let x: null; +let y: undefined; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index a079b243a575..efe8d5d323b3 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -15659,6 +15659,209 @@ Object { } `; +exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "TSNullKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TSUndefinedKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "type": "Program", +} +`; + exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` Object { "body": Array [ From 2ec09ad3cadcd119dcf14fb6e3757decab00755e Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Fri, 9 Jun 2017 08:14:19 -0500 Subject: [PATCH 168/326] Fix: Use TSExportAssignment node type (fixes #304) (#317) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 15 +++-- .../basics/export-assignment.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 58 +++++++++++++++++++ 4 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-assignment.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 0dc90341c6ae..fbfbf12ca39a 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -108,6 +108,7 @@ module.exports = { TSConstructSignature: "TSConstructSignature", TSDeclareKeyword: "TSDeclareKeyword", TSEnumDeclaration: "TSEnumDeclaration", + TSExportAssignment: "TSExportAssigment", TSIndexSignature: "TSIndexSignature", TSInterfaceBody: "TSInterfaceBody", TSInterfaceDeclaration: "TSInterfaceDeclaration", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index ec939bbb09af..cab1da76e50c 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1330,10 +1330,17 @@ module.exports = function convert(config) { break; case SyntaxKind.ExportAssignment: - Object.assign(result, { - type: AST_NODE_TYPES.ExportDefaultDeclaration, - declaration: convertChild(node.expression) - }); + if (node.isExportEquals) { + Object.assign(result, { + type: AST_NODE_TYPES.TSExportAssignment, + expression: convertChild(node.expression) + }); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.ExportDefaultDeclaration, + declaration: convertChild(node.expression) + }); + } break; // Unary Operations diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-assignment.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-assignment.src.ts new file mode 100644 index 000000000000..36a5d0e319d8 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-assignment.src.ts @@ -0,0 +1 @@ +export = foo; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index efe8d5d323b3..446061c64074 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -8898,6 +8898,64 @@ Object { } `; +exports[`typescript fixtures/basics/export-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "TSExportAssigment", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "module", + "type": "Program", +} +`; + exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` Object { "body": Array [ From e973e67744f2ff69e8608f52666695c063145a6b Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Fri, 9 Jun 2017 08:15:06 -0500 Subject: [PATCH 169/326] Fix: Ensure JSX tag names are JSXIdentifiers (fixes #315) (#318) --- .../typescript-eslint-parser/lib/convert.js | 1 + .../fixtures/jsx/element-keyword-name.src.js | 5 + .../tests/lib/__snapshots__/jsx.js.snap | 803 ++++++++++++++++++ 3 files changed, 809 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/element-keyword-name.src.js diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index cab1da76e50c..7b807bb8f284 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -291,6 +291,7 @@ module.exports = function convert(config) { tagNameToken.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.JSXMemberExpression : AST_NODE_TYPES.JSXIdentifier; tagNameToken.property.type = AST_NODE_TYPES.JSXIdentifier; } else { + tagNameToken.type = AST_NODE_TYPES.JSXIdentifier; tagNameToken.name = tagNameToken.value; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/element-keyword-name.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/element-keyword-name.src.js new file mode 100644 index 000000000000..55faaf141dc2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/element-keyword-name.src.js @@ -0,0 +1,5 @@ +
+ + + + diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap index 7ec2ae783a7d..b7baabd60e39 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -743,6 +743,809 @@ Object { } `; +exports[`JSX useJSXTextNode: false fixtures/element-keyword-name.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "object", + "range": Array [ + 11, + 17, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 20, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 10, + 20, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "abstract", + "range": Array [ + 26, + 34, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 25, + 37, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 25, + 37, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 37, + 42, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "module", + "range": Array [ + 43, + 49, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 52, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 42, + 52, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "raw": " +", + "type": "Literal", + "value": " +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 55, + 58, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 53, + 59, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 59, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Keyword", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Keyword", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "JSXText", + "value": " +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 55, + 58, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + exports[`JSX useJSXTextNode: false fixtures/embedded-comment.src 1`] = ` Object { "body": Array [ From e109963c099b9226e4d61881db5642dbb71fb700 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 12 Jun 2017 13:14:10 -0500 Subject: [PATCH 170/326] Fix: Calculate correct type parameter range (fixes #316) (#320) --- .../typescript-eslint-parser/lib/convert.js | 13 +- .../basics/type-parameters-comments.src.ts | 3 + .../lib/__snapshots__/typescript.js.snap | 356 ++++++++++++++++++ 3 files changed, 368 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-parameters-comments.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 7b807bb8f284..806b60bc6932 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -101,13 +101,15 @@ module.exports = function convert(config) { function convertTypeArgumentsToTypeParameters(typeArguments) { const firstTypeArgument = typeArguments[0]; const lastTypeArgument = typeArguments[typeArguments.length - 1]; + const greaterThanToken = nodeUtils.findNextToken(lastTypeArgument, ast); + return { type: AST_NODE_TYPES.TypeParameterInstantiation, range: [ firstTypeArgument.pos - 1, - lastTypeArgument.end + 1 + greaterThanToken.end ], - loc: nodeUtils.getLocFor(firstTypeArgument.pos - 1, lastTypeArgument.end + 1, ast), + loc: nodeUtils.getLocFor(firstTypeArgument.pos - 1, greaterThanToken.end, ast), params: typeArguments.map(typeArgument => ({ type: AST_NODE_TYPES.GenericTypeAnnotation, range: [ @@ -131,13 +133,16 @@ module.exports = function convert(config) { function convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { const firstTypeParameter = typeParameters[0]; const lastTypeParameter = typeParameters[typeParameters.length - 1]; + + const greaterThanToken = nodeUtils.findNextToken(lastTypeParameter, ast); + return { type: AST_NODE_TYPES.TypeParameterDeclaration, range: [ firstTypeParameter.pos - 1, - lastTypeParameter.end + 1 + greaterThanToken.end ], - loc: nodeUtils.getLocFor(firstTypeParameter.pos - 1, lastTypeParameter.end + 1, ast), + loc: nodeUtils.getLocFor(firstTypeParameter.pos - 1, greaterThanToken.end, ast), params: typeParameters.map(typeParameter => { const name = nodeUtils.unescapeIdentifier(typeParameter.name.text); diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-parameters-comments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-parameters-comments.src.ts new file mode 100644 index 000000000000..b79b05bda402 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-parameters-comments.src.ts @@ -0,0 +1,3 @@ +foo< /* comment 1 */ A /* comment 2 */ >(); +function bar< /* aaa */ A /* bbb */ >() { } +function baz< /* aaa */ A /* bbb */ = Foo >() { } diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 446061c64074..193113dc4dc7 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -17001,6 +17001,362 @@ Object { } `; +exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 3, + 40, + ], + "type": "TypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "ExpressionStatement", + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 87, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 44, + 87, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "A", + "range": Array [ + 68, + 69, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 56, + 81, + ], + "type": "TypeParameterDeclaration", + }, + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 134, + 137, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "baz", + "range": Array [ + 97, + 100, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 88, + 137, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": null, + "default": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "A", + "range": Array [ + 112, + 129, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 100, + 131, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 137, + ], + "sourceType": "script", + "type": "Program", +} +`; + exports[`typescript fixtures/basics/typed-this.src 1`] = ` Object { "body": Array [ From 8069f080d258495c53791ecd35177895e90cbc4c Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 14 Jun 2017 16:23:42 +0100 Subject: [PATCH 171/326] New: Provider loggerFn option to configure logging (fixes #323) (#324) --- packages/typescript-eslint-parser/parser.js | 40 +- .../tests/lib/__snapshots__/basics.js.snap | 3018 +- .../tests/lib/__snapshots__/comments.js.snap | 9155 +- .../lib/__snapshots__/typescript.js.snap | 70623 +++++++++++----- .../tests/lib/basics.js | 15 +- .../tests/lib/comments.js | 11 +- .../tests/lib/ecma-features.js | 21 +- .../tests/lib/typescript.js | 15 +- 8 files changed, 61119 insertions(+), 21779 deletions(-) diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 0c38df51eac9..944606e34520 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -14,24 +14,8 @@ const astNodeTypes = require("./lib/ast-node-types"), const SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.typescript; const ACTIVE_TYPESCRIPT_VERSION = ts.version; - const isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS); -if (!isRunningSupportedTypeScriptVersion) { - const border = "============="; - const versionWarning = [ - border, - "WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser.", - "You may find that it works just fine, or you may not.", - `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, - `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, - "Please only submit bug reports when using the officially supported version.", - border - ]; - - console.warn(versionWarning.join("\n\n")); // eslint-disable-line no-console -} - let extra; /** @@ -49,7 +33,8 @@ function resetExtra() { errors: [], strict: false, ecmaFeatures: {}, - useJSXTextNode: false + useJSXTextNode: false, + log: console.log // eslint-disable-line no-console }; } @@ -109,6 +94,27 @@ function parse(code, options) { extra.useJSXTextNode = true; } + /** + * Allow the user to override the function used for logging + */ + if (typeof options.loggerFn === "function") { + extra.log = options.loggerFn; + } + + } + + if (!isRunningSupportedTypeScriptVersion) { + const border = "============="; + const versionWarning = [ + border, + "WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser.", + "You may find that it works just fine, or you may not.", + `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, + `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, + "Please only submit bug reports when using the officially supported version.", + border + ]; + extra.log(versionWarning.join("\n\n")); } // Even if jsx option is set in typescript compiler, filename still has to diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap index b6f81770e6a0..eed952e8cbea 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap @@ -109,6 +109,98 @@ Object { 15, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "delete", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], "type": "Program", } `; @@ -422,74 +514,11 @@ Object { 58, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`basics fixtures/identifiers-double-underscore.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "__test", - "range": Array [ - 4, - 10, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 17, - ], - "raw": "'ff'", - "type": "Literal", - "value": "ff", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 17, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 18, + "column": 2, "line": 1, }, "start": Object { @@ -499,128 +528,1699 @@ Object { }, "range": Array [ 0, - 18, + 2, ], - "type": "VariableDeclaration", + "type": "Keyword", + "value": "do", }, Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 3, - }, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, }, - "range": Array [ - 32, - 36, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, + "start": Object { + "column": 2, + "line": 1, }, - "name": "__Foo", - "range": Array [ - 26, - 31, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 9, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 4, + "line": 1, }, }, "range": Array [ - 20, - 36, + 4, + 9, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Keyword", + "value": "while", }, Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 17, - "line": 7, - }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 55, - 59, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 7, - }, - "start": Object { - "column": 9, - "line": 7, - }, + "start": Object { + "column": 9, + "line": 1, }, - "name": "__Bar", - "range": Array [ - 47, - 52, - ], - "type": "Identifier", }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, - "line": 7, + "column": 10, + "line": 1, }, }, - "params": Array [], "range": Array [ - 38, + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Keyword", + "value": "do", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "Punctuator", + "value": "+=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 44, + 49, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`basics fixtures/identifiers-double-underscore.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "__test", + "range": Array [ + 4, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "raw": "'ff'", + "type": "Literal", + "value": "ff", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "__Foo", + "range": Array [ + 26, + 31, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 36, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 55, + 59, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "__Bar", + "range": Array [ + 47, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "params": Array [], + "range": Array [ + 38, + 59, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 10, + ], + "type": "Identifier", + "value": "__test", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "String", + "value": "'ff'", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "Identifier", + "value": "__Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 47, + 52, + ], + "type": "Identifier", + "value": "__Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 58, 59, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`basics fixtures/instanceof.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "instanceof", + "range": Array [ + 0, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Set", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 13, + ], + "type": "Keyword", + "value": "instanceof", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Set", + }, + ], + "type": "Program", +} +`; + +exports[`basics fixtures/new-with-member-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 4, + 11, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "NewExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`basics fixtures/new-without-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 16, + ], + "type": "FunctionDeclaration", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "X", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "NewExpression", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`basics fixtures/typeof-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "'str'", + "type": "Literal", + "value": "str", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 0, + 12, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 12, + "line": 1, }, "start": Object { "column": 0, @@ -629,205 +2229,298 @@ Object { }, "range": Array [ 0, - 59, + 12, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "'str'", + }, + ], "type": "Program", } `; -exports[`basics fixtures/instanceof.src 1`] = ` +exports[`basics fixtures/update-expression.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "i", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, "loc": Object { "end": Object { - "column": 2, + "column": 9, "line": 1, }, "start": Object { - "column": 0, + "column": 4, "line": 1, }, }, "range": Array [ - 0, - 2, + 4, + 9, ], - "raw": "''", - "type": "Literal", - "value": "", + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "i", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 28, + 31, + ], + "type": "UpdateExpression", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ExpressionStatement", + }, + ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 13, + "line": 2, }, }, - "operator": "instanceof", "range": Array [ - 0, - 17, + 24, + 34, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, }, - "name": "Set", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", }, - "type": "BinaryExpression", + "name": "f", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, - "range": Array [ - 0, - 17, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "params": Array [], + "range": Array [ + 11, + 34, + ], + "type": "FunctionDeclaration", }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`basics fixtures/new-with-member-expression.src 1`] = ` -Object { - "body": Array [ Object { "expression": Object { "arguments": Array [], "callee": Object { - "computed": false, "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 4, - "line": 1, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "column": 0, + "line": 5, }, - "name": "bar", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", }, + "name": "f", "range": Array [ - 4, - 11, + 35, + 36, ], - "type": "MemberExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 13, + 35, + 38, ], - "type": "NewExpression", + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 4, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 14, + 35, + 39, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 4, + "line": 5, }, "start": Object { "column": 0, @@ -836,396 +2529,245 @@ Object { }, "range": Array [ 0, - 14, + 39, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`basics fixtures/new-without-parens.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 14, - 16, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, }, - "name": "X", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "i", + }, + Object { "loc": Object { "end": Object { - "column": 16, + "column": 7, "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, - "params": Array [], "range": Array [ - 0, - 16, + 6, + 7, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": "=", }, Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "X", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, }, - "range": Array [ - 17, - 22, - ], - "type": "NewExpression", }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "f", + }, + Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 2, }, "start": Object { - "column": 0, + "column": 10, "line": 2, }, }, "range": Array [ - 17, - 23, + 21, + 22, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 6, - "line": 2, + "type": "Punctuator", + "value": "(", }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 23, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`basics fixtures/typeof-expression.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 12, - ], - "raw": "'str'", - "type": "Literal", - "value": "str", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "operator": "typeof", - "prefix": true, - "range": Array [ - 0, - 12, - ], - "type": "UnaryExpression", - }, "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 0, - 12, + 22, + 23, ], - "type": "ExpressionStatement", + "type": "Punctuator", + "value": ")", }, - ], - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 12, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`basics fixtures/update-expression.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "i", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "raw": "0", - "type": "Literal", - "value": 0, - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 9, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, }, + }, + "range": Array [ + 24, + 25, ], - "kind": "var", + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 3, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 0, - 10, + 28, + 29, ], - "type": "VariableDeclaration", + "type": "Identifier", + "value": "i", }, Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "i", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "operator": "++", - "prefix": false, - "range": Array [ - 28, - 31, - ], - "type": "UpdateExpression", - }, - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 28, - 32, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 24, - 34, - ], - "type": "BlockStatement", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, + "range": Array [ + 29, + 31, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, }, - "name": "f", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { "column": 1, @@ -1233,85 +2775,89 @@ Object { }, "start": Object { "column": 0, - "line": 2, + "line": 4, }, }, - "params": Array [], "range": Array [ - 11, + 33, 34, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": "}", }, Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "name": "f", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 1, + "line": 5, }, - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, + "start": Object { + "column": 0, + "line": 5, }, - "range": Array [ - 35, - 38, - ], - "type": "CallExpression", }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "f", + }, + Object { "loc": Object { "end": Object { - "column": 4, + "column": 2, "line": 5, }, "start": Object { - "column": 0, + "column": 1, "line": 5, }, }, "range": Array [ - 35, - 39, + 36, + 37, ], - "type": "ExpressionStatement", + "type": "Punctuator", + "value": "(", }, - ], - "loc": Object { - "end": Object { - "column": 4, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 39, ], - "sourceType": "script", "type": "Program", } `; @@ -1445,6 +2991,152 @@ Object { 16, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], "type": "Program", } `; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap index 920218ab9335..b8f6fb078fe4 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap @@ -76,6 +76,26 @@ Object { "type": "BlockStatement", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 15, + 24, + ], + "type": "Line", + "value": "comment", + }, + ], "loc": Object { "end": Object { "column": 1, @@ -91,6 +111,116 @@ Object { 26, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -153,6 +283,44 @@ Object { "type": "IfStatement", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Block", + "value": " foo ", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Block", + "value": " bar ", + }, + ], "loc": Object { "end": Object { "column": 20, @@ -168,6 +336,116 @@ Object { 30, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Keyword", + "value": "if", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -313,6 +591,48 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "type": "Block", + "value": "* + * this is anonymous class. + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 63, + 98, + ], + "type": "Block", + "value": "* + * this is method1. + ", + }, + ], "loc": Object { "end": Object { "column": 1, @@ -328,235 +648,193 @@ Object { 121, ], "sourceType": "module", - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-block-comment.src 1`] = `"Unterminated regular expression literal."`; - -exports[`Comments fixtures/jsx-tag-comments.src 1`] = `"Type expected."`; - -exports[`Comments fixtures/line-comment-with-block-syntax.src 1`] = ` -Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 1, + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Keyword", + "value": "export", }, - "start": Object { - "column": 0, - "line": 2, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 43, + 50, + ], + "type": "Keyword", + "value": "default", }, - }, - "range": Array [ - 12, - 0, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/mix-line-and-block-comments.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "zzz", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 24, - 27, - ], - "raw": "777", - "type": "Literal", - "value": 777, - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 10, - 27, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, }, + }, + "range": Array [ + 51, + 56, ], - "kind": "var", + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { "column": 22, - "line": 2, + "line": 4, }, "start": Object { - "column": 0, - "line": 2, + "column": 21, + "line": 4, }, }, "range": Array [ - 6, - 28, + 57, + 58, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 22, - "line": 2, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 103, + 110, + ], + "type": "Identifier", + "value": "method1", }, - "start": Object { - "column": 0, - "line": 2, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 6, - 28, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/no-comment-regex.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "regex", - "range": Array [ - 6, - 11, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 33, - ], - "raw": "/no comment\\\\/**foo/", - "regex": Object { - "flags": "", - "pattern": "no comment\\\\/**foo", - }, - "type": "Literal", - "value": null, - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 33, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, }, + }, + "range": Array [ + 111, + 112, ], - "kind": "const", + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 14, + "line": 8, }, "start": Object { - "column": 0, - "line": 1, + "column": 13, + "line": 8, }, }, "range": Array [ - 0, - 34, + 112, + 113, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 34, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": "}", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 34, ], - "sourceType": "script", "type": "Program", } `; -exports[`Comments fixtures/no-comment-template.src 1`] = ` +exports[`Comments fixtures/jsx-block-comment.src 1`] = ` Object { "body": Array [ Object { @@ -565,7 +843,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 1, }, "start": Object { @@ -573,100 +851,242 @@ Object { "line": 1, }, }, - "name": "str", + "name": "pure", "range": Array [ 6, - 9, + 10, ], "type": "Identifier", }, "init": Object { - "expressions": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 60, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 72, + ], + "type": "JSXEmptyExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 60, + 73, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 73, + 82, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "name": "Foo", + "range": Array [ + 84, + 87, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 82, + 88, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 47, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 42, + 88, + ], + "type": "JSXElement", }, - "start": Object { - "column": 15, - "line": 1, + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "range": Array [ + 25, + 95, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 1, }, - "name": "__dirname", - "range": Array [ - 15, - 24, - ], - "type": "Identifier", }, - ], + "range": Array [ + 19, + 97, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 7, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, - "quasis": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 15, - ], - "tail": false, - "type": "TemplateElement", - "value": Object { - "cooked": "", - "raw": "", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 36, - ], - "tail": true, - "type": "TemplateElement", - "value": Object { - "cooked": "/test/*.js", - "raw": "/test/*.js", - }, - }, - ], + "params": Array [], "range": Array [ - 12, - 36, + 13, + 97, ], - "type": "TemplateLiteral", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 7, }, "start": Object { "column": 6, @@ -675,7 +1095,7 @@ Object { }, "range": Array [ 6, - 36, + 97, ], "type": "VariableDeclarator", }, @@ -683,8 +1103,8 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 1, + "line": 7, }, "start": Object { "column": 0, @@ -693,15 +1113,35 @@ Object { }, "range": Array [ 0, - 37, + 97, ], "type": "VariableDeclaration", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 72, + ], + "type": "Block", + "value": "COMMENT", + }, + ], "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 1, + "line": 7, }, "start": Object { "column": 0, @@ -710,808 +1150,647 @@ Object { }, "range": Array [ 0, - 37, + 97, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/surrounding-call-comments.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "foo", - "range": Array [ - 36, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 36, - 41, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 36, - 42, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 60, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 5, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [], "range": Array [ 0, - 60, + 5, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + "type": "Keyword", + "value": "const", }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 60, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/surrounding-debugger-comments.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 36, - 45, - ], - "type": "DebuggerStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 13, - 63, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 12, + "line": 1, }, "start": Object { - "column": 0, + "column": 11, "line": 1, }, }, - "params": Array [], "range": Array [ - 0, - 63, + 11, + 12, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "=", }, - }, - "range": Array [ - 0, - 63, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/surrounding-return-comments.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 36, - 43, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 13, - 61, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "start": Object { + "column": 13, + "line": 1, }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 15, + "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, - "params": Array [], "range": Array [ - 0, - 61, + 14, + 15, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": ")", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 61, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/surrounding-throw-comments.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 42, - 44, - ], - "raw": "55", - "type": "Literal", - "value": 55, - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 36, - 45, - ], - "type": "ThrowStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, }, - "range": Array [ - 13, - 63, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 9, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 3, }, }, - "params": Array [], "range": Array [ - 0, - 63, + 42, + 43, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": "<", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + "value": "Foo", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", }, - }, - "range": Array [ - 0, - 63, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/surrounding-while-loop-comments.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 46, - ], - "type": "BlockStatement", - }, - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 46, - ], - "test": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 37, - "line": 1, - }, - }, - "range": Array [ - 37, - 41, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - "type": "WhileStatement", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 65, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "name": "each", - "range": Array [ - 61, - 65, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 65, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "range": Array [ - 61, - 65, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 66, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 66, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 68, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 3, }, - "range": Array [ - 13, - 68, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 47, + 60, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, }, - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 68, - "line": 1, + "column": 25, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 24, + "line": 4, }, }, - "params": Array [], "range": Array [ - 0, - 68, + 72, + 73, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": "}", }, - ], - "loc": Object { - "end": Object { - "column": 68, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 73, + 82, + ], + "type": "JSXText", + "value": " + ", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 84, + 87, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 68, ], - "sourceType": "script", "type": "Program", } `; -exports[`Comments fixtures/switch-fallthrough-comment.src 1`] = ` +exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` Object { "body": Array [ Object { - "cases": Array [ + "declarations": Array [ Object { - "consequent": Array [], - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 29, - 36, - ], - "test": Object { + "id": Object { "loc": Object { "end": Object { "column": 10, - "line": 3, + "line": 1, }, "start": Object { - "column": 9, - "line": 3, + "column": 6, + "line": 1, }, }, + "name": "pure", "range": Array [ - 34, - 35, + 6, + 10, ], - "raw": "1", - "type": "Literal", - "value": 1, + "type": "Identifier", }, - "type": "SwitchCase", - }, - Object { - "consequent": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 103, + 112, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "name": "Foo", + "range": Array [ + 114, + 117, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 112, + 118, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 103, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 42, + 118, + ], + "type": "JSXElement", + }, "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 6, + "line": 8, }, "start": Object { - "column": 8, - "line": 6, + "column": 4, + "line": 2, }, }, - "name": "doIt", "range": Array [ - 82, - 86, + 25, + 125, ], - "type": "Identifier", + "type": "ReturnStatement", }, - "loc": Object { - "end": Object { - "column": 14, - "line": 6, - }, - "start": Object { - "column": 8, - "line": 6, - }, - }, - "range": Array [ - 82, - 88, - ], - "type": "CallExpression", - }, + ], "loc": Object { "end": Object { - "column": 15, - "line": 6, + "column": 1, + "line": 9, }, "start": Object { - "column": 8, - "line": 6, + "column": 19, + "line": 1, }, }, "range": Array [ - 82, - 89, + 19, + 127, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 5, + "type": "BlockStatement", }, - }, - "range": Array [ - 66, - 89, - ], - "test": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 10, - "line": 5, + "column": 1, + "line": 9, }, "start": Object { - "column": 9, - "line": 5, + "column": 13, + "line": 1, }, }, + "params": Array [], "range": Array [ - 71, - 72, + 13, + 127, ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "type": "SwitchCase", - }, - ], - "discriminant": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, + "type": "ArrowFunctionExpression", }, - "start": Object { - "column": 7, - "line": 1, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "range": Array [ + 6, + 127, + ], + "type": "VariableDeclarator", }, - "name": "foo", - "range": Array [ - 7, - 10, - ], - "type": "Identifier", - }, + ], + "kind": "const", "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 9, }, "start": Object { "column": 0, @@ -1520,15 +1799,53 @@ Object { }, "range": Array [ 0, - 91, + 127, ], - "type": "SwitchStatement", + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 59, + 68, + ], + "type": "Line", + "value": " single", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 81, + 92, + ], + "type": "Block", + "value": " block ", }, ], "loc": Object { "end": Object { "column": 1, - "line": 7, + "line": 9, }, "start": Object { "column": 0, @@ -1537,362 +1854,385 @@ Object { }, "range": Array [ 0, - 91, + 127, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/switch-fallthrough-comment-in-function.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "cases": Array [ - Object { - "consequent": Array [], - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 61, - 68, - ], - "test": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "range": Array [ - 66, - 67, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "SwitchCase", - }, - Object { - "consequent": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 7, - }, - "start": Object { - "column": 12, - "line": 7, - }, - }, - "name": "doIt", - "range": Array [ - 126, - 130, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 7, - }, - "start": Object { - "column": 12, - "line": 7, - }, - }, - "range": Array [ - 126, - 132, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 7, - }, - "start": Object { - "column": 12, - "line": 7, - }, - }, - "range": Array [ - 126, - 133, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 19, - "line": 7, - }, - "start": Object { - "column": 8, - "line": 6, - }, - }, - "range": Array [ - 106, - 133, - ], - "test": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 6, - }, - "start": Object { - "column": 13, - "line": 6, - }, - }, - "range": Array [ - 111, - 112, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "type": "SwitchCase", - }, - ], - "discriminant": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 31, - 34, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 5, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 24, - 139, - ], - "type": "SwitchStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 18, - 141, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "start": Object { + "column": 0, + "line": 1, }, - "name": "bar", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 10, + "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, + "range": Array [ + 6, + 10, ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, "range": Array [ - 0, - 141, + 11, + 12, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": "=", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 9, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 141, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`Comments fixtures/switch-no-default-comment.src 1`] = ` -Object { - "body": Array [ Object { - "cases": Array [ - Object { - "consequent": Array [ - Object { - "label": null, - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 33, - 39, - ], - "type": "BreakStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 17, - 39, - ], - "test": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "SwitchCase", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, }, + }, + "range": Array [ + 16, + 18, ], - "discriminant": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 103, + 112, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 114, + 117, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, }, - "name": "a", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/line-comment-with-block-syntax.src 1`] = ` +Object { + "body": Array [], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, "start": Object { "column": 0, @@ -1901,412 +2241,4893 @@ Object { }, "range": Array [ 0, - 58, + 11, ], - "type": "SwitchStatement", + "type": "Line", + "value": " /*test*/", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 1, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ + 12, 0, - 58, ], "sourceType": "script", + "tokens": Array [], "type": "Program", } `; -exports[`Comments fixtures/switch-no-default-comment-in-function.src 1`] = ` +exports[`Comments fixtures/mix-line-and-block-comments.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "cases": Array [ - Object { - "consequent": Array [ - Object { - "label": null, - "loc": Object { - "end": Object { - "column": 18, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 63, - 69, - ], - "type": "BreakStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 43, - 69, - ], - "test": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "range": Array [ - 48, - 49, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "type": "SwitchCase", - }, - Object { - "consequent": Array [ - Object { - "label": null, - "loc": Object { - "end": Object { - "column": 18, - "line": 6, - }, - "start": Object { - "column": 12, - "line": 6, - }, - }, - "range": Array [ - 98, - 104, - ], - "type": "BreakStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 6, - }, - "start": Object { - "column": 8, - "line": 5, - }, - }, - "range": Array [ - 78, - 104, - ], - "test": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 5, - }, - }, - "range": Array [ - 83, - 84, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "SwitchCase", + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, }, - ], - "discriminant": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, + "start": Object { + "column": 4, + "line": 2, }, - "name": "a", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", }, + "name": "zzz", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "init": Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 21, + "line": 2, }, "start": Object { - "column": 4, + "column": 18, "line": 2, }, }, "range": Array [ - 22, - 131, + 24, + 27, ], - "type": "SwitchStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 133, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "raw": "777", + "type": "Literal", + "value": 777, }, - }, - "name": "bar", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 4, + "line": 2, }, }, - "name": "a", "range": Array [ - 13, - 14, + 10, + 27, ], - "type": "Identifier", + "type": "VariableDeclarator", }, ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, "range": Array [ - 0, - 133, + 6, + 28, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, ], - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Line", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Block", + "value": "aaa", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "Line", + "value": "bar", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 133, + 6, + 28, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "zzz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Numeric", + "value": "777", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], "type": "Program", } `; -exports[`Comments fixtures/switch-no-default-comment-in-nested-functions.src 1`] = ` +exports[`Comments fixtures/no-comment-regex.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "object": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, - "name": "module", + "name": "regex", "range": Array [ - 0, 6, + 11, ], "type": "Identifier", }, - "property": Object { + "init": Object { "loc": Object { "end": Object { - "column": 14, + "column": 33, "line": 1, }, "start": Object { - "column": 7, + "column": 14, "line": 1, }, }, - "name": "exports", "range": Array [ - 7, 14, + 33, ], - "type": "Identifier", + "raw": "/no comment\\\\/**foo/", + "regex": Object { + "flags": "", + "pattern": "no comment\\\\/**foo", + }, + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, "range": Array [ - 0, - 14, + 6, + 33, ], - "type": "MemberExpression", + "type": "VariableDeclarator", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 1, - }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 34, + "line": 1, }, - "operator": "=", - "range": Array [ - 0, - 286, - ], - "right": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "cases": Array [ - Object { - "consequent": Array [ - Object { - "argument": Object { - "arguments": Array [ - Object { - "computed": true, - "loc": Object { - "end": Object { - "column": 79, - "line": 6, - }, - "start": Object { - "column": 34, - "line": 6, - }, - }, - "object": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 50, - "line": 6, - }, - "start": Object { - "column": 34, - "line": 6, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 6, - }, - "start": Object { - "column": 34, - "line": 6, - }, - }, - "name": "node", - "range": Array [ - 172, - 176, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "regex", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 33, + ], + "regex": Object { + "flags": "", + "pattern": "no comment\\\\/**foo", + }, + "type": "RegularExpression", + "value": "/no comment\\\\/**foo/", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/no-comment-template.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "str", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "init": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "__dirname", + "range": Array [ + 15, + 24, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 36, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "/test/*.js", + "raw": "/test/*.js", + }, + }, + ], + "range": Array [ + 12, + 36, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 36, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "str", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Template", + "value": "\`\${", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 24, + ], + "type": "Identifier", + "value": "__dirname", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 36, + ], + "type": "Template", + "value": "}/test/*.js\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-call-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "foo", + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 60, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 60, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 58, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-debugger-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 45, + ], + "type": "DebuggerStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 50, + 61, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 44, + ], + "type": "Keyword", + "value": "debugger", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-return-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 61, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 48, + 59, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-throw-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 44, + ], + "raw": "55", + "type": "Literal", + "value": 55, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 45, + ], + "type": "ThrowStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 50, + 61, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Keyword", + "value": "throw", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 44, + ], + "type": "Numeric", + "value": "55", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/surrounding-while-loop-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 46, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 41, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "name": "each", + "range": Array [ + 61, + 65, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 66, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 68, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 68, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 29, + ], + "type": "Block", + "value": " infinite ", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "Block", + "value": " bar ", + }, + ], + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 41, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 65, + ], + "type": "Identifier", + "value": "each", + }, + Object { + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-fallthrough-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 29, + 36, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "doIt", + "range": Array [ + 82, + 86, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 89, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 66, + 89, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "type": "SwitchStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Line", + "value": " foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 45, + 61, + ], + "type": "Line", + "value": " falls through", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 66, + 70, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "Identifier", + "value": "doIt", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-fallthrough-comment-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 61, + 68, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "doIt", + "range": Array [ + 126, + 130, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 126, + 133, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 106, + 133, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 139, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 141, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 141, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Line", + "value": " foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 81, + 97, + ], + "type": "Line", + "value": " falls through", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 141, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 61, + 65, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 106, + 110, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 126, + 130, + ], + "type": "Identifier", + "value": "doIt", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-no-default-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 39, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "type": "SwitchStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 44, + 56, + ], + "type": "Line", + "value": "no default", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-no-default-comment-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 43, + 69, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 104, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 131, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 133, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 133, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 113, + 125, + ], + "type": "Line", + "value": "no default", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 133, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 82, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 98, + 103, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/switch-no-default-comment-in-nested-functions.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "module", + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "exports", + "range": Array [ + 7, + 14, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 14, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 286, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "argument": Object { + "arguments": Array [ + Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 79, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 50, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "name": "node", + "range": Array [ + 172, + 176, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { "end": Object { "column": 50, "line": 6, @@ -2785,40 +7606,944 @@ Object { ], "type": "FunctionExpression", }, - "type": "AssignmentExpression", + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 287, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 232, + 245, + ], + "type": "Line", + "value": " no default", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 287, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Identifier", + "value": "exports", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + "value": "context", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 42, + 50, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 51, + 61, + ], + "type": "Identifier", + "value": "isConstant", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 86, + 90, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 115, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 116, + 136, + ], + "type": "String", + "value": "\\"SequenceExpression\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 154, + 160, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 161, + 171, + ], + "type": "Identifier", + "value": "isConstant", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "range": Array [ + 172, + 176, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 38, + "line": 6, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 6, + }, + "start": Object { + "column": 39, + "line": 6, + }, + }, + "range": Array [ + 177, + 188, + ], + "type": "Identifier", + "value": "expressions", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 6, + }, + "start": Object { + "column": 50, + "line": 6, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "range": Array [ + 189, + 193, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 6, + }, + "start": Object { + "column": 55, + "line": 6, + }, + }, + "range": Array [ + 193, + 194, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 6, + }, + "start": Object { + "column": 56, + "line": 6, + }, + }, + "range": Array [ + 194, + 205, + ], + "type": "Identifier", + "value": "expressions", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 6, + }, + "start": Object { + "column": 67, + "line": 6, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 6, + }, + "start": Object { + "column": 68, + "line": 6, + }, + }, + "range": Array [ + 206, + 212, + ], + "type": "Identifier", + "value": "length", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 6, + }, + "start": Object { + "column": 75, + "line": 6, + }, + }, + "range": Array [ + 213, + 214, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 6, + }, + "start": Object { + "column": 77, + "line": 6, + }, + }, + "range": Array [ + 215, + 216, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 6, + }, + "start": Object { + "column": 78, + "line": 6, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 6, + }, + "start": Object { + "column": 79, + "line": 6, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 81, + "line": 6, + }, + "start": Object { + "column": 80, + "line": 6, + }, }, + "range": Array [ + 218, + 219, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { - "column": 2, + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 254, + 255, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 264, + 270, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 271, + 276, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 276, + 277, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 282, + 283, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, "line": 12, }, "start": Object { "column": 0, - "line": 1, + "line": 12, }, }, "range": Array [ - 0, - 287, + 285, + 286, ], - "type": "ExpressionStatement", + "type": "Punctuator", + "value": "}", }, - ], - "loc": Object { - "end": Object { - "column": 2, - "line": 12, - }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "start": Object { + "column": 1, + "line": 12, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 287, ], - "sourceType": "script", "type": "Program", } `; @@ -3019,6 +8744,26 @@ Object { "type": "BlockStatement", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 17, + 51, + ], + "type": "Block", + "value": " TODO comment comment comment ", + }, + ], "loc": Object { "end": Object { "column": 1, @@ -3034,6 +8779,188 @@ Object { 64, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Template", + "value": "\`\${", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 193113dc4dc7..77fddad952d7 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -157,6 +157,206 @@ Object { 68, ], "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "value": "AbstractSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 52, + 63, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -425,6 +625,296 @@ Object { 86, ], "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "value": "AbstractSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 52, + 64, + ], + "type": "Identifier", + "value": "createSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 75, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -607,131 +1097,367 @@ Object { 62, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/abstract-class-with-abstract-readonly-property.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": "public", - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 48, - 51, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 42, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 23, - 63, - ], - "readonly": true, - "static": false, - "type": "TSAbstractClassProperty", - "typeAnnotation": null, - "value": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 54, - 62, - ], - "raw": "'string'", - "type": "Literal", - "value": "string", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 19, - 65, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "start": Object { + "column": 0, + "line": 1, }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 0, + "column": 9, "line": 1, }, }, "range": Array [ - 0, - 65, + 9, + 14, ], - "superClass": null, - "type": "TSAbstractClassDeclaration", + "type": "Keyword", + "value": "class", }, - ], + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/abstract-class-with-abstract-readonly-property.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 63, + ], + "readonly": true, + "static": false, + "type": "TSAbstractClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 54, + 62, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 65, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "TSAbstractClassDeclaration", + }, + ], "loc": Object { "end": Object { "column": 1, @@ -747,6 +1473,224 @@ Object { 65, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 39, + 47, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 54, + 62, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -1016,56 +1960,346 @@ Object { 78, ], "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/abstract-interface.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "declaration": Object { - "abstract": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 31, - ], - "type": "TSInterfaceBody", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, }, - "heritage": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "I", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", + "start": Object { + "column": 0, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 1, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "value": "AbstractSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + "value": "createSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 60, + 67, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/abstract-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "I", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, "line": 2, }, "start": Object { @@ -1113,6 +2347,116 @@ Object { 31, ], "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 25, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "I", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -1390,140 +2734,648 @@ Object { 33, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "async": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 26, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "test", - "range": Array [ - 16, - 20, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 1, - 26, - ], - "type": "FunctionExpression", + "loc": Object { + "end": Object { + "column": 1, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 4, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 0, - 29, - ], - "type": "CallExpression", }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 2, + "line": 1, }, "start": Object { - "column": 0, + "column": 1, "line": 1, }, }, "range": Array [ - 0, - 30, + 1, + 2, ], - "type": "ExpressionStatement", + "type": "Identifier", + "value": "X", }, - ], - "loc": Object { - "end": Object { - "column": 5, - "line": 2, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 30, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/async-function-with-var-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, }, "start": Object { "column": 8, @@ -1808,36 +3660,434 @@ Object { 96, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-accessibility-modifiers.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": "private", - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 22, - 25, - ], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 38, + 43, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 59, + 64, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + "value": "fooBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 93, + ], + "type": "String", + "value": "'fooBar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-accessibility-modifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 22, + 25, + ], "type": "Identifier", }, "loc": Object { @@ -2430,710 +4680,751 @@ Object { 173, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 16, - 27, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 16, - 54, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 46, - 54, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "accessibility": null, - "decorators": Array [], - "export": true, - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 44, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 44, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 28, - 44, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 27, - 54, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 10, - 56, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 56, + 10, + 11, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "private", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "bar", }, - }, - "range": Array [ - 0, - 56, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-extends-generic.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, }, - "range": Array [ - 28, - 32, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "value": "string", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 3, }, }, "range": Array [ - 0, - 32, + 38, + 44, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, }, - "name": "Bar", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", }, - "superTypeParameters": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, + "range": Array [ + 45, + 51, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 24, - 27, - ], - "type": "TypeParameterInstantiation", }, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 10, - 11, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 9, - 12, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "number", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 32, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-extends-generic-multiple.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 41, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, }, - "range": Array [ - 41, - 45, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 68, + 74, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 17, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 16, + "line": 4, }, }, "range": Array [ - 0, - 45, + 82, + 83, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, }, - "name": "Bar", - "range": Array [ - 31, - 34, - ], - "type": "Identifier", }, - "superTypeParameters": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "name": "C", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "name": "D", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 34, - 40, - ], - "type": "TypeParameterInstantiation", }, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, }, - "params": Array [ - Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 10, - 21, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 9, - 22, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 91, + 97, + ], + "type": "Keyword", + "value": "return", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 102, + ], + "type": "Keyword", + "value": "this", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 114, + 123, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "setBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 132, + 135, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 138, + 144, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 32, + "line": 7, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 7, + }, + "start": Object { + "column": 34, + "line": 7, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 156, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 157, + 160, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 45, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/class-with-generic-method.src 1`] = ` +exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` Object { "body": Array [ Object { @@ -3142,39 +5433,38 @@ Object { Object { "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, - "name": "getBar", + "name": "constructor", "range": Array [ - 14, - 20, + 16, + 27, ], "type": "Identifier", }, - "kind": "method", + "kind": "constructor", "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 14, - 28, + 16, + 54, ], "static": false, "type": "MethodDefinition", @@ -3184,17 +5474,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 14, + "column": 34, "line": 2, }, }, "range": Array [ - 26, - 28, + 46, + 54, ], "type": "BlockStatement", }, @@ -3203,65 +5493,102 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 4, }, "start": Object { - "column": 8, + "column": 15, "line": 2, }, }, - "params": Array [], - "range": Array [ - 23, - 28, - ], - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, + "params": Array [ + Object { + "accessibility": null, + "decorators": Array [], + "export": true, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, }, - }, - "params": Array [ - Object { - "constraint": null, + "parameter": Object { "loc": Object { "end": Object { - "column": 10, + "column": 24, "line": 2, }, "start": Object { - "column": 9, + "column": 23, "line": 2, }, }, - "name": "T", + "name": "a", "range": Array [ - 21, - 22, + 35, + 36, ], - "type": "TypeParameter", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, + }, }, - ], - "range": Array [ - 20, - 23, - ], - "type": "TypeParameterDeclaration", - }, + "range": Array [ + 28, + 44, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 27, + 54, + ], + "type": "FunctionExpression", }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 10, @@ -3270,7 +5597,7 @@ Object { }, "range": Array [ 10, - 30, + 56, ], "type": "ClassBody", }, @@ -3297,7 +5624,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -3306,7 +5633,7 @@ Object { }, "range": Array [ 0, - 30, + 56, ], "superClass": null, "type": "ClassDeclaration", @@ -3315,7 +5642,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -3324,186 +5651,268 @@ Object { }, "range": Array [ 0, - 30, + 56, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; -exports[`typescript fixtures/basics/class-with-generic-method-default.src 1`] = ` +exports[`typescript fixtures/basics/class-with-extends-generic.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "getBar", - "range": Array [ - 14, - 20, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 34, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 32, - 34, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 29, - 34, - ], - "type": "FunctionExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "params": Array [ - Object { - "constraint": null, - "default": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "name": "Bar", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "T", - "range": Array [ - 21, - 28, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 20, - 29, - ], - "type": "TypeParameterDeclaration", - }, - }, - }, - ], + "body": Array [], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 10, + "column": 28, "line": 1, }, }, "range": Array [ - 10, - 36, + 28, + 32, ], "type": "ClassBody", }, @@ -3539,125 +5948,120 @@ Object { }, "range": Array [ 0, - 36, + 32, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-implements.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], + "superClass": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 24, + "line": 1, }, "start": Object { - "column": 25, + "column": 21, "line": 1, }, }, + "name": "Bar", "range": Array [ - 25, - 29, + 21, + 24, ], - "type": "ClassBody", + "type": "Identifier", }, - "decorators": Array [], - "id": Object { + "superTypeParameters": Object { "loc": Object { "end": Object { - "column": 9, + "column": 27, "line": 1, }, "start": Object { - "column": 6, + "column": 24, "line": 1, }, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "id": Object { + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { - "column": 21, + "column": 25, "line": 1, }, }, - "name": "Bar", "range": Array [ - 21, - 24, + 25, + 26, ], - "type": "Identifier", + "type": "GenericTypeAnnotation", + "typeParameters": null, }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, }, - "range": Array [ - 21, - 24, - ], - "type": "ClassImplements", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 10, + 11, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TypeParameterDeclaration", }, - "range": Array [ - 0, - 29, - ], - "superClass": null, - "type": "ClassDeclaration", }, ], "loc": Object { @@ -3672,14 +6076,232 @@ Object { }, "range": Array [ 0, - 29, + 32, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; -exports[`typescript fixtures/basics/class-with-implements-generic.src 1`] = ` +exports[`typescript fixtures/basics/class-with-extends-generic-multiple.src 1`] = ` Object { "body": Array [ Object { @@ -3691,13 +6313,13 @@ Object { "line": 3, }, "start": Object { - "column": 28, + "column": 41, "line": 1, }, }, "range": Array [ - 28, - 32, + 41, + 45, ], "type": "ClassBody", }, @@ -3720,98 +6342,7 @@ Object { ], "type": "Identifier", }, - "implements": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 24, - ], - "type": "ClassImplements", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "S", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 24, - 27, - ], - "type": "TypeParameterInstantiation", - }, - }, - ], + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -3824,216 +6355,207 @@ Object { }, "range": Array [ 0, - 32, + 45, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 32, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-implements-generic-multiple.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [], + "superClass": Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { "column": 31, "line": 1, }, }, + "name": "Bar", "range": Array [ 31, - 35, + 34, ], - "type": "ClassBody", + "type": "Identifier", }, - "decorators": Array [], - "id": Object { + "superTypeParameters": Object { "loc": Object { "end": Object { - "column": 9, + "column": 40, "line": 1, }, "start": Object { - "column": 6, + "column": 34, "line": 1, }, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [ - Object { - "id": Object { + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 24, + "column": 36, "line": 1, }, "start": Object { - "column": 21, + "column": 35, "line": 1, }, }, - "name": "Bar", "range": Array [ - 21, - 24, + 35, + 36, ], - "type": "Identifier", + "type": "GenericTypeAnnotation", + "typeParameters": null, }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "D", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", }, - }, - "range": Array [ - 21, - 24, - ], - "type": "ClassImplements", - "typeParameters": Object { "loc": Object { "end": Object { - "column": 30, + "column": 39, "line": 1, }, "start": Object { - "column": 24, + "column": 38, "line": 1, }, }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "S", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", + "range": Array [ + 38, + 39, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 34, + 40, + ], + "type": "TypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, }, + }, + "range": Array [ + 20, + 21, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, + "column": 21, "line": 1, }, "start": Object { - "column": 25, + "column": 20, "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 21, ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - Object { - "id": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 29, + "column": 21, "line": 1, }, "start": Object { - "column": 28, + "column": 20, "line": 1, }, }, - "name": "T", + "name": "B", "range": Array [ - 28, - 29, + 20, + 21, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, }, - ], + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", "range": Array [ - 24, - 30, + 10, + 21, ], - "type": "TypeParameterInstantiation", + "type": "TypeParameter", }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, + ], + "range": Array [ + 9, + 22, + ], + "type": "TypeParameterDeclaration", }, - "range": Array [ - 0, - 35, - ], - "superClass": null, - "type": "ClassDeclaration", }, ], "loc": Object { @@ -4048,92 +6570,426 @@ Object { }, "range": Array [ 0, - 35, + 45, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 19, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 30, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "D", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; -exports[`typescript fixtures/basics/class-with-mixin.src 1`] = ` +exports[`typescript fixtures/basics/class-with-generic-method.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { "body": Array [ Object { - "argument": Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "getBar", + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 28, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, "body": Object { "body": Array [], "loc": Object { "end": Object { - "column": 33, + "column": 16, "line": 2, }, "start": Object { - "column": 30, + "column": 14, "line": 2, }, }, "range": Array [ - 79, - 82, + 26, + 28, ], - "type": "ClassBody", + "type": "BlockStatement", }, - "decorators": Array [], + "expression": false, + "generator": false, "id": null, - "implements": Array [], "loc": Object { "end": Object { - "column": 33, + "column": 16, "line": 2, }, "start": Object { - "column": 11, + "column": 8, "line": 2, }, }, + "params": Array [], "range": Array [ - 60, - 82, + 23, + 28, ], - "superClass": Object { + "type": "FunctionExpression", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 29, + "column": 11, "line": 2, }, "start": Object { - "column": 25, + "column": 8, "line": 2, }, }, - "name": "Base", + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "TypeParameter", + }, + ], "range": Array [ - 74, - 78, + 20, + 23, ], - "type": "Identifier", - }, - "type": "ClassExpression", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "type": "TypeParameterDeclaration", }, }, - "range": Array [ - 53, - 82, - ], - "type": "ReturnStatement", }, ], "loc": Object { @@ -4142,36 +6998,36 @@ Object { "line": 3, }, "start": Object { - "column": 47, + "column": 10, "line": 1, }, }, "range": Array [ - 47, - 84, + 10, + 30, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "M", + "name": "Foo", "range": Array [ + 6, 9, - 10, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -4182,244 +7038,424 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, + "range": Array [ + 0, + 30, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-generic-method-default.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "getBar", + "range": Array [ + 14, + 20, + ], + "type": "Identifier", }, - }, - "name": "Base", - "range": Array [ - 38, - 42, - ], - "type": "Identifier", - "typeAnnotation": Object { + "kind": "method", "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 44, - 45, + 14, + 34, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 44, - "line": 1, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "TSTypeReference", - "typeName": Object { + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 44, - "line": 1, + "column": 20, + "line": 2, }, }, - "name": "T", "range": Array [ - 44, - 45, + 32, + 34, ], - "type": "Identifier", + "type": "BlockStatement", }, - }, - }, - }, - ], - "range": Array [ - 0, - 84, - ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 8, + "line": 2, }, }, + "params": Array [], "range": Array [ - 21, - 36, + 29, + 34, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "type": "FunctionExpression", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 36, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + "column": 8, + "line": 2, }, - "name": "Constructor", - "range": Array [ - 21, - 32, - ], - "type": "Identifier", }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { + "params": Array [ + Object { + "constraint": null, + "default": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 33, - "line": 1, + "column": 13, + "line": 2, }, }, - "members": Array [], + "name": "Bar", "range": Array [ - 33, - 35, + 25, + 28, ], - "type": "TSTypeLiteral", + "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, }, - "range": Array [ - 33, - 35, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, }, - ], - "range": Array [ - 32, - 36, - ], - "type": "TypeParameterInstantiation", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, + "name": "T", + "range": Array [ + 21, + 28, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 20, + 29, + ], + "type": "TypeParameterDeclaration", }, }, - "name": "T", - "range": Array [ - 11, - 36, - ], - "type": "TypeParameter", }, ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, "range": Array [ 10, - 37, - ], - "type": "TypeParameterDeclaration", - }, - }, - Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 42, - "line": 5, - }, - "start": Object { - "column": 39, - "line": 5, - }, - }, - "range": Array [ - 125, - 128, + 36, ], "type": "ClassBody", }, @@ -4427,550 +7463,413 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 9, + "line": 1, }, "start": Object { "column": 6, - "line": 5, + "line": 1, }, }, - "name": "X", + "name": "Foo", "range": Array [ - 92, - 93, + 6, + 9, ], "type": "Identifier", }, - "implements": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 5, - }, - "start": Object { - "column": 37, - "line": 5, - }, - }, - "name": "I", - "range": Array [ - 123, - 124, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 38, - "line": 5, - }, - "start": Object { - "column": 37, - "line": 5, - }, - }, - "range": Array [ - 123, - 124, - ], - "type": "ClassImplements", + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 42, - "line": 5, + "column": 5, + "line": 1, }, "start": Object { "column": 0, - "line": 5, + "line": 1, }, }, "range": Array [ - 86, - 128, + 0, + 5, ], - "superClass": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 23, - "line": 5, - }, - }, - "name": "C", - "range": Array [ - 109, - 110, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 5, - }, - "start": Object { - "column": 16, - "line": 5, - }, - }, - "name": "M", - "range": Array [ - 102, - 103, - ], - "type": "Identifier", + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 25, - "line": 5, - }, - "start": Object { - "column": 16, - "line": 5, - }, + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 102, - 111, - ], - "type": "CallExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 5, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 104, - 107, - ], - "type": "TSAnyKeyword", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 104, - 107, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 103, - 108, - ], - "type": "TypeParameterInstantiation", + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, }, }, - "type": "ClassDeclaration", + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", }, Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 11, - "line": 7, - }, - "start": Object { - "column": 8, - "line": 7, - }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, }, - "range": Array [ - 138, - 141, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 6, - "line": 7, - }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, }, - "name": "C", - "range": Array [ - 136, - 137, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { "loc": Object { "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { "column": 11, - "line": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 7, + "line": 3, }, }, "range": Array [ - 130, - 141, + 35, + 36, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements.src 1`] = ` +Object { + "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { "end": Object { - "column": 15, - "line": 8, + "column": 1, + "line": 3, }, "start": Object { - "column": 12, - "line": 8, + "column": 25, + "line": 1, }, }, "range": Array [ - 154, - 157, + 25, + 29, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, - "heritage": Array [], + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 11, - "line": 8, + "column": 9, + "line": 1, }, "start": Object { - "column": 10, - "line": 8, + "column": 6, + "line": 1, }, }, - "name": "I", + "name": "Foo", "range": Array [ - 152, - 153, + 6, + 9, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 0, - "line": 8, - }, - }, - "range": Array [ - 142, - 157, - ], - "type": "TSInterfaceDeclaration", - }, - Object { - "declarations": Array [ + "implements": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 16, - "line": 9, + "column": 24, + "line": 1, }, "start": Object { - "column": 5, - "line": 9, + "column": 21, + "line": 1, }, }, - "name": "Constructor", + "name": "Bar", "range": Array [ - 163, - 174, + 21, + 24, ], "type": "Identifier", }, - "init": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 22, - "line": 9, - }, - }, - "parameters": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 9, - }, - "start": Object { - "column": 30, - "line": 9, - }, - }, - "name": "args", - "range": Array [ - 188, - 192, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 36, - "line": 9, - }, - }, - "range": Array [ - 194, - 199, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 9, - }, - "start": Object { - "column": 36, - "line": 9, - }, - }, - "range": Array [ - 194, - 197, - ], - "type": "TSAnyKeyword", - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 36, - "line": 9, - }, - }, - "range": Array [ - 194, - 199, - ], - "type": "TSArrayType", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 27, - "line": 9, - }, - }, - "range": Array [ - 185, - 199, - ], - "type": "RestElement", - }, - ], - "range": Array [ - 180, - 205, - ], - "type": "TSConstructorType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 46, - "line": 9, - }, - }, - "range": Array [ - 204, - 205, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 46, - "line": 9, - }, - }, - "range": Array [ - 204, - 205, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 46, - "line": 9, - }, - }, - "name": "T", - "range": Array [ - 204, - 205, - ], - "type": "Identifier", - }, - }, - }, - "typeParameters": null, - }, "loc": Object { "end": Object { - "column": 48, - "line": 9, + "column": 24, + "line": 1, }, "start": Object { - "column": 5, - "line": 9, + "column": 21, + "line": 1, }, }, "range": Array [ - 163, - 206, + 21, + 24, ], - "type": "VariableDeclarator", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 9, - }, - "start": Object { - "column": 16, - "line": 9, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 18, - "line": 9, - }, - "start": Object { - "column": 17, - "line": 9, - }, - }, - "name": "T", - "range": Array [ - 175, - 176, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 174, - 177, - ], - "type": "TypeParameterDeclaration", - }, + "type": "ClassImplements", }, ], - "kind": "type", "loc": Object { "end": Object { - "column": 48, - "line": 9, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 9, + "line": 1, }, }, "range": Array [ - 158, - 206, + 0, + 29, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 48, - "line": 9, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -4979,94 +7878,142 @@ Object { }, "range": Array [ 0, - 206, + 29, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 20, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; -exports[`typescript fixtures/basics/class-with-optional-computed-property.src 1`] = ` +exports[`typescript fixtures/basics/class-with-implements-generic.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [ - Object { - "accessibility": "private", - "computed": true, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 23, - 28, - ], - "raw": "'foo'", - "type": "Literal", - "value": "foo", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": true, - "range": Array [ - 14, - 43, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "undefined", - "range": Array [ - 33, - 42, - ], - "type": "Identifier", - }, - }, - ], + "body": Array [], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 8, + "column": 28, "line": 1, }, }, "range": Array [ - 8, - 45, + 28, + 32, ], "type": "ClassBody", }, @@ -5074,7 +8021,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -5082,14 +8029,105 @@ Object { "line": 1, }, }, - "name": "X", + "name": "Foo", "range": Array [ 6, - 7, + 9, ], "type": "Identifier", }, - "implements": Array [], + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "ClassImplements", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "S", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], "loc": Object { "end": Object { "column": 1, @@ -5102,7 +8140,7 @@ Object { }, "range": Array [ 0, - 45, + 32, ], "superClass": null, "type": "ClassDeclaration", @@ -5120,320 +8158,350 @@ Object { }, "range": Array [ 0, - 45, + 32, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-optional-methods.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "foo", - "optional": true, - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 20, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-implements-generic-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 21, + "line": 1, }, }, + "name": "Bar", "range": Array [ - 14, 21, + 24, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 18, - 21, - ], - "type": "FunctionExpression", - }, + "type": "Identifier", }, - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "bar", - "optional": true, - "range": Array [ - 24, - 27, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "kind": "method", + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "ClassImplements", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 30, + "line": 1, }, "start": Object { - "column": 2, - "line": 3, + "column": 24, + "line": 1, }, }, - "range": Array [ - 24, - 39, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 28, - 39, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "params": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 25, + "line": 1, }, }, + "name": "S", "range": Array [ - 32, - 38, + 25, + 26, ], - "type": "TSStringKeyword", - }, - }, - "type": "FunctionExpression", - }, - }, - Object { - "accessibility": "private", - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 10, - "line": 4, - }, - }, - "name": "baz", - "optional": true, - "range": Array [ - 50, - 53, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 42, - 65, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, + "type": "Identifier", }, - }, - "params": Array [], - "range": Array [ - 54, - 65, - ], - "returnType": Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 26, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 25, + "line": 1, }, }, "range": Array [ - 58, - 64, + 25, + 26, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + Object { + "id": Object { "loc": Object { "end": Object { - "column": 24, - "line": 4, + "column": 29, + "line": 1, }, "start": Object { - "column": 18, - "line": 4, + "column": 28, + "line": 1, }, }, + "name": "T", "range": Array [ - 58, - 64, + 28, + 29, ], - "type": "TSStringKeyword", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, }, + "range": Array [ + 28, + 29, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, }, - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 67, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + ], + "range": Array [ + 24, + 30, + ], + "type": "TypeParameterInstantiation", }, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [], + ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -5442,7 +8510,7 @@ Object { }, "range": Array [ 0, - 67, + 35, ], "superClass": null, "type": "ClassDeclaration", @@ -5451,7 +8519,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, @@ -5460,353 +8528,292 @@ Object { }, "range": Array [ 0, - 67, + 35, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-optional-properties.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "foo", - "optional": true, - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 19, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, - }, - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "bar", - "optional": true, - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 22, - 36, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "range": Array [ - 29, - 35, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "range": Array [ - 29, - 35, - ], - "type": "TSStringKeyword", - }, - }, - "value": null, - }, - Object { - "accessibility": "private", - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 10, - "line": 4, - }, - }, - "name": "baz", - "optional": true, - "range": Array [ - 47, - 50, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 39, - 61, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 4, - }, - "start": Object { - "column": 17, - "line": 4, - }, - }, - "range": Array [ - 54, - 60, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 4, - }, - "start": Object { - "column": 17, - "line": 4, - }, - }, - "range": Array [ - 54, - 60, - ], - "type": "TSStringKeyword", - }, - }, - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 10, - 63, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 20, + "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 63, + 10, + 20, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Keyword", + "value": "implements", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 63, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/class-with-optional-property-undefined.src 1`] = ` +exports[`typescript fixtures/basics/class-with-mixin.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { "body": Array [ Object { - "accessibility": "private", - "computed": false, - "decorators": Array [], - "key": Object { + "argument": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 79, + 82, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], "loc": Object { "end": Object { - "column": 13, + "column": 33, "line": 2, }, "start": Object { - "column": 10, + "column": 11, "line": 2, }, }, - "name": "foo", - "optional": true, "range": Array [ - 20, - 23, + 60, + 82, ], - "type": "Identifier", + "superClass": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "Base", + "range": Array [ + 74, + 78, + ], + "type": "Identifier", + }, + "type": "ClassExpression", }, "loc": Object { "end": Object { - "column": 27, + "column": 33, "line": 2, }, "start": Object { - "column": 2, + "column": 4, "line": 2, }, }, "range": Array [ - 12, - 37, + 53, + 82, ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "undefined", - "range": Array [ - 27, - 36, - ], - "type": "Identifier", - }, + "type": "ReturnStatement", }, ], "loc": Object { @@ -5815,36 +8822,36 @@ Object { "line": 3, }, "start": Object { - "column": 8, + "column": 47, "line": 1, }, }, "range": Array [ - 8, - 39, + 47, + 84, ], - "type": "ClassBody", + "type": "BlockStatement", }, - "decorators": Array [], + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "X", + "name": "M", "range": Array [ - 6, - 7, + 9, + 10, ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -5855,501 +8862,244 @@ Object { "line": 1, }, }, - "range": Array [ - 0, - 39, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 39, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-private-parameter-properties.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 14, - 25, - ], - "type": "Identifier", + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, }, - "kind": "constructor", + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "Base", + "range": Array [ + 38, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 59, - "line": 5, + "column": 45, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 44, + "line": 1, }, }, "range": Array [ - 14, - 201, + 44, + 45, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 59, - "line": 5, + "column": 45, + "line": 1, }, "start": Object { - "column": 57, - "line": 5, + "column": 44, + "line": 1, }, }, + "name": "T", "range": Array [ - 199, - 201, + 44, + 45, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + }, + }, + }, + ], + "range": Array [ + 0, + 84, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { "loc": Object { "end": Object { - "column": 59, - "line": 5, + "column": 36, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 21, + "line": 1, }, }, - "params": Array [ - Object { - "accessibility": "private", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, + "range": Array [ + 21, + 36, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "name": "firstName", - "range": Array [ - 34, - 43, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 45, - 51, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 45, - 51, - ], - "type": "TSStringKeyword", - }, - }, + "start": Object { + "column": 21, + "line": 1, }, - "range": Array [ - 26, - 51, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", }, - Object { - "accessibility": "private", - "decorators": Array [], - "export": false, + "range": Array [ + 21, + 36, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 47, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 31, - "line": 3, - }, - }, - "name": "lastName", - "range": Array [ - 84, - 92, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 3, - }, - "start": Object { - "column": 41, - "line": 3, - }, - }, - "range": Array [ - 94, - 100, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 3, - }, - "start": Object { - "column": 41, - "line": 3, - }, - }, - "range": Array [ - 94, - 100, - ], - "type": "TSStringKeyword", - }, + "column": 21, + "line": 1, }, }, + "name": "Constructor", "range": Array [ - 67, - 100, + 21, + 32, ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", + "type": "Identifier", }, - Object { - "accessibility": "private", - "decorators": Array [], - "export": false, + "typeParameters": Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 14, - "line": 4, + "column": 32, + "line": 1, }, }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 4, - }, - }, - "name": "age", - "range": Array [ - 124, - 127, - ], - "type": "Identifier", - "typeAnnotation": Object { + "params": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 33, - "line": 4, + "column": 35, + "line": 1, }, "start": Object { - "column": 27, - "line": 4, + "column": 33, + "line": 1, }, }, + "members": Array [], "range": Array [ - 129, - 135, + 33, + 35, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 4, - }, - "start": Object { - "column": 27, - "line": 4, - }, - }, - "range": Array [ - 129, - 135, - ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 38, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, + "type": "TSTypeLiteral", }, - }, - "range": Array [ - 116, - 140, - ], - "right": Object { "loc": Object { "end": Object { - "column": 38, - "line": 4, + "column": 35, + "line": 1, }, "start": Object { - "column": 36, - "line": 4, + "column": 33, + "line": 1, }, }, "range": Array [ - 138, - 140, + 33, + 35, ], - "raw": "30", - "type": "Literal", - "value": 30, + "type": "GenericTypeAnnotation", + "typeParameters": null, }, - "type": "AssignmentPattern", - }, + ], "range": Array [ - 116, - 140, + 32, + 36, ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", + "type": "TypeParameterInstantiation", }, - Object { - "accessibility": "private", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 55, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 5, - }, - "start": Object { - "column": 31, - "line": 5, - }, - }, - "name": "student", - "range": Array [ - 173, - 180, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 5, - }, - "start": Object { - "column": 40, - "line": 5, - }, - }, - "range": Array [ - 182, - 189, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 5, - }, - "start": Object { - "column": 40, - "line": 5, - }, - }, - "range": Array [ - 182, - 189, - ], - "type": "TSBooleanKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 55, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "range": Array [ - 156, - 197, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 5, - }, - "start": Object { - "column": 50, - "line": 5, - }, - }, - "range": Array [ - 192, - 197, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - "type": "AssignmentPattern", - }, - "range": Array [ - 156, - 197, - ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 25, - 201, - ], - "type": "FunctionExpression", + }, + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, + "name": "T", + "range": Array [ + 11, + 36, + ], + "type": "TypeParameter", }, ], + "range": Array [ + 10, + 37, + ], + "type": "TypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 42, + "line": 5, }, "start": Object { - "column": 10, - "line": 1, + "column": 39, + "line": 5, }, }, "range": Array [ - 10, - 203, + 125, + 128, ], "type": "ClassBody", }, @@ -6357,572 +9107,550 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { "column": 6, - "line": 1, + "line": 5, }, }, - "name": "Foo", + "name": "X", "range": Array [ - 6, - 9, + 92, + 93, ], "type": "Identifier", }, - "implements": Array [], + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "name": "I", + "range": Array [ + 123, + 124, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "ClassImplements", + }, + ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 42, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 203, + 86, + 128, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 203, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-protected-parameter-properties.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ + "superClass": Object { + "arguments": Array [ Object { - "accessibility": null, - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 14, - 25, - ], - "type": "Identifier", - }, - "kind": "constructor", "loc": Object { "end": Object { - "column": 61, + "column": 24, "line": 5, }, "start": Object { - "column": 2, - "line": 2, + "column": 23, + "line": 5, }, }, + "name": "C", "range": Array [ - 14, - 209, + 109, + 110, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "M", + "range": Array [ + 102, + 103, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 102, + 111, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "params": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 61, + "column": 21, "line": 5, }, "start": Object { - "column": 59, + "column": 18, "line": 5, }, }, "range": Array [ - 207, - 209, + 104, + 107, ], - "type": "BlockStatement", + "type": "TSAnyKeyword", }, - "expression": false, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 61, + "column": 21, "line": 5, }, "start": Object { - "column": 13, - "line": 2, + "column": 18, + "line": 5, }, }, - "params": Array [ - Object { - "accessibility": "protected", - "decorators": Array [], - "export": false, + "range": Array [ + 104, + 107, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 103, + 108, + ], + "type": "TypeParameterInstantiation", + }, + }, + "type": "ClassDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 138, + 141, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "C", + "range": Array [ + 136, + 137, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 130, + 141, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 154, + 157, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "name": "I", + "range": Array [ + 152, + 153, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 142, + 157, + ], + "type": "TSInterfaceDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "name": "Constructor", + "range": Array [ + 163, + 174, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "parameters": Array [ + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 34, + "line": 9, }, "start": Object { - "column": 14, - "line": 2, + "column": 30, + "line": 9, }, }, - "parameter": Object { + "name": "args", + "range": Array [ + 188, + 192, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 41, + "line": 9, }, "start": Object { - "column": 24, - "line": 2, + "column": 36, + "line": 9, }, }, - "name": "firstName", "range": Array [ - 36, - 45, + 194, + 199, ], - "type": "Identifier", + "type": "TypeAnnotation", "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 2, - }, - "start": Object { - "column": 35, - "line": 2, - }, - }, - "range": Array [ - 47, - 53, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "elementType": Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 39, + "line": 9, }, "start": Object { - "column": 35, - "line": 2, + "column": 36, + "line": 9, }, }, "range": Array [ - 47, - 53, + 194, + 197, ], - "type": "TSStringKeyword", + "type": "TSAnyKeyword", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, }, + "range": Array [ + 194, + 199, + ], + "type": "TSArrayType", }, }, - "range": Array [ - 26, - 53, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", }, - Object { - "accessibility": "protected", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, + "loc": Object { + "end": Object { + "column": 41, + "line": 9, }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "name": "lastName", - "range": Array [ - 88, - 96, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 43, - "line": 3, - }, - }, - "range": Array [ - 98, - 104, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 43, - "line": 3, - }, - }, - "range": Array [ - 98, - 104, - ], - "type": "TSStringKeyword", - }, - }, + "start": Object { + "column": 27, + "line": 9, }, - "range": Array [ - 69, - 104, - ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", }, - Object { - "accessibility": "protected", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 40, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, + "range": Array [ + 185, + 199, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 180, + 205, + ], + "type": "TSConstructorType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "name": "age", - "range": Array [ - 130, - 133, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 4, - }, - "start": Object { - "column": 29, - "line": 4, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 4, - }, - "start": Object { - "column": 29, - "line": 4, - }, - }, - "range": Array [ - 135, - 141, - ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "range": Array [ - 120, - 146, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 4, - }, - "start": Object { - "column": 38, - "line": 4, - }, - }, - "range": Array [ - 144, - 146, - ], - "raw": "30", - "type": "Literal", - "value": 30, - }, - "type": "AssignmentPattern", + "start": Object { + "column": 46, + "line": 9, }, - "range": Array [ - 120, - 146, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", }, - Object { - "accessibility": "protected", - "decorators": Array [], - "export": false, + "range": Array [ + 204, + 205, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 57, - "line": 5, + "column": 47, + "line": 9, }, "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 5, - }, - "start": Object { - "column": 33, - "line": 5, - }, - }, - "name": "student", - "range": Array [ - 181, - 188, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 5, - }, - "start": Object { - "column": 42, - "line": 5, - }, - }, - "range": Array [ - 190, - 197, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 5, - }, - "start": Object { - "column": 42, - "line": 5, - }, - }, - "range": Array [ - 190, - 197, - ], - "type": "TSBooleanKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "range": Array [ - 162, - 205, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 5, - }, - "start": Object { - "column": 52, - "line": 5, - }, - }, - "range": Array [ - 200, - 205, - ], - "raw": "false", - "type": "Literal", - "value": false, + "column": 46, + "line": 9, }, - "type": "AssignmentPattern", }, + "name": "T", "range": Array [ - 162, + 204, 205, ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", + "type": "Identifier", }, - ], - "range": Array [ - 25, - 209, - ], - "type": "FunctionExpression", + }, }, + "typeParameters": null, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 211, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, }, - "start": Object { - "column": 6, - "line": 1, + "range": Array [ + 163, + 206, + ], + "type": "VariableDeclarator", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "name": "T", + "range": Array [ + 175, + 176, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 174, + 177, + ], + "type": "TypeParameterDeclaration", }, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [], + ], + "kind": "type", "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 48, + "line": 9, }, "start": Object { "column": 0, - "line": 1, + "line": 9, }, }, "range": Array [ - 0, - 211, + 158, + 206, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 48, + "line": 9, }, "start": Object { "column": 0, @@ -6931,1418 +9659,425 @@ Object { }, "range": Array [ 0, - 211, + 206, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-public-parameter-properties.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 14, - 25, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 58, - "line": 5, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 197, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 58, - "line": 5, - }, - "start": Object { - "column": 56, - "line": 5, - }, - }, - "range": Array [ - 195, - 197, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 58, - "line": 5, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [ - Object { - "accessibility": "public", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "name": "firstName", - "range": Array [ - 33, - 42, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 44, - 50, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 44, - 50, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 26, - 50, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", - }, - Object { - "accessibility": "public", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 46, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "name": "lastName", - "range": Array [ - 82, - 90, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 3, - }, - "start": Object { - "column": 40, - "line": 3, - }, - }, - "range": Array [ - 92, - 98, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 3, - }, - "start": Object { - "column": 40, - "line": 3, - }, - }, - "range": Array [ - 92, - 98, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 66, - 98, - ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", - }, - Object { - "accessibility": "public", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 37, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 21, - "line": 4, - }, - }, - "name": "age", - "range": Array [ - 121, - 124, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 26, - "line": 4, - }, - }, - "range": Array [ - 126, - 132, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 4, - }, - "start": Object { - "column": 26, - "line": 4, - }, - }, - "range": Array [ - 126, - 132, - ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "range": Array [ - 114, - 137, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 4, - }, - "start": Object { - "column": 35, - "line": 4, - }, - }, - "range": Array [ - 135, - 137, - ], - "raw": "30", - "type": "Literal", - "value": 30, - }, - "type": "AssignmentPattern", - }, - "range": Array [ - 114, - 137, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", - }, - Object { - "accessibility": "public", - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 5, - }, - "start": Object { - "column": 30, - "line": 5, - }, - }, - "name": "student", - "range": Array [ - 169, - 176, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 5, - }, - "start": Object { - "column": 39, - "line": 5, - }, - }, - "range": Array [ - 178, - 185, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 5, - }, - "start": Object { - "column": 39, - "line": 5, - }, - }, - "range": Array [ - 178, - 185, - ], - "type": "TSBooleanKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "range": Array [ - 153, - 193, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 49, - "line": 5, - }, - }, - "range": Array [ - 188, - 193, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - "type": "AssignmentPattern", - }, - "range": Array [ - 153, - 193, - ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 25, - 197, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 10, - 199, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "M", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 199, + 10, + 11, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "<", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "T", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", }, - }, - "range": Array [ - 0, - 199, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-readonly-parameter-properties.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 14, - 25, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 53, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 14, - 107, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 53, - "line": 3, - }, - "start": Object { - "column": 51, - "line": 3, - }, - }, - "range": Array [ - 105, - 107, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 53, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [ - Object { - "accessibility": null, - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 40, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "firstName", - "range": Array [ - 35, - 44, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 46, - 52, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 46, - 52, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 26, - 52, - ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", - }, - Object { - "accessibility": null, - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "parameter": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "name": "lastName", - "range": Array [ - 77, - 85, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 87, - 93, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 87, - 93, - ], - "type": "TSStringKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 68, - 103, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 42, - "line": 3, - }, - }, - "range": Array [ - 96, - 103, - ], - "raw": "'Smith'", - "type": "Literal", - "value": "Smith", - }, - "type": "AssignmentPattern", - }, - "range": Array [ - 68, - 103, - ], - "readonly": true, - "static": false, - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 25, - 107, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, }, - "range": Array [ - 10, - 109, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + "value": "Constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "<", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 34, + "line": 1, }, "start": Object { - "column": 0, + "column": 33, "line": 1, }, }, "range": Array [ - 0, - 109, + 33, + 34, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", }, - }, - "range": Array [ - 0, - 109, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-readonly-property.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": "public", - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 16, - 47, - ], - "readonly": true, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 46, - ], - "raw": "'string'", - "type": "Literal", - "value": "string", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, }, - "range": Array [ - 10, - 49, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 42, + "line": 1, }, "start": Object { - "column": 0, + "column": 38, "line": 1, }, }, "range": Array [ - 0, - 49, + 38, + 42, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Identifier", + "value": "Base", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-static-parameter-properties.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "constructor", - "range": Array [ - 16, - 27, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 16, - 54, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 46, - 54, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "accessibility": null, - "decorators": Array [], - "export": false, - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 44, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 38, - 44, - ], - "type": "TSStringKeyword", - }, - }, - }, - "range": Array [ - 28, - 44, - ], - "readonly": false, - "static": true, - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 27, - 54, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, }, - "range": Array [ - 10, - 56, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 42, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 45, + "line": 1, }, "start": Object { - "column": 0, + "column": 44, "line": 1, }, }, "range": Array [ - 0, - 56, + 44, + 45, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + "type": "Identifier", + "value": "T", }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 56, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-type-parameter.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, }, - "range": Array [ - 13, - 17, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 45, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 48, + "line": 1, }, "start": Object { - "column": 0, + "column": 47, "line": 1, }, }, "range": Array [ - 0, - 17, + 47, + 48, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 10, - 11, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 9, - 12, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 53, + 59, + ], + "type": "Keyword", + "value": "return", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 60, + 65, + ], + "type": "Keyword", + "value": "class", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 66, + 73, + ], + "type": "Keyword", + "value": "extends", }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-type-parameter-default.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, }, - "range": Array [ - 19, - 23, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 74, + 78, + ], + "type": "Identifier", + "value": "Base", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + Object { "loc": Object { "end": Object { "column": 1, @@ -8350,580 +10085,849 @@ Object { }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 23, + 83, + 84, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, }, - "params": Array [ - Object { - "constraint": null, - "default": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 17, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 10, - 17, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 9, - 18, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 86, + 91, + ], + "type": "Keyword", + "value": "class", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 23, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/class-with-type-parameter-underscore.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 7, + "line": 5, }, - "range": Array [ - 13, - 15, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 6, + "line": 5, }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "X", + }, + Object { "loc": Object { "end": Object { "column": 15, - "line": 1, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 0, - 15, + 94, + 101, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "__P", - "range": Array [ - 8, - 11, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 7, - 12, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 102, + 103, + ], + "type": "Identifier", + "value": "M", }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "<", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "any", }, - }, - "range": Array [ - 0, - 15, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "bar", - "optional": true, - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 24, - 36, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 28, - 36, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "TSAnyKeyword", - }, - }, - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, }, - "range": Array [ - 18, - 38, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, }, - "name": "Foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 24, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 5, }, }, "range": Array [ - 0, - 38, + 109, + 110, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Identifier", + "value": "C", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ")", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 112, + 122, + ], + "type": "Keyword", + "value": "implements", }, - }, - "range": Array [ - 0, - 38, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/declare-function.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": null, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Identifier", + "value": "I", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, }, - "name": "foo", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { "column": 42, - "line": 1, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, }, "start": Object { "column": 0, - "line": 1, + "line": 7, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { + "range": Array [ + 130, + 135, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 142, + 151, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Identifier", + "value": "I", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 158, + 162, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 163, + 174, + ], + "type": "Identifier", + "value": "Constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "range": Array [ + 180, + 183, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 9, + }, + "start": Object { + "column": 26, + "line": 9, + }, + }, + "range": Array [ + 184, + 185, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 9, + }, + "start": Object { + "column": 27, + "line": 9, + }, + }, + "range": Array [ + 185, + 188, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 9, + }, + "start": Object { + "column": 30, + "line": 9, + }, + }, + "range": Array [ + 188, + 192, + ], + "type": "Identifier", + "value": "args", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 9, + }, + }, + "range": Array [ + 192, + 193, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 197, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 9, + }, + "start": Object { + "column": 39, + "line": 9, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 40, + "line": 9, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 43, + "line": 9, + }, + }, + "range": Array [ + 201, + 203, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 47, + "line": 9, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-computed-property.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 4, + "line": 2, }, }, + "optional": true, "range": Array [ - 26, - 32, + 14, + 43, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { "loc": Object { "end": Object { "column": 32, - "line": 1, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 23, + "line": 2, }, }, + "name": "undefined", "range": Array [ - 26, - 32, + 33, + 42, ], - "type": "TSStringKeyword", + "type": "Identifier", }, }, - }, - ], - "range": Array [ - 0, - 42, - ], - "returnType": Object { + ], "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 35, + "column": 8, "line": 1, }, }, "range": Array [ - 35, - 41, + 8, + 45, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSStringKeyword", - }, + "type": "ClassBody", }, - "type": "DeclareFunction", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 42, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-assignment.src 1`] = ` -Object { - "body": Array [ - Object { - "expression": Object { + "decorators": Array [], + "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 7, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "foo", + "name": "X", "range": Array [ - 9, - 12, + 6, + 7, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -8932,15 +10936,16 @@ Object { }, "range": Array [ 0, - 13, + 45, ], - "type": "TSExportAssigment", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -8949,364 +10954,209 @@ Object { }, "range": Array [ 0, - 13, + 45, ], - "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` -Object { - "body": Array [ + "sourceType": "script", + "tokens": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 28, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": null, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 15, - 28, - ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 21, - 22, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 20, - 23, - ], - "type": "TypeParameterDeclaration", + "start": Object { + "column": 0, + "line": 1, }, }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 7, + "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, "range": Array [ - 0, - 28, + 6, + 7, ], - "type": "ExportDefaultDeclaration", + "type": "Identifier", + "value": "X", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "private", }, - }, - "range": Array [ - 0, - 28, - ], - "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` -Object { - "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 31, - ], - "type": "ClassBody", + "loc": Object { + "end": Object { + "column": 13, + "line": 2, }, - "decorators": Array [], - "id": null, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "start": Object { + "column": 12, + "line": 2, }, - "range": Array [ - 15, - 31, - ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 21, - 22, - ], - "type": "TypeParameter", - }, - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 24, - 25, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 20, - 26, - ], - "type": "TypeParameterDeclaration", + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, }, }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "'foo'", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 19, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 18, + "line": 2, }, }, "range": Array [ - 0, - 31, + 28, + 29, ], - "type": "ExportDefaultDeclaration", + "type": "Punctuator", + "value": "]", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "?", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "=", }, - }, - "range": Array [ - 0, - 31, - ], - "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` -Object { - "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 24, - ], - "type": "ClassBody", + "loc": Object { + "end": Object { + "column": 32, + "line": 2, }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", + "start": Object { + "column": 23, + "line": 2, }, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 1, - }, + }, + "range": Array [ + 33, + 42, + ], + "type": "Keyword", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, }, - "range": Array [ - 7, - 24, - ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 17, - 18, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 16, - 19, - ], - "type": "TypeParameterDeclaration", + "start": Object { + "column": 32, + "line": 2, }, }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { "column": 1, @@ -9314,308 +11164,328 @@ Object { }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 24, + 44, + 45, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 24, ], - "sourceType": "module", "type": "Program", } `; -exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` +exports[`typescript fixtures/basics/class-with-optional-methods.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "optional": true, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", }, - "start": Object { - "column": 23, - "line": 1, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, }, - }, - "range": Array [ - 23, - 27, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 27, - ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, + "range": Array [ + 14, + 21, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 5, + "line": 2, }, }, - "name": "T", + "params": Array [], "range": Array [ - 17, 18, - ], - "type": "TypeParameter", - }, - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "U", - "range": Array [ - 20, 21, ], - "type": "TypeParameter", + "type": "FunctionExpression", }, - ], - "range": Array [ - 16, - 22, - ], - "type": "TypeParameterDeclaration", - }, - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 27, - ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` -Object { - "body": Array [ - Object { - "declaration": Object { - "declarations": Array [ + }, Object { - "id": Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 12, - "line": 1, + "column": 2, + "line": 3, }, }, - "name": "TestAlias", + "name": "bar", + "optional": true, "range": Array [ - 12, - 21, + 24, + 27, ], "type": "Identifier", }, - "init": Object { + "kind": "method", + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 24, + 39, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 17, + "line": 3, }, "start": Object { - "column": 24, - "line": 1, + "column": 5, + "line": 3, }, }, + "params": Array [], "range": Array [ - 24, + 28, 39, ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, }, - "range": Array [ - 24, - 30, - ], - "type": "TSStringKeyword", }, - Object { + "range": Array [ + 32, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 33, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 33, - 39, + 32, + 38, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", + }, + }, + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 50, + 53, ], + "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 25, + "line": 4, }, "start": Object { - "column": 12, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 12, - 40, + 42, + 65, ], - "type": "VariableDeclarator", + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 54, + 65, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionExpression", + }, }, ], - "kind": "type", "loc": Object { "end": Object { - "column": 40, + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 67, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 6, "line": 1, }, }, + "name": "Foo", "range": Array [ - 7, - 40, + 6, + 9, ], - "type": "VariableDeclaration", + "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -9624,17 +11494,16 @@ Object { }, "range": Array [ 0, - 40, + 67, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -9643,171 +11512,15 @@ Object { }, "range": Array [ 0, - 40, + 67, ], - "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-type-class-declaration.src 1`] = ` -Object { - "body": Array [ + "sourceType": "script", + "tokens": Array [ Object { - "declaration": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "TestClassProps", - "range": Array [ - 12, - 26, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "members": Array [ - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "count", - "range": Array [ - 35, - 40, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": false, - "range": Array [ - 35, - 48, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 29, - 50, - ], - "type": "TSTypeLiteral", - }, - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 51, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 51, - ], - "type": "VariableDeclaration", - }, "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 5, + "line": 1, }, "start": Object { "column": 0, @@ -9816,741 +11529,690 @@ Object { }, "range": Array [ 0, - 51, + 5, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "Keyword", + "value": "class", }, - ], - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 51, - ], - "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/export-type-function-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "declaration": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "TestCallback", - "range": Array [ - 12, - 24, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "parameters": Array [ - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 27, - 46, - ], - "type": "TSFunctionType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 42, - "line": 1, - }, - }, - "range": Array [ - 42, - 46, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 42, - "line": 1, - }, - }, - "range": Array [ - 42, - 46, - ], - "type": "TSVoidKeyword", - }, - }, - "typeParameters": null, - }, - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 47, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 7, - 47, - ], - "type": "VariableDeclaration", }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 47, + "column": 11, "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 47, + 10, + 11, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 47, - ], - "sourceType": "module", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-await.src 1`] = ` -Object { - "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "name": "future", - "range": Array [ - 40, - 46, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 46, - ], - "type": "AwaitExpression", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 34, - 47, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, }, - "range": Array [ - 28, - 49, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "start": Object { + "column": 2, + "line": 2, }, - "name": "hope", - "range": Array [ - 15, - 19, - ], - "type": "Identifier", }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 6, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 5, + "line": 2, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "future", - "range": Array [ - 20, - 26, - ], - "type": "Identifier", - }, - ], "range": Array [ - 0, - 49, + 17, + 18, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + "type": "Punctuator", + "value": "?", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 47, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, }, - "range": Array [ - 47, - 51, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "kind": "init", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 42, + 49, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 50, + 53, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 2, + "line": 2, }, }, - "method": false, + "name": "foo", + "optional": true, "range": Array [ 14, 17, ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "range": Array [ + 14, + 19, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, }, - "name": "baz", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", }, - "kind": "init", + "name": "bar", + "optional": true, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 22, + 36, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 9, + "line": 3, }, }, - "method": false, "range": Array [ - 19, - 22, + 29, + 35, ], - "shorthand": true, - "type": "Property", - "value": Object { + "type": "TypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 9, + "line": 3, }, }, - "name": "baz", "range": Array [ - 19, - 22, + 29, + 35, ], - "type": "Identifier", + "type": "TSStringKeyword", }, }, - ], - "range": Array [ - 13, - 23, - ], - "type": "ObjectPattern", - "typeAnnotation": Object { + "value": null, + }, + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 24, + "line": 4, }, "start": Object { - "column": 25, - "line": 1, + "column": 2, + "line": 4, }, }, "range": Array [ - 25, - 45, + 39, + 61, ], - "type": "TypeAnnotation", + "readonly": false, + "static": false, + "type": "ClassProperty", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 23, + "line": 4, }, "start": Object { - "column": 25, - "line": 1, + "column": 17, + "line": 4, }, }, - "members": Array [ - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", + "range": Array [ + 54, + 60, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, }, - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, + "start": Object { + "column": 17, + "line": 4, }, - "optional": true, - "range": Array [ - 26, - 39, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 40, - 43, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "optional": true, - "range": Array [ - 40, - 44, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": null, }, - ], - "range": Array [ - 25, - 45, - ], - "type": "TSTypeLiteral", + "range": Array [ + 54, + 60, + ], + "type": "TSStringKeyword", + }, }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, }, }, - ], + "range": Array [ + 10, + 63, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 51, + 63, ], - "type": "FunctionDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, @@ -10559,56 +12221,442 @@ Object { }, "range": Array [ 0, - 51, + 63, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 39, + 46, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` +exports[`typescript fixtures/basics/class-with-optional-property-undefined.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "foo", + "optional": true, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 37, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "undefined", + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + }, + }, + ], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 45, + "column": 8, "line": 1, }, }, "range": Array [ - 45, - 49, + 8, + 39, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 7, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "foo", + "name": "X", "range": Array [ - 9, - 12, + 6, + 7, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -10619,584 +12667,728 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "kind": "init", + "range": Array [ + 0, + 39, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 19, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 36, + ], + "type": "Keyword", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-private-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 2, + "line": 2, }, }, - "method": false, + "name": "constructor", "range": Array [ 14, - 17, + 25, ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, + "type": "Identifier", }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 59, + "line": 5, }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "start": Object { + "column": 2, + "line": 2, }, - "method": false, - "range": Array [ - 19, - 22, - ], - "shorthand": true, - "type": "Property", - "value": Object { + }, + "range": Array [ + 14, + 201, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 59, + "line": 5, }, "start": Object { - "column": 19, - "line": 1, + "column": 57, + "line": 5, }, }, - "name": "baz", "range": Array [ - 19, - 22, + 199, + 201, ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 13, - 23, - ], - "type": "ObjectPattern", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, + "type": "BlockStatement", }, - }, - "range": Array [ - 25, - 43, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 59, + "line": 5, }, "start": Object { - "column": 25, - "line": 1, + "column": 13, + "line": 2, }, }, - "members": Array [ + "params": Array [ Object { - "accessibility": null, - "computed": false, + "accessibility": "private", + "decorators": Array [], "export": false, - "initializer": null, - "key": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "parameter": Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 31, + "line": 2, }, "start": Object { - "column": 26, - "line": 1, + "column": 22, + "line": 2, }, }, - "name": "bar", + "name": "firstName", "range": Array [ - 26, - 29, + 34, + 43, ], "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "TSStringKeyword", + }, }, }, - "optional": false, "range": Array [ 26, - 38, + 51, ], "readonly": false, "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "parameter": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 39, + "line": 3, }, "start": Object { "column": 31, - "line": 1, + "line": 3, }, }, + "name": "lastName", "range": Array [ - 31, - 37, + 84, + 92, ], - "type": "TypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 47, + "line": 3, }, "start": Object { - "column": 31, - "line": 1, + "column": 41, + "line": 3, }, }, "range": Array [ - 31, - 37, + 94, + 100, ], - "type": "TSStringKeyword", + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "TSStringKeyword", + }, }, }, + "range": Array [ + 67, + 100, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", }, Object { - "accessibility": null, - "computed": false, + "accessibility": "private", + "decorators": Array [], "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 38, + "line": 4, }, - "name": "baz", - "range": Array [ - 39, - 42, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 124, + 127, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 116, + 140, ], - "type": "Identifier", + "right": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 138, + 140, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", }, + "range": Array [ + 116, + 140, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 55, + "line": 5, }, "start": Object { - "column": 39, - "line": 1, + "column": 14, + "line": 5, }, }, - "optional": false, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 173, + 180, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 156, + 197, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 192, + 197, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + }, "range": Array [ - 39, - 42, + 156, + 197, ], - "readonly": false, + "readonly": true, "static": false, - "type": "TSPropertySignature", - "typeAnnotation": null, + "type": "TSParameterProperty", }, ], "range": Array [ 25, - 43, - ], - "type": "TSTypeLiteral", - }, - }, - }, - ], - "range": Array [ - 0, - 49, - ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` -Object { - "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "b", - "range": Array [ - 36, - 37, + 201, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "type": "FunctionExpression", }, - "range": Array [ - 29, - 38, - ], - "type": "ReturnStatement", }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { - "column": 23, + "column": 10, "line": 1, }, }, "range": Array [ - 23, - 40, + 10, + 203, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "a", + "name": "Foo", "range": Array [ + 6, 9, - 10, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ 0, - 40, + 203, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - }, - }, - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 11, - 12, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 10, - 13, - ], - "type": "TypeParameterDeclaration", - }, + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, @@ -11205,675 +13397,659 @@ Object { }, "range": Array [ 0, - 40, + 203, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 33, - 35, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "start": Object { + "column": 0, + "line": 1, }, - "name": "compare", - "range": Array [ - 9, - 16, - ], - "type": "Identifier", }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { "loc": Object { "end": Object { - "column": 35, + "column": 9, "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, - "params": Array [], "range": Array [ - 0, - 35, + 6, + 9, ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 28, - 29, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 16, - 30, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", }, - }, - "range": Array [ - 0, - 35, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "b", - "range": Array [ - 47, - 48, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 40, - 49, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 34, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, }, - "range": Array [ - 34, - 51, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 26, + 33, + ], + "type": "Keyword", + "value": "private", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 31, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 22, + "line": 2, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 28, - 29, - ], - "type": "Identifier", - }, - }, - }, + "range": Array [ + 34, + 43, + ], + "type": "Identifier", + "value": "firstName", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, "range": Array [ - 0, + 45, 51, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, }, - "range": Array [ - 32, - 33, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 33, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - }, + "start": Object { + "column": 39, + "line": 2, }, }, - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, }, - "params": Array [ - Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 23, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 21, - 23, - ], - "type": "TSTypeLiteral", - }, - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "X", - "range": Array [ - 11, - 23, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 10, - 24, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 67, + 74, + ], + "type": "Keyword", + "value": "private", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 75, + 83, + ], + "type": "Identifier", + "value": "readonly", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "Identifier", + "value": "lastName", }, - }, - "range": Array [ - 0, - 51, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/function-with-types.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "name", - "range": Array [ - 50, - 54, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 43, - 55, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 37, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, }, - "range": Array [ - 37, - 57, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, }, - "name": "message", - "range": Array [ - 9, - 16, - ], - "type": "Identifier", }, + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + "value": "string", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 48, "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 47, + "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "name", - "range": Array [ - 17, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, }, + }, + "range": Array [ + 116, + 123, ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, "range": Array [ - 0, - 57, + 124, + 127, ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, }, - "range": Array [ - 30, - 36, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 36, - ], - "type": "TSStringKeyword", + "start": Object { + "column": 25, + "line": 4, }, }, - "type": "FunctionDeclaration", + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": ":", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "Identifier", + "value": "number", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 4, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 138, + 140, + ], + "type": "Numeric", + "value": "30", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 156, + 163, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 164, + 172, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "range": Array [ + 173, + 180, + ], + "type": "Identifier", + "value": "student", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 192, + 197, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 5, + }, + "start": Object { + "column": 55, + "line": 5, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 200, + 201, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 202, + 203, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 57, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +exports[`typescript fixtures/basics/class-with-protected-parameter-properties.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { "body": Array [ Object { - "argument": Object { + "accessibility": null, + "computed": false, + "key": Object { "loc": Object { "end": Object { "column": 13, "line": 2, }, "start": Object { - "column": 9, + "column": 2, "line": 2, }, }, - "name": "name", + "name": "constructor", "range": Array [ - 89, - 93, + 14, + 25, ], "type": "Identifier", }, + "kind": "constructor", "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 61, + "line": 5, }, "start": Object { "column": 2, @@ -11881,483 +14057,462 @@ Object { }, }, "range": Array [ - 82, - 94, + 14, + 209, ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 78, - "line": 1, - }, - }, - "range": Array [ - 78, - 96, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "message", - "range": Array [ - 9, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "name", - "range": Array [ - 17, - 21, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "name": "age", - "range": Array [ - 30, - 33, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 40, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 61, + "line": 5, }, "start": Object { - "column": 34, - "line": 1, + "column": 59, + "line": 5, }, }, "range": Array [ - 34, - 40, + 207, + 209, ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 46, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 46, - ], - "raw": "100", - "type": "Literal", - "value": 100, - }, - "type": "AssignmentPattern", - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 55, - "line": 1, - }, - "start": Object { - "column": 51, - "line": 1, + "type": "BlockStatement", }, - }, - "name": "args", - "range": Array [ - 51, - 55, - ], - "type": "Identifier", - "typeAnnotation": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 69, - "line": 1, + "column": 61, + "line": 5, }, "start": Object { - "column": 56, - "line": 1, + "column": 13, + "line": 2, }, }, - "range": Array [ - 56, - 69, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 69, - "line": 1, + "params": Array [ + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, }, - "start": Object { - "column": 56, - "line": 1, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 36, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSStringKeyword", + }, + }, }, + "range": Array [ + 26, + 53, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", }, - "range": Array [ - 56, - 69, - ], - "type": "TSTypeReference", - "typeName": Object { + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, "loc": Object { "end": Object { - "column": 61, - "line": 1, + "column": 49, + "line": 3, }, "start": Object { - "column": 56, - "line": 1, + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 88, + 96, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TSStringKeyword", + }, }, }, - "name": "Array", "range": Array [ - 56, - 61, + 69, + 104, ], - "type": "Identifier", + "readonly": true, + "static": false, + "type": "TSParameterProperty", }, - "typeParameters": Object { + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, "loc": Object { "end": Object { - "column": 69, - "line": 1, + "column": 40, + "line": 4, }, "start": Object { - "column": 61, - "line": 1, + "column": 14, + "line": 4, }, }, - "params": Array [ - Object { - "id": Object { + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 68, - "line": 1, + "column": 35, + "line": 4, }, "start": Object { - "column": 62, - "line": 1, + "column": 29, + "line": 4, }, }, "range": Array [ - 62, - 68, + 135, + 141, ], - "type": "TSStringKeyword", + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, }, + }, + "range": Array [ + 120, + 146, + ], + "right": Object { "loc": Object { "end": Object { - "column": 68, - "line": 1, + "column": 40, + "line": 4, }, "start": Object { - "column": 62, - "line": 1, + "column": 38, + "line": 4, }, }, "range": Array [ - 62, - 68, + 144, + 146, ], - "type": "GenericTypeAnnotation", - "typeParameters": null, + "raw": "30", + "type": "Literal", + "value": 30, }, - ], + "type": "AssignmentPattern", + }, "range": Array [ - 61, - 69, + 120, + 146, ], - "type": "TypeParameterInstantiation", + "readonly": false, + "static": false, + "type": "TSParameterProperty", }, - }, - }, - }, - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 48, - "line": 1, - }, - }, - "range": Array [ - 48, - 69, - ], - "type": "RestElement", - }, - ], - "range": Array [ - 0, - 96, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 71, - "line": 1, - }, - }, - "range": Array [ - 71, - 77, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 77, - "line": 1, - }, - "start": Object { - "column": 71, - "line": 1, - }, - }, - "range": Array [ - 71, - 77, - ], - "type": "TSStringKeyword", - }, - }, - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 96, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-extends.src 1`] = ` -Object { - "body": Array [ - Object { - "abstract": false, - "body": Object { - "body": Array [], + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 181, + 188, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 162, + 205, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 52, + "line": 5, + }, + }, + "range": Array [ + 200, + 205, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + }, + "range": Array [ + 162, + 205, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 209, + ], + "type": "FunctionExpression", + }, + }, + ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { - "column": 26, + "column": 10, "line": 1, }, }, "range": Array [ - 26, - 30, + 10, + 211, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, - "heritage": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 25, - ], - "type": "TSInterfaceHeritage", - }, - ], + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "name": "Foo", "range": Array [ - 10, - 13, + 6, + 9, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, @@ -12366,15 +14521,16 @@ Object { }, "range": Array [ 0, - 30, + 211, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 6, }, "start": Object { "column": 0, @@ -12383,1569 +14539,1122 @@ Object { }, "range": Array [ 0, - 30, + 211, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "abstract": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 34, - ], - "type": "TSInterfaceBody", - }, - "heritage": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 25, - ], - "type": "TSInterfaceHeritage", + "loc": Object { + "end": Object { + "column": 5, + "line": 1, }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "Baz", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 29, - ], - "type": "TSInterfaceHeritage", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 5, ], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "Foo", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 34, + 10, + 11, ], - "type": "TSInterfaceDeclaration", + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 34, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "abstract": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, }, - "range": Array [ - 17, - 21, - ], - "type": "TSInterfaceBody", }, - "heritage": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "range": Array [ + 26, + 35, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, }, - "name": "Foo", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", }, + "range": Array [ + 36, + 45, + ], + "type": "Identifier", + "value": "firstName", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 34, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 33, + "line": 2, }, }, "range": Array [ - 0, - 21, + 45, + 46, ], - "type": "TSInterfaceDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 13, - 16, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + "value": "string", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ",", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 69, + 78, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 79, + 87, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 88, + 96, + ], + "type": "Identifier", + "value": "lastName", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 120, + 129, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 144, + 146, + ], + "type": "Numeric", + "value": "30", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 4, + }, + "start": Object { + "column": 40, + "line": 4, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 162, + 171, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 172, + 180, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 181, + 188, + ], + "type": "Identifier", + "value": "student", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 52, + "line": 5, + }, + }, + "range": Array [ + 200, + 205, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 5, + }, + "start": Object { + "column": 59, + "line": 5, + }, + }, + "range": Array [ + 207, + 208, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 60, + "line": 5, + }, + }, + "range": Array [ + 208, + 209, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 21, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = ` +exports[`typescript fixtures/basics/class-with-public-parameter-properties.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { "accessibility": null, "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "baa", + "name": "constructor", "range": Array [ - 20, - 23, + 14, + 25, ], "type": "Identifier", }, + "kind": "constructor", "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 58, + "line": 5, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "optional": false, "range": Array [ - 20, - 32, + 14, + 197, ], - "readonly": false, "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 25, - 31, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 58, + "line": 5, }, "start": Object { - "column": 9, - "line": 2, + "column": 56, + "line": 5, }, }, "range": Array [ - 25, - 31, + 195, + 197, ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 37, - 40, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, + "type": "BlockStatement", }, - }, - "optional": true, - "range": Array [ - 37, - 50, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 58, + "line": 5, }, "start": Object { - "column": 10, - "line": 3, + "column": 13, + "line": 2, }, }, - "range": Array [ - 43, - 49, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, + "params": Array [ + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, }, - }, - "range": Array [ - 43, - 49, - ], - "type": "TSNumberKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": true, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "name": "bax", - "range": Array [ - 56, - 59, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "optional": false, - "range": Array [ - 55, - 69, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 4, - }, - }, - "range": Array [ - 62, - 68, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 4, - }, - }, - "range": Array [ - 62, - 68, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": true, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "name": "baz", - "range": Array [ - 75, - 78, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "optional": true, - "range": Array [ - 74, - 89, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, - }, - }, - "range": Array [ - 82, - 88, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 5, - }, - "start": Object { - "column": 12, - "line": 5, - }, - }, - "range": Array [ - 82, - 88, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "export": false, - "index": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 6, - }, - "start": Object { - "column": 5, - "line": 6, - }, - }, - "name": "eee", - "range": Array [ - 95, - 98, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 6, - }, - "start": Object { - "column": 10, - "line": 6, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "firstName", + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSStringKeyword", + }, + }, }, + "range": Array [ + 26, + 50, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", }, - "range": Array [ - 100, - 106, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, "loc": Object { "end": Object { - "column": 16, - "line": 6, + "column": 46, + "line": 3, }, "start": Object { - "column": 10, - "line": 6, + "column": 14, + "line": 3, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 82, + 90, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "TSStringKeyword", + }, }, }, "range": Array [ - 100, - 106, + 66, + 98, ], - "type": "TSNumberKeyword", - }, - }, - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 94, - 116, - ], - "readonly": false, - "static": false, - "type": "TSIndexSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 6, - }, - "start": Object { - "column": 19, - "line": 6, - }, - }, - "range": Array [ - 109, - 115, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 6, - }, - "start": Object { - "column": 19, - "line": 6, - }, - }, - "range": Array [ - 109, - 115, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "export": false, - "index": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 7, - }, - "start": Object { - "column": 5, - "line": 7, - }, - }, - "name": "fff", - "optional": true, - "range": Array [ - 122, - 125, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 7, - }, - "start": Object { - "column": 11, - "line": 7, - }, + "readonly": true, + "static": false, + "type": "TSParameterProperty", }, - "range": Array [ - 128, - 134, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, "loc": Object { "end": Object { - "column": 17, - "line": 7, + "column": 37, + "line": 4, }, "start": Object { - "column": 11, - "line": 7, + "column": 14, + "line": 4, + }, + }, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "name": "age", + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 114, + 137, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 135, + 137, + ], + "raw": "30", + "type": "Literal", + "value": 30, }, + "type": "AssignmentPattern", }, "range": Array [ - 128, - 134, + 114, + 137, ], - "type": "TSNumberKeyword", + "readonly": false, + "static": false, + "type": "TSParameterProperty", }, - }, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "range": Array [ - 121, - 144, - ], - "readonly": false, - "static": false, - "type": "TSIndexSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 7, - }, - "start": Object { - "column": 20, - "line": 7, - }, - }, - "range": Array [ - 137, - 143, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 7, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, }, - "start": Object { - "column": 20, - "line": 7, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": "student", + "range": Array [ + 169, + 176, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 153, + 193, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 5, + }, + }, + "range": Array [ + 188, + 193, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", }, + "range": Array [ + 153, + 193, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", }, - "range": Array [ - 137, - 143, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "name": "doo", - "range": Array [ - 149, - 152, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "optional": false, - "params": Array [], - "range": Array [ - 149, - 161, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 11, - "line": 8, - }, - }, "range": Array [ - 156, - 160, + 25, + 197, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 11, - "line": 8, - }, - }, - "range": Array [ - 156, - 160, - ], - "type": "TSVoidKeyword", - }, + "type": "FunctionExpression", }, }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "name": "doo", - "range": Array [ - 166, - 169, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 9, - }, - }, - "optional": true, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 9, - }, - "start": Object { - "column": 9, - "line": 9, - }, - }, - "name": "a", - "range": Array [ - 171, - 172, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 9, - }, - "start": Object { - "column": 12, - "line": 9, - }, - }, - "name": "b", - "range": Array [ - 174, - 175, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 9, - }, - "start": Object { - "column": 15, - "line": 9, - }, - }, - "name": "c", - "range": Array [ - 177, - 178, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 166, - 186, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 9, - }, - "start": Object { - "column": 19, - "line": 9, - }, - }, - "range": Array [ - 181, - 185, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 9, - }, - "start": Object { - "column": 19, - "line": 9, - }, - }, - "range": Array [ - 181, - 185, - ], - "type": "TSVoidKeyword", - }, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, }, - Object { - "accessibility": null, - "computed": true, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 10, - }, - "start": Object { - "column": 5, - "line": 10, - }, - }, - "name": "loo", - "range": Array [ - 192, - 195, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 10, - }, - "start": Object { - "column": 4, - "line": 10, - }, - }, - "optional": true, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 10, - }, - "start": Object { - "column": 11, - "line": 10, - }, - }, - "name": "a", - "range": Array [ - 198, - 199, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 10, - }, - "start": Object { - "column": 14, - "line": 10, - }, - }, - "name": "b", - "range": Array [ - 201, - 202, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 10, - }, - "start": Object { - "column": 17, - "line": 10, - }, - }, - "name": "c", - "range": Array [ - 204, - 205, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 191, - 213, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 10, - }, - "start": Object { - "column": 21, - "line": 10, - }, - }, - "range": Array [ - 208, - 212, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 10, - }, - "start": Object { - "column": 21, - "line": 10, - }, - }, - "range": Array [ - 208, - 212, - ], - "type": "TSVoidKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "name": "boo", - "range": Array [ - 218, - 221, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 11, - }, - "start": Object { - "column": 11, - "line": 11, - }, - }, - "name": "a", - "range": Array [ - 225, - 226, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 11, - }, - "start": Object { - "column": 14, - "line": 11, - }, - }, - "name": "b", - "range": Array [ - 228, - 229, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 11, - }, - "start": Object { - "column": 17, - "line": 11, - }, - }, - "name": "c", - "range": Array [ - 231, - 232, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 218, - 240, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 11, - }, - "start": Object { - "column": 21, - "line": 11, - }, - }, - "range": Array [ - 235, - 239, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 11, - }, - "start": Object { - "column": 21, - "line": 11, - }, - }, - "range": Array [ - 235, - 239, - ], - "type": "TSVoidKeyword", - }, - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 11, - }, - "start": Object { - "column": 7, - "line": 11, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 9, - "line": 11, - }, - "start": Object { - "column": 8, - "line": 11, - }, - }, - "name": "J", - "range": Array [ - 222, - 223, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 221, - 224, - ], - "type": "TypeParameterDeclaration", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 12, - }, - "start": Object { - "column": 4, - "line": 12, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 12, - }, - "start": Object { - "column": 9, - "line": 12, - }, - }, - "name": "a", - "range": Array [ - 250, - 251, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 12, - }, - "start": Object { - "column": 12, - "line": 12, - }, - }, - "name": "b", - "optional": true, - "range": Array [ - 253, - 254, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 245, - 265, - ], - "type": "TSConstructSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 12, - }, - "start": Object { - "column": 17, - "line": 12, - }, - }, - "range": Array [ - 258, - 264, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 12, - }, - "start": Object { - "column": 17, - "line": 12, - }, - }, - "range": Array [ - 258, - 264, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 13, - }, - "start": Object { - "column": 4, - "line": 13, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 13, - }, - "start": Object { - "column": 12, - "line": 13, - }, - }, - "name": "a", - "range": Array [ - 278, - 279, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 13, - }, - "start": Object { - "column": 15, - "line": 13, - }, - }, - "name": "b", - "optional": true, - "range": Array [ - 281, - 282, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 270, - 293, - ], - "type": "TSConstructSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 13, - }, - "start": Object { - "column": 20, - "line": 13, - }, - }, - "range": Array [ - 286, - 292, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 13, - }, - "start": Object { - "column": 20, - "line": 13, - }, - }, - "range": Array [ - 286, - 292, - ], - "type": "TSStringKeyword", - }, - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 13, - }, - "start": Object { - "column": 8, - "line": 13, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 13, - }, - "start": Object { - "column": 9, - "line": 13, - }, - }, - "name": "F", - "range": Array [ - 275, - 276, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 274, - 277, - ], - "type": "TypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 14, - }, - "start": Object { - "column": 14, - "line": 1, + "start": Object { + "column": 10, + "line": 1, }, }, "range": Array [ - 14, - 295, + 10, + 199, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, - "heritage": Array [], + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "name": "Foo", "range": Array [ - 10, - 13, + 6, + 9, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 14, + "line": 6, }, "start": Object { "column": 0, @@ -13954,15 +15663,16 @@ Object { }, "range": Array [ 0, - 295, + 199, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 14, + "line": 6, }, "start": Object { "column": 0, @@ -13971,158 +15681,15 @@ Object { }, "range": Array [ 0, - 295, + 199, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "abstract": false, - "body": Object { - "body": Array [ - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "params": Array [ - Object { - "accessibility": "public", - "export": false, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - "range": Array [ - 26, - 34, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", - }, - Object { - "accessibility": "private", - "export": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "parameter": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "name": "y", - "range": Array [ - 44, - 45, - ], - "type": "Identifier", - }, - "range": Array [ - 36, - 45, - ], - "readonly": false, - "static": false, - "type": "TSParameterProperty", - }, - ], - "range": Array [ - 21, - 47, - ], - "type": "TSConstructSignature", - "typeAnnotation": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 49, - ], - "type": "TSInterfaceBody", - }, - "heritage": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "Test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 5, + "line": 1, }, "start": Object { "column": 0, @@ -14131,794 +15698,921 @@ Object { }, "range": Array [ 0, - 49, + 5, ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "class", }, - }, - "range": Array [ - 0, - 49, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-with-extends-type-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "abstract": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 36, - ], - "type": "TSInterfaceBody", - }, - "heritage": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "Bar", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 28, - ], - "type": "TSInterfaceHeritage", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "J", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 28, - 31, - ], - "type": "TypeParameterInstantiation", - }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, }, - ], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "Foo", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 36, + 10, + 11, ], - "type": "TSInterfaceDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 14, - 15, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 13, - 16, - ], - "type": "TypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-with-generic.src 1`] = ` -Object { - "body": Array [ Object { - "abstract": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, }, - "range": Array [ - 18, - 21, - ], - "type": "TSInterfaceBody", - }, - "heritage": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "start": Object { + "column": 2, + "line": 2, }, - "name": "Test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { "loc": Object { "end": Object { - "column": 1, + "column": 14, "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 0, - 21, + 25, + 26, ], - "type": "TSInterfaceDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 15, - 16, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 14, - 17, - ], - "type": "TypeParameterDeclaration", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-with-jsdoc.src 1`] = ` -Object { - "body": Array [ Object { - "abstract": false, - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 76, - 79, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 6, - }, - "start": Object { - "column": 8, - "line": 6, - }, - }, - "name": "bar", - "range": Array [ - 80, - 83, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 76, - 85, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 7, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, }, - "range": Array [ - 15, - 87, - ], - "type": "TSInterfaceBody", - }, - "heritage": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "start": Object { + "column": 14, + "line": 2, }, - "name": "Test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "public", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 30, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 0, - 87, + 33, + 42, ], - "type": "TSInterfaceDeclaration", + "type": "Identifier", + "value": "firstName", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 7, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 66, + 72, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 73, + 81, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 82, + 90, + ], + "type": "Identifier", + "value": "lastName", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 114, + 120, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 135, + 137, + ], + "type": "Numeric", + "value": "30", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 153, + 159, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 160, + 168, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 169, + 176, + ], + "type": "Identifier", + "value": "student", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 5, + }, + "start": Object { + "column": 47, + "line": 5, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 5, + }, + }, + "range": Array [ + 188, + 193, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 193, + 194, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 87, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = ` +exports[`typescript fixtures/basics/class-with-readonly-parameter-properties.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { "accessibility": null, "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 2, }, "start": Object { - "column": 4, + "column": 2, "line": 2, }, }, - "name": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": true, - "range": Array [ - 21, - 26, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": null, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "bar", + "name": "constructor", "range": Array [ - 31, - 34, + 14, + 25, ], "type": "Identifier", }, + "kind": "constructor", "loc": Object { "end": Object { - "column": 17, + "column": 53, "line": 3, }, "start": Object { - "column": 4, - "line": 3, + "column": 2, + "line": 2, }, }, - "optional": true, "range": Array [ - 31, - 44, + 14, + 107, ], - "readonly": false, "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 37, - 43, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 16, + "column": 53, "line": 3, }, "start": Object { - "column": 10, + "column": 51, "line": 3, }, }, "range": Array [ - 37, - 43, + 105, + 107, ], - "type": "TSStringKeyword", + "type": "BlockStatement", }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "key": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 53, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 13, + "line": 2, }, }, - "name": "baz", - "range": Array [ - 49, - 52, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "optional": true, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "name": "foo", - "range": Array [ - 54, - 57, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "name": "bar", - "optional": true, - "range": Array [ - 59, - 62, - ], - "type": "Identifier", - "typeAnnotation": Object { + "params": Array [ + Object { + "accessibility": null, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 40, + "line": 2, }, "start": Object { - "column": 20, - "line": 4, + "column": 14, + "line": 2, }, }, - "range": Array [ - 65, - 71, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "parameter": Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 32, + "line": 2, }, "start": Object { - "column": 20, - "line": 4, + "column": 23, + "line": 2, }, }, + "name": "firstName", "range": Array [ - 65, - 71, + 35, + 44, ], - "type": "TSStringKeyword", + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSStringKeyword", + }, + }, }, + "range": Array [ + 26, + 52, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", }, - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 4, + Object { + "accessibility": null, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, }, - "start": Object { - "column": 28, - "line": 4, + "parameter": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "name": "lastName", + "range": Array [ + 77, + 85, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 68, + 103, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "raw": "'Smith'", + "type": "Literal", + "value": "Smith", + }, + "type": "AssignmentPattern", }, + "range": Array [ + 68, + 103, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", }, - "name": "baz", - "optional": true, - "range": Array [ - 73, - 76, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 49, - 79, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": null, + ], + "range": Array [ + 25, + 107, + ], + "type": "FunctionExpression", + }, }, ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 4, }, "start": Object { - "column": 15, + "column": 10, "line": 1, }, }, "range": Array [ - 15, - 81, + 10, + 109, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, - "heritage": Array [], + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, - "name": "test", + "name": "Foo", "range": Array [ - 10, - 14, + 6, + 9, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -14927,15 +16621,16 @@ Object { }, "range": Array [ 0, - 81, + 109, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 4, }, "start": Object { "column": 0, @@ -14944,494 +16639,406 @@ Object { }, "range": Array [ 0, - 81, + 109, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/interface-without-type-annotation.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "abstract": false, - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": false, - "range": Array [ - 21, - 25, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 15, - 27, - ], - "type": "TSInterfaceBody", }, - "heritage": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 27, + 10, + 11, ], - "type": "TSInterfaceDeclaration", + "type": "Punctuator", + "value": "{", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "nestedArray", - "range": Array [ - 4, - 15, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 44, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 44, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 17, - 22, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 23, - 28, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 43, - ], - "type": "GenericTypeAnnotation", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "Array", - "range": Array [ - 29, - 34, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 42, - ], - "type": "GenericTypeAnnotation", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSStringKeyword", - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 34, - 42, - ], - "type": "TypeParameterInstantiation", - }, - }, - ], - "range": Array [ - 28, - 43, - ], - "type": "TypeParameterInstantiation", - }, - }, - ], - "range": Array [ - 22, - 44, - ], - "type": "TypeParameterInstantiation", - }, - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 44, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, }, + }, + "range": Array [ + 26, + 34, ], - "kind": "var", + "type": "Identifier", + "value": "readonly", + }, + Object { "loc": Object { "end": Object { - "column": 44, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 0, + 35, 44, ], - "type": "VariableDeclaration", + "type": "Identifier", + "value": "firstName", }, - ], - "loc": Object { - "end": Object { - "column": 44, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ":", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 68, + 76, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 77, + 85, + ], + "type": "Identifier", + "value": "lastName", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "type": "String", + "value": "'Smith'", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 3, + }, + "start": Object { + "column": 51, + "line": 3, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 52, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 44, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +exports[`typescript fixtures/basics/class-with-readonly-property.src 1`] = ` Object { "body": Array [ Object { - "async": false, "body": Object { "body": Array [ Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "name": "e", - "range": Array [ - 56, - 57, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "validateEntity", - "range": Array [ - 41, - 55, - ], - "type": "Identifier", - }, + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { "loc": Object { "end": Object { - "column": 21, + "column": 23, "line": 2, }, "start": Object { - "column": 4, + "column": 20, "line": 2, }, }, + "name": "foo", "range": Array [ - 41, - 58, + 32, + 35, ], - "type": "CallExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 35, "line": 2, }, "start": Object { @@ -15440,268 +17047,92 @@ Object { }, }, "range": Array [ - 41, - 59, + 16, + 47, ], - "type": "ExpressionStatement", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "name": "s", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", + "readonly": true, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, }, - "init": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "object": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "name": "e", - "range": Array [ - 72, - 73, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 72, - 74, - ], - "type": "TSNonNullExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 75, - 79, - ], - "type": "Identifier", - }, - "range": Array [ - 72, - 79, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, + "start": Object { + "column": 26, + "line": 2, }, - "range": Array [ - 68, - 79, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, }, + "range": Array [ + 38, + 46, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", }, - "range": Array [ - 64, - 80, - ], - "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 35, + "column": 10, "line": 1, }, }, "range": Array [ - 35, - 82, + 10, + 49, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 22, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "processEntity", + "name": "Foo", "range": Array [ + 6, 9, - 22, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "e", - "optional": true, - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 33, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 33, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "name": "Entity", - "range": Array [ - 27, - 33, - ], - "type": "Identifier", - }, - }, - }, - }, - ], "range": Array [ 0, - 82, + 49, ], - "type": "FunctionDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -15710,93 +17141,14 @@ Object { }, "range": Array [ 0, - 82, + 49, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "type": "TSNullKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 11, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 12, + "column": 5, "line": 1, }, "start": Object { @@ -15806,348 +17158,379 @@ Object { }, "range": Array [ 0, - 12, + 5, ], - "type": "VariableDeclaration", + "type": "Keyword", + "value": "class", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "y", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 20, - 29, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 20, - 29, - ], - "type": "TSUndefinedKeyword", - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 17, - 29, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, + }, + "range": Array [ + 6, + 9, ], - "kind": "let", + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, "line": 2, }, "start": Object { - "column": 0, + "column": 4, "line": 2, }, }, "range": Array [ - 13, - 30, + 16, + 22, ], - "type": "VariableDeclaration", + "type": "Keyword", + "value": "public", }, - ], - "loc": Object { - "end": Object { - "column": 17, - "line": 2, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "Identifier", + "value": "readonly", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 30, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` +exports[`typescript fixtures/basics/class-with-static-parameter-properties.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + }, + "kind": "constructor", "loc": Object { "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { "column": 5, - "line": 1, - }, - }, - "name": "Result", - "range": Array [ - 5, - 11, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 17, - 37, + 16, + 54, ], - "type": "TSUnionType", - "types": Array [ - Object { + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 17, - 27, + 46, + 54, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "Success", - "range": Array [ - 17, - 24, - ], - "type": "Identifier", + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, }, - "typeParameters": Object { + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": null, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 16, + "line": 2, }, }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", + "parameter": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, }, + }, + "name": "a", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 32, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 25, - 26, + 38, + 44, ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 24, - 27, - ], - "type": "TypeParameterInstantiation", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 37, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, }, }, - "name": "Failure", "range": Array [ - 30, - 37, + 28, + 44, ], - "type": "Identifier", + "readonly": false, + "static": true, + "type": "TSParameterProperty", }, - }, - ], - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + ], + "range": Array [ + 27, + 54, + ], + "type": "FunctionExpression", }, }, - "range": Array [ - 5, - 37, - ], - "type": "VariableDeclarator", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 12, - 13, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 11, - 14, - ], - "type": "TypeParameterDeclaration", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, }, }, - ], - "kind": "type", + "range": Array [ + 10, + 56, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -16156,15 +17539,16 @@ Object { }, "range": Array [ 0, - 37, + 56, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -16173,274 +17557,367 @@ Object { }, "range": Array [ 0, - 37, + 56, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; -exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +exports[`typescript fixtures/basics/class-with-type-parameter.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Result", - "range": Array [ - 5, - 11, - ], - "type": "Identifier", + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "init": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 48, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 38, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "Success", - "range": Array [ - 28, - 35, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 35, - 38, - ], - "type": "TypeParameterInstantiation", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 48, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "name": "Failure", - "range": Array [ - 41, - 48, - ], - "type": "Identifier", - }, - }, - ], + "start": Object { + "column": 13, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + }, + "range": Array [ + 13, + 17, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, }, - "range": Array [ - 5, - 48, - ], - "type": "VariableDeclarator", - "typeParameters": Object { + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, "loc": Object { "end": Object { - "column": 25, + "column": 11, "line": 1, }, "start": Object { - "column": 11, + "column": 10, "line": 1, }, }, - "params": Array [ - Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 24, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 22, - 24, - ], - "type": "TSTypeLiteral", - }, - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 12, - 24, - ], - "type": "TypeParameter", - }, - ], + "name": "T", "range": Array [ + 10, 11, - 25, ], - "type": "TypeParameterDeclaration", + "type": "TypeParameter", }, - }, - ], - "kind": "type", + ], + "range": Array [ + 9, + 12, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { "loc": Object { "end": Object { - "column": 48, + "column": 5, "line": 1, }, "start": Object { @@ -16450,214 +17927,170 @@ Object { }, "range": Array [ 0, - 48, + 5, ], - "type": "VariableDeclaration", + "type": "Keyword", + "value": "class", }, - ], - "loc": Object { - "end": Object { - "column": 48, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 48, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +exports[`typescript fixtures/basics/class-with-type-parameter-default.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "init": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "members": Array [ - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "optional": false, - "range": Array [ - 12, - 24, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 23, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 23, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "optional": false, - "range": Array [ - 25, - 28, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": null, - }, - ], - "range": Array [ - 11, - 29, - ], - "type": "TSTypeLiteral", + "start": Object { + "column": 19, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + }, + "range": Array [ + 19, + 23, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 5, - 30, - ], - "type": "VariableDeclarator", }, - ], - "kind": "type", + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -16666,326 +18099,370 @@ Object { }, "range": Array [ 0, - 30, + 23, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 30, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-guard.src 1`] = ` -Object { - "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [ + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ Object { - "argument": Object { - "left": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 59, - 60, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "operator": "typeof", - "prefix": true, - "range": Array [ - 52, - 60, - ], - "type": "UnaryExpression", - }, + "constraint": null, + "default": Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 14, + "line": 1, }, }, - "operator": "===", "range": Array [ - 52, - 73, + 14, + 17, ], - "right": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 14, + "line": 1, }, }, + "name": "Bar", "range": Array [ - 65, - 73, + 14, + 17, ], - "raw": "'string'", - "type": "Literal", - "value": "string", + "type": "Identifier", }, - "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 32, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 10, + "line": 1, }, }, + "name": "T", "range": Array [ - 45, - 73, + 10, + 17, ], - "type": "ReturnStatement", + "type": "TypeParameter", }, ], + "range": Array [ + 9, + 18, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/class-with-type-parameter-underscore.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 39, + "column": 13, "line": 1, }, }, "range": Array [ - 39, - 75, + 13, + 15, ], - "type": "BlockStatement", + "type": "ClassBody", }, - "expression": false, - "generator": false, + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "isString", + "name": "A", "range": Array [ - 9, - 17, + 6, + 7, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "range": Array [ + 0, + 15, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "name": "x", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, "loc": Object { "end": Object { - "column": 24, + "column": 11, "line": 1, }, "start": Object { - "column": 21, + "column": 8, "line": 1, }, }, + "name": "__P", "range": Array [ - 21, - 24, + 8, + 11, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 24, - ], - "type": "TSAnyKeyword", - }, - }, - }, - ], - "range": Array [ - 0, - 75, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, + "type": "TypeParameter", }, - }, + ], "range": Array [ - 27, - 38, + 7, + 12, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "parameterName": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 27, - 28, - ], - "type": "Identifier", - }, - "range": Array [ - 27, - 38, - ], - "type": "TSTypePredicate", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStringKeyword", - }, - }, - }, + "type": "TypeParameterDeclaration", }, - "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { "column": 0, @@ -16994,111 +18471,14 @@ Object { }, "range": Array [ 0, - 75, + 15, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 0, - 3, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 42, - ], - "type": "CallExpression", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - ], - "range": Array [ - 3, - 40, - ], - "type": "TypeParameterInstantiation", - }, - }, "loc": Object { "end": Object { - "column": 43, + "column": 5, "line": 1, }, "start": Object { @@ -17108,548 +18488,226 @@ Object { }, "range": Array [ 0, - 43, + 5, ], - "type": "ExpressionStatement", + "type": "Keyword", + "value": "class", }, Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 40, - "line": 2, - }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 84, - 87, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "bar", - "range": Array [ - 53, - 56, - ], - "type": "Identifier", }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { "loc": Object { "end": Object { - "column": 43, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 7, + "line": 1, }, }, - "params": Array [], "range": Array [ - 44, - 87, + 7, + 8, ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, }, - "params": Array [ - Object { - "constraint": null, - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "A", - "range": Array [ - 68, - 69, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 56, - 81, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "__P", }, Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 46, - "line": 3, - }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "range": Array [ - 134, - 137, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, + "start": Object { + "column": 11, + "line": 1, }, - "name": "baz", - "range": Array [ - 97, - 100, - ], - "type": "Identifier", }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { "loc": Object { "end": Object { - "column": 49, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 13, + "line": 1, }, }, - "params": Array [], "range": Array [ - 88, - 137, + 13, + 14, ], - "type": "FunctionDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "params": Array [ - Object { - "constraint": null, - "default": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 38, - "line": 3, - }, - }, - "range": Array [ - 126, - 129, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 38, - "line": 3, - }, - }, - "name": "Foo", - "range": Array [ - 126, - 129, - ], - "type": "Identifier", - }, - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 3, - }, - "start": Object { - "column": 24, - "line": 3, - }, - }, - "name": "A", - "range": Array [ - 112, - 129, - ], - "type": "TypeParameter", - }, - ], - "range": Array [ - 100, - 131, - ], - "type": "TypeParameterDeclaration", }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", }, ], - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 137, - ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/basics/typed-this.src 1`] = ` +exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { "accessibility": null, "computed": false, - "export": false, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 2, }, "start": Object { - "column": 1, + "column": 4, "line": 2, }, }, - "name": "addClickListener", + "name": "bar", + "optional": true, "range": Array [ - 23, - 39, + 24, + 27, ], "type": "Identifier", }, + "kind": "method", "loc": Object { "end": Object { - "column": 65, + "column": 16, "line": 2, }, "start": Object { - "column": 1, + "column": 4, "line": 2, }, }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "onclick", - "range": Array [ - 40, - 47, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "range": Array [ - 49, - 79, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "parameters": Array [ - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "name": "this", - "range": Array [ - 50, - 54, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 56, - 60, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 56, - 60, - ], - "type": "TSVoidKeyword", - }, - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 2, - }, - "start": Object { - "column": 40, - "line": 2, - }, - }, - "name": "e", - "range": Array [ - 62, - 63, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, - }, - }, - "range": Array [ - 65, - 70, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, - }, - }, - "range": Array [ - 65, - 70, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 2, - }, - "start": Object { - "column": 43, - "line": 2, - }, - }, - "name": "Event", - "range": Array [ - 65, - 70, - ], - "type": "Identifier", - }, - }, - }, - }, - ], - "range": Array [ - 49, - 79, - ], - "type": "TSFunctionType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 53, - "line": 2, - }, - }, - "range": Array [ - 75, - 79, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 53, - "line": 2, - }, - }, - "range": Array [ - 75, - 79, - ], - "type": "TSVoidKeyword", - }, - }, - "typeParameters": null, - }, - }, - }, - ], "range": Array [ - 23, - 87, + 24, + 36, ], - "readonly": false, "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 64, + "column": 16, "line": 2, }, "start": Object { - "column": 60, + "column": 7, "line": 2, }, }, + "params": Array [], "range": Array [ - 82, - 86, + 28, + 36, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { - "column": 64, + "column": 15, "line": 2, }, "start": Object { - "column": 60, + "column": 12, "line": 2, }, }, "range": Array [ - 82, - 86, + 32, + 35, ], - "type": "TSVoidKeyword", + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TSAnyKeyword", + }, }, + "type": "FunctionExpression", }, }, ], @@ -17659,35 +18717,36 @@ Object { "line": 3, }, "start": Object { - "column": 20, + "column": 18, "line": 1, }, }, "range": Array [ - 20, - 89, + 18, + 38, ], - "type": "TSInterfaceBody", + "type": "ClassBody", }, - "heritage": Array [], + "decorators": Array [], "id": Object { "loc": Object { "end": Object { - "column": 19, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, - "name": "UIElement", + "name": "Foo", "range": Array [ - 10, - 19, + 14, + 17, ], "type": "Identifier", }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -17700,9 +18759,10 @@ Object { }, "range": Array [ 0, - 89, + 38, ], - "type": "TSInterfaceDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { @@ -17717,181 +18777,14 @@ Object { }, "range": Array [ 0, - 89, + 38, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "type": "TSTypeReference", - "typeName": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 12, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "C", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - "type": "TSQualifiedName", - }, - }, - }, - }, - "init": null, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 14, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 1, }, "start": Object { @@ -17901,128 +18794,589 @@ Object { }, "range": Array [ 0, - 15, + 7, ], - "type": "VariableDeclaration", + "type": "Identifier", + "value": "declare", }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Foo", }, - }, - "range": Array [ - 0, - 15, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/basics/var-with-type.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/declare-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, "line": 1, }, "start": Object { - "column": 4, + "column": 26, "line": 1, }, }, - "name": "name", "range": Array [ - 4, - 8, + 26, + 32, ], - "type": "Identifier", + "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 15, + "column": 32, "line": 1, }, "start": Object { - "column": 9, + "column": 26, "line": 1, }, }, "range": Array [ - 9, - 15, + 26, + 32, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 15, - ], - "type": "TSStringKeyword", - }, + "type": "TSStringKeyword", }, }, - "init": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 28, - ], - "raw": "\\"Nicholas\\"", - "type": "Literal", - "value": "Nicholas", + }, + ], + "range": Array [ + 0, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 41, "line": 1, }, "start": Object { - "column": 4, + "column": 35, "line": 1, }, }, "range": Array [ - 4, - 28, + 35, + 41, ], - "type": "VariableDeclarator", + "type": "TSStringKeyword", + }, + }, + "type": "DeclareFunction", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 7, ], - "kind": "var", + "type": "Identifier", + "value": "declare", + }, + Object { "loc": Object { "end": Object { - "column": 29, + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, "line": 1, }, "start": Object { @@ -18032,14 +19386,14 @@ Object { }, "range": Array [ 0, - 29, + 13, ], - "type": "VariableDeclaration", + "type": "TSExportAssigment", }, ], "loc": Object { "end": Object { - "column": 29, + "column": 13, "line": 1, }, "start": Object { @@ -18049,285 +19403,172 @@ Object { }, "range": Array [ 0, - 29, + 13, ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = ` -Object { - "body": Array [ + "sourceType": "module", + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 32, - 37, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "configurable", - "range": Array [ - 19, - 31, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 19, - 38, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 18, - 38, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 47, - 48, - ], - "type": "Identifier", - }, - "kind": "get", - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "range": Array [ - 18, - 70, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 60, - 64, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "_x", - "range": Array [ - 65, - 67, - ], - "type": "Identifier", - }, - "range": Array [ - 60, - 67, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 53, - 68, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 51, - 70, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 48, - 70, - ], - "type": "FunctionExpression", + "start": Object { + "column": 24, + "line": 1, }, }, - ], + "range": Array [ + 24, + 28, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 12, + "column": 15, "line": 1, }, }, "range": Array [ - 12, - 72, + 15, + 28, ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TypeParameterDeclaration", }, - "name": "Point", - "range": Array [ - 6, - 11, - ], - "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -18336,16 +19577,15 @@ Object { }, "range": Array [ 0, - 72, + 28, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -18354,343 +19594,263 @@ Object { }, "range": Array [ 0, - 72, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 25, - 34, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 30, - 34, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - }, - ], - "range": Array [ - 23, - 36, - ], - "type": "ObjectExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 19, - 37, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 18, - 37, - ], - "type": "Decorator", - }, - ], - "key": Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 15, - "line": 3, + "column": 21, + "line": 1, }, }, - "name": "bar", + "name": "T", "range": Array [ - 53, - 56, + 21, + 22, ], - "type": "Identifier", - }, - "kind": "get", - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "type": "TypeParameter", }, - "range": Array [ - 18, - 80, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 3, - }, - "start": Object { - "column": 30, - "line": 3, - }, - }, - "range": Array [ - 68, - 72, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 3, - }, - "start": Object { - "column": 35, - "line": 3, - }, - }, - "name": "_bar", - "range": Array [ - 73, - 77, - ], - "type": "Identifier", - }, - "range": Array [ - 68, - 77, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "range": Array [ - 61, - 78, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 59, - 80, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + Object { + "constraint": null, "loc": Object { "end": Object { - "column": 42, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 24, + "line": 1, }, }, - "params": Array [], + "name": "U", "range": Array [ - 56, - 80, + 24, + 25, ], - "type": "FunctionExpression", + "type": "TypeParameter", }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 82, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + ], + "range": Array [ + 20, + 26, + ], + "type": "TypeParameterDeclaration", }, - "name": "Other", - "range": Array [ - 6, - 11, - ], - "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -18699,16 +19859,15 @@ Object { }, "range": Array [ 0, - 82, + 31, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -18717,247 +19876,297 @@ Object { }, "range": Array [ 0, - 82, + 31, ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ + "sourceType": "module", + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "hidden", - "range": Array [ - 15, - 21, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 21, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "name": "z", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - }, - "kind": "get", - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 53, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 43, - 47, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "_z", - "range": Array [ - 48, - 50, - ], - "type": "Identifier", - }, - "range": Array [ - 43, - 50, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 36, - 51, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 3, - }, - }, - "range": Array [ - 34, - 53, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 31, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 31, - 53, - ], - "type": "FunctionExpression", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, + "range": Array [ + 20, + 24, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", }, - "range": Array [ - 8, - 55, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { + "implements": Array [], "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, - "name": "P", "range": Array [ - 6, 7, + 24, ], - "type": "Identifier", + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 16, + 19, + ], + "type": "TypeParameterDeclaration", + }, }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -18966,16 +20175,17 @@ Object { }, "range": Array [ 0, - 55, + 24, ], - "superClass": null, - "type": "ClassDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -18984,303 +20194,280 @@ Object { }, "range": Array [ 0, - 55, + 24, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "adminonly", - "range": Array [ - 18, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 17, - 27, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "name": "y", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "kind": "set", - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 23, + "line": 1, }, - "range": Array [ - 17, - 76, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 62, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "name": "_y", - "range": Array [ - 63, - 65, - ], - "type": "Identifier", - }, - "range": Array [ - 58, - 65, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "operator": "=", - "range": Array [ - 58, - 69, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "name": "a", - "range": Array [ - 68, - 69, - ], - "type": "Identifier", - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 58, - 70, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 48, - 76, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "params": Array [ - Object { - "decorators": Array [], - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 45, - 46, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 44, - 76, - ], - "type": "FunctionExpression", + }, + "range": Array [ + 23, + 27, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, }, - ], + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 3, }, "start": Object { - "column": 11, + "column": 7, "line": 1, }, }, "range": Array [ - 11, - 78, + 7, + 27, ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "TypeParameter", + }, + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 20, + 21, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 16, + 22, + ], + "type": "TypeParameterDeclaration", }, - "name": "User", - "range": Array [ - 6, - 10, - ], - "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 3, }, "start": Object { "column": 0, @@ -19289,16 +20476,17 @@ Object { }, "range": Array [ 0, - 78, + 27, ], - "superClass": null, - "type": "ClassDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 3, }, "start": Object { "column": 0, @@ -19307,306 +20495,311 @@ Object { }, "range": Array [ 0, - 78, + 27, ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` -Object { - "body": Array [ + "sourceType": "module", + "tokens": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 18, - 20, - ], - "type": "ClassBody", }, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "sealed", - "range": Array [ - 1, - 7, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "Decorator", + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, + }, + "range": Array [ + 7, + 12, ], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "name": "Qux", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 0, + "column": 16, "line": 1, }, }, "range": Array [ - 0, - 20, + 16, + 17, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "<", }, - ], - "loc": Object { - "end": Object { - "column": 12, - "line": 2, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "T", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", }, - }, - "range": Array [ - 0, - 20, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 19, - "line": 4, - }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, }, - "range": Array [ - 56, - 58, - ], - "type": "ClassBody", }, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "selector", - "range": Array [ - 17, - 25, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 17, - 32, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 27, - 32, - ], - "raw": "'foo'", - "type": "Literal", - "value": "foo", - }, - }, - ], - "range": Array [ - 11, - 35, - ], - "type": "ObjectExpression", - }, - ], - "callee": Object { + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 21, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, - "name": "Component", + "name": "TestAlias", "range": Array [ - 1, - 10, + 12, + 21, ], "type": "Identifier", }, + "init": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 39, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "TSNumberKeyword", + }, + ], + }, "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 40, + "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, "range": Array [ - 1, - 36, + 12, + 40, ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "VariableDeclarator", }, - "range": Array [ - 0, - 36, - ], - "type": "Decorator", - }, - ], - "id": Object { + ], + "kind": "type", "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 40, + "line": 1, }, "start": Object { - "column": 6, - "line": 4, + "column": 7, + "line": 1, }, }, - "name": "FooComponent", "range": Array [ - 43, - 55, + 7, + 40, ], - "type": "Identifier", + "type": "VariableDeclaration", }, - "implements": Array [], "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 40, + "line": 1, }, "start": Object { "column": 0, @@ -19615,16 +20808,17 @@ Object { }, "range": Array [ 0, - 58, + 40, ], - "superClass": null, - "type": "ClassDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 40, + "line": 1, }, "start": Object { "column": 0, @@ -19633,214 +20827,317 @@ Object { }, "range": Array [ 0, - 58, + 40, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "value": "TestAlias", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` +exports[`typescript fixtures/basics/export-type-class-declaration.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ + "declaration": Object { + "declarations": Array [ Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 24, - 29, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestClassProps", + "range": Array [ + 12, + 26, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { "loc": Object { "end": Object { - "column": 13, + "column": 9, "line": 2, }, "start": Object { - "column": 5, + "column": 4, "line": 2, }, }, - "name": "onlyRead", + "name": "count", "range": Array [ - 15, - 23, + 35, + 40, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 20, + "column": 17, "line": 2, }, "start": Object { - "column": 5, + "column": 4, "line": 2, }, }, + "optional": false, "range": Array [ - 15, - 30, + 35, + 48, ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSNumberKeyword", + }, }, }, - "range": Array [ - 14, - 30, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "instanceMethod", + ], "range": Array [ - 35, - 49, + 29, + 50, ], - "type": "Identifier", + "type": "TSTypeLiteral", }, - "kind": "method", "loc": Object { "end": Object { - "column": 23, + "column": 2, "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 14, - 54, + 12, + 51, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 52, - 54, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 49, - 54, - ], - "type": "FunctionExpression", - }, + "type": "VariableDeclarator", }, ], + "kind": "type", "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 2, + "line": 3, }, "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 56, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { "column": 7, "line": 1, }, - "start": Object { - "column": 6, - "line": 1, - }, }, - "name": "B", "range": Array [ - 6, 7, + 51, ], - "type": "Identifier", + "type": "VariableDeclaration", }, - "implements": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 2, + "line": 3, }, "start": Object { "column": 0, @@ -19849,16 +21146,17 @@ Object { }, "range": Array [ 0, - 56, + 51, ], - "superClass": null, - "type": "ClassDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 2, + "line": 3, }, "start": Object { "column": 0, @@ -19867,214 +21165,364 @@ Object { }, "range": Array [ 0, - 56, + 51, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 26, + ], + "type": "Identifier", + "value": "TestClassProps", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 35, + 40, + ], + "type": "Identifier", + "value": "count", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` +exports[`typescript fixtures/basics/export-type-function-declaration.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ + "declaration": Object { + "declarations": Array [ Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, - 24, - ], - "raw": "false", - "type": "Literal", - "value": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestCallback", + "range": Array [ + 12, + 24, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameters": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, }, + }, + "name": "a", + "range": Array [ + 28, + 29, ], - "callee": Object { + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 31, + "line": 1, }, }, - "name": "Foo", "range": Array [ - 15, - 18, + 31, + 37, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSNumberKeyword", }, }, - "range": Array [ - 15, - 25, - ], - "type": "CallExpression", }, + ], + "range": Array [ + 27, + 46, + ], + "type": "TSFunctionType", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 46, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 42, + "line": 1, }, }, "range": Array [ - 14, - 25, + 42, + 46, ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "TSVoidKeyword", }, }, - "name": "staticMethod", - "range": Array [ - 37, - 49, - ], - "type": "Identifier", + "typeParameters": null, }, - "kind": "method", "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 47, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 14, - 54, + 12, + 47, ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "range": Array [ - 52, - 54, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 49, - 54, - ], - "type": "FunctionExpression", - }, + "type": "VariableDeclarator", }, ], + "kind": "type", "loc": Object { "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 56, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 7, + "column": 47, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, - "name": "C", "range": Array [ - 6, 7, + 47, ], - "type": "Identifier", + "type": "VariableDeclaration", }, - "implements": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 47, + "line": 1, }, "start": Object { "column": 0, @@ -20083,16 +21531,17 @@ Object { }, "range": Array [ 0, - 56, + 47, ], - "superClass": null, - "type": "ClassDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 47, + "line": 1, }, "start": Object { "column": 0, @@ -20101,82 +21550,278 @@ Object { }, "range": Array [ 0, - 56, + 47, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 24, + ], + "type": "Identifier", + "value": "TestCallback", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 41, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` +exports[`typescript fixtures/basics/function-with-await.src 1`] = ` Object { "body": Array [ Object { + "async": true, "body": Object { "body": Array [ Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "onlyRead", - "range": Array [ - 15, - 23, - ], - "type": "Identifier", - }, + "expression": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 13, + "column": 16, "line": 2, }, "start": Object { - "column": 4, + "column": 10, "line": 2, }, }, + "name": "future", "range": Array [ - 14, - 23, + 40, + 46, ], - "type": "Decorator", + "type": "Identifier", }, - ], - "key": Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { "column": 4, - "line": 3, + "line": 2, }, }, - "name": "instanceMethod", "range": Array [ - 28, - 42, + 34, + 46, ], - "type": "Identifier", + "type": "AwaitExpression", }, - "kind": "method", "loc": Object { "end": Object { - "column": 23, - "line": 3, + "column": 17, + "line": 2, }, "start": Object { "column": 4, @@ -20184,111 +21829,89 @@ Object { }, }, "range": Array [ - 14, + 34, 47, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "range": Array [ - 45, - 47, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 42, - 47, - ], - "type": "FunctionExpression", - }, + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { - "column": 8, + "column": 28, "line": 1, }, }, "range": Array [ - 8, + 28, 49, ], - "type": "ClassBody", + "type": "BlockStatement", }, - "decorators": Array [], + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 19, "line": 1, }, "start": Object { - "column": 6, + "column": 15, "line": 1, }, }, - "name": "A", + "name": "hope", "range": Array [ - 6, - 7, + 15, + 19, ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "future", + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + }, + ], "range": Array [ 0, 49, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 4, + "line": 3, }, "start": Object { "column": 0, @@ -20300,920 +21923,558 @@ Object { 49, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "Foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "name": "staticMethod", - "range": Array [ - 30, - 42, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 47, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "range": Array [ - 45, - 47, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 23, - "line": 3, - }, - }, - "params": Array [], - "range": Array [ - 42, - 47, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 8, - 49, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "D", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 19, + "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, "range": Array [ - 0, - 49, + 15, + 19, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Identifier", + "value": "hope", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 49, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +exports[`typescript fixtures/basics/function-with-object-type-with-optional-properties.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "key": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 14, + "line": 1, }, }, - "name": "constructor", + "method": false, "range": Array [ - 20, - 31, + 14, + 17, ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 20, - 113, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 81, - 85, - ], - "type": "ThisExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 86, - 91, - ], - "type": "Identifier", - }, - "range": Array [ - 81, - 91, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "operator": "=", - "range": Array [ - 81, - 106, - ], - "right": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 3, - }, - }, - "name": "config", - "range": Array [ - 94, - 100, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 101, - 106, - ], - "type": "Identifier", - }, - "range": Array [ - 94, - 106, - ], - "type": "MemberExpression", - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 81, - 107, - ], - "type": "ExpressionStatement", + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 55, - "line": 2, + "column": 19, + "line": 1, }, }, + "name": "baz", "range": Array [ - 71, - 113, + 19, + 22, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + "kind": "init", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 19, + "line": 1, }, }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "APP_CONFIG", - "range": Array [ - 40, - 50, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "Inject", - "range": Array [ - 33, - 39, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 33, - 51, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 32, - 51, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "name": "config", - "range": Array [ - 52, - 58, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 2, - }, - "start": Object { - "column": 44, - "line": 2, - }, - }, - "range": Array [ - 60, - 69, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 2, - }, - "start": Object { - "column": 44, - "line": 2, - }, - }, - "range": Array [ - 60, - 69, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 2, - }, - "start": Object { - "column": 44, - "line": 2, - }, - }, - "name": "AppConfig", - "range": Array [ - 60, - 69, - ], - "type": "Identifier", - }, - }, - }, - }, - ], + "method": false, "range": Array [ - 31, - 113, + 19, + 22, ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 115, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Service", - "range": Array [ - 6, - 13, - ], - "type": "Identifier", - }, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 115, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 115, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", }, - "name": "bar", - "range": Array [ - 16, - 19, - ], - "type": "Identifier", }, - "kind": "method", + ], + "range": Array [ + 13, + 23, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 45, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 16, - 50, + 25, + 45, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 38, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "range": Array [ - 48, - 50, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "type": "TypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 45, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 25, + "line": 1, }, }, - "params": Array [ + "members": Array [ Object { - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 29, - 33, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 21, - 28, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 21, - 34, - ], - "type": "CallExpression", + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, + "start": Object { + "column": 26, + "line": 1, }, - "range": Array [ - 20, - 34, - ], - "type": "Decorator", }, - ], + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 39, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 26, + "line": 1, }, }, - "name": "baz", + "optional": true, "range": Array [ - 35, - 38, + 26, + 39, ], - "type": "Identifier", + "readonly": false, + "static": false, + "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 38, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 32, + "line": 1, }, }, "range": Array [ - 40, - 46, + 32, + 38, ], "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 38, + "line": 1, }, "start": Object { - "column": 28, - "line": 2, + "column": 32, + "line": 1, }, }, "range": Array [ - 40, - 46, + 32, + 38, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, }, }, + "optional": true, + "range": Array [ + 40, + 44, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, }, ], "range": Array [ - 19, - 50, + 25, + 45, ], - "type": "FunctionExpression", + "type": "TSTypeLiteral", }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 1, - }, }, - "range": Array [ - 10, - 52, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, + ], "range": Array [ 0, - 52, + 51, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { @@ -21228,280 +22489,741 @@ Object { }, "range": Array [ 0, - 52, + 51, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/basics/function-with-object-type-without-annotation.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 14, + "line": 1, }, }, - "name": "bar", + "method": false, "range": Array [ - 29, - 32, + 14, + 17, ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 45, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", }, }, - "range": Array [ - 22, - 63, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 43, - "line": 2, + "column": 19, + "line": 1, }, }, + "name": "baz", "range": Array [ - 61, - 63, + 19, + 22, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + "kind": "init", "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 19, + "line": 1, }, }, - "params": Array [ + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 13, + 23, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 43, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "members": Array [ Object { - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 42, - 46, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "special", - "range": Array [ - 34, - 41, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 34, - 47, - ], - "type": "CallExpression", + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, + "start": Object { + "column": 26, + "line": 1, }, - "range": Array [ - 33, - 47, - ], - "type": "Decorator", }, - ], + "name": "bar", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 38, + "line": 1, }, "start": Object { - "column": 30, - "line": 2, + "column": 26, + "line": 1, }, }, - "name": "baz", + "optional": false, "range": Array [ - 48, - 51, + 26, + 38, ], - "type": "Identifier", + "readonly": false, + "static": false, + "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 35, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 53, - 59, + 31, + 37, ], "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 41, - "line": 2, + "column": 37, + "line": 1, }, "start": Object { - "column": 35, - "line": 2, + "column": 31, + "line": 1, }, }, "range": Array [ - 53, - 59, + 31, + 37, ], - "type": "TSNumberKeyword", + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, }, }, + "optional": false, + "range": Array [ + 39, + 42, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, }, ], "range": Array [ - 32, - 63, + 25, + 43, ], - "type": "FunctionExpression", + "type": "TSTypeLiteral", }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 65, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "StaticFoo", - "range": Array [ - 6, - 15, - ], - "type": "Identifier", - }, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, }, - }, + ], "range": Array [ 0, - 65, + 49, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { @@ -21516,387 +23238,369 @@ Object { }, "range": Array [ 0, - 65, + 49, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "greet", - "range": Array [ - 20, - 25, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 20, - 95, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 67, - 75, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 82, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 78, - 82, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 67, - 88, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 85, - 88, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 60, - 89, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 50, - 95, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "required", - "range": Array [ - 27, - 35, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 26, - 35, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "name": "name", - "range": Array [ - 36, - 40, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 25, - 95, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 14, - 97, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, }, - "name": "Greeter", - "range": Array [ - 6, - 13, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 13, + "line": 1, }, "start": Object { - "column": 0, + "column": 12, "line": 1, }, }, "range": Array [ - 0, - 97, + 12, + 13, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "(", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 97, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { "body": Array [ Object { - "accessibility": null, - "computed": false, - "decorators": Array [], - "key": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 2, }, "start": Object { @@ -21904,18 +23608,17 @@ Object { "line": 2, }, }, - "name": "greet", + "name": "b", "range": Array [ - 33, - 38, + 36, + 37, ], "type": "Identifier", }, - "kind": "method", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 13, + "line": 2, }, "start": Object { "column": 4, @@ -21923,930 +23626,231 @@ Object { }, }, "range": Array [ - 26, - 108, + 29, + 38, ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 80, - 88, - ], - "raw": "\\"Hello \\"", - "type": "Literal", - "value": "Hello ", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 95, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 3, - }, - }, - "name": "name", - "range": Array [ - 91, - 95, - ], - "type": "Identifier", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 80, - 101, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 3, - }, - }, - "range": Array [ - 98, - 101, - ], - "raw": "\\"!\\"", - "type": "Literal", - "value": "!", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 73, - 102, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 41, - "line": 2, - }, - }, - "range": Array [ - 63, - 108, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "params": Array [ - Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "name": "required", - "range": Array [ - 40, - 48, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 39, - 48, - ], - "type": "Decorator", - }, - ], - "loc": Object { - "end": Object { - "column": 31, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "name": "name", - "range": Array [ - 49, - 53, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 55, - 61, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 2, - }, - "start": Object { - "column": 33, - "line": 2, - }, - }, - "range": Array [ - 55, - 61, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 38, - 108, - ], - "type": "FunctionExpression", - }, + "type": "ReturnStatement", }, ], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { - "column": 20, + "column": 23, "line": 1, }, }, "range": Array [ - 20, - 110, + 23, + 40, ], - "type": "ClassBody", + "type": "BlockStatement", }, - "decorators": Array [], + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 19, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "StaticGreeter", + "name": "a", "range": Array [ - 6, - 19, + 9, + 10, ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "range": Array [ - 0, - 110, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 110, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "Input", - "range": Array [ - 27, - 32, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 27, - 34, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 26, - 34, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "name": "data", - "range": Array [ - 35, - 39, - ], - "type": "Identifier", + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, + }, + "name": "b", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 18, - "line": 2, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 26, - 40, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, - }, - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "Output", - "range": Array [ - 46, - 52, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 46, - 54, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 45, - 54, - ], - "type": "Decorator", - }, + 17, + 18, ], - "key": Object { + "type": "TypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 9, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 17, + "line": 1, }, }, - "name": "click", "range": Array [ - 59, - 64, + 17, + 18, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 31, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 45, - 86, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": Object { - "arguments": Array [], - "callee": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 28, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 16, - "line": 4, + "column": 17, + "line": 1, }, }, - "name": "EventEmitter", + "name": "X", "range": Array [ - 71, - 83, + 17, + 18, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 30, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 67, - 85, - ], - "type": "NewExpression", }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 20, - "line": 1, - }, }, - "range": Array [ - 20, - 88, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { + ], + "range": Array [ + 0, + 40, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 19, + "column": 22, "line": 1, }, "start": Object { - "column": 6, + "column": 21, "line": 1, }, }, - "name": "SomeComponent", "range": Array [ - 6, - 19, + 21, + 22, ], - "type": "Identifier", - }, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 88, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 88, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 18, - "line": 2, - }, - }, - "range": Array [ - 28, - 32, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "configurable", - "range": Array [ - 15, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 33, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 33, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 2, - }, - "start": Object { - "column": 31, - "line": 2, - }, - }, - "name": "prop1", - "range": Array [ - 41, - 46, - ], - "type": "Identifier", + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 21, + "line": 1, }, - "range": Array [ - 14, - 47, - ], - "readonly": false, - "static": true, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, }, - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 4, - }, - "start": Object { - "column": 18, - "line": 4, - }, - }, - "range": Array [ - 67, - 72, - ], - "raw": "false", - "type": "Literal", - "value": false, - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "name": "configurable", - "range": Array [ - 54, - 66, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "range": Array [ - 54, - 73, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 53, - 73, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 5, - }, - "start": Object { - "column": 11, - "line": 5, - }, - }, - "name": "prop2", - "range": Array [ - 85, - 90, - ], - "type": "Identifier", - }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 21, + "line": 1, }, }, + "name": "X", "range": Array [ - 53, - 91, + 21, + 22, ], - "readonly": false, - "static": true, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 8, - "line": 1, + "type": "Identifier", }, }, - "range": Array [ - 8, - 93, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { + "type": "FunctionDeclaration", + "typeParameters": Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, - "name": "A", + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "TypeParameter", + }, + ], "range": Array [ - 6, - 7, + 10, + 13, ], - "type": "Identifier", - }, - "implements": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "type": "TypeParameterDeclaration", }, - "range": Array [ - 0, - 93, - ], - "superClass": null, - "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 1, - "line": 6, + "line": 3, }, "start": Object { "column": 0, @@ -22855,549 +23859,424 @@ Object { }, "range": Array [ 0, - 93, + 40, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 21, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, - }, - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "bar", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 26, - 30, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "name": "y", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 6, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 26, - 37, - ], - "readonly": false, - "static": false, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 39, - ], - "type": "ClassBody", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, }, - "name": "B", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 39, + 10, + 11, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "<", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ">", }, - }, - "range": Array [ - 0, - 39, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 28, - ], - "readonly": false, - "static": true, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, - }, - Object { - "accessibility": null, - "computed": false, - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "qux", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 33, - 37, - ], - "type": "Decorator", - }, - ], - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 4, - }, - }, - "name": "b", - "range": Array [ - 49, - 50, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 33, - 51, - ], - "readonly": false, - "static": true, - "type": "ClassProperty", - "typeAnnotation": null, - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 8, - 53, - ], - "type": "ClassBody", }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "name": "C", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 16, + "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, "range": Array [ - 0, - 53, + 15, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": ":", }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "X", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 53, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-that-have-comments.src 1`] = ` Object { "body": Array [ Object { + "async": false, "body": Object { "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 18, + "column": 33, "line": 1, }, }, "range": Array [ - 18, - 22, + 33, + 35, ], - "type": "ClassBody", + "type": "BlockStatement", }, - "decorators": Array [], + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "Foo", + "name": "compare", "range": Array [ - 6, 9, + 16, ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 22, + 35, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 28, + 29, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 16, + 30, + ], + "type": "TypeParameterDeclaration", + }, }, ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { "column": 0, @@ -23406,59 +24285,15 @@ Object { }, "range": Array [ 0, - 22, + 35, ], "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = ` -Object { - "body": Array [ + "tokens": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 37, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "implements": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { "column": 0, @@ -23467,262 +24302,236 @@ Object { }, "range": Array [ 0, - 37, + 8, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "function", }, - }, - "range": Array [ - 0, - 37, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 33, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 33, - 37, - ], - "type": "ClassBody", - }, - "decorators": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 9, + "line": 1, }, - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", }, - "implements": Array [], + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "compare", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 0, + "column": 16, "line": 1, }, }, "range": Array [ - 0, - 37, + 16, + 17, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, }, - "name": "Bar", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", }, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "T", }, - }, - "range": Array [ - 0, - 37, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "decorators": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "dec", - "range": Array [ - 1, - 4, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 4, - ], - "type": "Decorator", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, }, + }, + "range": Array [ + 29, + 30, ], + "type": "Punctuator", + "value": ">", + }, + Object { "loc": Object { "end": Object { - "column": 14, + "column": 31, "line": 1, }, "start": Object { - "column": 0, + "column": 30, "line": 1, }, }, - "members": Array [], - "name": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, }, - "name": "E", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", }, "range": Array [ - 0, - 14, + 31, + 32, ], - "type": "TSEnumDeclaration", + "type": "Punctuator", + "value": ")", }, - ], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 14, ], - "sourceType": "script", "type": "Program", } `; -exports[`typescript fixtures/errorRecovery/interface-empty-extends.src 1`] = ` +exports[`typescript fixtures/basics/function-with-type-parameters-with-constraint.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, + "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 40, + 49, + ], + "type": "ReturnStatement", + }, + ], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 22, + "column": 34, "line": 1, }, }, "range": Array [ - 22, - 26, + 34, + 51, ], - "type": "TSInterfaceBody", + "type": "BlockStatement", }, - "heritage": Array [], + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, - "name": "Foo", + "name": "a", "range": Array [ + 9, 10, - 13, ], "type": "Identifier", }, @@ -23736,2041 +24545,31457 @@ Object { "line": 1, }, }, - "range": Array [ - 0, - 26, - ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`typescript fixtures/errorRecovery/interface-property-modifiers.src 1`] = ` -Object { - "body": Array [ - Object { - "abstract": false, - "body": Object { - "body": Array [ - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": Object { + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 34, - 37, + 28, + 29, ], - "raw": "'a'", - "type": "Literal", - "value": "a", - }, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 20, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "optional": false, - "range": Array [ - 20, - 38, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 25, - 31, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 28, + "line": 1, }, }, + "name": "X", "range": Array [ - 25, - 31, + 28, + 29, ], - "type": "TSStringKeyword", + "type": "Identifier", }, }, }, - Object { - "accessibility": "public", - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 50, - 51, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + }, + ], + "range": Array [ + 0, + 51, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, }, - "optional": false, - "range": Array [ - 43, - 60, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 53, - 59, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 53, - 59, - ], - "type": "TSStringKeyword", - }, + "start": Object { + "column": 32, + "line": 1, }, }, - Object { - "accessibility": "private", - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "name": "b", - "range": Array [ - 73, - 74, - ], - "type": "Identifier", - }, + "range": Array [ + 32, + 33, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 22, - "line": 4, + "column": 33, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 32, + "line": 1, }, }, - "optional": false, + "name": "X", "range": Array [ - 65, - 83, + 32, + 33, ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 4, - }, - }, - "range": Array [ - 76, - 82, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 4, - }, - }, - "range": Array [ - 76, - 82, - ], - "type": "TSStringKeyword", - }, - }, + "type": "Identifier", + }, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, }, + }, + "params": Array [ Object { - "accessibility": "protected", - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "name": "c", - "range": Array [ - 98, - 99, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "optional": false, - "range": Array [ - 88, - 108, - ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { + "constraint": Object { "loc": Object { "end": Object { "column": 23, - "line": 5, + "line": 1, }, "start": Object { - "column": 17, - "line": 5, + "column": 21, + "line": 1, }, }, "range": Array [ - 101, - 107, + 21, + 23, ], "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { "column": 23, - "line": 5, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "range": Array [ - 101, - 107, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 11, - "line": 6, - }, - }, - "name": "d", - "range": Array [ - 120, - 121, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "optional": false, - "range": Array [ - 113, - 130, - ], - "readonly": false, - "static": true, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 6, - }, - "start": Object { - "column": 14, - "line": 6, - }, - }, - "range": Array [ - 123, - 129, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 6, + "line": 1, }, "start": Object { - "column": 14, - "line": 6, + "column": 21, + "line": 1, }, }, + "members": Array [], "range": Array [ - 123, - 129, + 21, + 23, ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": true, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 7, - }, - "start": Object { - "column": 11, - "line": 7, - }, + "type": "TSTypeLiteral", }, - "name": "e", - "range": Array [ - 142, - 143, - ], - "type": "Identifier", }, "loc": Object { "end": Object { - "column": 21, - "line": 7, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 7, + "column": 11, + "line": 1, }, }, - "optional": false, + "name": "X", "range": Array [ - 135, - 152, + 11, + 23, ], - "readonly": false, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 7, - }, - "start": Object { - "column": 14, - "line": 7, - }, - }, - "range": Array [ - 145, - 151, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 7, - }, - "start": Object { - "column": 14, - "line": 7, - }, - }, - "range": Array [ - 145, - 151, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "initializer": null, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { - "column": 13, - "line": 8, - }, - }, - "name": "f", - "range": Array [ - 166, - 167, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "optional": false, - "range": Array [ - 157, - 176, - ], - "readonly": true, - "static": false, - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 8, - }, - "start": Object { - "column": 16, - "line": 8, - }, - }, - "range": Array [ - 169, - 175, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 8, - }, - "start": Object { - "column": 16, - "line": 8, - }, - }, - "range": Array [ - 169, - 175, - ], - "type": "TSStringKeyword", - }, - }, + "type": "TypeParameter", }, + ], + "range": Array [ + 10, + 24, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-types.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ Object { - "accessibility": "public", - "export": false, - "index": Object { + "argument": Object { "loc": Object { "end": Object { "column": 15, - "line": 10, + "line": 2, }, "start": Object { - "column": 12, - "line": 10, + "column": 11, + "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 190, - 193, + 50, + 54, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 10, - }, - "start": Object { - "column": 17, - "line": 10, - }, - }, - "range": Array [ - 195, - 201, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 10, - }, - "start": Object { - "column": 17, - "line": 10, - }, - }, - "range": Array [ - 195, - 201, - ], - "type": "TSStringKeyword", - }, - }, }, "loc": Object { "end": Object { - "column": 33, - "line": 10, + "column": 16, + "line": 2, }, "start": Object { "column": 4, - "line": 10, + "line": 2, }, }, "range": Array [ - 182, - 211, + 43, + 55, ], - "readonly": false, - "static": false, - "type": "TSIndexSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 10, - }, - "start": Object { - "column": 26, - "line": 10, - }, - }, - "range": Array [ - 204, - 210, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 10, - }, - "start": Object { - "column": 26, - "line": 10, - }, - }, - "range": Array [ - 204, - 210, - ], - "type": "TSStringKeyword", - }, - }, + "type": "ReturnStatement", }, - Object { - "accessibility": "private", - "export": false, - "index": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 11, - }, - "start": Object { - "column": 13, - "line": 11, - }, - }, - "name": "baz", - "range": Array [ - 225, - 228, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 11, - }, - "start": Object { - "column": 18, - "line": 11, - }, - }, - "range": Array [ - 230, - 236, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 11, - }, - "start": Object { - "column": 18, - "line": 11, - }, - }, - "range": Array [ - 230, - 236, - ], - "type": "TSStringKeyword", - }, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 57, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "message", + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, + }, + "name": "name", + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, - "line": 11, + "column": 28, + "line": 1, }, "start": Object { - "column": 4, - "line": 11, + "column": 22, + "line": 1, }, }, "range": Array [ - 216, - 246, + 22, + 28, ], - "readonly": false, - "static": false, - "type": "TSIndexSignature", + "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, - "line": 11, + "column": 28, + "line": 1, }, "start": Object { - "column": 27, - "line": 11, + "column": 22, + "line": 1, }, }, "range": Array [ - 239, - 245, + 22, + 28, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 11, - }, - "start": Object { - "column": 27, - "line": 11, - }, - }, - "range": Array [ - 239, - 245, - ], - "type": "TSStringKeyword", - }, + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 57, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, }, }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "message", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/function-with-types-assignation.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ Object { - "accessibility": "protected", - "export": false, - "index": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 18, - "line": 12, + "column": 13, + "line": 2, }, "start": Object { - "column": 15, - "line": 12, + "column": 9, + "line": 2, }, }, - "name": "baz", + "name": "name", "range": Array [ - 262, - 265, + 89, + 93, ], "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 12, - }, - "start": Object { - "column": 20, - "line": 12, - }, - }, - "range": Array [ - 267, - 273, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 12, - }, - "start": Object { - "column": 20, - "line": 12, - }, - }, - "range": Array [ - 267, - 273, - ], - "type": "TSStringKeyword", - }, - }, }, "loc": Object { "end": Object { - "column": 36, - "line": 12, + "column": 14, + "line": 2, }, "start": Object { - "column": 4, - "line": 12, + "column": 2, + "line": 2, }, }, "range": Array [ - 251, - 283, + 82, + 94, ], - "readonly": false, - "static": false, - "type": "TSIndexSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 12, - }, - "start": Object { - "column": 29, - "line": 12, - }, - }, - "range": Array [ - 276, - 282, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 12, - }, - "start": Object { - "column": 29, - "line": 12, - }, - }, - "range": Array [ - 276, - 282, - ], - "type": "TSStringKeyword", - }, - }, + "type": "ReturnStatement", }, - Object { - "accessibility": null, - "export": false, - "index": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 13, - }, - "start": Object { - "column": 12, - "line": 13, - }, - }, - "name": "baz", - "range": Array [ - 296, - 299, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 13, - }, - "start": Object { - "column": 17, - "line": 13, - }, - }, - "range": Array [ - 301, - 307, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 13, - }, - "start": Object { - "column": 17, - "line": 13, - }, - }, - "range": Array [ - 301, - 307, - ], - "type": "TSStringKeyword", - }, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 96, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "message", + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, + }, + "name": "name", + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 33, - "line": 13, + "column": 28, + "line": 1, }, "start": Object { - "column": 4, - "line": 13, + "column": 22, + "line": 1, }, }, "range": Array [ - 288, - 317, + 22, + 28, ], - "readonly": false, - "static": true, - "type": "TSIndexSignature", + "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, - "line": 13, + "column": 28, + "line": 1, }, "start": Object { - "column": 26, - "line": 13, + "column": 22, + "line": 1, }, }, "range": Array [ - 310, - 316, + 22, + 28, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 13, - }, - "start": Object { - "column": 26, - "line": 13, - }, - }, - "range": Array [ - 310, - 316, - ], - "type": "TSStringKeyword", - }, + "type": "TSStringKeyword", }, }, - Object { - "accessibility": null, - "export": true, - "index": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 14, - }, - "start": Object { - "column": 12, - "line": 14, - }, - }, - "name": "baz", - "range": Array [ - 330, - 333, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 14, - }, - "start": Object { - "column": 17, - "line": 14, - }, - }, - "range": Array [ - 335, - 341, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 14, - }, - "start": Object { - "column": 17, - "line": 14, - }, - }, - "range": Array [ - 335, - 341, - ], - "type": "TSStringKeyword", - }, - }, - }, + }, + Object { + "left": Object { "loc": Object { "end": Object { "column": 33, - "line": 14, + "line": 1, }, "start": Object { - "column": 4, - "line": 14, + "column": 30, + "line": 1, }, }, + "name": "age", "range": Array [ - 322, - 351, + 30, + 33, ], - "readonly": false, - "static": false, - "type": "TSIndexSignature", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, - "line": 14, + "column": 40, + "line": 1, }, "start": Object { - "column": 26, - "line": 14, + "column": 34, + "line": 1, }, }, "range": Array [ - 344, - 350, + 34, + 40, ], "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 32, - "line": 14, + "column": 40, + "line": 1, }, "start": Object { - "column": 26, - "line": 14, + "column": 34, + "line": 1, }, }, "range": Array [ - 344, - 350, + 34, + 40, ], - "type": "TSStringKeyword", + "type": "TSNumberKeyword", }, }, }, - Object { - "accessibility": null, - "export": false, - "index": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 15, - }, - "start": Object { - "column": 14, - "line": 15, - }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 46, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, }, - "name": "baz", - "range": Array [ - 366, - 369, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 15, - }, - "start": Object { - "column": 19, - "line": 15, - }, - }, - "range": Array [ - 371, - 377, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 15, - }, - "start": Object { - "column": 19, - "line": 15, - }, - }, - "range": Array [ - 371, - 377, - ], - "type": "TSStringKeyword", - }, + "start": Object { + "column": 43, + "line": 1, }, }, + "range": Array [ + 43, + 46, + ], + "raw": "100", + "type": "Literal", + "value": 100, + }, + "type": "AssignmentPattern", + }, + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 35, - "line": 15, + "column": 55, + "line": 1, }, "start": Object { - "column": 4, - "line": 15, + "column": 51, + "line": 1, }, }, + "name": "args", "range": Array [ - 356, - 387, + 51, + 55, ], - "readonly": true, - "static": false, - "type": "TSIndexSignature", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, - "line": 15, + "column": 69, + "line": 1, }, "start": Object { - "column": 28, - "line": 15, + "column": 56, + "line": 1, }, }, "range": Array [ - 380, - 386, + 56, + 69, ], "type": "TypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 34, - "line": 15, - }, - "start": Object { - "column": 28, - "line": 15, - }, - }, - "range": Array [ - 380, - 386, - ], - "type": "TSStringKeyword", - }, - }, - }, - Object { - "accessibility": "public", - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 17, - }, - "start": Object { - "column": 11, - "line": 17, - }, - }, - "name": "g", - "range": Array [ - 400, - 401, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 17, - }, - "start": Object { - "column": 4, - "line": 17, - }, - }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 17, + "column": 69, + "line": 1, }, "start": Object { - "column": 13, - "line": 17, + "column": 56, + "line": 1, }, }, - "name": "bar", "range": Array [ - 402, - 405, + 56, + 69, ], - "type": "Identifier", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 24, - "line": 17, + "column": 61, + "line": 1, }, "start": Object { - "column": 18, - "line": 17, + "column": 56, + "line": 1, }, }, + "name": "Array", "range": Array [ - 407, - 413, + 56, + 61, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 17, + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", }, - "start": Object { - "column": 18, - "line": 17, + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, }, + "range": Array [ + 62, + 68, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, }, - "range": Array [ - 407, - 413, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 393, - 421, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 17, - }, - "start": Object { - "column": 27, - "line": 17, - }, - }, - "range": Array [ - 416, - 420, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 17, - }, - "start": Object { - "column": 27, - "line": 17, - }, - }, - "range": Array [ - 416, - 420, - ], - "type": "TSVoidKeyword", - }, - }, - }, - Object { - "accessibility": "private", - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 18, - }, - "start": Object { - "column": 12, - "line": 18, - }, - }, - "name": "h", - "range": Array [ - 434, - 435, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 18, - }, - "start": Object { - "column": 4, - "line": 18, - }, - }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 18, - }, - "start": Object { - "column": 14, - "line": 18, - }, - }, - "name": "bar", - "range": Array [ - 436, - 439, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 18, - }, - "start": Object { - "column": 19, - "line": 18, - }, - }, - "range": Array [ - 441, - 447, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 18, - }, - "start": Object { - "column": 19, - "line": 18, - }, - }, - "range": Array [ - 441, - 447, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 426, - 455, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 18, - }, - "start": Object { - "column": 28, - "line": 18, - }, - }, - "range": Array [ - 450, - 454, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 18, - }, - "start": Object { - "column": 28, - "line": 18, - }, - }, - "range": Array [ - 450, - 454, - ], - "type": "TSVoidKeyword", - }, - }, - }, - Object { - "accessibility": "protected", - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 19, - }, - "start": Object { - "column": 14, - "line": 19, - }, - }, - "name": "i", - "range": Array [ - 470, - 471, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 19, - }, - "start": Object { - "column": 4, - "line": 19, - }, - }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 19, - }, - "start": Object { - "column": 16, - "line": 19, - }, - }, - "name": "bar", - "range": Array [ - 472, - 475, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 19, - }, - "start": Object { - "column": 21, - "line": 19, - }, - }, "range": Array [ - 477, - 483, + 61, + 69, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 19, - }, - "start": Object { - "column": 21, - "line": 19, - }, - }, - "range": Array [ - 477, - 483, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 460, - 491, - ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 19, - }, - "start": Object { - "column": 30, - "line": 19, - }, - }, - "range": Array [ - 486, - 490, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 19, - }, - "start": Object { - "column": 30, - "line": 19, - }, + "type": "TypeParameterInstantiation", }, - "range": Array [ - 486, - 490, - ], - "type": "TSVoidKeyword", }, }, }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 20, - }, - "start": Object { - "column": 11, - "line": 20, - }, - }, - "name": "j", - "range": Array [ - 503, - 504, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 20, - }, - "start": Object { - "column": 4, - "line": 20, - }, + "loc": Object { + "end": Object { + "column": 69, + "line": 1, }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 20, - }, - "start": Object { - "column": 13, - "line": 20, - }, - }, - "name": "bar", - "range": Array [ - 505, - 508, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 20, - }, - "start": Object { - "column": 18, - "line": 20, - }, - }, - "range": Array [ - 510, - 516, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 20, - }, - "start": Object { - "column": 18, - "line": 20, - }, - }, - "range": Array [ - 510, - 516, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], - "range": Array [ - 496, - 524, - ], - "readonly": false, - "static": true, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 20, - }, - "start": Object { - "column": 27, - "line": 20, - }, - }, - "range": Array [ - 519, - 523, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 20, - }, - "start": Object { - "column": 27, - "line": 20, - }, - }, - "range": Array [ - 519, - 523, - ], - "type": "TSVoidKeyword", - }, + "start": Object { + "column": 48, + "line": 1, }, }, - Object { - "accessibility": null, - "computed": false, - "export": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 21, - }, - "start": Object { - "column": 11, - "line": 21, - }, - }, - "name": "k", - "range": Array [ - 536, - 537, - ], - "type": "Identifier", + "range": Array [ + 48, + 69, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 0, + 96, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 32, - "line": 21, - }, - "start": Object { - "column": 4, - "line": 21, - }, + "start": Object { + "column": 71, + "line": 1, }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 21, - }, - "start": Object { - "column": 13, - "line": 21, - }, - }, - "name": "bar", - "range": Array [ - 538, - 541, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 21, - }, - "start": Object { - "column": 18, - "line": 21, - }, - }, - "range": Array [ - 543, - 549, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 21, - }, - "start": Object { - "column": 18, - "line": 21, - }, - }, - "range": Array [ - 543, - 549, - ], - "type": "TSStringKeyword", - }, - }, + }, + "range": Array [ + 71, + 77, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 96, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "message", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "Numeric", + "value": "100", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 55, + ], + "type": "Identifier", + "value": "args", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 89, + 93, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, }, - ], + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "Bar", "range": Array [ - 529, - 557, + 22, + 25, ], - "readonly": false, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 21, - }, - "start": Object { - "column": 27, - "line": 21, - }, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 34, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, }, - "range": Array [ - 552, - 556, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 21, - }, - "start": Object { - "column": 27, - "line": 21, - }, - }, - "range": Array [ - 552, - 556, - ], - "type": "TSVoidKeyword", + "start": Object { + "column": 22, + "line": 1, }, }, + "name": "Bar", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", }, - Object { - "accessibility": null, - "computed": false, - "export": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 22, - }, - "start": Object { - "column": 13, - "line": 22, - }, - }, - "name": "l", - "range": Array [ - 571, - 572, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + }, + Object { + "id": Object { "loc": Object { "end": Object { - "column": 34, - "line": 22, + "column": 29, + "line": 1, }, "start": Object { - "column": 4, - "line": 22, + "column": 26, + "line": 1, }, }, - "optional": false, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 22, - }, - "start": Object { - "column": 15, - "line": 22, - }, - }, - "name": "bar", - "range": Array [ - 573, - 576, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 22, - }, - "start": Object { - "column": 20, - "line": 22, - }, - }, - "range": Array [ - 578, - 584, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 22, - }, - "start": Object { - "column": 20, - "line": 22, - }, - }, - "range": Array [ - 578, - 584, - ], - "type": "TSStringKeyword", - }, - }, - }, - ], + "name": "Baz", "range": Array [ - 562, - 592, + 26, + 29, ], - "readonly": true, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 22, - }, - "start": Object { - "column": 29, - "line": 22, - }, - }, - "range": Array [ - 587, - 591, - ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 22, - }, - "start": Object { - "column": 29, - "line": 22, - }, - }, - "range": Array [ - 587, - 591, - ], - "type": "TSVoidKeyword", - }, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, }, }, - ], + "range": Array [ + 26, + 29, + ], + "type": "TSInterfaceHeritage", + }, + ], + "id": Object { "loc": Object { "end": Object { - "column": 1, - "line": 23, + "column": 13, + "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, - "range": Array [ - 14, - 594, - ], - "type": "TSInterfaceBody", + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "Baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 14, + 15, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "baa", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 20, + 32, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, + "range": Array [ + 37, + 50, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": true, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "bax", + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 55, + 69, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": true, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "baz", + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "optional": true, + "range": Array [ + 74, + 89, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "name": "eee", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 94, + 116, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 109, + 115, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 109, + 115, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "name": "fff", + "optional": true, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 134, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 134, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 121, + 144, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 137, + 143, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 137, + 143, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "doo", + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "optional": false, + "params": Array [], + "range": Array [ + 149, + 161, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 156, + 160, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 156, + 160, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "name": "doo", + "range": Array [ + 166, + 169, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "optional": true, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "name": "a", + "range": Array [ + 171, + 172, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "name": "b", + "range": Array [ + 174, + 175, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "name": "c", + "range": Array [ + 177, + 178, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 166, + 186, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 181, + 185, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 181, + 185, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": true, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "name": "loo", + "range": Array [ + 192, + 195, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "optional": true, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "name": "a", + "range": Array [ + 198, + 199, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "name": "b", + "range": Array [ + 201, + 202, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "name": "c", + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 191, + 213, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 10, + }, + }, + "range": Array [ + 208, + 212, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 10, + }, + }, + "range": Array [ + 208, + 212, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "name": "boo", + "range": Array [ + 218, + 221, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "name": "a", + "range": Array [ + 225, + 226, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "name": "b", + "range": Array [ + 228, + 229, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "name": "c", + "range": Array [ + 231, + 232, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 218, + 240, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 11, + }, + "start": Object { + "column": 21, + "line": 11, + }, + }, + "range": Array [ + 235, + 239, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 11, + }, + "start": Object { + "column": 21, + "line": 11, + }, + }, + "range": Array [ + 235, + 239, + ], + "type": "TSVoidKeyword", + }, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "J", + "range": Array [ + 222, + 223, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 221, + 224, + ], + "type": "TypeParameterDeclaration", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "name": "a", + "range": Array [ + 250, + 251, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 253, + 254, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 245, + 265, + ], + "type": "TSConstructSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 258, + 264, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 258, + 264, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 13, + }, + }, + "name": "a", + "range": Array [ + 278, + 279, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "start": Object { + "column": 15, + "line": 13, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 281, + 282, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 270, + 293, + ], + "type": "TSConstructSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 286, + 292, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 286, + 292, + ], + "type": "TSStringKeyword", + }, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 9, + "line": 13, + }, + }, + "name": "F", + "range": Array [ + 275, + 276, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 274, + 277, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 295, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 295, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 295, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "baa", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "value": "bax", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + "value": "eee", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 109, + 115, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "fff", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 134, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 137, + 143, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + "value": "doo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 156, + 160, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 166, + 169, + ], + "type": "Identifier", + "value": "doo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 177, + 178, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 181, + 185, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 23, + "line": 9, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "range": Array [ + 192, + 195, + ], + "type": "Identifier", + "value": "loo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 9, + "line": 10, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 10, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 10, + }, + }, + "range": Array [ + 202, + 203, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 10, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 10, + }, + }, + "range": Array [ + 206, + 207, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 10, + }, + }, + "range": Array [ + 208, + 212, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 10, + }, + "start": Object { + "column": 25, + "line": 10, + }, + }, + "range": Array [ + 212, + 213, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 218, + 221, + ], + "type": "Identifier", + "value": "boo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "range": Array [ + 221, + 222, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 222, + 223, + ], + "type": "Identifier", + "value": "J", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 223, + 224, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 10, + "line": 11, + }, + }, + "range": Array [ + 224, + 225, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "range": Array [ + 225, + 226, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 12, + "line": 11, + }, + }, + "range": Array [ + 226, + 227, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 229, + 230, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 231, + 232, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 232, + 233, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 11, + }, + "start": Object { + "column": 19, + "line": 11, + }, + }, + "range": Array [ + 233, + 234, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 11, + }, + "start": Object { + "column": 21, + "line": 11, + }, + }, + "range": Array [ + 235, + 239, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 25, + "line": 11, + }, + }, + "range": Array [ + 239, + 240, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "range": Array [ + 245, + 248, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 250, + 251, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 251, + 252, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "range": Array [ + 253, + 254, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 13, + "line": 12, + }, + }, + "range": Array [ + 254, + 255, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 14, + "line": 12, + }, + }, + "range": Array [ + 255, + 256, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "range": Array [ + 256, + 257, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 258, + 264, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 12, + }, + "start": Object { + "column": 23, + "line": 12, + }, + }, + "range": Array [ + 264, + 265, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 270, + 273, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 274, + 275, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 9, + "line": 13, + }, + }, + "range": Array [ + 275, + 276, + ], + "type": "Identifier", + "value": "F", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 13, + }, + "start": Object { + "column": 10, + "line": 13, + }, + }, + "range": Array [ + 276, + 277, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 13, + }, + "start": Object { + "column": 11, + "line": 13, + }, + }, + "range": Array [ + 277, + 278, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 13, + }, + }, + "range": Array [ + 278, + 279, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "range": Array [ + 279, + 280, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "start": Object { + "column": 15, + "line": 13, + }, + }, + "range": Array [ + 281, + 282, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 13, + }, + "start": Object { + "column": 16, + "line": 13, + }, + }, + "range": Array [ + 282, + 283, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 13, + }, + "start": Object { + "column": 17, + "line": 13, + }, + }, + "range": Array [ + 283, + 284, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 13, + }, + "start": Object { + "column": 18, + "line": 13, + }, + }, + "range": Array [ + 284, + 285, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 286, + 292, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 13, + }, + "start": Object { + "column": 26, + "line": 13, + }, + }, + "range": Array [ + 292, + 293, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 14, + }, + }, + "range": Array [ + 294, + 295, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-construct-signature-with-parameter-accessibility.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "public", + "export": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "range": Array [ + 26, + 34, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "export": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "range": Array [ + 36, + 45, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 21, + 47, + ], + "type": "TSConstructSignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 49, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-extends-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSInterfaceHeritage", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "J", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 28, + 31, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 14, + 15, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 24, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "J", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 15, + 16, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 14, + 17, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-jsdoc.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 76, + 85, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 87, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 76, + 22, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 30, + 25, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 30, + 30, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 32, + 32, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 32, + 39, + ], + "type": "Identifier", + "value": "Comment", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 40, + 40, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 40, + 44, + ], + "type": "Identifier", + "value": "Line", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 45, + 45, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 52, + 47, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 52, + 52, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 54, + 54, + ], + "type": "Identifier", + "value": "", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 55, + 58, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "range": Array [ + 21, + 26, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, + "range": Array [ + 31, + 44, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "baz", + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": true, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "foo", + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 49, + 79, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 81, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 32, + "line": 4, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/interface-without-type-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 21, + 25, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "nestedArray", + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 43, + ], + "type": "GenericTypeAnnotation", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Array", + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "GenericTypeAnnotation", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 28, + 43, + ], + "type": "TypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 22, + 44, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "value": "nestedArray", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "validateEntity", + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 58, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 59, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "s", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "init": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "e", + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "TSNonNullExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + }, + "range": Array [ + 72, + 79, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 79, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 82, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processEntity", + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "e", + "optional": true, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "Entity", + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "value": "processEntity", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "Entity", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + "value": "validateEntity", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 67, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = `"Unknown AST_NODE_TYPE: \\"TSUndefinedKeyword\\""`; + +exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 37, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "Failure", + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + }, + }, + ], + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 37, + ], + "type": "VariableDeclarator", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Result", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + "value": "Success", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + "value": "Failure", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 48, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 35, + 38, + ], + "type": "TypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "Failure", + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + }, + }, + ], + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 48, + ], + "type": "VariableDeclarator", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 22, + 24, + ], + "type": "TSTypeLiteral", + }, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 12, + 24, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 11, + 25, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Result", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + "value": "Success", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "value": "Failure", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 24, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 25, + 28, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": null, + }, + ], + "range": Array [ + 11, + 29, + ], + "type": "TSTypeLiteral", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-guard.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 52, + 60, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "===", + "range": Array [ + 52, + 73, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 45, + 73, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 75, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "isString", + "range": Array [ + 9, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "range": Array [ + 27, + 38, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 75, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Punctuator", + "value": "===", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/type-parameters-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 3, + 40, + ], + "type": "TypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "ExpressionStatement", + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 87, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 44, + 87, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "A", + "range": Array [ + 68, + 69, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 56, + 81, + ], + "type": "TypeParameterDeclaration", + }, + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 134, + 137, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "baz", + "range": Array [ + 97, + 100, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 88, + 137, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": null, + "default": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + }, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "A", + "range": Array [ + 112, + 129, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 100, + 131, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 137, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 44, + 52, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 96, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 97, + 100, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 3, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/typed-this.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "addClickListener", + "range": Array [ + 23, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 65, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "onclick", + "range": Array [ + 40, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 49, + 79, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "name": "e", + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "name": "Event", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 49, + 79, + ], + "type": "TSFunctionType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TSVoidKeyword", + }, + }, + "typeParameters": null, + }, + }, + }, + ], + "range": Array [ + 23, + 87, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "TSVoidKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 89, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "UIElement", + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "UIElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 23, + 39, + ], + "type": "Identifier", + "value": "addClickListener", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 40, + 47, + ], + "type": "Identifier", + "value": "onclick", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 50, + 54, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + "value": "Event", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 2, + }, + "start": Object { + "column": 64, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/var-with-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "name", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "raw": "\\"Nicholas\\"", + "type": "Literal", + "value": "Nicholas", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "String", + "value": "\\"Nicholas\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 38, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 70, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_x", + "range": Array [ + 65, + 67, + ], + "type": "Identifier", + }, + "range": Array [ + 60, + 67, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 68, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 70, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 48, + 70, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 72, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Point", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "Point", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + "value": "configurable", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 65, + 67, + ], + "type": "Identifier", + "value": "_x", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 25, + 34, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 34, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + }, + ], + "range": Array [ + 23, + 36, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 37, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 80, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "name": "_bar", + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + }, + "range": Array [ + 68, + 77, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 78, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 80, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 56, + 80, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 82, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Other", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "Other", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 34, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + "value": "_bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "hidden", + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "z", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 53, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_z", + "range": Array [ + 48, + 50, + ], + "type": "Identifier", + }, + "range": Array [ + 43, + 50, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 51, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 53, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 31, + 53, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 55, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "P", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + "value": "hidden", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "Identifier", + "value": "_z", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/accessor-decorators/accessor-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "adminonly", + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "y", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 76, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "_y", + "range": Array [ + 63, + 65, + ], + "type": "Identifier", + }, + "range": Array [ + 58, + 65, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "operator": "=", + "range": Array [ + 58, + 69, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "a", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 70, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 48, + 76, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 44, + 76, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 78, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "User", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "User", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "value": "adminonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 63, + 65, + ], + "type": "Identifier", + "value": "_y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/class-decorators/class-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sealed", + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "Qux", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + "value": "sealed", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/class-decorators/class-decorator-factory.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "ClassBody", + }, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "selector", + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + }, + ], + "range": Array [ + 11, + 35, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "Component", + "range": Array [ + 1, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 36, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "Decorator", + }, + ], + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "FooComponent", + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 10, + ], + "type": "Identifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + "value": "selector", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + "value": "FooComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 30, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 30, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "range": Array [ + 35, + 49, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 54, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 49, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 56, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + "value": "onlyRead", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 49, + ], + "type": "Identifier", + "value": "instanceMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 25, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "staticMethod", + "range": Array [ + 37, + 49, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 54, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 49, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 56, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 37, + 49, + ], + "type": "Identifier", + "value": "staticMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + "value": "onlyRead", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + "value": "instanceMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/method-decorators/method-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "staticMethod", + "range": Array [ + 30, + 42, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "D", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "D", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "Identifier", + "value": "staticMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 113, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "ThisExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + "range": Array [ + 81, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "config", + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + }, + "range": Array [ + 94, + 106, + ], + "type": "MemberExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 113, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "APP_CONFIG", + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "Inject", + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 51, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 51, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "AppConfig", + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 31, + 113, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 115, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Service", + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Service", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "Inject", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + "value": "APP_CONFIG", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + "value": "AppConfig", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 50, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 19, + 50, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 52, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 63, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "special", + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 47, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 32, + 63, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 65, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticFoo", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "value": "StaticFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "greet", + "range": Array [ + 20, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 95, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 82, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 88, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 60, + 89, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 95, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "required", + "range": Array [ + 27, + 35, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 35, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 36, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 25, + 95, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 97, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Greeter", + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Greeter", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Identifier", + "value": "greet", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "Identifier", + "value": "required", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 36, + 40, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "String", + "value": "\\"!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/parameter-decorators/parameter-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "greet", + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 108, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 95, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 101, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 102, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 108, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "required", + "range": Array [ + 40, + 48, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "name", + "range": Array [ + 49, + 53, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 38, + 108, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 110, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticGreeter", + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + "value": "StaticGreeter", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + "value": "greet", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "Identifier", + "value": "required", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 49, + 53, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 79, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "type": "String", + "value": "\\"!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Input", + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "data", + "range": Array [ + 35, + 39, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 40, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Output", + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 54, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "click", + "range": Array [ + 59, + 64, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 86, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "EventEmitter", + "range": Array [ + 71, + 83, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 67, + 85, + ], + "type": "NewExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 88, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SomeComponent", + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + "value": "Input", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "Identifier", + "value": "data", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "Output", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 59, + 64, + ], + "type": "Identifier", + "value": "click", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 67, + 70, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 71, + 83, + ], + "type": "Identifier", + "value": "EventEmitter", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 32, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "range": Array [ + 15, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 33, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 33, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "prop1", + "range": Array [ + 41, + 46, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 47, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 67, + 72, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "configurable", + "range": Array [ + 54, + 66, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 54, + 73, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 73, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "prop2", + "range": Array [ + 85, + 90, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 91, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 93, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 93, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 93, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "Identifier", + "value": "configurable", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 41, + 46, + ], + "type": "Identifier", + "value": "prop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 54, + 66, + ], + "type": "Identifier", + "value": "configurable", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 67, + 72, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 85, + 90, + ], + "type": "Identifier", + "value": "prop2", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "y", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 37, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/decorators/property-decorators/property-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 28, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + Object { + "accessibility": null, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "qux", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "Decorator", + }, + ], + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 51, + ], + "readonly": false, + "static": true, + "type": "ClassProperty", + "typeAnnotation": null, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 53, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-empty-extends-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/class-extends-empty-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 32, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/decorator-on-enum-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "dec", + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "E", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 14, + ], + "type": "TSEnumDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "value": "dec", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "E", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/interface-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/errorRecovery/interface-property-modifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "raw": "'a'", + "type": "Literal", + "value": "a", + }, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 20, + 38, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 43, + 60, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "private", + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 65, + 83, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "name": "c", + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 88, + 108, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "d", + "range": Array [ + 120, + 121, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 113, + 130, + ], + "readonly": false, + "static": true, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 123, + 129, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 123, + 129, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": true, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "name": "e", + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "optional": false, + "range": Array [ + 135, + 152, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 145, + 151, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 145, + 151, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "name": "f", + "range": Array [ + 166, + 167, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "optional": false, + "range": Array [ + 157, + 176, + ], + "readonly": true, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 169, + 175, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 169, + 175, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "public", + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "name": "baz", + "range": Array [ + 190, + 193, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 195, + 201, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 195, + 201, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 182, + 211, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 10, + }, + "start": Object { + "column": 26, + "line": 10, + }, + }, + "range": Array [ + 204, + 210, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 10, + }, + "start": Object { + "column": 26, + "line": 10, + }, + }, + "range": Array [ + 204, + 210, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "private", + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 13, + "line": 11, + }, + }, + "name": "baz", + "range": Array [ + 225, + 228, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 216, + 246, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 11, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 11, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "protected", + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "name": "baz", + "range": Array [ + 262, + 265, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 267, + 273, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 267, + 273, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "range": Array [ + 251, + 283, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 12, + }, + "start": Object { + "column": 29, + "line": 12, + }, + }, + "range": Array [ + 276, + 282, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 12, + }, + "start": Object { + "column": 29, + "line": 12, + }, + }, + "range": Array [ + 276, + 282, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 13, + }, + }, + "name": "baz", + "range": Array [ + 296, + 299, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 17, + "line": 13, + }, + }, + "range": Array [ + 301, + 307, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 17, + "line": 13, + }, + }, + "range": Array [ + 301, + 307, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 288, + 317, + ], + "readonly": false, + "static": true, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 13, + }, + "start": Object { + "column": 26, + "line": 13, + }, + }, + "range": Array [ + 310, + 316, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 13, + }, + "start": Object { + "column": 26, + "line": 13, + }, + }, + "range": Array [ + 310, + 316, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": true, + "index": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 12, + "line": 14, + }, + }, + "name": "baz", + "range": Array [ + 330, + 333, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 335, + 341, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 335, + 341, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 322, + 351, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 14, + }, + "start": Object { + "column": 26, + "line": 14, + }, + }, + "range": Array [ + 344, + 350, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 14, + }, + "start": Object { + "column": 26, + "line": 14, + }, + }, + "range": Array [ + 344, + 350, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": null, + "export": false, + "index": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 15, + }, + "start": Object { + "column": 14, + "line": 15, + }, + }, + "name": "baz", + "range": Array [ + 366, + 369, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 15, + }, + "start": Object { + "column": 19, + "line": 15, + }, + }, + "range": Array [ + 371, + 377, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 15, + }, + "start": Object { + "column": 19, + "line": 15, + }, + }, + "range": Array [ + 371, + 377, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 15, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "range": Array [ + 356, + 387, + ], + "readonly": true, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 15, + }, + "start": Object { + "column": 28, + "line": 15, + }, + }, + "range": Array [ + 380, + 386, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 15, + }, + "start": Object { + "column": 28, + "line": 15, + }, + }, + "range": Array [ + 380, + 386, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 17, + }, + "start": Object { + "column": 11, + "line": 17, + }, + }, + "name": "g", + "range": Array [ + 400, + 401, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "start": Object { + "column": 13, + "line": 17, + }, + }, + "name": "bar", + "range": Array [ + 402, + 405, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 18, + "line": 17, + }, + }, + "range": Array [ + 407, + 413, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 18, + "line": 17, + }, + }, + "range": Array [ + 407, + 413, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 393, + 421, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 17, + }, + "start": Object { + "column": 27, + "line": 17, + }, + }, + "range": Array [ + 416, + 420, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 17, + }, + "start": Object { + "column": 27, + "line": 17, + }, + }, + "range": Array [ + 416, + 420, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": "private", + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 18, + }, + "start": Object { + "column": 12, + "line": 18, + }, + }, + "name": "h", + "range": Array [ + 434, + 435, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 18, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 18, + }, + "start": Object { + "column": 14, + "line": 18, + }, + }, + "name": "bar", + "range": Array [ + 436, + 439, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 441, + 447, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 441, + 447, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 426, + 455, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 18, + }, + "start": Object { + "column": 28, + "line": 18, + }, + }, + "range": Array [ + 450, + 454, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 18, + }, + "start": Object { + "column": 28, + "line": 18, + }, + }, + "range": Array [ + 450, + 454, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 14, + "line": 19, + }, + }, + "name": "i", + "range": Array [ + 470, + 471, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 19, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 16, + "line": 19, + }, + }, + "name": "bar", + "range": Array [ + 472, + 475, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 19, + }, + "start": Object { + "column": 21, + "line": 19, + }, + }, + "range": Array [ + 477, + 483, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 19, + }, + "start": Object { + "column": 21, + "line": 19, + }, + }, + "range": Array [ + 477, + 483, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 460, + 491, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 19, + }, + "start": Object { + "column": 30, + "line": 19, + }, + }, + "range": Array [ + 486, + 490, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 19, + }, + "start": Object { + "column": 30, + "line": 19, + }, + }, + "range": Array [ + 486, + 490, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 20, + }, + "start": Object { + "column": 11, + "line": 20, + }, + }, + "name": "j", + "range": Array [ + 503, + 504, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 20, + }, + "start": Object { + "column": 4, + "line": 20, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 20, + }, + "start": Object { + "column": 13, + "line": 20, + }, + }, + "name": "bar", + "range": Array [ + 505, + 508, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 20, + }, + "start": Object { + "column": 18, + "line": 20, + }, + }, + "range": Array [ + 510, + 516, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 20, + }, + "start": Object { + "column": 18, + "line": 20, + }, + }, + "range": Array [ + 510, + 516, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 496, + 524, + ], + "readonly": false, + "static": true, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 20, + }, + "start": Object { + "column": 27, + "line": 20, + }, + }, + "range": Array [ + 519, + 523, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 20, + }, + "start": Object { + "column": 27, + "line": 20, + }, + }, + "range": Array [ + 519, + 523, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 21, + }, + "start": Object { + "column": 11, + "line": 21, + }, + }, + "name": "k", + "range": Array [ + 536, + 537, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 21, + }, + "start": Object { + "column": 4, + "line": 21, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 21, + }, + "start": Object { + "column": 13, + "line": 21, + }, + }, + "name": "bar", + "range": Array [ + 538, + 541, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 21, + }, + "start": Object { + "column": 18, + "line": 21, + }, + }, + "range": Array [ + 543, + 549, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 21, + }, + "start": Object { + "column": 18, + "line": 21, + }, + }, + "range": Array [ + 543, + 549, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 529, + 557, + ], + "readonly": false, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 21, + }, + "start": Object { + "column": 27, + "line": 21, + }, + }, + "range": Array [ + 552, + 556, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 21, + }, + "start": Object { + "column": 27, + "line": 21, + }, + }, + "range": Array [ + 552, + 556, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "accessibility": null, + "computed": false, + "export": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 22, + }, + "start": Object { + "column": 13, + "line": 22, + }, + }, + "name": "l", + "range": Array [ + 571, + 572, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 22, + }, + "start": Object { + "column": 4, + "line": 22, + }, + }, + "optional": false, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 22, + }, + "start": Object { + "column": 15, + "line": 22, + }, + }, + "name": "bar", + "range": Array [ + 573, + 576, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 22, + }, + "start": Object { + "column": 20, + "line": 22, + }, + }, + "range": Array [ + 578, + 584, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 22, + }, + "start": Object { + "column": 20, + "line": 22, + }, + }, + "range": Array [ + 578, + 584, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 562, + 592, + ], + "readonly": true, + "static": false, + "type": "TSMethodSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 22, + }, + "start": Object { + "column": 29, + "line": 22, + }, + }, + "range": Array [ + 587, + 591, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 22, + }, + "start": Object { + "column": 29, + "line": 22, + }, + }, + "range": Array [ + 587, + 591, + ], + "type": "TSVoidKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 23, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 594, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 23, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 594, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 23, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 594, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "String", + "value": "'a'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 65, + 72, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 88, + 97, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 113, + 119, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 123, + 129, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 145, + 151, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 157, + 165, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 169, + 175, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 22, + "line": 8, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 182, + 188, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 189, + 190, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "range": Array [ + 190, + 193, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 10, + }, + }, + "range": Array [ + 193, + 194, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 195, + 201, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 10, + }, + "start": Object { + "column": 23, + "line": 10, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 24, + "line": 10, + }, + }, + "range": Array [ + 202, + 203, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 10, + }, + "start": Object { + "column": 26, + "line": 10, + }, + }, + "range": Array [ + 204, + 210, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 10, + }, + "start": Object { + "column": 32, + "line": 10, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 216, + 223, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 12, + "line": 11, + }, + }, + "range": Array [ + 224, + 225, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 13, + "line": 11, + }, + }, + "range": Array [ + 225, + 228, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 16, + "line": 11, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 11, + }, + "start": Object { + "column": 24, + "line": 11, + }, + }, + "range": Array [ + 236, + 237, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 25, + "line": 11, + }, + }, + "range": Array [ + 237, + 238, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 11, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 11, + }, + "start": Object { + "column": 33, + "line": 11, + }, + }, + "range": Array [ + 245, + 246, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "range": Array [ + 251, + 260, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 14, + "line": 12, + }, + }, + "range": Array [ + 261, + 262, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "range": Array [ + 262, + 265, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 12, + }, + "start": Object { + "column": 18, + "line": 12, + }, + }, + "range": Array [ + 265, + 266, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 267, + 273, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 26, + "line": 12, + }, + }, + "range": Array [ + 273, + 274, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 12, + }, + "start": Object { + "column": 27, + "line": 12, + }, + }, + "range": Array [ + 274, + 275, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 12, + }, + "start": Object { + "column": 29, + "line": 12, + }, + }, + "range": Array [ + 276, + 282, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 12, + }, + "start": Object { + "column": 35, + "line": 12, + }, + }, + "range": Array [ + 282, + 283, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 288, + 294, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 13, + }, + "start": Object { + "column": 11, + "line": 13, + }, + }, + "range": Array [ + 295, + 296, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 13, + }, + }, + "range": Array [ + 296, + 299, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "start": Object { + "column": 15, + "line": 13, + }, + }, + "range": Array [ + 299, + 300, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 17, + "line": 13, + }, + }, + "range": Array [ + 301, + 307, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 13, + }, + "start": Object { + "column": 23, + "line": 13, + }, + }, + "range": Array [ + 307, + 308, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 13, + }, + "start": Object { + "column": 24, + "line": 13, + }, + }, + "range": Array [ + 308, + 309, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 13, + }, + "start": Object { + "column": 26, + "line": 13, + }, + }, + "range": Array [ + 310, + 316, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 13, + }, + "start": Object { + "column": 32, + "line": 13, + }, + }, + "range": Array [ + 316, + 317, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 322, + 328, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 14, + }, + "start": Object { + "column": 11, + "line": 14, + }, + }, + "range": Array [ + 329, + 330, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 12, + "line": 14, + }, + }, + "range": Array [ + 330, + 333, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 333, + 334, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 335, + 341, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 14, + }, + "start": Object { + "column": 23, + "line": 14, + }, + }, + "range": Array [ + 341, + 342, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 14, + }, + "start": Object { + "column": 24, + "line": 14, + }, + }, + "range": Array [ + 342, + 343, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 14, + }, + "start": Object { + "column": 26, + "line": 14, + }, + }, + "range": Array [ + 344, + 350, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 14, + }, + "start": Object { + "column": 32, + "line": 14, + }, + }, + "range": Array [ + 350, + 351, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 15, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "range": Array [ + 356, + 364, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 13, + "line": 15, + }, + }, + "range": Array [ + 365, + 366, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 15, + }, + "start": Object { + "column": 14, + "line": 15, + }, + }, + "range": Array [ + 366, + 369, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 15, + }, + }, + "range": Array [ + 369, + 370, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 15, + }, + "start": Object { + "column": 19, + "line": 15, + }, + }, + "range": Array [ + 371, + 377, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 15, + }, + "start": Object { + "column": 25, + "line": 15, + }, + }, + "range": Array [ + 377, + 378, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 15, + }, + "start": Object { + "column": 26, + "line": 15, + }, + }, + "range": Array [ + 378, + 379, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 15, + }, + "start": Object { + "column": 28, + "line": 15, + }, + }, + "range": Array [ + 380, + 386, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 15, + }, + "start": Object { + "column": 34, + "line": 15, + }, + }, + "range": Array [ + 386, + 387, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "range": Array [ + 393, + 399, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 17, + }, + "start": Object { + "column": 11, + "line": 17, + }, + }, + "range": Array [ + 400, + 401, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 17, + }, + "start": Object { + "column": 12, + "line": 17, + }, + }, + "range": Array [ + 401, + 402, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "start": Object { + "column": 13, + "line": 17, + }, + }, + "range": Array [ + 402, + 405, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 16, + "line": 17, + }, + }, + "range": Array [ + 405, + 406, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 18, + "line": 17, + }, + }, + "range": Array [ + 407, + 413, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 17, + }, + "start": Object { + "column": 24, + "line": 17, + }, + }, + "range": Array [ + 413, + 414, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 17, + }, + "start": Object { + "column": 25, + "line": 17, + }, + }, + "range": Array [ + 414, + 415, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 17, + }, + "start": Object { + "column": 27, + "line": 17, + }, + }, + "range": Array [ + 416, + 420, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 31, + "line": 17, + }, + }, + "range": Array [ + 420, + 421, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 18, + }, + }, + "range": Array [ + 426, + 433, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 18, + }, + "start": Object { + "column": 12, + "line": 18, + }, + }, + "range": Array [ + 434, + 435, + ], + "type": "Identifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 18, + }, + "start": Object { + "column": 13, + "line": 18, + }, + }, + "range": Array [ + 435, + 436, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 18, + }, + "start": Object { + "column": 14, + "line": 18, + }, + }, + "range": Array [ + 436, + 439, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 18, + }, + "start": Object { + "column": 17, + "line": 18, + }, + }, + "range": Array [ + 439, + 440, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 441, + 447, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 18, + }, + "start": Object { + "column": 25, + "line": 18, + }, + }, + "range": Array [ + 447, + 448, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 18, + }, + "start": Object { + "column": 26, + "line": 18, + }, + }, + "range": Array [ + 448, + 449, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 18, + }, + "start": Object { + "column": 28, + "line": 18, + }, + }, + "range": Array [ + 450, + 454, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 18, + }, + "start": Object { + "column": 32, + "line": 18, + }, + }, + "range": Array [ + 454, + 455, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 19, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "range": Array [ + 460, + 469, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 14, + "line": 19, + }, + }, + "range": Array [ + 470, + 471, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 19, + }, + "start": Object { + "column": 15, + "line": 19, + }, + }, + "range": Array [ + 471, + 472, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 16, + "line": 19, + }, + }, + "range": Array [ + 472, + 475, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 19, + }, + "start": Object { + "column": 19, + "line": 19, + }, + }, + "range": Array [ + 475, + 476, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 19, + }, + "start": Object { + "column": 21, + "line": 19, + }, + }, + "range": Array [ + 477, + 483, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 19, + }, + "start": Object { + "column": 27, + "line": 19, + }, + }, + "range": Array [ + 483, + 484, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 19, + }, + "start": Object { + "column": 28, + "line": 19, + }, + }, + "range": Array [ + 484, + 485, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 19, + }, + "start": Object { + "column": 30, + "line": 19, + }, + }, + "range": Array [ + 486, + 490, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 19, + }, + "start": Object { + "column": 34, + "line": 19, + }, + }, + "range": Array [ + 490, + 491, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 20, + }, + "start": Object { + "column": 4, + "line": 20, + }, + }, + "range": Array [ + 496, + 502, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 20, + }, + "start": Object { + "column": 11, + "line": 20, + }, + }, + "range": Array [ + 503, + 504, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 20, + }, + "start": Object { + "column": 12, + "line": 20, + }, + }, + "range": Array [ + 504, + 505, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 20, + }, + "start": Object { + "column": 13, + "line": 20, + }, + }, + "range": Array [ + 505, + 508, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 20, + }, + "start": Object { + "column": 16, + "line": 20, + }, + }, + "range": Array [ + 508, + 509, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 20, + }, + "start": Object { + "column": 18, + "line": 20, + }, + }, + "range": Array [ + 510, + 516, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 20, + }, + "start": Object { + "column": 24, + "line": 20, + }, + }, + "range": Array [ + 516, + 517, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 20, + }, + "start": Object { + "column": 25, + "line": 20, + }, + }, + "range": Array [ + 517, + 518, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 20, + }, + "start": Object { + "column": 27, + "line": 20, + }, + }, + "range": Array [ + 519, + 523, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 20, + }, + "start": Object { + "column": 31, + "line": 20, + }, + }, + "range": Array [ + 523, + 524, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 21, + }, + "start": Object { + "column": 4, + "line": 21, + }, + }, + "range": Array [ + 529, + 535, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 21, + }, + "start": Object { + "column": 11, + "line": 21, + }, + }, + "range": Array [ + 536, + 537, + ], + "type": "Identifier", + "value": "k", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 21, + }, + "start": Object { + "column": 12, + "line": 21, + }, + }, + "range": Array [ + 537, + 538, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 21, + }, + "start": Object { + "column": 13, + "line": 21, + }, + }, + "range": Array [ + 538, + 541, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 21, + }, + "start": Object { + "column": 16, + "line": 21, + }, + }, + "range": Array [ + 541, + 542, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 21, + }, + "start": Object { + "column": 18, + "line": 21, + }, }, - "heritage": Array [], - "id": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "range": Array [ + 543, + 549, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 21, + }, + "start": Object { + "column": 24, + "line": 21, + }, + }, + "range": Array [ + 549, + 550, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 21, + }, + "start": Object { + "column": 25, + "line": 21, + }, + }, + "range": Array [ + 550, + 551, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 21, + }, + "start": Object { + "column": 27, + "line": 21, + }, + }, + "range": Array [ + 552, + 556, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 21, + }, + "start": Object { + "column": 31, + "line": 21, + }, + }, + "range": Array [ + 556, + 557, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 22, + }, + "start": Object { + "column": 4, + "line": 22, + }, + }, + "range": Array [ + 562, + 570, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 22, + }, + "start": Object { + "column": 13, + "line": 22, + }, + }, + "range": Array [ + 571, + 572, + ], + "type": "Identifier", + "value": "l", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 22, + }, + "start": Object { + "column": 14, + "line": 22, + }, + }, + "range": Array [ + 572, + 573, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 22, + }, + "start": Object { + "column": 15, + "line": 22, + }, + }, + "range": Array [ + 573, + 576, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 22, + }, + "start": Object { + "column": 18, + "line": 22, + }, + }, + "range": Array [ + 576, + 577, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 22, + }, + "start": Object { + "column": 20, + "line": 22, + }, + }, + "range": Array [ + 578, + 584, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 22, + }, + "start": Object { + "column": 26, + "line": 22, + }, + }, + "range": Array [ + 584, + 585, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 22, + }, + "start": Object { + "column": 27, + "line": 22, + }, + }, + "range": Array [ + 585, + 586, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 22, + }, + "start": Object { + "column": 29, + "line": 22, }, - "name": "Foo", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", }, + "range": Array [ + 587, + 591, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 22, + }, + "start": Object { + "column": 33, + "line": 22, + }, + }, + "range": Array [ + 591, + 592, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { "column": 1, @@ -25778,31 +56003,17 @@ Object { }, "start": Object { "column": 0, - "line": 1, + "line": 23, }, }, "range": Array [ - 0, + 593, 594, ], - "type": "TSInterfaceDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 23, + "type": "Punctuator", + "value": "}", }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 594, ], - "sourceType": "script", "type": "Program", } `; @@ -26041,6 +56252,260 @@ Object { 24, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], "type": "Program", } `; @@ -26177,39 +56642,239 @@ Object { "type": "VariableDeclarator", }, ], - "kind": "const", + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "B", + }, + Object { "loc": Object { "end": Object { - "column": 21, + "column": 18, "line": 1, }, "start": Object { - "column": 0, + "column": 17, "line": 1, }, }, "range": Array [ - 0, - 21, + 17, + 18, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": ">", }, - ], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 21, ], - "sourceType": "script", "type": "Program", } `; @@ -26380,6 +57045,188 @@ Object { 56, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 29, + ], + "type": "String", + "value": "\\"i-use-things\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 41, + 43, + ], + "type": "Identifier", + "value": "fs", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 49, + 53, + ], + "type": "String", + "value": "'fs'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -26619,81 +57466,425 @@ Object { "line": 1, }, }, - "range": Array [ - 21, - 84, - ], - "type": "TSModuleBlock", + "range": Array [ + 21, + 84, + ], + "type": "TSModuleBlock", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "modifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "TSDeclareKeyword", + }, + ], + "name": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "d3", + "range": Array [ + 18, + 20, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 84, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Identifier", + "value": "d3", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + "value": "select", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 48, + 56, + ], + "type": "Identifier", + "value": "selector", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 67, + 76, + ], + "type": "Identifier", + "value": "Selection", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, }, + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + "value": "any", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 58, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 57, + "line": 2, }, }, - "modifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "TSDeclareKeyword", + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, }, + }, + "range": Array [ + 81, + 82, ], - "name": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, }, - "name": "d3", - "range": Array [ - 18, - 20, - ], - "type": "Identifier", }, "range": Array [ - 0, + 83, 84, ], - "type": "TSModuleDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 84, ], - "sourceType": "script", "type": "Program", } `; @@ -27052,6 +58243,476 @@ Object { 112, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 93, + 101, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 5, + }, + "start": Object { + "column": 34, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 35, + "line": 5, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "}", + }, + ], "type": "Program", } `; @@ -27130,6 +58791,80 @@ Object { 32, ], "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "type": "String", + "value": "\\"hot-new-module\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], "type": "Program", } `; diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index 31d9d73ecbf4..7f3f4d01d6e9 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -32,22 +32,17 @@ const testFiles = shelljs.find(FIXTURES_DIR) describe("basics", () => { - let config; - - beforeEach(() => { - config = { + testFiles.forEach(filename => { + // Uncomment and fill in filename to focus on a single file + // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); + const config = { loc: true, range: true, tokens: true, ecmaFeatures: {}, errorOnUnknownASTType: true }; - }); - - testFiles.forEach(filename => { - // Uncomment and fill in filename to focus on a single file - // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; - const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); diff --git a/packages/typescript-eslint-parser/tests/lib/comments.js b/packages/typescript-eslint-parser/tests/lib/comments.js index 376877b70bb1..36f79870eaea 100644 --- a/packages/typescript-eslint-parser/tests/lib/comments.js +++ b/packages/typescript-eslint-parser/tests/lib/comments.js @@ -51,10 +51,9 @@ const testFiles = shelljs.find(FIXTURES_DIR) describe("Comments", () => { - let config; - - beforeEach(() => { - config = { + testFiles.forEach(filename => { + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); + const config = { loc: true, range: true, tokens: true, @@ -63,10 +62,6 @@ describe("Comments", () => { jsx: true } }; - }); - - testFiles.forEach(filename => { - const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 8d51513e5680..b7b152110fbc 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -39,24 +39,19 @@ const regexFilenames = [ describe("ecmaFeatures", () => { - let config; - - beforeEach(() => { - config = { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {}, - errorOnUnknownASTType: true - }; - }); - testFiles.forEach(filename => { // Uncomment and fill in filename to focus on a single file // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const feature = path.dirname(filename), - code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); + code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`), + config = { + loc: true, + range: true, + tokens: true, + ecmaFeatures: {}, + errorOnUnknownASTType: true + }; if (regexFilenames.indexOf(filename) === -1) { test(`fixtures/${filename}.src`, () => { diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index 8e8540eb2c6f..84d6ba24b02d 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -32,22 +32,17 @@ const testFiles = shelljs.find(FIXTURES_DIR) describe("typescript", () => { - let config; - - beforeEach(() => { - config = { + testFiles.forEach(filename => { + // Uncomment and fill in filename to focus on a single file + // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`); + const config = { loc: true, range: true, tokens: true, ecmaFeatures: {}, errorOnUnknownASTType: true }; - }); - - testFiles.forEach(filename => { - // Uncomment and fill in filename to focus on a single file - // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; - const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`); test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); From 926f93cb2b09503cc70063ffe70edb56a228ae1e Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 15 Jun 2017 12:47:37 +0100 Subject: [PATCH 172/326] Breaking: Remove TypeAnnotation wrapper from constraint (#325) --- .../lib/ast-node-types.js | 2 + .../typescript-eslint-parser/lib/convert.js | 8 +- .../type-parameters.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 944 +++++++++++++++--- .../tools/test-utils.js | 7 + 5 files changed, 838 insertions(+), 124 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameters.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index fbfbf12ca39a..629bc8d3e5a6 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -121,6 +121,7 @@ module.exports = { TSNonNullExpression: "TSNonNullExpression", TSNullKeyword: "TSNullKeyword", TSNumberKeyword: "TSNumberKeyword", + TSObjectKeyword: "TSObjectKeyword", TSParameterProperty: "TSParameterProperty", TSPropertySignature: "TSPropertySignature", TSQualifiedName: "TSQualifiedName", @@ -130,6 +131,7 @@ module.exports = { TSTypePredicate: "TSTypePredicate", TSTypeReference: "TSTypeReference", TSUnionType: "TSUnionType", + TSUndefinedKeyword: "TSUndefinedKeyword", TSVoidKeyword: "TSVoidKeyword", TypeAnnotation: "TypeAnnotation", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 806b60bc6932..8f881eeb70fd 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -146,6 +146,10 @@ module.exports = function convert(config) { params: typeParameters.map(typeParameter => { const name = nodeUtils.unescapeIdentifier(typeParameter.name.text); + const constraint = typeParameter.constraint + ? convert({ node: typeParameter.constraint, parent: typeParameter, ast, additionalOptions }) + : null; + const defaultParameter = typeParameter.default ? convert({ node: typeParameter.default, parent: typeParameter, ast, additionalOptions }) : typeParameter.default; @@ -158,9 +162,7 @@ module.exports = function convert(config) { ], loc: nodeUtils.getLoc(typeParameter, ast), name, - constraint: (typeParameter.constraint) - ? convertTypeAnnotation(typeParameter.constraint) - : null, + constraint, default: defaultParameter }; }) diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameters.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameters.src.ts new file mode 100644 index 000000000000..526137f30906 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameters.src.ts @@ -0,0 +1 @@ +function f() {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 77fddad952d7..2068b4e30099 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -1,5 +1,392 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`typescript fixtures/babylon-convergence/type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 42, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSObjectKeyword", + }, + "default": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSObjectKeyword", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 11, + 36, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 10, + 37, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/abstract-class-with-abstract-constructor.src 1`] = ` Object { "body": Array [ @@ -6495,8 +6882,8 @@ Object { 20, 21, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 21, @@ -6507,29 +6894,12 @@ Object { "line": 1, }, }, + "name": "B", "range": Array [ 20, 21, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, + "type": "Identifier", }, }, "loc": Object { @@ -8967,11 +9337,11 @@ Object { 21, 36, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 36, + "column": 32, "line": 1, }, "start": Object { @@ -8979,60 +9349,27 @@ Object { "line": 1, }, }, + "name": "Constructor", "range": Array [ 21, - 36, + 32, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, }, - "name": "Constructor", - "range": Array [ - 21, - 32, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, + "start": Object { + "column": 32, + "line": 1, }, - "params": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 33, - 35, - ], - "type": "TSTypeLiteral", - }, + }, + "params": Array [ + Object { + "id": Object { "loc": Object { "end": Object { "column": 35, @@ -9043,20 +9380,36 @@ Object { "line": 1, }, }, + "members": Array [], "range": Array [ 33, 35, ], - "type": "GenericTypeAnnotation", - "typeParameters": null, + "type": "TSTypeLiteral", }, - ], - "range": Array [ - 32, - 36, - ], - "type": "TypeParameterInstantiation", - }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "GenericTypeAnnotation", + "typeParameters": null, + }, + ], + "range": Array [ + 32, + 36, + ], + "type": "TypeParameterInstantiation", }, }, "loc": Object { @@ -24698,29 +25051,12 @@ Object { "line": 1, }, }, + "members": Array [], "range": Array [ 21, 23, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 21, - 23, - ], - "type": "TSTypeLiteral", - }, + "type": "TSTypeLiteral", }, "loc": Object { "end": Object { @@ -34723,7 +35059,390 @@ Object { } `; -exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = `"Unknown AST_NODE_TYPE: \\"TSUndefinedKeyword\\""`; +exports[`typescript fixtures/basics/null-and-undefined-type-annotations.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "TSNullKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TSUndefinedKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` Object { @@ -35410,29 +36129,12 @@ Object { "line": 1, }, }, + "members": Array [], "range": Array [ 22, 24, ], - "type": "TypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 22, - 24, - ], - "type": "TSTypeLiteral", - }, + "type": "TSTypeLiteral", }, "loc": Object { "end": Object { diff --git a/packages/typescript-eslint-parser/tools/test-utils.js b/packages/typescript-eslint-parser/tools/test-utils.js index b93dbc90e902..8ae966033bed 100644 --- a/packages/typescript-eslint-parser/tools/test-utils.js +++ b/packages/typescript-eslint-parser/tools/test-utils.js @@ -56,6 +56,13 @@ function createSnapshotTestBlock(code, config) { const result = parse(); expect(result).toMatchSnapshot(); } catch (e) { + /** + * If we are deliberately throwing because of encountering an unknown + * AST_NODE_TYPE, we rethrow to cause the test to fail + */ + if (e.message.match("Unknown AST_NODE_TYPE")) { + throw new Error(e); + } expect(parse).toThrowErrorMatchingSnapshot(); } }; From e56d8c82517fbc6f41041f01c86d8a3dc5447986 Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Sun, 18 Jun 2017 03:57:57 +1000 Subject: [PATCH 173/326] Fix: Unescape string literal identifiers (fixes #328) (#330) --- .../typescript-eslint-parser/lib/convert.js | 6 +- .../object-with-escaped-properties.src.ts | 7 + .../lib/__snapshots__/typescript.js.snap | 1079 +++++++++++++++++ 3 files changed, 1091 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/object-with-escaped-properties.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 8f881eeb70fd..35046c91a4ca 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1537,9 +1537,13 @@ module.exports = function convert(config) { case SyntaxKind.StringLiteral: Object.assign(result, { type: AST_NODE_TYPES.Literal, - value: nodeUtils.unescapeStringLiteralText(node.text), raw: ast.text.slice(result.range[0], result.range[1]) }); + if (parent.name && parent.name === node) { + result.value = nodeUtils.unescapeIdentifier(node.text); + } else { + result.value = nodeUtils.unescapeStringLiteralText(node.text); + } break; case SyntaxKind.NumericLiteral: diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/object-with-escaped-properties.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/object-with-escaped-properties.src.ts new file mode 100644 index 000000000000..430a8bad251d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/object-with-escaped-properties.src.ts @@ -0,0 +1,7 @@ +({ '__': null }); + +({ '__'() {} }); + +({ ['__']: null }); + +class X { '__' = null } diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 2068b4e30099..3b6837caec32 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -35444,6 +35444,1085 @@ Object { } `; +exports[`typescript fixtures/basics/object-with-escaped-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 13, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "range": Array [ + 1, + 15, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "method": true, + "range": Array [ + 22, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 26, + 31, + ], + "type": "FunctionExpression", + }, + }, + ], + "range": Array [ + 20, + 33, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 35, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 41, + 45, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "method": false, + "range": Array [ + 40, + 52, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 48, + 52, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "range": Array [ + 38, + 54, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": null, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 72, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 79, + ], + "readonly": false, + "static": false, + "type": "ClassProperty", + "typeAnnotation": null, + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 75, + 79, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 66, + 81, + ], + "type": "ClassBody", + }, + "decorators": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "X", + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 58, + 81, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 48, + 52, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 58, + 63, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` Object { "body": Array [ From 60385f548f835b1cc56d0862b412dfafdaf70faa Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 10 Jul 2017 12:31:24 -0500 Subject: [PATCH 174/326] Fix: Arrow function body should be ObjectExpression (fixes #331) (#334) --- .../typescript-eslint-parser/lib/convert.js | 14 +- .../lib/node-utils.js | 34 +- .../basic-in-binary-expression.src.js | 5 + .../lib/__snapshots__/ecma-features.js.snap | 1341 +++++++++++++++++ 4 files changed, 1376 insertions(+), 18 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 35046c91a4ca..880e166f85ed 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -606,8 +606,18 @@ module.exports = function convert(config) { case SyntaxKind.ObjectLiteralExpression: { - const objectAssignNode = nodeUtils.findAncestorOfKind(node, SyntaxKind.BinaryExpression); - let objectIsInAssignment; + const ancestorNode = nodeUtils.findFirstMatchingAncestor( + node, + parentNode => + (parentNode.kind === SyntaxKind.BinaryExpression || parentNode.kind === SyntaxKind.ArrowFunction) + ); + const objectAssignNode = ( + ancestorNode && + ancestorNode.kind === SyntaxKind.BinaryExpression && + ancestorNode.operatorToken.kind === SyntaxKind.FirstAssignment + ) ? ancestorNode : null; + + let objectIsInAssignment = false; if (objectAssignNode) { if (objectAssignNode.left === node) { diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index f1b61c3ac6a7..eca668db452f 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -121,22 +121,6 @@ function findFirstMatchingChild(node, sourceFile, predicate) { return undefined; } -/** - * Find the first matching ancestor based on the given predicate function. - * @param {TSNode} node The current TSNode - * @param {Function} predicate The predicate function to apply to each checked ancestor - * @returns {TSNode|undefined} a matching parent TSNode - */ -function findFirstMatchingAncestor(node, predicate) { - while (node) { - if (predicate(node)) { - return node; - } - node = node.parent; - } - return undefined; -} - /** * Returns true if the given TSNode is a let variable declaration * @param {TSNode} node The TSNode @@ -187,6 +171,7 @@ module.exports = { hasStaticModifierFlag, findNextToken, findChildOfKind, + findFirstMatchingAncestor, findAncestorOfKind, hasJSXAncestor, unescapeIdentifier, @@ -417,6 +402,22 @@ function findChildOfKind(node, kind, sourceFile) { return findFirstMatchingChild(node, sourceFile, child => child.kind === kind); } +/** + * Find the first matching ancestor based on the given predicate function. + * @param {TSNode} node The current TSNode + * @param {Function} predicate The predicate function to apply to each checked ancestor + * @returns {TSNode|undefined} a matching parent TSNode + */ +function findFirstMatchingAncestor(node, predicate) { + while (node) { + if (predicate(node)) { + return node; + } + node = node.parent; + } + return undefined; +} + /** * Finds the first parent TSNode which mastches the given kind * @param {TSNode} node The current TSNode @@ -427,6 +428,7 @@ function findAncestorOfKind(node, kind) { return findFirstMatchingAncestor(node, parent => parent.kind === kind); } + /** * Returns true if a given TSNode has a JSX token within its hierarchy * @param {TSNode} node TSNode to be checked diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js new file mode 100644 index 000000000000..f27ea48bae31 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js @@ -0,0 +1,5 @@ +(a => ({})) + 1; +(a => ({})) = 1; +((a => ({})) + 1); +((a => ({})) = 1); + diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 27aaffe008d2..11aa3fbeda34 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -2008,6 +2008,1347 @@ Object { } `; +exports[`ecmaFeatures fixtures/arrowFunctions/basic-in-binary-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 7, + 9, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 1, + 10, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 0, + 15, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "left": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "properties": Array [], + "range": Array [ + 24, + 26, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 18, + 27, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "=", + "range": Array [ + 17, + 32, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 33, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "left": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [], + "range": Array [ + 42, + 44, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 36, + 45, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 35, + 50, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 52, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "left": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "properties": Array [], + "range": Array [ + 61, + 63, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "a", + "range": Array [ + 55, + 56, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 55, + 64, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "operator": "=", + "range": Array [ + 54, + 69, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 53, + 71, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 40, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 57, + 59, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`ecmaFeatures fixtures/arrowFunctions/block-body.src 1`] = ` Object { "body": Array [ From d9772e3102df15bef3105e38a3a7d25c74961181 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Mon, 10 Jul 2017 12:47:47 -0500 Subject: [PATCH 175/326] Breaking: Include type annotation range for Identifiers (fixes #314) (#319) --- .../typescript-eslint-parser/lib/convert.js | 17 +- .../typescript/basics/var-with-type.src.ts | 1 + ...declaration-type-annotation-spacing.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 577 +++++++++++++++--- 4 files changed, 523 insertions(+), 73 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 880e166f85ed..c4e89a31ce01 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -526,7 +526,7 @@ module.exports = function convert(config) { } - case SyntaxKind.VariableDeclaration: + case SyntaxKind.VariableDeclaration: { Object.assign(result, { type: AST_NODE_TYPES.VariableDeclarator, id: convertChild(node.name), @@ -535,8 +535,18 @@ module.exports = function convert(config) { if (node.type) { result.id.typeAnnotation = convertTypeAnnotation(node.type); + result.id.range[1] = node.type.getEnd(); + + const identifierEnd = node.name.getEnd(); + const numCharsBetweenTypeAndIdentifier = node.type.getStart() - (node.type.getFullStart() - identifierEnd - ":".length) - identifierEnd; + + result.id.typeAnnotation.range = [ + result.id.typeAnnotation.range[0] - numCharsBetweenTypeAndIdentifier, + result.id.typeAnnotation.range[1] + ]; } break; + } case SyntaxKind.VariableStatement: Object.assign(result, { @@ -1145,9 +1155,8 @@ module.exports = function convert(config) { } if (node.type) { - Object.assign(parameter, { - typeAnnotation: convertTypeAnnotation(node.type) - }); + parameter.typeAnnotation = convertTypeAnnotation(node.type); + parameter.range[1] = node.type.getEnd(); } if (node.questionToken) { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts index c27e19d3cc07..547ca4bd9180 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-type.src.ts @@ -1 +1,2 @@ var name:string = "Nicholas"; +var foo: string = "Bar"; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts new file mode 100644 index 000000000000..03b1ebddffb6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/variable-declaration-type-annotation-spacing.src.ts @@ -0,0 +1 @@ +let x : string; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 3b6837caec32..45aef01523d8 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -2936,7 +2936,7 @@ Object { "name": "b", "range": Array [ 4, - 5, + 8, ], "type": "Identifier", "typeAnnotation": Object { @@ -4951,7 +4951,7 @@ Object { "name": "bar", "range": Array [ 132, - 135, + 144, ], "type": "Identifier", "typeAnnotation": Object { @@ -5917,7 +5917,7 @@ Object { "name": "a", "range": Array [ 35, - 36, + 44, ], "type": "Identifier", "typeAnnotation": Object { @@ -9247,7 +9247,7 @@ Object { "name": "Base", "range": Array [ 38, - 42, + 45, ], "type": "Identifier", "typeAnnotation": Object { @@ -9796,7 +9796,7 @@ Object { "name": "args", "range": Array [ 188, - 192, + 199, ], "type": "Identifier", "typeAnnotation": Object { @@ -13335,7 +13335,7 @@ Object { "name": "firstName", "range": Array [ 34, - 43, + 51, ], "type": "Identifier", "typeAnnotation": Object { @@ -13409,7 +13409,7 @@ Object { "name": "lastName", "range": Array [ 84, - 92, + 100, ], "type": "Identifier", "typeAnnotation": Object { @@ -13484,7 +13484,7 @@ Object { "name": "age", "range": Array [ 124, - 127, + 135, ], "type": "Identifier", "typeAnnotation": Object { @@ -13594,7 +13594,7 @@ Object { "name": "student", "range": Array [ 173, - 180, + 189, ], "type": "Identifier", "typeAnnotation": Object { @@ -14477,7 +14477,7 @@ Object { "name": "firstName", "range": Array [ 36, - 45, + 53, ], "type": "Identifier", "typeAnnotation": Object { @@ -14551,7 +14551,7 @@ Object { "name": "lastName", "range": Array [ 88, - 96, + 104, ], "type": "Identifier", "typeAnnotation": Object { @@ -14626,7 +14626,7 @@ Object { "name": "age", "range": Array [ 130, - 133, + 141, ], "type": "Identifier", "typeAnnotation": Object { @@ -14736,7 +14736,7 @@ Object { "name": "student", "range": Array [ 181, - 188, + 197, ], "type": "Identifier", "typeAnnotation": Object { @@ -15619,7 +15619,7 @@ Object { "name": "firstName", "range": Array [ 33, - 42, + 50, ], "type": "Identifier", "typeAnnotation": Object { @@ -15693,7 +15693,7 @@ Object { "name": "lastName", "range": Array [ 82, - 90, + 98, ], "type": "Identifier", "typeAnnotation": Object { @@ -15768,7 +15768,7 @@ Object { "name": "age", "range": Array [ 121, - 124, + 132, ], "type": "Identifier", "typeAnnotation": Object { @@ -15878,7 +15878,7 @@ Object { "name": "student", "range": Array [ 169, - 176, + 185, ], "type": "Identifier", "typeAnnotation": Object { @@ -16761,7 +16761,7 @@ Object { "name": "firstName", "range": Array [ 35, - 44, + 52, ], "type": "Identifier", "typeAnnotation": Object { @@ -16836,7 +16836,7 @@ Object { "name": "lastName", "range": Array [ 77, - 85, + 93, ], "type": "Identifier", "typeAnnotation": Object { @@ -17789,7 +17789,7 @@ Object { "name": "a", "range": Array [ 35, - 36, + 44, ], "type": "Identifier", "typeAnnotation": Object { @@ -19406,7 +19406,7 @@ Object { "name": "bar", "range": Array [ 21, - 24, + 32, ], "type": "Identifier", "typeAnnotation": Object { @@ -21758,7 +21758,7 @@ Object { "name": "a", "range": Array [ 28, - 29, + 37, ], "type": "Identifier", "typeAnnotation": Object { @@ -22663,7 +22663,7 @@ Object { ], "range": Array [ 13, - 23, + 45, ], "type": "ObjectPattern", "typeAnnotation": Object { @@ -23412,7 +23412,7 @@ Object { ], "range": Array [ 13, - 23, + 43, ], "type": "ObjectPattern", "typeAnnotation": Object { @@ -24046,7 +24046,7 @@ Object { "name": "b", "range": Array [ 14, - 15, + 18, ], "type": "Identifier", "typeAnnotation": Object { @@ -24913,7 +24913,7 @@ Object { "name": "b", "range": Array [ 25, - 26, + 29, ], "type": "Identifier", "typeAnnotation": Object { @@ -25569,7 +25569,7 @@ Object { "name": "name", "range": Array [ 17, - 21, + 28, ], "type": "Identifier", "typeAnnotation": Object { @@ -26026,7 +26026,7 @@ Object { "name": "name", "range": Array [ 17, - 21, + 28, ], "type": "Identifier", "typeAnnotation": Object { @@ -26079,7 +26079,7 @@ Object { "name": "age", "range": Array [ 30, - 33, + 40, ], "type": "Identifier", "typeAnnotation": Object { @@ -26167,7 +26167,7 @@ Object { "name": "args", "range": Array [ 51, - 55, + 69, ], "type": "Identifier", "typeAnnotation": Object { @@ -27951,7 +27951,7 @@ Object { "name": "eee", "range": Array [ 95, - 98, + 106, ], "type": "Identifier", "typeAnnotation": Object { @@ -28059,7 +28059,7 @@ Object { "optional": true, "range": Array [ 122, - 125, + 134, ], "type": "Identifier", "typeAnnotation": Object { @@ -32922,7 +32922,7 @@ Object { "optional": true, "range": Array [ 59, - 62, + 71, ], "type": "Identifier", "typeAnnotation": Object { @@ -33783,7 +33783,7 @@ Object { "name": "nestedArray", "range": Array [ 4, - 15, + 44, ], "type": "Identifier", "typeAnnotation": Object { @@ -33798,7 +33798,7 @@ Object { }, }, "range": Array [ - 17, + 15, 44, ], "type": "TypeAnnotation", @@ -34560,7 +34560,7 @@ Object { "optional": true, "range": Array [ 23, - 24, + 33, ], "type": "Identifier", "typeAnnotation": Object { @@ -35079,7 +35079,7 @@ Object { "name": "x", "range": Array [ 4, - 5, + 11, ], "type": "Identifier", "typeAnnotation": Object { @@ -35094,7 +35094,7 @@ Object { }, }, "range": Array [ - 7, + 5, 11, ], "type": "TypeAnnotation", @@ -35169,7 +35169,7 @@ Object { "name": "y", "range": Array [ 17, - 18, + 29, ], "type": "Identifier", "typeAnnotation": Object { @@ -35184,7 +35184,7 @@ Object { }, }, "range": Array [ - 20, + 18, 29, ], "type": "TypeAnnotation", @@ -38126,7 +38126,7 @@ Object { "name": "x", "range": Array [ 18, - 19, + 24, ], "type": "Identifier", "typeAnnotation": Object { @@ -39502,7 +39502,7 @@ Object { "name": "onclick", "range": Array [ 40, - 47, + 79, ], "type": "Identifier", "typeAnnotation": Object { @@ -39547,7 +39547,7 @@ Object { "name": "this", "range": Array [ 50, - 54, + 60, ], "type": "Identifier", "typeAnnotation": Object { @@ -39599,7 +39599,7 @@ Object { "name": "e", "range": Array [ 62, - 63, + 70, ], "type": "Identifier", "typeAnnotation": Object { @@ -40250,7 +40250,7 @@ Object { "name": "foo", "range": Array [ 4, - 7, + 14, ], "type": "Identifier", "typeAnnotation": Object { @@ -40265,7 +40265,7 @@ Object { }, }, "range": Array [ - 9, + 7, 14, ], "type": "TypeAnnotation", @@ -40615,7 +40615,7 @@ Object { "name": "name", "range": Array [ 4, - 8, + 15, ], "type": "Identifier", "typeAnnotation": Object { @@ -40630,7 +40630,7 @@ Object { }, }, "range": Array [ - 9, + 8, 15, ], "type": "TypeAnnotation", @@ -40706,11 +40706,119 @@ Object { ], "type": "VariableDeclaration", }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 34, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 37, + 45, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, + ], + "raw": "\\"Bar\\"", + "type": "Literal", + "value": "Bar", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 53, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 54, + ], + "type": "VariableDeclaration", + }, ], "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { "column": 0, @@ -40719,7 +40827,7 @@ Object { }, "range": Array [ 0, - 29, + 54, ], "sourceType": "script", "tokens": Array [ @@ -40849,6 +40957,337 @@ Object { "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, + ], + "type": "String", + "value": "\\"Bar\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/variable-declaration-type-annotation-spacing.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } @@ -46399,7 +46838,7 @@ Object { "name": "config", "range": Array [ 52, - 58, + 69, ], "type": "Identifier", "typeAnnotation": Object { @@ -47157,7 +47596,7 @@ Object { "name": "baz", "range": Array [ 35, - 38, + 46, ], "type": "Identifier", "typeAnnotation": Object { @@ -47753,7 +48192,7 @@ Object { "name": "baz", "range": Array [ 48, - 51, + 59, ], "type": "Identifier", "typeAnnotation": Object { @@ -48439,7 +48878,7 @@ Object { "name": "name", "range": Array [ 36, - 40, + 48, ], "type": "Identifier", "typeAnnotation": Object { @@ -49179,7 +49618,7 @@ Object { "name": "name", "range": Array [ 49, - 53, + 61, ], "type": "Identifier", "typeAnnotation": Object { @@ -53554,7 +53993,7 @@ Object { "name": "baz", "range": Array [ 190, - 193, + 201, ], "type": "Identifier", "typeAnnotation": Object { @@ -53661,7 +54100,7 @@ Object { "name": "baz", "range": Array [ 225, - 228, + 236, ], "type": "Identifier", "typeAnnotation": Object { @@ -53768,7 +54207,7 @@ Object { "name": "baz", "range": Array [ 262, - 265, + 273, ], "type": "Identifier", "typeAnnotation": Object { @@ -53875,7 +54314,7 @@ Object { "name": "baz", "range": Array [ 296, - 299, + 307, ], "type": "Identifier", "typeAnnotation": Object { @@ -53982,7 +54421,7 @@ Object { "name": "baz", "range": Array [ 330, - 333, + 341, ], "type": "Identifier", "typeAnnotation": Object { @@ -54089,7 +54528,7 @@ Object { "name": "baz", "range": Array [ 366, - 369, + 377, ], "type": "Identifier", "typeAnnotation": Object { @@ -54227,7 +54666,7 @@ Object { "name": "bar", "range": Array [ 402, - 405, + 413, ], "type": "Identifier", "typeAnnotation": Object { @@ -54356,7 +54795,7 @@ Object { "name": "bar", "range": Array [ 436, - 439, + 447, ], "type": "Identifier", "typeAnnotation": Object { @@ -54485,7 +54924,7 @@ Object { "name": "bar", "range": Array [ 472, - 475, + 483, ], "type": "Identifier", "typeAnnotation": Object { @@ -54614,7 +55053,7 @@ Object { "name": "bar", "range": Array [ 505, - 508, + 516, ], "type": "Identifier", "typeAnnotation": Object { @@ -54743,7 +55182,7 @@ Object { "name": "bar", "range": Array [ 538, - 541, + 549, ], "type": "Identifier", "typeAnnotation": Object { @@ -54872,7 +55311,7 @@ Object { "name": "bar", "range": Array [ 573, - 576, + 584, ], "type": "Identifier", "typeAnnotation": Object { @@ -59067,7 +59506,7 @@ Object { "name": "selector", "range": Array [ 48, - 56, + 64, ], "type": "Identifier", "typeAnnotation": Object { From 4dd068673aee096d3ab050fdf61cf197c8faf6ff Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 10 Jul 2017 14:47:18 -0400 Subject: [PATCH 176/326] Build: changelog update for 4.0.0 --- .../typescript-eslint-parser/CHANGELOG.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 3d36a4a2e977..6ea68fbf6c26 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,38 @@ +v4.0.0 - July 10, 2017 + +* 6a612cd Breaking: Include type annotation range for Identifiers (fixes #314) (#319) (Reyad Attiyat) +* 074a64f Fix: Arrow function body should be ObjectExpression (fixes #331) (#334) (Reyad Attiyat) +* fb66f61 Fix: Unescape string literal identifiers (fixes #328) (#330) (Lucas Azzola) +* 9cab9d3 Breaking: Remove TypeAnnotation wrapper from constraint (#325) (James Henry) +* b255499 New: Provider loggerFn option to configure logging (fixes #323) (#324) (James Henry) +* 0540298 Fix: Calculate correct type parameter range (fixes #316) (#320) (Reyad Attiyat) +* 4938c2c Fix: Ensure JSX tag names are JSXIdentifiers (fixes #315) (#318) (Reyad Attiyat) +* 1f20557 Fix: Use TSExportAssignment node type (fixes #304) (#317) (Reyad Attiyat) +* b26cda1 Fix: Use TSNullKeyword for null type instead of Literal (#313) (James Henry) +* 9037dc5 Chore: Add node 8 to .travis.yml (#312) (James Henry) +* 8062515 Chore: Refactor tests to assert snapshots not JSON (#311) (James Henry) +* 2ad791b Fix: Add name to JSXIdentifier when converting ThisKeyword (fixes #307) (#310) (Reyad Attiyat) +* 519907e Breaking: Use ESTree export node types in modules (fixes# 263) (#265) (Reyad Attiyat) +* c4b0b64 Fix: Label readonly class properties (fixes #302) (#303) (Reyad Attiyat) +* bffd6cc Fix: Add more tests for destructuring and spread (fixes #306) (#308) (Reyad Attiyat) +* f7c9246 Chore: Fix typo in comment (#305) (Jeremy Attali) +* 3dcba7d Breaking: Change isReadonly to readonly (fixes #284) (#285) (James Henry) +* bc9225f Chore: Replace mocha (istanbul, chai, leche) with Jest (#300) (James Henry) +* 8744577 Breaking: Decorator ESTree compliance, always convert (fixes #250) (#293) (James Henry) +* dd6404a Breaking: Convert Signature types to be more ESTree like (fixes #262) (#264) (Reyad Attiyat) +* 379dcaf Fix: Only set optional property on certain node property (fixes #289) (#292) (Reyad Attiyat) +* 89f8561 Fix: Label static and export in TSParameterProperty (fixes #286) (#301) (Reyad Attiyat) +* 992f1fa Fix: Unescape type parameter names (fixes #296) (#298) (Reyad Attiyat) +* 5ed8573 Fix: Async generator method should be labeled (fixes #297) (#299) (Reyad Attiyat) +* 31ad3c4 Fix: Create RegExp object for RegExp literals (fixes #287) (#291) (Reyad Attiyat) +* 525a544 Fix: Set node type to ExperimentalRestProperty (fixes #276) (#279) (Reyad Attiyat) +* eb32fed Fix: Convert type guards (fixes #282) (#283) (James Henry) +* b7220fd New: Create option to enable JSXText node type (fixes #266) (#272) (Reyad Attiyat) +* 6dd3696 Fix: Add exponentiation operators (fixes #280) (#281) (Lucas Azzola) +* 3491b4b Fix: Replace JSXMemberExpression with TSQualifiedName (fixes #257) (#258) (Lucas Azzola) +* b4eb0b5 Fix: Convert range and line number corretly in JSX literals (#277) (Reyad Attiyat) +* 3f9f41c Fix: wrap interface in ExportNamedDeclaration if necessary (fixes #269) (#270) (Danny Martini) + v3.0.0 - May 17, 2017 * 6b56bfe Fix: Use correct starting range and loc for JSXText tokens (fixes #227) (#271) (Reyad Attiyat) From d571345e11eef507868da43e57e9af42f455674c Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 10 Jul 2017 14:47:19 -0400 Subject: [PATCH 177/326] 4.0.0 --- packages/typescript-eslint-parser/package.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 790cfedf63ae..68b47c321022 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "3.0.0", + "version": "4.0.0", "files": [ "lib", "parser.js" @@ -55,9 +55,11 @@ "typescript": "*" }, "jest": { - "testRegex": "tests\/lib\/.+\\.js$", + "testRegex": "tests/lib/.+\\.js$", "testPathIgnorePatterns": [], "collectCoverage": true, - "coverageReporters": ["text-summary"] + "coverageReporters": [ + "text-summary" + ] } } From 16418b14b20c3d38297876ba44f6642ad9e9edb4 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 10 Jul 2017 22:03:09 +0100 Subject: [PATCH 178/326] Fix: Handle assignment within property destructuring (fixes #332) (#336) --- .../typescript-eslint-parser/lib/convert.js | 39 +- .../basics/destructuring-assignment.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 387 ++++++++++++++++++ 3 files changed, 417 insertions(+), 10 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/destructuring-assignment.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index c4e89a31ce01..f17782b91fba 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -666,17 +666,36 @@ module.exports = function convert(config) { }); break; - case SyntaxKind.ShorthandPropertyAssignment: - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.name), - value: convertChild(node.name), - computed: false, - method: false, - shorthand: true, - kind: "init" - }); + case SyntaxKind.ShorthandPropertyAssignment: { + if (node.objectAssignmentInitializer) { + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.name), + value: { + type: AST_NODE_TYPES.AssignmentPattern, + left: convertChild(node.name), + right: convertChild(node.objectAssignmentInitializer), + loc: result.loc, + range: result.range + }, + computed: false, + method: false, + shorthand: true, + kind: "init" + }); + } else { + Object.assign(result, { + type: AST_NODE_TYPES.Property, + key: convertChild(node.name), + value: convertChild(node.initializer || node.name), + computed: false, + method: false, + shorthand: true, + kind: "init" + }); + } break; + } case SyntaxKind.ComputedPropertyName: diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/destructuring-assignment.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/destructuring-assignment.src.ts new file mode 100644 index 000000000000..d29509f70afd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/destructuring-assignment.src.ts @@ -0,0 +1 @@ +({ foo = [] } = bar); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 45aef01523d8..5cb2f2f416e9 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -19705,6 +19705,393 @@ Object { } `; +exports[`typescript fixtures/basics/destructuring-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 11, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "ArrayPattern", + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 1, + 13, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 19, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/export-assignment.src 1`] = ` Object { "body": Array [ From f4c47183b9d686d5f1886e39b386318471676789 Mon Sep 17 00:00:00 2001 From: Reyad Attiyat Date: Thu, 13 Jul 2017 10:08:39 -0500 Subject: [PATCH 179/326] Fix: Use name 'this' in JSXMemberExpression (fixes #337) (#338) --- .../typescript-eslint-parser/lib/convert.js | 3 + .../jsx/member-expression-this.src.js | 1 + .../tests/lib/__snapshots__/jsx.js.snap | 240 +++++++++++++++++- 3 files changed, 241 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index f17782b91fba..94519981e314 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -297,6 +297,9 @@ module.exports = function convert(config) { // Assign the appropriate types tagNameToken.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.JSXMemberExpression : AST_NODE_TYPES.JSXIdentifier; tagNameToken.property.type = AST_NODE_TYPES.JSXIdentifier; + if (tagName.expression.kind === SyntaxKind.ThisKeyword) { + tagNameToken.object.name = "this"; + } } else { tagNameToken.type = AST_NODE_TYPES.JSXIdentifier; tagNameToken.name = tagNameToken.value; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js index f3bd61bc75f1..a9ab134d4b48 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/member-expression-this.src.js @@ -1 +1,2 @@ ; +; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap index b7baabd60e39..c18fea7de354 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -5504,11 +5504,119 @@ Object { ], "type": "ExpressionStatement", }, + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 27, + 31, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "Component", + "range": Array [ + 32, + 41, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 27, + 41, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 26, + 44, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 26, + 44, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 45, + ], + "type": "ExpressionStatement", + }, ], "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { "column": 0, @@ -5517,7 +5625,7 @@ Object { }, "range": Array [ 0, - 25, + 45, ], "sourceType": "script", "tokens": Array [ @@ -5683,6 +5791,132 @@ Object { "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 32, + 41, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } From aeb8d47768ad581654087bfa46677ea7909f0696 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 19 Jul 2017 18:13:01 +0100 Subject: [PATCH 180/326] Breaking: Use TSTypeReference for TypeParameters (#340) --- .../typescript-eslint-parser/lib/convert.js | 4 +- .../lib/__snapshots__/typescript.js.snap | 676 +++++++++--------- 2 files changed, 340 insertions(+), 340 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 94519981e314..6779cc4eeedf 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -111,13 +111,13 @@ module.exports = function convert(config) { ], loc: nodeUtils.getLocFor(firstTypeArgument.pos - 1, greaterThanToken.end, ast), params: typeArguments.map(typeArgument => ({ - type: AST_NODE_TYPES.GenericTypeAnnotation, + type: AST_NODE_TYPES.TSTypeReference, range: [ typeArgument.getStart(), typeArgument.getEnd() ], loc: nodeUtils.getLoc(typeArgument, ast), - id: convertChild(typeArgument.typeName || typeArgument), + typeName: convertChild(typeArgument.typeName || typeArgument), typeParameters: (typeArgument.typeArguments) ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) : null diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 5cb2f2f416e9..468b11c7e454 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -878,7 +878,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 43, @@ -895,21 +910,6 @@ Object { ], "type": "TSStringKeyword", }, - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 37, - "line": 2, - }, - }, - "range": Array [ - 76, - 82, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -2213,7 +2213,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 35, @@ -2230,21 +2245,6 @@ Object { ], "type": "TSStringKeyword", }, - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -6368,7 +6368,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 26, @@ -6386,21 +6401,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -6775,7 +6775,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 36, @@ -6793,25 +6808,25 @@ Object { ], "type": "Identifier", }, + "typeParameters": null, + }, + Object { "loc": Object { "end": Object { - "column": 36, + "column": 39, "line": 1, }, "start": Object { - "column": 35, + "column": 38, "line": 1, }, }, "range": Array [ - 35, - 36, + 38, + 39, ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - Object { - "id": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 39, @@ -6829,21 +6844,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 38, - "line": 1, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -8454,7 +8454,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 26, @@ -8472,21 +8487,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -8788,7 +8788,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 26, @@ -8806,25 +8821,25 @@ Object { ], "type": "Identifier", }, + "typeParameters": null, + }, + Object { "loc": Object { "end": Object { - "column": 26, + "column": 29, "line": 1, }, "start": Object { - "column": 25, + "column": 28, "line": 1, }, }, "range": Array [ - 25, - 26, + 28, + 29, ], - "type": "GenericTypeAnnotation", - "typeParameters": null, - }, - Object { - "id": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 29, @@ -8842,21 +8857,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -9369,7 +9369,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 35, @@ -9387,21 +9402,6 @@ Object { ], "type": "TSTypeLiteral", }, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 35, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -9593,7 +9593,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 21, @@ -9610,21 +9625,6 @@ Object { ], "type": "TSAnyKeyword", }, - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 104, - 107, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -26620,7 +26620,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 68, @@ -26637,21 +26652,6 @@ Object { ], "type": "TSStringKeyword", }, - "loc": Object { - "end": Object { - "column": 68, - "line": 1, - }, - "start": Object { - "column": 62, - "line": 1, - }, - }, - "range": Array [ - 62, - 68, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -31835,7 +31835,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 30, @@ -31853,21 +31868,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -34236,7 +34236,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 43, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 28, @@ -34254,21 +34269,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 43, - ], - "type": "GenericTypeAnnotation", "typeParameters": Object { "loc": Object { "end": Object { @@ -34282,7 +34282,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 34, @@ -34300,21 +34315,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 42, - ], - "type": "GenericTypeAnnotation", "typeParameters": Object { "loc": Object { "end": Object { @@ -34328,7 +34328,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 41, @@ -34345,21 +34360,6 @@ Object { ], "type": "TSStringKeyword", }, - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -36998,7 +36998,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 26, @@ -37016,21 +37031,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -37476,7 +37476,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 37, @@ -37494,21 +37509,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -39042,7 +39042,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 22, @@ -39060,21 +39075,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -58677,7 +58677,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 5, @@ -58695,21 +58710,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -58785,7 +58785,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 10, @@ -58802,21 +58817,6 @@ Object { ], "type": "TSNumberKeyword", }, - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 20, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -59189,7 +59189,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 17, @@ -59207,21 +59222,6 @@ Object { ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], @@ -59999,7 +59999,22 @@ Object { }, "params": Array [ Object { - "id": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 57, @@ -60016,21 +60031,6 @@ Object { ], "type": "TSAnyKeyword", }, - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 54, - "line": 2, - }, - }, - "range": Array [ - 77, - 80, - ], - "type": "GenericTypeAnnotation", "typeParameters": null, }, ], From 39b7578dd7cc65acf44a7536a807e5a58bb72ac5 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 6 Aug 2017 16:06:07 +0200 Subject: [PATCH 181/326] New: Support TypeScript 2.4 (fixes #321) (#322) (#326) --- packages/typescript-eslint-parser/README.md | 2 +- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 6 + .../typescript-eslint-parser/package.json | 2 +- .../dynamic-import.src.js | 1 + .../lib/__snapshots__/ecma-features.js.snap | 350 ++++++++++++++++ .../lib/__snapshots__/typescript.js.snap | 378 ------------------ 7 files changed, 360 insertions(+), 380 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalDynamicImport/dynamic-import.src.js diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 9d8031820ae0..8d3cd4d1d67c 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -8,7 +8,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.3.2`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~2.4.0`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 629bc8d3e5a6..66de023490c3 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -56,6 +56,7 @@ module.exports = { GenericTypeAnnotation: "GenericTypeAnnotation", Identifier: "Identifier", IfStatement: "IfStatement", + Import: "Import", ImportDeclaration: "ImportDeclaration", ImportDefaultSpecifier: "ImportDefaultSpecifier", ImportNamespaceSpecifier: "ImportNamespaceSpecifier", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 6779cc4eeedf..d974525d627c 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1649,6 +1649,12 @@ module.exports = function convert(config) { break; } + case SyntaxKind.ImportKeyword: + Object.assign(result, { + type: AST_NODE_TYPES.Import + }); + break; + case SyntaxKind.EmptyStatement: case SyntaxKind.DebuggerStatement: simplyCopy(); diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 68b47c321022..1f4f0a42e9e8 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -26,7 +26,7 @@ "npm-license": "0.3.3", "shelljs": "0.7.7", "shelljs-nodecli": "0.1.1", - "typescript": "~2.3.2" + "typescript": "~2.4.0" }, "keywords": [ "ast", diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalDynamicImport/dynamic-import.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalDynamicImport/dynamic-import.src.js new file mode 100644 index 000000000000..18dff34f73a5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalDynamicImport/dynamic-import.src.js @@ -0,0 +1 @@ +import('foo').then(main); diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 11aa3fbeda34..771fa8c4c332 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -57916,6 +57916,356 @@ Object { } `; +exports[`ecmaFeatures fixtures/experimentalDynamicImport/dynamic-import.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "main", + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Import", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "then", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 18, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "then", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + "value": "main", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/arg-spread.src 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 468b11c7e454..ac75332e44bb 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -32625,384 +32625,6 @@ Object { "type": "Punctuator", "value": "{", }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "range": Array [ - 76, - 22, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 0, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 30, - 25, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 30, - 30, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 32, - 32, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 32, - 39, - ], - "type": "Identifier", - "value": "Comment", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 40, - 40, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 40, - 44, - ], - "type": "Identifier", - "value": "Line", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 45, - 45, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Identifier", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "range": Array [ - 52, - 47, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "range": Array [ - 52, - 52, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, - }, - "range": Array [ - 52, - 53, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 4, - }, - "start": Object { - "column": 7, - "line": 4, - }, - }, - "range": Array [ - 54, - 54, - ], - "type": "Identifier", - "value": "", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 7, - "line": 4, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Punctuator", - "value": "@", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 55, - 58, - ], - "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 4, - }, - "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 59, - 62, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "range": Array [ - 69, - 70, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "range": Array [ - 70, - 71, - ], - "type": "Punctuator", - "value": "/", - }, Object { "loc": Object { "end": Object { From a614369fdd830137c36676a4378ec0aeb5958608 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 6 Aug 2017 10:08:07 -0400 Subject: [PATCH 182/326] Build: changelog update for 5.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 6ea68fbf6c26..6f20e4351cab 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,10 @@ +v5.0.0 - August 6, 2017 + +* 271b4f1 New: Support TypeScript 2.4 (fixes #321) (#322) (#326) (James Henry) +* ea6c3bb Breaking: Use TSTypeReference for TypeParameters (#340) (James Henry) +* a9ca775 Fix: Use name 'this' in JSXMemberExpression (fixes #337) (#338) (Reyad Attiyat) +* ef2687b Fix: Handle assignment within property destructuring (fixes #332) (#336) (James Henry) + v4.0.0 - July 10, 2017 * 6a612cd Breaking: Include type annotation range for Identifiers (fixes #314) (#319) (Reyad Attiyat) From d859cf64a15b697b76be0a2a5809bb30f09530fa Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 6 Aug 2017 10:08:08 -0400 Subject: [PATCH 183/326] 5.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 1f4f0a42e9e8..a5a8685e7c6f 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "4.0.0", + "version": "5.0.0", "files": [ "lib", "parser.js" From 320339cd09c3e5069a608c5406dd6c0cd1c1d193 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 7 Aug 2017 22:49:24 +0200 Subject: [PATCH 184/326] Chore: AST alignment testing against Babylon (#342) --- .../typescript-eslint-parser/package.json | 5 + .../tests/ast-alignment/.eslintrc.yml | 2 + .../tests/ast-alignment/parse.js | 90 +++++++++++++++ .../tests/ast-alignment/spec.js | 106 ++++++++++++++++++ .../tests/ast-alignment/utils.js | 66 +++++++++++ 5 files changed, 269 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/parse.js create mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/spec.js create mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/utils.js diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index a5a8685e7c6f..504e1eb12451 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -18,11 +18,15 @@ }, "license": "BSD-2-Clause", "devDependencies": { + "babel-code-frame": "^6.22.0", + "babylon": "^7.0.0-beta.16", "eslint": "3.19.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "4.2.2", "eslint-release": "0.10.3", + "glob": "^7.1.2", "jest": "20.0.4", + "lodash.isplainobject": "^4.0.6", "npm-license": "0.3.3", "shelljs": "0.7.7", "shelljs-nodecli": "0.1.1", @@ -40,6 +44,7 @@ "scripts": { "test": "node Makefile.js test", "jest": "jest", + "ast-alignment-tests": "jest --config={} ./tests/ast-alignment/spec.js", "lint": "node Makefile.js lint", "release": "eslint-release", "ci-release": "eslint-ci-release", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml b/packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml new file mode 100644 index 000000000000..e19b2cfa824a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml @@ -0,0 +1,2 @@ +env: + jest: true diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js new file mode 100644 index 000000000000..2aca3127b041 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js @@ -0,0 +1,90 @@ +"use strict"; + +const codeFrame = require("babel-code-frame"); +const parseUtils = require("./utils"); + +function createError(message, line, column) { // eslint-disable-line + // Construct an error similar to the ones thrown by Babylon. + const error = new SyntaxError(`${message} (${line}:${column})`); + error.loc = { + line, + column + }; + return error; +} + +function parseWithBabylonPluginTypescript(text) { // eslint-disable-line + const babylon = require("babylon"); + return babylon.parse(text, { + sourceType: "script", + allowImportExportEverywhere: true, + allowReturnOutsideFunction: true, + ranges: true, + plugins: [ + "jsx", + "typescript", + "doExpressions", + "objectRestSpread", + "decorators", + "classProperties", + "exportExtensions", + "asyncGenerators", + "functionBind", + "functionSent", + "dynamicImport", + "numericSeparator", + "estree" + ] + }); +} + +function parseWithTypeScriptESLintParser(text) { // eslint-disable-line + const parser = require("../../parser"); + try { + return parser.parse(text, { + loc: true, + range: true, + tokens: false, + comment: false, + ecmaFeatures: { + jsx: true + } + }); + } catch (e) { + throw createError( + e.message, + e.lineNumber, + e.column + ); + } +} + +module.exports = function parse(text, opts) { + + let parseFunction; + + switch (opts.parser) { + case "typescript-eslint-parser": + parseFunction = parseWithTypeScriptESLintParser; + break; + case "babylon-plugin-typescript": + parseFunction = parseWithBabylonPluginTypescript; + break; + default: + throw new Error("Please provide a valid parser: either \"typescript-eslint-parser\" or \"babylon-plugin-typescript\""); + } + + try { + return parseUtils.normalizeNodeTypes(parseFunction(text)); + } catch (error) { + const loc = error.loc; + if (loc) { + error.codeFrame = codeFrame(text, loc.line, loc.column + 1, { + highlightCode: true + }); + error.message += `\n${error.codeFrame}`; + } + throw error; + } + +}; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js new file mode 100644 index 000000000000..44bd4a0e8811 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -0,0 +1,106 @@ +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const glob = require("glob"); +const parse = require("./parse"); +const parseUtils = require("./utils"); + +const fixturesDirPath = path.join(__dirname, "../fixtures"); +const fixturePatternsToTest = [ + "basics/instanceof.src.js", + "basics/update-expression.src.js", + "basics/new-without-parens.src.js", + "ecma-features/arrowFunctions/**/as*.src.js" +]; + +const fixturesToTest = []; + +fixturePatternsToTest.forEach(fixturePattern => { + const matchingFixtures = glob.sync(`${fixturesDirPath}/${fixturePattern}`, {}); + matchingFixtures.forEach(filename => fixturesToTest.push(filename)); +}); + +/** + * - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now... + * - Remove "start" and "end" values from Babylon nodes to reduce unimportant noise in diffs ("loc" data will still be in + * each final AST and compared). + * + * @param {Object} ast raw babylon AST + * @returns {Object} processed babylon AST + */ +function preprocessBabylonAST(ast) { + return parseUtils.omitDeep(ast.program, [ + { + key: "start", + predicate(val) { + // only remove the "start" number (not the "start" object within loc) + return typeof val === "number"; + } + }, + { + key: "end", + predicate(val) { + // only remove the "end" number (not the "end" object within loc) + return typeof val === "number"; + } + }, + { + key: "identifierName", + predicate() { + return true; + } + }, + { + key: "extra", + predicate() { + return true; + } + }, + { + key: "directives", + predicate() { + return true; + } + }, + { + key: "innerComments", + predicate() { + return true; + } + }, + { + key: "leadingComments", + predicate() { + return true; + } + } + ]); +} + +fixturesToTest.forEach(filename => { + + const source = fs.readFileSync(filename, "utf8").replace(/\r\n/g, "\n"); + + /** + * Parse with typescript-eslint-parser + */ + const typeScriptESLintParserAST = parse(source, { + parser: "typescript-eslint-parser" + }); + + /** + * Parse the source with babylon typescript-plugin, and perform some extra formatting steps + */ + const babylonTypeScriptPluginAST = preprocessBabylonAST(parse(source, { + parser: "babylon-plugin-typescript" + })); + + /** + * Assert the two ASTs match + */ + test(`${filename}`, () => { + expect(babylonTypeScriptPluginAST).toEqual(typeScriptESLintParserAST); + }); + +}); diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/utils.js b/packages/typescript-eslint-parser/tests/ast-alignment/utils.js new file mode 100644 index 000000000000..e9a52a269528 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/ast-alignment/utils.js @@ -0,0 +1,66 @@ +"use strict"; + +const isPlainObject = require("lodash.isplainobject"); + +/** + * By default, pretty-format (within Jest matchers) retains the names/types of nodes from the babylon AST, + * quick and dirty way to avoid that is to JSON.stringify and then JSON.parser the + * ASTs before comparing them with pretty-format + * + * @param {Object} ast raw AST + * @returns {Object} normalized AST + */ +function normalizeNodeTypes(ast) { + return JSON.parse(JSON.stringify(ast)); +} + +/** + * Removes the given keys from the given AST object recursively + * @param {Object} obj A JavaScript object to remove keys from + * @param {Object[]} keysToOmit Names and predicate functions use to determine what keys to omit from the final object + * @returns {Object} formatted object + */ +function omitDeep(obj, keysToOmit) { + keysToOmit = keysToOmit || []; + function shouldOmit(keyName, val) { // eslint-disable-line + if (!keysToOmit || !keysToOmit.length) { + return false; + } + for (const keyConfig of keysToOmit) { + if (keyConfig.key !== keyName) { + continue; + } + return keyConfig.predicate(val); + } + return false; + } + for (const key in obj) { + if (!obj.hasOwnProperty(key)) { + continue; + } + const val = obj[key]; + if (isPlainObject(val)) { + if (shouldOmit(key, val)) { + delete obj[key]; + break; + } + omitDeep(val, keysToOmit); + } else if (Array.isArray(val)) { + if (shouldOmit(key, val)) { + delete obj[key]; + break; + } + for (const i of val) { + omitDeep(i, keysToOmit); + } + } else if (shouldOmit(key, val)) { + delete obj[key]; + } + } + return obj; +} + +module.exports = { + normalizeNodeTypes, + omitDeep +}; From 4b932596390014ea07e9af956ae1ea13410d5d6c Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 9 Aug 2017 08:06:32 -0400 Subject: [PATCH 185/326] Fix: Only warn about an unsupported TypeScript version once (#347) --- packages/typescript-eslint-parser/parser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 944606e34520..250eebdcf6dd 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -17,6 +17,7 @@ const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS); let extra; +let warnedAboutTSVersion = false; /** * Resets the extra config object @@ -99,11 +100,13 @@ function parse(code, options) { */ if (typeof options.loggerFn === "function") { extra.log = options.loggerFn; + } else if (options.loggerFn === false) { + extra.log = Function.prototype; } } - if (!isRunningSupportedTypeScriptVersion) { + if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { const border = "============="; const versionWarning = [ border, @@ -115,6 +118,7 @@ function parse(code, options) { border ]; extra.log(versionWarning.join("\n\n")); + warnedAboutTSVersion = true; } // Even if jsx option is set in typescript compiler, filename still has to From 8674b8bcf9542e4707bfee4345e0cf9e2e4f8787 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 9 Aug 2017 08:08:54 -0400 Subject: [PATCH 186/326] Build: changelog update for 5.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 6f20e4351cab..783812ba49cc 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v5.0.1 - August 9, 2017 + +* 81e20c0 Fix: Only warn about an unsupported TypeScript version once (#347) (Jed Fox) +* 5e22fac Chore: AST alignment testing against Babylon (#342) (James Henry) + v5.0.0 - August 6, 2017 * 271b4f1 New: Support TypeScript 2.4 (fixes #321) (#322) (#326) (James Henry) From cb597c107749eb1db9f1cd0f11ce3332793986ea Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 9 Aug 2017 08:08:55 -0400 Subject: [PATCH 187/326] 5.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 504e1eb12451..227e748ee0b0 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "5.0.0", + "version": "5.0.1", "files": [ "lib", "parser.js" From 7a08ce41f9983ed5c4c69f859d8f7355f9f39df8 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 15 Aug 2017 16:32:00 +0100 Subject: [PATCH 188/326] Fix: Remove start and end values from JSX tokens (fixes #341) (#351) --- .../lib/node-utils.js | 2 - .../typescript-eslint-parser/package.json | 2 +- .../tests/ast-alignment/parse.js | 2 + .../tests/ast-alignment/spec.js | 3 +- .../tests/fixtures/jsx/attributes.src.js | 2 +- .../tests/lib/__snapshots__/jsx.js.snap | 225 ++++++------------ 6 files changed, 83 insertions(+), 153 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index eca668db452f..d10207efd51b 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -627,8 +627,6 @@ function convertToken(token, ast) { newToken = { type: getTokenType(token), value, - start, - end, range: [start, end], loc: getLocFor(start, end, ast) }; diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 227e748ee0b0..91e31ee9f3a3 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -19,7 +19,7 @@ "license": "BSD-2-Clause", "devDependencies": { "babel-code-frame": "^6.22.0", - "babylon": "^7.0.0-beta.16", + "babylon": "^7.0.0-beta.19", "eslint": "3.19.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "4.2.2", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js index 2aca3127b041..180d6f1b8645 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js @@ -46,6 +46,8 @@ function parseWithTypeScriptESLintParser(text) { // eslint-disable-line range: true, tokens: false, comment: false, + useJSXTextNode: true, + errorOnUnknownASTType: true, ecmaFeatures: { jsx: true } diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index 44bd4a0e8811..73bf551bf013 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -11,7 +11,8 @@ const fixturePatternsToTest = [ "basics/instanceof.src.js", "basics/update-expression.src.js", "basics/new-without-parens.src.js", - "ecma-features/arrowFunctions/**/as*.src.js" + "ecma-features/arrowFunctions/**/as*.src.js", + "jsx/attributes.src.js" ]; const fixturesToTest = []; diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.src.js index c70e86b54566..5de9359ff361 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.src.js +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/attributes.src.js @@ -1 +1 @@ -test +test \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap index c18fea7de354..b2ed1b9e7c1a 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -9,17 +9,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 46, + "column": 39, "line": 1, }, "start": Object { - "column": 42, + "column": 35, "line": 1, }, }, "range": Array [ - 42, - 46, + 35, + 39, ], "raw": "test", "type": "Literal", @@ -29,41 +29,41 @@ Object { "closingElement": Object { "loc": Object { "end": Object { - "column": 52, + "column": 45, "line": 1, }, "start": Object { - "column": 46, + "column": 39, "line": 1, }, }, "name": Object { "loc": Object { "end": Object { - "column": 51, + "column": 44, "line": 1, }, "start": Object { - "column": 48, + "column": 41, "line": 1, }, }, "name": "foo", "range": Array [ - 48, - 51, + 41, + 44, ], "type": "JSXIdentifier", }, "range": Array [ - 46, - 52, + 39, + 45, ], "type": "JSXClosingElement", }, "loc": Object { "end": Object { - "column": 52, + "column": 45, "line": 1, }, "start": Object { @@ -198,79 +198,44 @@ Object { }, }, Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 31, + "column": 33, "line": 1, }, "start": Object { - "column": 25, + "column": 29, "line": 1, }, }, - "name": "spread", + "name": "rest", "range": Array [ - 25, - 31, + 29, + 33, ], - "type": "JSXIdentifier", + "type": "Identifier", }, - "range": Array [ - 25, - 41, - ], - "type": "JSXAttribute", - "value": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, - }, - "name": "rest", - "range": Array [ - 36, - 40, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 34, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, + "start": Object { + "column": 25, + "line": 1, }, - "range": Array [ - 32, - 41, - ], - "type": "JSXExpressionContainer", }, + "range": Array [ + 25, + 34, + ], + "type": "JSXSpreadAttribute", }, ], "loc": Object { "end": Object { - "column": 42, + "column": 35, "line": 1, }, "start": Object { @@ -298,20 +263,20 @@ Object { }, "range": Array [ 0, - 42, + 35, ], "selfClosing": false, "type": "JSXOpeningElement", }, "range": Array [ 0, - 52, + 45, ], "type": "JSXElement", }, "loc": Object { "end": Object { - "column": 52, + "column": 45, "line": 1, }, "start": Object { @@ -321,14 +286,14 @@ Object { }, "range": Array [ 0, - 52, + 45, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 52, + "column": 45, "line": 1, }, "start": Object { @@ -338,7 +303,7 @@ Object { }, "range": Array [ 0, - 52, + 45, ], "sourceType": "script", "tokens": Array [ @@ -525,7 +490,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 26, "line": 1, }, "start": Object { @@ -535,43 +500,7 @@ Object { }, "range": Array [ 25, - 31, - ], - "type": "JSXIdentifier", - "value": "spread", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 33, + 26, ], "type": "Punctuator", "value": "{", @@ -579,17 +508,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 29, "line": 1, }, "start": Object { - "column": 33, + "column": 26, "line": 1, }, }, "range": Array [ - 33, - 36, + 26, + 29, ], "type": "Punctuator", "value": "...", @@ -597,17 +526,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, + "column": 33, "line": 1, }, "start": Object { - "column": 36, + "column": 29, "line": 1, }, }, "range": Array [ - 36, - 40, + 29, + 33, ], "type": "Identifier", "value": "rest", @@ -615,17 +544,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 34, "line": 1, }, "start": Object { - "column": 40, + "column": 33, "line": 1, }, }, "range": Array [ - 40, - 41, + 33, + 34, ], "type": "Punctuator", "value": "}", @@ -633,17 +562,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 35, "line": 1, }, "start": Object { - "column": 41, + "column": 34, "line": 1, }, }, "range": Array [ - 41, - 42, + 34, + 35, ], "type": "Punctuator", "value": ">", @@ -651,17 +580,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 46, + "column": 39, "line": 1, }, "start": Object { - "column": 42, + "column": 35, "line": 1, }, }, "range": Array [ - 42, - 46, + 35, + 39, ], "type": "JSXText", "value": "test", @@ -669,17 +598,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, + "column": 40, "line": 1, }, "start": Object { - "column": 46, + "column": 39, "line": 1, }, }, "range": Array [ - 46, - 47, + 39, + 40, ], "type": "Punctuator", "value": "<", @@ -687,17 +616,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, + "column": 41, "line": 1, }, "start": Object { - "column": 47, + "column": 40, "line": 1, }, }, "range": Array [ - 47, - 48, + 40, + 41, ], "type": "Punctuator", "value": "/", @@ -705,17 +634,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 51, + "column": 44, "line": 1, }, "start": Object { - "column": 48, + "column": 41, "line": 1, }, }, "range": Array [ - 48, - 51, + 41, + 44, ], "type": "JSXIdentifier", "value": "foo", @@ -723,17 +652,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 52, + "column": 45, "line": 1, }, "start": Object { - "column": 51, + "column": 44, "line": 1, }, }, "range": Array [ - 51, - 52, + 44, + 45, ], "type": "Punctuator", "value": ">", From e8da1cbe6838db22683e7adb05bace04034af334 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 15 Aug 2017 17:57:19 +0100 Subject: [PATCH 189/326] Fix: Include newlines at the end of source in AST (fixes #352) (#353) --- .../typescript-eslint-parser/lib/convert.js | 3 +- .../tests/lib/__snapshots__/basics.js.snap | 36 +- .../tests/lib/__snapshots__/comments.js.snap | 118 ++-- .../lib/__snapshots__/ecma-features.js.snap | 666 +++++++++--------- .../tests/lib/__snapshots__/jsx.js.snap | 30 +- .../lib/__snapshots__/typescript.js.snap | 408 +++++------ 6 files changed, 630 insertions(+), 631 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index d974525d627c..892b6f0c0bd0 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -331,8 +331,7 @@ module.exports = function convert(config) { } }); - // fix end location - result.range[1] = node.endOfFileToken.pos; + result.range[1] = node.endOfFileToken.end; result.loc = nodeUtils.getLocFor(node.getStart(), result.range[1], ast); break; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap index eed952e8cbea..c4e3cd136659 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap @@ -96,8 +96,8 @@ Object { ], "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -106,7 +106,7 @@ Object { }, "range": Array [ 0, - 15, + 16, ], "sourceType": "script", "tokens": Array [ @@ -501,8 +501,8 @@ Object { ], "loc": Object { "end": Object { - "column": 16, - "line": 6, + "column": 0, + "line": 7, }, "start": Object { "column": 0, @@ -511,7 +511,7 @@ Object { }, "range": Array [ 0, - 58, + 59, ], "sourceType": "script", "tokens": Array [ @@ -1181,8 +1181,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -1191,7 +1191,7 @@ Object { }, "range": Array [ 0, - 59, + 60, ], "sourceType": "script", "tokens": Array [ @@ -1716,8 +1716,8 @@ Object { ], "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -1726,7 +1726,7 @@ Object { }, "range": Array [ 0, - 14, + 15, ], "sourceType": "script", "tokens": Array [ @@ -2219,8 +2219,8 @@ Object { ], "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -2229,7 +2229,7 @@ Object { }, "range": Array [ 0, - 12, + 13, ], "sourceType": "script", "tokens": Array [ @@ -2978,8 +2978,8 @@ Object { ], "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -2988,7 +2988,7 @@ Object { }, "range": Array [ 0, - 16, + 17, ], "sourceType": "script", "tokens": Array [ diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap index b8f6fb078fe4..4fece593373b 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap @@ -98,8 +98,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -108,7 +108,7 @@ Object { }, "range": Array [ 0, - 26, + 27, ], "sourceType": "script", "tokens": Array [ @@ -323,8 +323,8 @@ Object { ], "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -333,7 +333,7 @@ Object { }, "range": Array [ 10, - 30, + 31, ], "sourceType": "script", "tokens": Array [ @@ -635,8 +635,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 10, + "column": 0, + "line": 11, }, "start": Object { "column": 0, @@ -645,7 +645,7 @@ Object { }, "range": Array [ 36, - 121, + 122, ], "sourceType": "module", "tokens": Array [ @@ -1140,8 +1140,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -1150,7 +1150,7 @@ Object { }, "range": Array [ 0, - 97, + 98, ], "sourceType": "script", "tokens": Array [ @@ -1844,8 +1844,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 0, + "line": 11, }, "start": Object { "column": 0, @@ -1854,7 +1854,7 @@ Object { }, "range": Array [ 0, - 127, + 129, ], "sourceType": "script", "tokens": Array [ @@ -2250,7 +2250,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 1, + "line": 2, }, "start": Object { "column": 0, @@ -2259,7 +2259,7 @@ Object { }, "range": Array [ 12, - 0, + 12, ], "sourceType": "script", "tokens": Array [], @@ -2403,8 +2403,8 @@ Object { ], "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -2413,7 +2413,7 @@ Object { }, "range": Array [ 6, - 28, + 35, ], "sourceType": "script", "tokens": Array [ @@ -2597,8 +2597,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -2607,7 +2607,7 @@ Object { }, "range": Array [ 0, - 34, + 35, ], "sourceType": "script", "tokens": Array [ @@ -2855,8 +2855,8 @@ Object { "comments": Array [], "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -2865,7 +2865,7 @@ Object { }, "range": Array [ 0, - 37, + 38, ], "sourceType": "script", "tokens": Array [ @@ -3155,8 +3155,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -3165,7 +3165,7 @@ Object { }, "range": Array [ 0, - 60, + 61, ], "sourceType": "script", "tokens": Array [ @@ -3473,8 +3473,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -3483,7 +3483,7 @@ Object { }, "range": Array [ 0, - 63, + 64, ], "sourceType": "script", "tokens": Array [ @@ -3756,8 +3756,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -3766,7 +3766,7 @@ Object { }, "range": Array [ 0, - 61, + 62, ], "sourceType": "script", "tokens": Array [ @@ -4057,8 +4057,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -4067,7 +4067,7 @@ Object { }, "range": Array [ 0, - 63, + 64, ], "sourceType": "script", "tokens": Array [ @@ -4450,8 +4450,8 @@ Object { ], "loc": Object { "end": Object { - "column": 68, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -4460,7 +4460,7 @@ Object { }, "range": Array [ 0, - 68, + 69, ], "sourceType": "script", "tokens": Array [ @@ -4948,8 +4948,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -4958,7 +4958,7 @@ Object { }, "range": Array [ 0, - 91, + 92, ], "sourceType": "script", "tokens": Array [ @@ -5541,8 +5541,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -5551,7 +5551,7 @@ Object { }, "range": Array [ 0, - 141, + 142, ], "sourceType": "script", "tokens": Array [ @@ -6093,8 +6093,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -6103,7 +6103,7 @@ Object { }, "range": Array [ 0, - 58, + 59, ], "sourceType": "script", "tokens": Array [ @@ -6562,8 +6562,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -6572,7 +6572,7 @@ Object { }, "range": Array [ 0, - 133, + 134, ], "sourceType": "script", "tokens": Array [ @@ -7647,8 +7647,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 12, + "column": 0, + "line": 13, }, "start": Object { "column": 0, @@ -7657,7 +7657,7 @@ Object { }, "range": Array [ 0, - 287, + 288, ], "sourceType": "script", "tokens": Array [ @@ -8766,8 +8766,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -8776,7 +8776,7 @@ Object { }, "range": Array [ 0, - 64, + 65, ], "sourceType": "script", "tokens": Array [ diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 771fa8c4c332..883912e05af5 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -84,8 +84,8 @@ Object { ], "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -94,7 +94,7 @@ Object { }, "range": Array [ 0, - 41, + 42, ], "sourceType": "script", "tokens": Array [ @@ -281,8 +281,8 @@ Object { ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -291,7 +291,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -478,8 +478,8 @@ Object { ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -488,7 +488,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -675,8 +675,8 @@ Object { ], "loc": Object { "end": Object { - "column": 41, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -685,7 +685,7 @@ Object { }, "range": Array [ 0, - 41, + 42, ], "sourceType": "script", "tokens": Array [ @@ -872,8 +872,8 @@ Object { ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -882,7 +882,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -1069,8 +1069,8 @@ Object { ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -1079,7 +1079,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -2466,8 +2466,8 @@ Object { ], "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -2476,7 +2476,7 @@ Object { }, "range": Array [ 0, - 71, + 73, ], "sourceType": "script", "tokens": Array [ @@ -7382,8 +7382,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -7392,7 +7392,7 @@ Object { }, "range": Array [ 0, - 6, + 7, ], "sourceType": "script", "tokens": Array [ @@ -7479,8 +7479,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -7489,7 +7489,7 @@ Object { }, "range": Array [ 0, - 6, + 7, ], "sourceType": "script", "tokens": Array [ @@ -7613,8 +7613,8 @@ Object { ], "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -7623,7 +7623,7 @@ Object { }, "range": Array [ 0, - 16, + 17, ], "sourceType": "script", "tokens": Array [ @@ -7801,8 +7801,8 @@ Object { ], "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -7811,7 +7811,7 @@ Object { }, "range": Array [ 0, - 14, + 15, ], "sourceType": "script", "tokens": Array [ @@ -8083,8 +8083,8 @@ Object { ], "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -8093,7 +8093,7 @@ Object { }, "range": Array [ 0, - 47, + 48, ], "sourceType": "script", "tokens": Array [ @@ -10510,8 +10510,8 @@ Object { ], "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -10520,7 +10520,7 @@ Object { }, "range": Array [ 0, - 25, + 26, ], "sourceType": "script", "tokens": Array [ @@ -11263,8 +11263,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -11273,7 +11273,7 @@ Object { }, "range": Array [ 0, - 44, + 45, ], "sourceType": "script", "tokens": Array [ @@ -18113,8 +18113,8 @@ Object { ], "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -18123,7 +18123,7 @@ Object { }, "range": Array [ 0, - 33, + 34, ], "sourceType": "script", "tokens": Array [ @@ -18507,8 +18507,8 @@ Object { ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -18517,7 +18517,7 @@ Object { }, "range": Array [ 0, - 27, + 28, ], "sourceType": "script", "tokens": Array [ @@ -20807,8 +20807,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -20817,7 +20817,7 @@ Object { }, "range": Array [ 0, - 46, + 47, ], "sourceType": "script", "tokens": Array [ @@ -21241,8 +21241,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -21251,7 +21251,7 @@ Object { }, "range": Array [ 0, - 38, + 39, ], "sourceType": "script", "tokens": Array [ @@ -24253,8 +24253,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -24263,7 +24263,7 @@ Object { }, "range": Array [ 0, - 47, + 48, ], "sourceType": "script", "tokens": Array [ @@ -24796,8 +24796,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -24806,7 +24806,7 @@ Object { }, "range": Array [ 0, - 51, + 52, ], "sourceType": "script", "tokens": Array [ @@ -25489,8 +25489,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -25499,7 +25499,7 @@ Object { }, "range": Array [ 0, - 51, + 52, ], "sourceType": "script", "tokens": Array [ @@ -26110,8 +26110,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -26120,7 +26120,7 @@ Object { }, "range": Array [ 0, - 47, + 48, ], "sourceType": "script", "tokens": Array [ @@ -26581,8 +26581,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -26591,7 +26591,7 @@ Object { }, "range": Array [ 0, - 39, + 40, ], "sourceType": "script", "tokens": Array [ @@ -27124,8 +27124,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -27134,7 +27134,7 @@ Object { }, "range": Array [ 0, - 43, + 44, ], "sourceType": "script", "tokens": Array [ @@ -27817,8 +27817,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -27827,7 +27827,7 @@ Object { }, "range": Array [ 0, - 43, + 44, ], "sourceType": "script", "tokens": Array [ @@ -28438,8 +28438,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -28448,7 +28448,7 @@ Object { }, "range": Array [ 0, - 39, + 40, ], "sourceType": "script", "tokens": Array [ @@ -43774,8 +43774,8 @@ Object { ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -43784,7 +43784,7 @@ Object { }, "range": Array [ 0, - 23, + 24, ], "sourceType": "script", "tokens": Array [ @@ -53435,8 +53435,8 @@ Object { ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -53445,7 +53445,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -54283,8 +54283,8 @@ Object { ], "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -54293,7 +54293,7 @@ Object { }, "range": Array [ 0, - 19, + 20, ], "sourceType": "script", "tokens": Array [ @@ -57254,8 +57254,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -57264,7 +57264,7 @@ Object { }, "range": Array [ 0, - 26, + 27, ], "sourceType": "script", "tokens": Array [ @@ -57591,8 +57591,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -57601,7 +57601,7 @@ Object { }, "range": Array [ 0, - 69, + 70, ], "sourceType": "script", "tokens": Array [ @@ -58067,8 +58067,8 @@ Object { ], "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -58077,7 +58077,7 @@ Object { }, "range": Array [ 0, - 25, + 26, ], "sourceType": "script", "tokens": Array [ @@ -58443,8 +58443,8 @@ Object { ], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -58453,7 +58453,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "script", "tokens": Array [ @@ -58941,8 +58941,8 @@ Object { ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -58951,7 +58951,7 @@ Object { }, "range": Array [ 0, - 23, + 24, ], "sourceType": "script", "tokens": Array [ @@ -59350,8 +59350,8 @@ Object { ], "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -59360,7 +59360,7 @@ Object { }, "range": Array [ 0, - 26, + 27, ], "sourceType": "script", "tokens": Array [ @@ -60013,8 +60013,8 @@ Object { ], "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -60023,7 +60023,7 @@ Object { }, "range": Array [ 0, - 48, + 49, ], "sourceType": "script", "tokens": Array [ @@ -60929,8 +60929,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -60939,7 +60939,7 @@ Object { }, "range": Array [ 0, - 83, + 84, ], "sourceType": "script", "tokens": Array [ @@ -61690,8 +61690,8 @@ Object { ], "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -61700,7 +61700,7 @@ Object { }, "range": Array [ 0, - 108, + 109, ], "sourceType": "script", "tokens": Array [ @@ -63081,8 +63081,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -63091,7 +63091,7 @@ Object { }, "range": Array [ 0, - 69, + 70, ], "sourceType": "script", "tokens": Array [ @@ -63799,8 +63799,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -63809,7 +63809,7 @@ Object { }, "range": Array [ 0, - 79, + 80, ], "sourceType": "script", "tokens": Array [ @@ -64423,8 +64423,8 @@ Object { ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -64433,7 +64433,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -64975,8 +64975,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -64985,7 +64985,7 @@ Object { }, "range": Array [ 0, - 77, + 78, ], "sourceType": "script", "tokens": Array [ @@ -65579,8 +65579,8 @@ Object { ], "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -65589,7 +65589,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "script", "tokens": Array [ @@ -66077,8 +66077,8 @@ Object { ], "loc": Object { "end": Object { - "column": 64, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -66087,7 +66087,7 @@ Object { }, "range": Array [ 0, - 64, + 65, ], "sourceType": "script", "tokens": Array [ @@ -66679,8 +66679,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -66689,7 +66689,7 @@ Object { }, "range": Array [ 0, - 41, + 42, ], "sourceType": "script", "tokens": Array [ @@ -67082,8 +67082,8 @@ Object { ], "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -67092,7 +67092,7 @@ Object { }, "range": Array [ 0, - 37, + 38, ], "sourceType": "script", "tokens": Array [ @@ -67696,8 +67696,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -67706,7 +67706,7 @@ Object { }, "range": Array [ 1, - 27, + 28, ], "sourceType": "script", "tokens": Array [ @@ -68112,8 +68112,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -68122,7 +68122,7 @@ Object { }, "range": Array [ 0, - 65, + 66, ], "sourceType": "script", "tokens": Array [ @@ -69908,8 +69908,8 @@ Object { ], "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -69918,7 +69918,7 @@ Object { }, "range": Array [ 0, - 26, + 27, ], "sourceType": "script", "tokens": Array [ @@ -70262,8 +70262,8 @@ Object { ], "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -70272,7 +70272,7 @@ Object { }, "range": Array [ 0, - 30, + 31, ], "sourceType": "script", "tokens": Array [ @@ -70633,8 +70633,8 @@ Object { ], "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -70643,7 +70643,7 @@ Object { }, "range": Array [ 0, - 25, + 26, ], "sourceType": "script", "tokens": Array [ @@ -70873,8 +70873,8 @@ Object { ], "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -70883,7 +70883,7 @@ Object { }, "range": Array [ 0, - 18, + 19, ], "sourceType": "module", "tokens": Array [ @@ -71044,8 +71044,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -71054,7 +71054,7 @@ Object { }, "range": Array [ 0, - 25, + 26, ], "sourceType": "module", "tokens": Array [ @@ -71232,8 +71232,8 @@ Object { ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -71242,7 +71242,7 @@ Object { }, "range": Array [ 0, - 23, + 24, ], "sourceType": "module", "tokens": Array [ @@ -71458,8 +71458,8 @@ Object { ], "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -71468,7 +71468,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "module", "tokens": Array [ @@ -71682,8 +71682,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -71692,7 +71692,7 @@ Object { }, "range": Array [ 0, - 30, + 31, ], "sourceType": "module", "tokens": Array [ @@ -71889,8 +71889,8 @@ Object { ], "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -71899,7 +71899,7 @@ Object { }, "range": Array [ 0, - 32, + 33, ], "sourceType": "module", "tokens": Array [ @@ -72094,8 +72094,8 @@ Object { ], "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -72104,7 +72104,7 @@ Object { }, "range": Array [ 0, - 18, + 19, ], "sourceType": "module", "tokens": Array [ @@ -72285,8 +72285,8 @@ Object { ], "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -72295,7 +72295,7 @@ Object { }, "range": Array [ 0, - 26, + 27, ], "sourceType": "module", "tokens": Array [ @@ -72489,8 +72489,8 @@ Object { ], "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -72499,7 +72499,7 @@ Object { }, "range": Array [ 0, - 19, + 20, ], "sourceType": "module", "tokens": Array [ @@ -72622,8 +72622,8 @@ Object { ], "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -72632,7 +72632,7 @@ Object { }, "range": Array [ 0, - 20, + 21, ], "sourceType": "module", "tokens": Array [ @@ -72829,8 +72829,8 @@ Object { ], "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -72839,7 +72839,7 @@ Object { }, "range": Array [ 0, - 28, + 29, ], "sourceType": "module", "tokens": Array [ @@ -73072,8 +73072,8 @@ Object { ], "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -73082,7 +73082,7 @@ Object { }, "range": Array [ 0, - 35, + 36, ], "sourceType": "module", "tokens": Array [ @@ -73351,8 +73351,8 @@ Object { ], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -73361,7 +73361,7 @@ Object { }, "range": Array [ 0, - 31, + 32, ], "sourceType": "module", "tokens": Array [ @@ -73683,8 +73683,8 @@ Object { ], "loc": Object { "end": Object { - "column": 40, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -73693,7 +73693,7 @@ Object { }, "range": Array [ 0, - 40, + 41, ], "sourceType": "module", "tokens": Array [ @@ -73998,8 +73998,8 @@ Object { ], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -74008,7 +74008,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "module", "tokens": Array [ @@ -74294,8 +74294,8 @@ Object { ], "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -74304,7 +74304,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "module", "tokens": Array [ @@ -74557,8 +74557,8 @@ Object { ], "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -74567,7 +74567,7 @@ Object { }, "range": Array [ 0, - 25, + 26, ], "sourceType": "module", "tokens": Array [ @@ -74782,8 +74782,8 @@ Object { ], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -74792,7 +74792,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "module", "tokens": Array [ @@ -75007,8 +75007,8 @@ Object { ], "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -75017,7 +75017,7 @@ Object { }, "range": Array [ 0, - 20, + 21, ], "sourceType": "module", "tokens": Array [ @@ -75285,8 +75285,8 @@ Object { ], "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -75295,7 +75295,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "module", "tokens": Array [ @@ -75547,8 +75547,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -75557,7 +75557,7 @@ Object { }, "range": Array [ 0, - 22, + 23, ], "sourceType": "module", "tokens": Array [ @@ -75682,8 +75682,8 @@ Object { ], "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -75692,7 +75692,7 @@ Object { }, "range": Array [ 0, - 10, + 11, ], "sourceType": "module", "tokens": Array [ @@ -75853,8 +75853,8 @@ Object { ], "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -75863,7 +75863,7 @@ Object { }, "range": Array [ 0, - 13, + 14, ], "sourceType": "module", "tokens": Array [ @@ -76095,8 +76095,8 @@ Object { ], "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -76105,7 +76105,7 @@ Object { }, "range": Array [ 0, - 18, + 19, ], "sourceType": "module", "tokens": Array [ @@ -76373,8 +76373,8 @@ Object { ], "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -76383,7 +76383,7 @@ Object { }, "range": Array [ 0, - 19, + 20, ], "sourceType": "module", "tokens": Array [ @@ -76617,8 +76617,8 @@ Object { ], "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -76627,7 +76627,7 @@ Object { }, "range": Array [ 0, - 15, + 16, ], "sourceType": "module", "tokens": Array [ @@ -76828,8 +76828,8 @@ Object { ], "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -76838,7 +76838,7 @@ Object { }, "range": Array [ 0, - 32, + 33, ], "sourceType": "module", "tokens": Array [ @@ -77126,8 +77126,8 @@ Object { ], "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -77136,7 +77136,7 @@ Object { }, "range": Array [ 0, - 19, + 20, ], "sourceType": "module", "tokens": Array [ @@ -77332,8 +77332,8 @@ Object { ], "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -77342,7 +77342,7 @@ Object { }, "range": Array [ 0, - 22, + 23, ], "sourceType": "module", "tokens": Array [ @@ -77573,8 +77573,8 @@ Object { ], "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -77583,7 +77583,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "module", "tokens": Array [ @@ -77868,8 +77868,8 @@ Object { ], "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -77878,7 +77878,7 @@ Object { }, "range": Array [ 0, - 32, + 33, ], "sourceType": "module", "tokens": Array [ @@ -78146,8 +78146,8 @@ Object { ], "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -78156,7 +78156,7 @@ Object { }, "range": Array [ 0, - 35, + 36, ], "sourceType": "module", "tokens": Array [ @@ -78406,8 +78406,8 @@ Object { ], "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -78416,7 +78416,7 @@ Object { }, "range": Array [ 0, - 22, + 23, ], "sourceType": "module", "tokens": Array [ @@ -78540,8 +78540,8 @@ Object { ], "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -78550,7 +78550,7 @@ Object { }, "range": Array [ 0, - 13, + 14, ], "sourceType": "module", "tokens": Array [ @@ -78710,8 +78710,8 @@ Object { ], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -78720,7 +78720,7 @@ Object { }, "range": Array [ 0, - 31, + 32, ], "sourceType": "module", "tokens": Array [ @@ -79041,8 +79041,8 @@ Object { ], "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -79051,7 +79051,7 @@ Object { }, "range": Array [ 0, - 36, + 37, ], "sourceType": "module", "tokens": Array [ @@ -79301,8 +79301,8 @@ Object { ], "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -79311,7 +79311,7 @@ Object { }, "range": Array [ 0, - 21, + 22, ], "sourceType": "module", "tokens": Array [ @@ -79525,8 +79525,8 @@ Object { ], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -79535,7 +79535,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "module", "tokens": Array [ @@ -79820,8 +79820,8 @@ Object { ], "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -79830,7 +79830,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "module", "tokens": Array [ @@ -80151,8 +80151,8 @@ Object { ], "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -80161,7 +80161,7 @@ Object { }, "range": Array [ 0, - 30, + 31, ], "sourceType": "module", "tokens": Array [ @@ -80429,8 +80429,8 @@ Object { ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -80439,7 +80439,7 @@ Object { }, "range": Array [ 0, - 27, + 28, ], "sourceType": "module", "tokens": Array [ @@ -80671,8 +80671,8 @@ Object { ], "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -80681,7 +80681,7 @@ Object { }, "range": Array [ 0, - 33, + 34, ], "sourceType": "module", "tokens": Array [ @@ -81006,8 +81006,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -81016,7 +81016,7 @@ Object { }, "range": Array [ 0, - 40, + 41, ], "sourceType": "script", "tokens": Array [ @@ -81434,8 +81434,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -81444,7 +81444,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "script", "tokens": Array [ @@ -82906,8 +82906,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -82916,7 +82916,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "script", "tokens": Array [ @@ -83260,8 +83260,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -83270,7 +83270,7 @@ Object { }, "range": Array [ 0, - 27, + 28, ], "sourceType": "script", "tokens": Array [ @@ -83577,8 +83577,8 @@ Object { ], "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -83587,7 +83587,7 @@ Object { }, "range": Array [ 0, - 12, + 13, ], "sourceType": "script", "tokens": Array [ @@ -83914,8 +83914,8 @@ Object { ], "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -83924,7 +83924,7 @@ Object { }, "range": Array [ 0, - 20, + 21, ], "sourceType": "script", "tokens": Array [ @@ -84270,8 +84270,8 @@ Object { ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -84280,7 +84280,7 @@ Object { }, "range": Array [ 0, - 23, + 24, ], "sourceType": "script", "tokens": Array [ @@ -85780,8 +85780,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -85790,7 +85790,7 @@ Object { }, "range": Array [ 0, - 50, + 51, ], "sourceType": "script", "tokens": Array [ @@ -88240,8 +88240,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -88250,7 +88250,7 @@ Object { }, "range": Array [ 0, - 52, + 53, ], "sourceType": "script", "tokens": Array [ @@ -88890,8 +88890,8 @@ Object { ], "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -88900,7 +88900,7 @@ Object { }, "range": Array [ 0, - 66, + 67, ], "sourceType": "script", "tokens": Array [ @@ -89277,8 +89277,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -89287,7 +89287,7 @@ Object { }, "range": Array [ 0, - 6, + 7, ], "sourceType": "script", "tokens": Array [ @@ -89410,8 +89410,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -89420,7 +89420,7 @@ Object { }, "range": Array [ 0, - 20, + 21, ], "sourceType": "script", "tokens": Array [ @@ -89543,8 +89543,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -89553,7 +89553,7 @@ Object { }, "range": Array [ 0, - 6, + 7, ], "sourceType": "script", "tokens": Array [ @@ -89682,8 +89682,8 @@ Object { ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -89692,7 +89692,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -90325,8 +90325,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -90335,7 +90335,7 @@ Object { }, "range": Array [ 0, - 43, + 44, ], "sourceType": "script", "tokens": Array [ @@ -90722,8 +90722,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -90732,7 +90732,7 @@ Object { }, "range": Array [ 0, - 35, + 36, ], "sourceType": "script", "tokens": Array [ @@ -93038,8 +93038,8 @@ Object { ], "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -93048,7 +93048,7 @@ Object { }, "range": Array [ 0, - 45, + 46, ], "sourceType": "script", "tokens": Array [ @@ -94692,8 +94692,8 @@ Object { ], "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -94702,7 +94702,7 @@ Object { }, "range": Array [ 0, - 9, + 10, ], "sourceType": "script", "tokens": Array [ diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap index b2ed1b9e7c1a..663ef27155fd 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -1038,8 +1038,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -1048,7 +1048,7 @@ Object { }, "range": Array [ 0, - 59, + 60, ], "sourceType": "script", "tokens": Array [ @@ -5070,8 +5070,8 @@ Object { ], "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -5080,7 +5080,7 @@ Object { }, "range": Array [ 0, - 11, + 12, ], "sourceType": "script", "tokens": Array [ @@ -5544,8 +5544,8 @@ Object { ], "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -5554,7 +5554,7 @@ Object { }, "range": Array [ 0, - 45, + 46, ], "sourceType": "script", "tokens": Array [ @@ -6567,8 +6567,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -6577,7 +6577,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "script", "tokens": Array [ @@ -9925,8 +9925,8 @@ Object { ], "loc": Object { "end": Object { - "column": 6, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -9935,7 +9935,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "script", "tokens": Array [ diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index ac75332e44bb..625b31a8dc91 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -1471,8 +1471,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -1481,7 +1481,7 @@ Object { }, "range": Array [ 0, - 62, + 63, ], "sourceType": "script", "tokens": Array [ @@ -1847,8 +1847,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -1857,7 +1857,7 @@ Object { }, "range": Array [ 0, - 65, + 66, ], "sourceType": "script", "tokens": Array [ @@ -4034,8 +4034,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -4044,7 +4044,7 @@ Object { }, "range": Array [ 0, - 96, + 97, ], "sourceType": "script", "tokens": Array [ @@ -5054,8 +5054,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 10, + "column": 0, + "line": 11, }, "start": Object { "column": 0, @@ -5064,7 +5064,7 @@ Object { }, "range": Array [ 0, - 173, + 174, ], "sourceType": "script", "tokens": Array [ @@ -6028,8 +6028,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 7, }, "start": Object { "column": 0, @@ -6038,7 +6038,7 @@ Object { }, "range": Array [ 0, - 56, + 58, ], "sourceType": "script", "tokens": Array [ @@ -6453,8 +6453,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -6463,7 +6463,7 @@ Object { }, "range": Array [ 0, - 32, + 33, ], "sourceType": "script", "tokens": Array [ @@ -6930,8 +6930,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -6940,7 +6940,7 @@ Object { }, "range": Array [ 0, - 45, + 46, ], "sourceType": "script", "tokens": Array [ @@ -7418,8 +7418,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -7428,7 +7428,7 @@ Object { }, "range": Array [ 0, - 30, + 31, ], "sourceType": "script", "tokens": Array [ @@ -7869,8 +7869,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -7879,7 +7879,7 @@ Object { }, "range": Array [ 0, - 36, + 37, ], "sourceType": "script", "tokens": Array [ @@ -8238,8 +8238,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -8248,7 +8248,7 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "script", "tokens": Array [ @@ -8518,8 +8518,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -8528,7 +8528,7 @@ Object { }, "range": Array [ 0, - 32, + 33, ], "sourceType": "script", "tokens": Array [ @@ -8888,8 +8888,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -8898,7 +8898,7 @@ Object { }, "range": Array [ 0, - 35, + 36, ], "sourceType": "script", "tokens": Array [ @@ -10002,8 +10002,8 @@ Object { ], "loc": Object { "end": Object { - "column": 48, - "line": 9, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -10012,7 +10012,7 @@ Object { }, "range": Array [ 0, - 206, + 207, ], "sourceType": "script", "tokens": Array [ @@ -11297,8 +11297,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -11307,7 +11307,7 @@ Object { }, "range": Array [ 0, - 45, + 46, ], "sourceType": "script", "tokens": Array [ @@ -11855,8 +11855,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -11865,7 +11865,7 @@ Object { }, "range": Array [ 0, - 67, + 68, ], "sourceType": "script", "tokens": Array [ @@ -12564,8 +12564,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -12574,7 +12574,7 @@ Object { }, "range": Array [ 0, - 63, + 64, ], "sourceType": "script", "tokens": Array [ @@ -13030,8 +13030,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -13040,7 +13040,7 @@ Object { }, "range": Array [ 0, - 39, + 41, ], "sourceType": "script", "tokens": Array [ @@ -17484,8 +17484,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -17494,7 +17494,7 @@ Object { }, "range": Array [ 0, - 49, + 50, ], "sourceType": "script", "tokens": Array [ @@ -17900,8 +17900,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -17910,7 +17910,7 @@ Object { }, "range": Array [ 0, - 56, + 59, ], "sourceType": "script", "tokens": Array [ @@ -18253,8 +18253,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -18263,7 +18263,7 @@ Object { }, "range": Array [ 0, - 17, + 18, ], "sourceType": "script", "tokens": Array [ @@ -18533,8 +18533,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -18543,7 +18543,7 @@ Object { }, "range": Array [ 0, - 23, + 24, ], "sourceType": "script", "tokens": Array [ @@ -18814,8 +18814,8 @@ Object { ], "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -18824,7 +18824,7 @@ Object { }, "range": Array [ 0, - 15, + 16, ], "sourceType": "script", "tokens": Array [ @@ -20133,8 +20133,8 @@ Object { ], "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -20143,7 +20143,7 @@ Object { }, "range": Array [ 0, - 13, + 14, ], "sourceType": "module", "tokens": Array [ @@ -20324,8 +20324,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -20334,7 +20334,7 @@ Object { }, "range": Array [ 0, - 28, + 29, ], "sourceType": "module", "tokens": Array [ @@ -20606,8 +20606,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -20616,7 +20616,7 @@ Object { }, "range": Array [ 0, - 31, + 32, ], "sourceType": "module", "tokens": Array [ @@ -20924,8 +20924,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -20934,7 +20934,7 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "module", "tokens": Array [ @@ -21225,8 +21225,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -21235,7 +21235,7 @@ Object { }, "range": Array [ 0, - 27, + 28, ], "sourceType": "module", "tokens": Array [ @@ -22650,8 +22650,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -22660,7 +22660,7 @@ Object { }, "range": Array [ 0, - 49, + 50, ], "sourceType": "script", "tokens": Array [ @@ -23219,8 +23219,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -23229,7 +23229,7 @@ Object { }, "range": Array [ 0, - 51, + 52, ], "sourceType": "script", "tokens": Array [ @@ -23968,8 +23968,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -23978,7 +23978,7 @@ Object { }, "range": Array [ 0, - 49, + 50, ], "sourceType": "script", "tokens": Array [ @@ -24589,8 +24589,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -24599,7 +24599,7 @@ Object { }, "range": Array [ 0, - 40, + 41, ], "sourceType": "script", "tokens": Array [ @@ -25473,8 +25473,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -25483,7 +25483,7 @@ Object { }, "range": Array [ 0, - 51, + 52, ], "sourceType": "script", "tokens": Array [ @@ -26038,8 +26038,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -26048,7 +26048,7 @@ Object { }, "range": Array [ 0, - 57, + 58, ], "sourceType": "script", "tokens": Array [ @@ -26724,8 +26724,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -26734,7 +26734,7 @@ Object { }, "range": Array [ 0, - 96, + 97, ], "sourceType": "script", "tokens": Array [ @@ -27344,8 +27344,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -27354,7 +27354,7 @@ Object { }, "range": Array [ 0, - 30, + 31, ], "sourceType": "script", "tokens": Array [ @@ -27603,8 +27603,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -27613,7 +27613,7 @@ Object { }, "range": Array [ 0, - 34, + 35, ], "sourceType": "script", "tokens": Array [ @@ -27865,8 +27865,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -27875,7 +27875,7 @@ Object { }, "range": Array [ 0, - 21, + 22, ], "sourceType": "script", "tokens": Array [ @@ -29316,8 +29316,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 14, + "column": 0, + "line": 16, }, "start": Object { "column": 0, @@ -29326,7 +29326,7 @@ Object { }, "range": Array [ 0, - 295, + 297, ], "sourceType": "script", "tokens": Array [ @@ -31511,8 +31511,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -31521,7 +31521,7 @@ Object { }, "range": Array [ 0, - 49, + 50, ], "sourceType": "script", "tokens": Array [ @@ -31954,8 +31954,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -31964,7 +31964,7 @@ Object { }, "range": Array [ 0, - 36, + 37, ], "sourceType": "script", "tokens": Array [ @@ -32288,8 +32288,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -32298,7 +32298,7 @@ Object { }, "range": Array [ 0, - 21, + 22, ], "sourceType": "script", "tokens": Array [ @@ -32557,8 +32557,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -32567,7 +32567,7 @@ Object { }, "range": Array [ 0, - 87, + 88, ], "sourceType": "script", "tokens": Array [ @@ -33053,8 +33053,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -33063,7 +33063,7 @@ Object { }, "range": Array [ 0, - 81, + 82, ], "sourceType": "script", "tokens": Array [ @@ -33645,8 +33645,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -33655,7 +33655,7 @@ Object { }, "range": Array [ 0, - 27, + 28, ], "sourceType": "script", "tokens": Array [ @@ -35883,8 +35883,8 @@ Object { ], "loc": Object { "end": Object { - "column": 23, - "line": 7, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -35893,7 +35893,7 @@ Object { }, "range": Array [ 0, - 81, + 82, ], "sourceType": "script", "tokens": Array [ @@ -37758,8 +37758,8 @@ Object { ], "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -37768,7 +37768,7 @@ Object { }, "range": Array [ 0, - 30, + 31, ], "sourceType": "script", "tokens": Array [ @@ -38951,8 +38951,8 @@ Object { ], "loc": Object { "end": Object { - "column": 49, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -38961,7 +38961,7 @@ Object { }, "range": Array [ 0, - 137, + 138, ], "sourceType": "script", "tokens": Array [ @@ -39806,8 +39806,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -39816,7 +39816,7 @@ Object { }, "range": Array [ 0, - 89, + 90, ], "sourceType": "script", "tokens": Array [ @@ -40423,8 +40423,8 @@ Object { ], "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -40433,7 +40433,7 @@ Object { }, "range": Array [ 0, - 15, + 16, ], "sourceType": "script", "tokens": Array [ @@ -40826,8 +40826,8 @@ Object { ], "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -40836,7 +40836,7 @@ Object { }, "range": Array [ 0, - 54, + 55, ], "sourceType": "script", "tokens": Array [ @@ -44951,8 +44951,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -44961,7 +44961,7 @@ Object { }, "range": Array [ 0, - 56, + 57, ], "sourceType": "script", "tokens": Array [ @@ -45439,8 +45439,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -45449,7 +45449,7 @@ Object { }, "range": Array [ 0, - 56, + 57, ], "sourceType": "script", "tokens": Array [ @@ -45907,8 +45907,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -45917,7 +45917,7 @@ Object { }, "range": Array [ 0, - 49, + 50, ], "sourceType": "script", "tokens": Array [ @@ -46303,8 +46303,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -46313,7 +46313,7 @@ Object { }, "range": Array [ 0, - 49, + 50, ], "sourceType": "script", "tokens": Array [ @@ -46968,8 +46968,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -46978,7 +46978,7 @@ Object { }, "range": Array [ 0, - 115, + 116, ], "sourceType": "script", "tokens": Array [ @@ -47708,8 +47708,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -47718,7 +47718,7 @@ Object { }, "range": Array [ 0, - 52, + 53, ], "sourceType": "script", "tokens": Array [ @@ -48304,8 +48304,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -48314,7 +48314,7 @@ Object { }, "range": Array [ 0, - 65, + 66, ], "sourceType": "script", "tokens": Array [ @@ -48990,8 +48990,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -49000,7 +49000,7 @@ Object { }, "range": Array [ 0, - 97, + 98, ], "sourceType": "script", "tokens": Array [ @@ -49730,8 +49730,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -49740,7 +49740,7 @@ Object { }, "range": Array [ 0, - 110, + 111, ], "sourceType": "script", "tokens": Array [ @@ -52179,8 +52179,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -52189,7 +52189,7 @@ Object { }, "range": Array [ 0, - 53, + 54, ], "sourceType": "script", "tokens": Array [ @@ -52512,8 +52512,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -52522,7 +52522,7 @@ Object { }, "range": Array [ 0, - 22, + 23, ], "sourceType": "script", "tokens": Array [ @@ -52683,8 +52683,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -52693,7 +52693,7 @@ Object { }, "range": Array [ 0, - 37, + 38, ], "sourceType": "script", "tokens": Array [ @@ -52907,8 +52907,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -52917,7 +52917,7 @@ Object { }, "range": Array [ 0, - 37, + 38, ], "sourceType": "script", "tokens": Array [ @@ -53319,8 +53319,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -53329,7 +53329,7 @@ Object { }, "range": Array [ 0, - 26, + 27, ], "sourceType": "script", "tokens": Array [ @@ -55456,8 +55456,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 23, + "column": 0, + "line": 25, }, "start": Object { "column": 0, @@ -55466,7 +55466,7 @@ Object { }, "range": Array [ 0, - 594, + 596, ], "sourceType": "script", "tokens": Array [ @@ -59261,8 +59261,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -59271,7 +59271,7 @@ Object { }, "range": Array [ 0, - 56, + 57, ], "sourceType": "script", "tokens": Array [ @@ -60459,8 +60459,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 6, + "column": 0, + "line": 8, }, "start": Object { "column": 0, @@ -60469,7 +60469,7 @@ Object { }, "range": Array [ 0, - 112, + 114, ], "sourceType": "script", "tokens": Array [ @@ -61007,8 +61007,8 @@ Object { ], "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -61017,7 +61017,7 @@ Object { }, "range": Array [ 0, - 32, + 33, ], "sourceType": "script", "tokens": Array [ From ac299d09af40c1bc2128bd1a64e860aa650900bb Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 16 Aug 2017 15:25:50 +0100 Subject: [PATCH 190/326] Fix: Exp. operator assignment is AssignmentExpression (fixes #355) (#356) --- packages/typescript-eslint-parser/lib/convert.js | 7 +++++++ .../tests/lib/__snapshots__/ecma-features.js.snap | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 892b6f0c0bd0..a40e6e6b4748 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1461,6 +1461,13 @@ module.exports = function convert(config) { result.expressions.push(right); } + } else if (node.operatorToken && node.operatorToken.kind === SyntaxKind.AsteriskAsteriskEqualsToken) { + Object.assign(result, { + type: AST_NODE_TYPES.AssignmentExpression, + operator: nodeUtils.getTextForTokenKind(node.operatorToken.kind), + left: convertChild(node.left), + right: convertChild(node.right) + }); } else { Object.assign(result, { type: nodeUtils.getBinaryExpressionType(node.operatorToken), diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 883912e05af5..2fceee6ffb48 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -65558,7 +65558,7 @@ Object { "type": "Literal", "value": 4, }, - "type": "BinaryExpression", + "type": "AssignmentExpression", }, "loc": Object { "end": Object { From 53396fd65d5128c411922179675909cc917679b9 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 16 Aug 2017 15:26:06 +0100 Subject: [PATCH 191/326] Fix: Location data for methods and constructors (#357) --- .../typescript-eslint-parser/lib/convert.js | 26 ++++++++++--------- .../lib/__snapshots__/ecma-features.js.snap | 4 +-- .../lib/__snapshots__/typescript.js.snap | 6 ++--- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index a40e6e6b4748..f1e1ab9840c5 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -744,8 +744,9 @@ module.exports = function convert(config) { case SyntaxKind.SetAccessor: case SyntaxKind.MethodDeclaration: { - // TODO: double-check that these positions are correct - const methodLoc = ast.getLineAndCharacterOfPosition(node.name.end + 1), + const openingParen = nodeUtils.findNextToken(node.name, ast); + + const methodLoc = ast.getLineAndCharacterOfPosition(openingParen.getStart()), nodeIsMethod = (node.kind === SyntaxKind.MethodDeclaration), method = { type: AST_NODE_TYPES.FunctionExpression, @@ -758,7 +759,7 @@ module.exports = function convert(config) { loc: { start: { line: methodLoc.line + 1, - column: methodLoc.character - 1 + column: methodLoc.character }, end: result.loc.end } @@ -865,7 +866,8 @@ module.exports = function convert(config) { } }; - const constructorIdentifierLoc = ast.getLineAndCharacterOfPosition(firstConstructorToken.getStart()), + const constructorIdentifierLocStart = ast.getLineAndCharacterOfPosition(firstConstructorToken.getStart()), + constructorIdentifierLocEnd = ast.getLineAndCharacterOfPosition(firstConstructorToken.getEnd()), constructorIsComputed = !!node.name && nodeUtils.isComputedProperty(node.name); let constructorKey; @@ -878,12 +880,12 @@ module.exports = function convert(config) { range: [firstConstructorToken.getStart(), firstConstructorToken.end], loc: { start: { - line: constructorIdentifierLoc.line + 1, - column: constructorIdentifierLoc.character + line: constructorIdentifierLocStart.line + 1, + column: constructorIdentifierLocStart.character }, end: { - line: constructor.loc.start.line, - column: constructor.loc.start.column + line: constructorIdentifierLocEnd.line + 1, + column: constructorIdentifierLocEnd.character } } }; @@ -894,12 +896,12 @@ module.exports = function convert(config) { range: [firstConstructorToken.getStart(), firstConstructorToken.end], loc: { start: { - line: constructorIdentifierLoc.line + 1, - column: constructorIdentifierLoc.character + line: constructorIdentifierLocStart.line + 1, + column: constructorIdentifierLocStart.character }, end: { - line: constructor.loc.start.line, - column: constructor.loc.start.column + line: constructorIdentifierLocEnd.line + 1, + column: constructorIdentifierLocEnd.character } } }; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 2fceee6ffb48..aa7e72b68a77 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -10441,7 +10441,7 @@ Object { "line": 1, }, "start": Object { - "column": 18, + "column": 19, "line": 1, }, }, @@ -18360,7 +18360,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 625b31a8dc91..ecf860075179 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -400,7 +400,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 2, }, "start": Object { @@ -4744,7 +4744,7 @@ Object { "line": 6, }, "start": Object { - "column": 15, + "column": 16, "line": 4, }, }, @@ -4931,7 +4931,7 @@ Object { "line": 9, }, "start": Object { - "column": 18, + "column": 19, "line": 7, }, }, From b11b8fd8829cf7fac890ae0dfc962c25e9f4ad7d Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 16 Aug 2017 15:27:21 +0100 Subject: [PATCH 192/326] Breaking: Only add .implements/.accessibility/.decorators if truthy (#354) --- .../typescript-eslint-parser/lib/convert.js | 107 +++++--- .../tests/lib/__snapshots__/basics.js.snap | 2 - .../tests/lib/__snapshots__/comments.js.snap | 4 - .../lib/__snapshots__/ecma-features.js.snap | 193 +-------------- .../lib/__snapshots__/typescript.js.snap | 228 ------------------ 5 files changed, 81 insertions(+), 453 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index f1e1ab9840c5..8c5ebd7d6c46 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -229,6 +229,26 @@ module.exports = function convert(config) { }); } + /** + * Converts an array of TSNode parameters into an array of ESTreeNode params + * @param {TSNode[]} parameters An array of TSNode params to be converted + * @returns {ESTreeNode[]} an array of converted ESTreeNode params + */ + function convertParameters(parameters) { + if (!parameters || !parameters.length) { + return []; + } + return parameters.map(param => { + const convertedParam = convertChild(param); + if (!param.decorators || !param.decorators.length) { + return convertedParam; + } + return Object.assign(convertedParam, { + decorators: convertDecorators(param.decorators) + }); + }); + } + /** * For nodes that are copied directly from the TypeScript AST into * ESTree mostly as-is. The only difference is the addition of a type @@ -470,7 +490,7 @@ module.exports = function convert(config) { case SyntaxKind.ForInStatement: case SyntaxKind.ForOfStatement: { - const isAwait = node.awaitModifier && node.awaitModifier.kind === SyntaxKind.AwaitKeyword; + const isAwait = !!(node.awaitModifier && node.awaitModifier.kind === SyntaxKind.AwaitKeyword); Object.assign(result, { type: SyntaxKind[node.kind], left: convertChild(node.initializer), @@ -507,7 +527,7 @@ module.exports = function convert(config) { generator: !!node.asteriskToken, expression: false, async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), - params: node.parameters.map(convertChild), + params: convertParameters(node.parameters), body: convertChild(node.body) }); @@ -724,12 +744,19 @@ module.exports = function convert(config) { value: convertChild(node.initializer), computed: nodeUtils.isComputedProperty(node.name), static: nodeUtils.hasStaticModifierFlag(node), - accessibility: nodeUtils.getTSNodeAccessibility(node), readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), - decorators: convertDecorators(node.decorators), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null }); + if (node.decorators) { + result.decorators = convertDecorators(node.decorators); + } + + const accessibility = nodeUtils.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + if (node.name.kind === SyntaxKind.Identifier && node.questionToken) { result.key.optional = true; } @@ -788,11 +815,7 @@ module.exports = function convert(config) { /** * Unlike in object literal methods, class method params can have decorators */ - method.params = node.parameters.map(param => { - const convertedParam = convertChild(param); - convertedParam.decorators = convertDecorators(param.decorators); - return convertedParam; - }); + method.params = convertParameters(node.parameters); /** * TypeScript class methods can be defined as "abstract" @@ -807,11 +830,18 @@ module.exports = function convert(config) { value: method, computed: nodeUtils.isComputedProperty(node.name), static: nodeUtils.hasStaticModifierFlag(node), - kind: "method", - accessibility: nodeUtils.getTSNodeAccessibility(node), - decorators: convertDecorators(node.decorators) + kind: "method" }); + if (node.decorators) { + result.decorators = convertDecorators(node.decorators); + } + + const accessibility = nodeUtils.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + } if (result.key.type === AST_NODE_TYPES.Identifier && node.questionToken) { @@ -845,13 +875,7 @@ module.exports = function convert(config) { constructor = { type: AST_NODE_TYPES.FunctionExpression, id: null, - params: node.parameters.map(param => { - const convertedParam = convertChild(param); - const decorators = convertDecorators(param.decorators); - return Object.assign(convertedParam, { - decorators - }); - }), + params: convertParameters(node.parameters), generator: false, expression: false, async: false, @@ -912,10 +936,15 @@ module.exports = function convert(config) { key: constructorKey, value: constructor, computed: constructorIsComputed, - accessibility: nodeUtils.getTSNodeAccessibility(node), static: constructorIsStatic, kind: (constructorIsStatic || constructorIsComputed) ? "method" : "constructor" }); + + const accessibility = nodeUtils.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + break; } @@ -925,7 +954,7 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.FunctionExpression, id: convertChild(node.name), generator: !!node.asteriskToken, - params: node.parameters.map(convertChild), + params: convertParameters(node.parameters), body: convertChild(node.body), async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), expression: false @@ -1024,7 +1053,7 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.ArrowFunctionExpression, generator: false, id: null, - params: node.parameters.map(convertChild), + params: convertParameters(node.parameters), body: convertChild(node.body), async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), expression: node.body.kind !== SyntaxKind.Block @@ -1273,11 +1302,17 @@ module.exports = function convert(config) { range: [openBrace.getStart(), result.range[1]], loc: nodeUtils.getLocFor(openBrace.getStart(), node.end, ast) }, - superClass: (superClass ? convertChild(superClass.types[0].expression) : null), - implements: hasImplements ? heritageClauses[0].types.map(convertClassImplements) : [], - decorators: convertDecorators(node.decorators) + superClass: (superClass ? convertChild(superClass.types[0].expression) : null) }); + if (hasImplements) { + result.implements = heritageClauses[0].types.map(convertClassImplements); + } + + if (node.decorators) { + result.decorators = convertDecorators(node.decorators); + } + const filteredMembers = node.members.filter(nodeUtils.isESTreeClassMember); if (filteredMembers.length) { @@ -1845,14 +1880,18 @@ module.exports = function convert(config) { optional: nodeUtils.isOptional(node), computed: nodeUtils.isComputedProperty(node.name), key: convertChild(node.name), - params: node.parameters.map(parameter => convertChild(parameter)), + params: convertParameters(node.parameters), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, - accessibility: nodeUtils.getTSNodeAccessibility(node), readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) }); + const accessibility = nodeUtils.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + if (node.typeParameters) { result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); } @@ -1868,12 +1907,16 @@ module.exports = function convert(config) { key: convertChild(node.name), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, initializer: convertChild(node.initializer), - accessibility: nodeUtils.getTSNodeAccessibility(node), readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) }); + const accessibility = nodeUtils.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + break; } @@ -1882,19 +1925,23 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.TSIndexSignature, index: convertChild(node.parameters[0]), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, - accessibility: nodeUtils.getTSNodeAccessibility(node), readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) }); + const accessibility = nodeUtils.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + break; } case SyntaxKind.ConstructSignature: { Object.assign(result, { type: AST_NODE_TYPES.TSConstructSignature, - params: node.parameters.map(parameter => convertChild(parameter)), + params: convertParameters(node.parameters), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null }); diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap index c4e3cd136659..68590ebf8bfe 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap @@ -1084,7 +1084,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -1103,7 +1102,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap index 4fece593373b..72ee0ac2ef3b 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap @@ -458,9 +458,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -554,9 +552,7 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": null, - "implements": Array [], "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index aa7e72b68a77..4129aae7d37d 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -8397,9 +8397,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -8477,9 +8475,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -8550,7 +8546,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -8593,7 +8588,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -8612,7 +8606,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 31, @@ -9018,9 +9011,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": true, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -9114,7 +9105,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -9133,7 +9123,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 25, @@ -9465,9 +9454,7 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": null, - "implements": Array [], "loc": Object { "end": Object { "column": 9, @@ -9638,9 +9625,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -9734,7 +9719,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -9753,7 +9737,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -9997,9 +9980,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -10093,7 +10074,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -10112,7 +10092,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 21, @@ -10374,9 +10353,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -10470,7 +10447,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -10489,7 +10465,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 25, @@ -10698,9 +10673,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -10794,7 +10767,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -10813,7 +10785,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -11057,9 +11028,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -11206,7 +11175,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -11225,7 +11193,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -11541,9 +11508,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -11637,7 +11602,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -11656,7 +11620,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -11936,9 +11899,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": true, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12033,7 +11994,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -12052,7 +12012,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 34, @@ -12350,9 +12309,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12446,7 +12403,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -12465,7 +12421,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 28, @@ -12745,9 +12700,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12825,9 +12778,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12905,9 +12856,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12978,7 +12927,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 53, @@ -13021,7 +12969,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -13040,7 +12987,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 58, @@ -13572,9 +13518,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": true, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -13652,9 +13596,7 @@ Object { }, }, Object { - "accessibility": null, "computed": true, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -13748,7 +13690,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -13767,7 +13708,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 38, @@ -14227,9 +14167,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -14307,9 +14245,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -14403,7 +14339,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -14422,7 +14357,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 20, @@ -14756,9 +14690,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -14837,9 +14769,7 @@ Object { }, }, Object { - "accessibility": null, "computed": true, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -14934,7 +14864,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -14953,7 +14882,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 47, @@ -15323,9 +15251,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -15403,9 +15329,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -15499,7 +15423,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -15518,7 +15441,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 21, @@ -15870,9 +15792,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -15950,9 +15870,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -16046,7 +15964,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -16065,7 +15982,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -16453,9 +16369,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -16533,9 +16447,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -16629,7 +16541,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -16648,7 +16559,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 22, @@ -17018,7 +16928,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -17097,7 +17006,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -17192,7 +17100,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -17211,7 +17118,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 55, @@ -17581,7 +17487,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -17676,7 +17581,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -17695,7 +17599,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 25, @@ -17939,7 +17842,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -18011,7 +17913,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -18030,7 +17931,6 @@ Object { "type": "Identifier", }, Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -18073,7 +17973,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -18092,7 +17991,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 33, @@ -18355,7 +18253,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -18450,7 +18347,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -18469,7 +18365,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 26, @@ -18749,7 +18644,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -18768,7 +18662,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 27, @@ -19063,9 +18956,7 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": null, - "implements": Array [], "loc": Object { "end": Object { "column": 18, @@ -19305,7 +19196,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -19324,7 +19214,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 10, @@ -19493,7 +19382,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -19512,7 +19400,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 10, @@ -19681,7 +19568,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -19700,7 +19586,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 11, @@ -19887,7 +19772,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -19906,7 +19790,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 20, @@ -20130,7 +20013,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -20149,7 +20031,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 11, @@ -20354,7 +20235,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -20373,7 +20253,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 20, @@ -20616,7 +20495,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -20688,7 +20566,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "left": Object { "loc": Object { "end": Object { @@ -20767,7 +20644,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -20786,7 +20662,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -21049,9 +20924,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -21122,7 +20995,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "left": Object { "loc": Object { "end": Object { @@ -21201,7 +21073,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -21220,7 +21091,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -24060,9 +23930,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -24133,7 +24001,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "elements": Array [ Object { "loc": Object { @@ -24213,7 +24080,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -24232,7 +24098,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -24531,9 +24396,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -24604,7 +24467,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "elements": Array [ Object { "left": Object { @@ -24756,7 +24618,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -24775,7 +24636,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -25146,9 +25006,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -25219,7 +25077,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -25449,7 +25306,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -25468,7 +25324,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -25839,9 +25694,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -25912,7 +25765,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -26070,7 +25922,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -26089,7 +25940,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -26388,9 +26238,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -26461,7 +26309,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "elements": Array [ Object { "loc": Object { @@ -26541,7 +26388,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -26560,7 +26406,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -26859,9 +26704,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -26932,7 +26775,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "elements": Array [ Object { "left": Object { @@ -27084,7 +26926,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -27103,7 +26944,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -27474,9 +27314,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -27547,7 +27385,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -27777,7 +27614,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -27796,7 +27632,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -28167,9 +28002,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -28240,7 +28073,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -28398,7 +28230,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -28417,7 +28248,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -53344,6 +53174,7 @@ exports[`ecmaFeatures fixtures/destructuring-and-forOf/loop.src 1`] = ` Object { "body": Array [ Object { + "await": false, "body": Object { "loc": Object { "end": Object { @@ -65800,6 +65631,7 @@ exports[`ecmaFeatures fixtures/forOf/for-of-with-function-initializer.src 1`] = Object { "body": Array [ Object { + "await": false, "body": Object { "expression": Object { "arguments": Array [ @@ -66514,6 +66346,7 @@ exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-braces.src 1`] = ` Object { "body": Array [ Object { + "await": false, "body": Object { "body": Array [ Object { @@ -66936,6 +66769,7 @@ exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-no-braces.src 1`] = ` Object { "body": Array [ Object { + "await": false, "body": Object { "expression": Object { "arguments": Array [], @@ -67866,9 +67700,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -68072,7 +67904,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -68091,7 +67922,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -71005,9 +70835,7 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": null, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -71626,7 +71454,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -71645,7 +71472,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -75489,7 +75315,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -75508,7 +75333,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -90153,7 +89977,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -90243,7 +90066,6 @@ Object { ], "type": "Identifier", }, - "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -90285,7 +90107,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -90304,7 +90125,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -90549,9 +90369,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -90640,7 +90458,6 @@ Object { ], "type": "Identifier", }, - "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -90682,7 +90499,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -90701,7 +90517,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index ecf860075179..7996a112de2c 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -395,7 +395,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -473,7 +472,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -492,7 +490,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -756,9 +753,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -941,7 +936,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -960,7 +954,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -1313,9 +1306,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -1355,9 +1346,7 @@ Object { "value": null, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -1431,7 +1420,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -1450,7 +1438,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -1733,7 +1720,6 @@ Object { Object { "accessibility": "public", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -1807,7 +1793,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -1826,7 +1811,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -2090,9 +2074,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -2276,7 +2258,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -2295,7 +2276,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -4458,7 +4438,6 @@ Object { Object { "accessibility": "private", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -4533,7 +4512,6 @@ Object { Object { "accessibility": "public", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -4608,7 +4586,6 @@ Object { Object { "accessibility": "public", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -4759,7 +4736,6 @@ Object { Object { "accessibility": "protected", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -4937,7 +4913,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -5014,7 +4989,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -5033,7 +5007,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -5818,7 +5791,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -5891,7 +5863,6 @@ Object { "params": Array [ Object { "accessibility": null, - "decorators": Array [], "export": true, "loc": Object { "end": Object { @@ -5988,7 +5959,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -6007,7 +5977,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -6303,7 +6272,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -6322,7 +6290,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -6710,7 +6677,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -6729,7 +6695,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -7244,9 +7209,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -7378,7 +7341,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -7397,7 +7359,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -7660,9 +7621,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -7829,7 +7788,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -7848,7 +7806,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -8162,7 +8119,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -8387,7 +8343,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -8721,7 +8676,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -9132,9 +9086,7 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": null, - "implements": Array [], "loc": Object { "end": Object { "column": 33, @@ -9456,7 +9408,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -9656,7 +9607,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -9675,7 +9625,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 11, @@ -11182,7 +11131,6 @@ Object { Object { "accessibility": "private", "computed": true, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -11257,7 +11205,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -11276,7 +11223,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -11539,9 +11485,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -11603,9 +11547,7 @@ Object { }, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -11703,7 +11645,6 @@ Object { Object { "accessibility": "private", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -11815,7 +11756,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -11834,7 +11774,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -12313,9 +12252,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12356,9 +12293,7 @@ Object { "value": null, }, Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12434,7 +12369,6 @@ Object { Object { "accessibility": "private", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12524,7 +12458,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -12543,7 +12476,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -12916,7 +12848,6 @@ Object { Object { "accessibility": "private", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -12990,7 +12921,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -13009,7 +12939,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -13236,7 +13165,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -13309,7 +13237,6 @@ Object { "params": Array [ Object { "accessibility": "private", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -13383,7 +13310,6 @@ Object { }, Object { "accessibility": "private", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -13457,7 +13383,6 @@ Object { }, Object { "accessibility": "private", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -13567,7 +13492,6 @@ Object { }, Object { "accessibility": "private", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -13700,7 +13624,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -13719,7 +13642,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -14378,7 +14300,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -14451,7 +14372,6 @@ Object { "params": Array [ Object { "accessibility": "protected", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -14525,7 +14445,6 @@ Object { }, Object { "accessibility": "protected", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -14599,7 +14518,6 @@ Object { }, Object { "accessibility": "protected", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -14709,7 +14627,6 @@ Object { }, Object { "accessibility": "protected", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -14842,7 +14759,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -14861,7 +14777,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -15520,7 +15435,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -15593,7 +15507,6 @@ Object { "params": Array [ Object { "accessibility": "public", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -15667,7 +15580,6 @@ Object { }, Object { "accessibility": "public", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -15741,7 +15653,6 @@ Object { }, Object { "accessibility": "public", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -15851,7 +15762,6 @@ Object { }, Object { "accessibility": "public", - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -15984,7 +15894,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -16003,7 +15912,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -16662,7 +16570,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -16735,7 +16642,6 @@ Object { "params": Array [ Object { "accessibility": null, - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -16809,7 +16715,6 @@ Object { }, Object { "accessibility": null, - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -16942,7 +16847,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -16961,7 +16865,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -17370,7 +17273,6 @@ Object { Object { "accessibility": "public", "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -17444,7 +17346,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -17463,7 +17364,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -17690,7 +17590,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -17763,7 +17662,6 @@ Object { "params": Array [ Object { "accessibility": null, - "decorators": Array [], "export": false, "loc": Object { "end": Object { @@ -17860,7 +17758,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -17879,7 +17776,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -18175,7 +18071,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -18194,7 +18089,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -18420,7 +18314,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -18439,7 +18332,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -18736,7 +18628,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -18755,7 +18646,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 15, @@ -18966,9 +18856,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -19080,7 +18968,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -19099,7 +18986,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -20247,9 +20133,7 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": null, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -20510,9 +20394,7 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": null, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -20828,7 +20710,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -20847,7 +20728,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -21110,7 +20990,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -21129,7 +21008,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -21758,7 +21636,6 @@ Object { }, "members": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -23082,7 +22959,6 @@ Object { }, "members": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -23158,7 +23034,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -23831,7 +23706,6 @@ Object { }, "members": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -23907,7 +23781,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -28018,7 +27891,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -28094,7 +27966,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -28170,7 +28041,6 @@ Object { }, }, Object { - "accessibility": null, "computed": true, "export": false, "initializer": null, @@ -28246,7 +28116,6 @@ Object { }, }, Object { - "accessibility": null, "computed": true, "export": false, "initializer": null, @@ -28322,7 +28191,6 @@ Object { }, }, Object { - "accessibility": null, "export": false, "index": Object { "loc": Object { @@ -28429,7 +28297,6 @@ Object { }, }, Object { - "accessibility": null, "export": false, "index": Object { "loc": Object { @@ -28537,7 +28404,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -28613,7 +28479,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -28744,7 +28609,6 @@ Object { }, }, Object { - "accessibility": null, "computed": true, "export": false, "key": Object { @@ -28875,7 +28739,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -32441,7 +32304,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -32746,7 +32608,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -32789,7 +32650,6 @@ Object { "typeAnnotation": null, }, Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -32865,7 +32725,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -33548,7 +33407,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -35766,9 +35624,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -35843,7 +35699,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -35862,7 +35717,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -37596,7 +37450,6 @@ Object { }, "members": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -37672,7 +37525,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -39464,7 +39316,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -41309,7 +41160,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -41550,7 +41400,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -41569,7 +41418,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -41976,7 +41824,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -42275,7 +42122,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -42294,7 +42140,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -42791,7 +42636,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -42994,7 +42838,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -43013,7 +42856,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -43366,7 +43208,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -43582,7 +43423,6 @@ Object { }, "params": Array [ Object { - "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -43625,7 +43465,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -43644,7 +43483,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -44121,7 +43959,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 12, @@ -44442,7 +44279,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 21, @@ -44741,7 +44577,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -44911,7 +44746,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -44930,7 +44764,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -45229,7 +45062,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -45399,7 +45231,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -45418,7 +45249,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -45735,7 +45565,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -45867,7 +45696,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -45886,7 +45714,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -46131,7 +45958,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -46263,7 +46089,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -46282,7 +46107,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -46545,7 +46369,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "key": Object { "loc": Object { @@ -46928,7 +46751,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -46947,7 +46769,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -47444,9 +47265,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -47668,7 +47487,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -47687,7 +47505,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -48040,9 +47857,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -48264,7 +48079,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -48283,7 +48097,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -48654,9 +48467,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -48950,7 +48761,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -48969,7 +48779,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -49394,9 +49203,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -49690,7 +49497,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -49709,7 +49515,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -50152,7 +49957,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -50248,7 +50052,6 @@ Object { "value": null, }, Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -50395,7 +50198,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -50414,7 +50216,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -50839,7 +50640,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -50955,7 +50755,6 @@ Object { "value": null, }, Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -51087,7 +50886,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -51106,7 +50904,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -51513,7 +51310,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -51591,7 +51387,6 @@ Object { "value": null, }, Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -51685,7 +51480,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -51704,7 +51498,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -51967,7 +51760,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -52045,7 +51837,6 @@ Object { "value": null, }, Object { - "accessibility": null, "computed": false, "decorators": Array [ Object { @@ -52139,7 +51930,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -52158,7 +51948,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -52472,7 +52261,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -52643,7 +52431,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -52850,7 +52637,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -53436,7 +53222,6 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, "export": false, "initializer": Object { @@ -53758,7 +53543,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -53834,7 +53618,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": true, "initializer": null, @@ -53910,7 +53693,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "initializer": null, @@ -54307,7 +54089,6 @@ Object { }, }, Object { - "accessibility": null, "export": false, "index": Object { "loc": Object { @@ -54414,7 +54195,6 @@ Object { }, }, Object { - "accessibility": null, "export": true, "index": Object { "loc": Object { @@ -54521,7 +54301,6 @@ Object { }, }, Object { - "accessibility": null, "export": false, "index": Object { "loc": Object { @@ -55015,7 +54794,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -55144,7 +54922,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": true, "key": Object { @@ -55273,7 +55050,6 @@ Object { }, }, Object { - "accessibility": null, "computed": false, "export": false, "key": Object { @@ -60129,9 +59905,7 @@ Object { "body": Object { "body": Array [ Object { - "accessibility": null, "computed": false, - "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -60277,7 +60051,6 @@ Object { ], "type": "ClassBody", }, - "decorators": Array [], "id": Object { "loc": Object { "end": Object { @@ -60296,7 +60069,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 5, From 681c2e997003ad3cab8ff0c717541a6f731f5f81 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 18 Aug 2017 13:45:03 +0100 Subject: [PATCH 193/326] Chore: Build out AST comparison tests and categorize issues (#358) --- .../tests/ast-alignment/known-issues.js | 88 ++ .../tests/ast-alignment/parse.js | 49 +- .../tests/ast-alignment/spec.js | 523 ++++++++++- .../tests/ast-alignment/utils.js | 12 +- .../basic-in-binary-expression.src.js | 3 - .../destructuring/named-param.src.js | 2 +- .../tests/jsx-known-issues.js | 11 + .../lib/__snapshots__/ecma-features.js.snap | 810 ++---------------- .../typescript-eslint-parser/tests/lib/jsx.js | 12 +- 9 files changed, 725 insertions(+), 785 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js create mode 100644 packages/typescript-eslint-parser/tests/jsx-known-issues.js diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js b/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js new file mode 100644 index 000000000000..e00cd9bcf7ac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js @@ -0,0 +1,88 @@ +/** + * ================================================== + * KNOWN/DIAGNOSED ISSUES + * ================================================== + */ + +// const fixturePatternsToTest = [ + /** + * "ExperimentalSpreadProperty" in espree/typescript-eslint-parser vs "SpreadElement" in Babylon + * comes up a lot in this section + */ + // "ecma-features/experimentalObjectRestSpread/**/*.src.js", // mixture of babylon parse errors and AST diffs + + /* ================================================== */ + + /** + * Template strings seem to also be affected by the difference in opinion between different parsers in: + * https://github.com/babel/babylon/issues/673 + */ + // "comments/no-comment-template.src.js", // Purely AST diffs + // "comments/template-string-block.src.js", // Purely AST diffs + // "ecma-features/templateStrings/**/*.src.js", // mixture of babylon parse errors and AST diffs + + /* ================================================== */ + + /** + * TypeScript, espree and acorn parse this fine - esprima, flow and babylon do not... + */ + // "ecma-features/forOf/for-of-with-function-initializer.src.js", // babylon parse errors + + /* ================================================== */ + + /** + * TypeScript, flow and babylon parse this fine - esprima, espree and acorn do not... + */ + // "ecma-features/modules/invalid-export-default.src.js",, // typescript-eslint-parser parse errors + + /* ================================================== */ + + /** + * Babylon parse error because of more strict spec enforcement than other parsers. + */ + + /** + * super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this. + */ + // "ecma-features/classes/class-one-method-super.src.js", // babylon parse errors + + /* ================================================== */ + + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + // "ecma-features/arrowFunctions/error-dup-params.src.js", // babylon parse errors + // "ecma-features/arrowFunctions/error-dup-params.src.js", // babylon parse errors + // "ecma-features/arrowFunctions/error-strict-dup-params.src.js", // babylon parse errors + // "ecma-features/arrowFunctions/error-strict-octal.src.js", // babylon parse errors + // "ecma-features/arrowFunctions/error-two-lines.src.js", // babylon parse errors + // "ecma-features/classes/invalid-class-declaration.src.js", // babylon parse errors + // "ecma-features/classes/invalid-class-setter-declaration.src.js", // babylon parse errors + // "ecma-features/destructuring/invalid-defaults-object-assign.src.js", // babylon parse errors + // "ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.src.js", // babylon parse errors + // "ecma-features/objectLiteralDuplicateProperties/error-proto-property.src.js", // babylon parse errors + // "ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.src.js", // babylon parse errors + // "ecma-features/modules/invalid-export-named-default.src.js", // babylon parse errors + // "ecma-features/modules/invalid-import-default-module-specifier.src.js", // babylon parse errors + // "ecma-features/modules/invalid-import-module-specifier.src.js", // babylon parse errors + // "ecma-features/newTarget/invalid-new-target.src.js", // babylon parse errors + // "ecma-features/newTarget/invalid-unknown-property.src.js", // babylon parse errors + // "ecma-features/restParams/error-no-default.src.js", // babylon parse errors + // "ecma-features/restParams/error-not-last.src.js", // babylon parse errors + /** + * Deleting local variable in strict mode + */ + // { + // pattern: "ecma-features/modules/error-delete.src.js", + // config: { babylonParserOptions: { sourceType: "module" } } + // }, + /** + * 'with' in strict mode + */ + // { + // pattern: "ecma-features/modules/error-strict.src.js", + // config: { babylonParserOptions: { sourceType: "module" } } + // }, +// ]; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js index 180d6f1b8645..9ef4013735b2 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js @@ -13,9 +13,10 @@ function createError(message, line, column) { // eslint-disable-line return error; } -function parseWithBabylonPluginTypescript(text) { // eslint-disable-line +function parseWithBabylonPluginTypescript(text, parserOptions) { // eslint-disable-line + parserOptions = parserOptions || {}; const babylon = require("babylon"); - return babylon.parse(text, { + return babylon.parse(text, Object.assign({ sourceType: "script", allowImportExportEverywhere: true, allowReturnOutsideFunction: true, @@ -35,13 +36,14 @@ function parseWithBabylonPluginTypescript(text) { // eslint-disable-line "numericSeparator", "estree" ] - }); + }, parserOptions)); } -function parseWithTypeScriptESLintParser(text) { // eslint-disable-line +function parseWithTypeScriptESLintParser(text, parserOptions) { // eslint-disable-line + parserOptions = parserOptions || {}; const parser = require("../../parser"); try { - return parser.parse(text, { + return parser.parse(text, Object.assign({ loc: true, range: true, tokens: false, @@ -51,7 +53,7 @@ function parseWithTypeScriptESLintParser(text) { // eslint-disable-line ecmaFeatures: { jsx: true } - }); + }, parserOptions)); } catch (e) { throw createError( e.message, @@ -63,21 +65,26 @@ function parseWithTypeScriptESLintParser(text) { // eslint-disable-line module.exports = function parse(text, opts) { - let parseFunction; - - switch (opts.parser) { - case "typescript-eslint-parser": - parseFunction = parseWithTypeScriptESLintParser; - break; - case "babylon-plugin-typescript": - parseFunction = parseWithBabylonPluginTypescript; - break; - default: - throw new Error("Please provide a valid parser: either \"typescript-eslint-parser\" or \"babylon-plugin-typescript\""); - } + /** + * Always return a consistent interface, there will be times when we expect both + * parsers to fail to parse the invalid source. + */ + const result = { + parseError: null, + ast: null + }; try { - return parseUtils.normalizeNodeTypes(parseFunction(text)); + switch (opts.parser) { + case "typescript-eslint-parser": + result.ast = parseUtils.normalizeNodeTypes(parseWithTypeScriptESLintParser(text, opts.typeScriptESLintParserOptions)); + break; + case "babylon-plugin-typescript": + result.ast = parseUtils.normalizeNodeTypes(parseWithBabylonPluginTypescript(text, opts.babylonParserOptions)); + break; + default: + throw new Error("Please provide a valid parser: either \"typescript-eslint-parser\" or \"babylon-plugin-typescript\""); + } } catch (error) { const loc = error.loc; if (loc) { @@ -86,7 +93,9 @@ module.exports = function parse(text, opts) { }); error.message += `\n${error.codeFrame}`; } - throw error; + result.parseError = error; } + return result; + }; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index 73bf551bf013..ee8d16900b35 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -6,20 +6,431 @@ const glob = require("glob"); const parse = require("./parse"); const parseUtils = require("./utils"); +/** + * JSX fixtures which have known issues for typescript-eslint-parser + */ +const jsxFilesWithKnownIssues = require("../jsx-known-issues"); + +/** + * Current random error difference on jsx/invalid-no-tag-name.src.js + * TSEP - SyntaxError + * Babylon - RangeError + * + * Reported here: https://github.com/babel/babylon/issues/674 + */ +jsxFilesWithKnownIssues.push("jsx/invalid-no-tag-name"); + +const jsxPattern = `jsx/!(${jsxFilesWithKnownIssues.map(f => f.replace("jsx/", "")).join("|")}).src.js`; + const fixturesDirPath = path.join(__dirname, "../fixtures"); + +// Either a string of the pattern, or an object containing the pattern and some additional config const fixturePatternsToTest = [ - "basics/instanceof.src.js", - "basics/update-expression.src.js", - "basics/new-without-parens.src.js", - "ecma-features/arrowFunctions/**/as*.src.js", - "jsx/attributes.src.js" + "basics/**/*.src.js", + + "comments/block-trailing-comment.src.js", + "comments/comment-within-condition.src.js", + "comments/jsx-block-comment.src.js", + "comments/jsx-tag-comments.src.js", + "comments/line-comment-with-block-syntax.src.js", + "comments/mix-line-and-block-comments.src.js", + "comments/no-comment-regex.src.js", + "comments/surrounding-call-comments.src.js", + "comments/surrounding-debugger-comments.src.js", + "comments/surrounding-return-comments.src.js", + "comments/surrounding-throw-comments.src.js", + "comments/surrounding-while-loop-comments.src.js", + "comments/switch-fallthrough-comment-in-function.src.js", + "comments/switch-fallthrough-comment.src.js", + "comments/switch-no-default-comment-in-function.src.js", + "comments/switch-no-default-comment-in-nested-functions.src.js", + "comments/switch-no-default-comment.src.js", + + "ecma-features/arrowFunctions/as-param-with-params.src.js", + "ecma-features/arrowFunctions/as-param.src.js", + "ecma-features/arrowFunctions/basic.src.js", + "ecma-features/arrowFunctions/basic-in-binary-expression.src.js", + "ecma-features/arrowFunctions/block-body-not-object.src.js", + "ecma-features/arrowFunctions/block-body.src.js", + "ecma-features/arrowFunctions/error-missing-paren.src.js", + "ecma-features/arrowFunctions/error-not-arrow.src.js", + "ecma-features/arrowFunctions/error-numeric-param-multi.src.js", + "ecma-features/arrowFunctions/error-numeric-param.src.js", + "ecma-features/arrowFunctions/error-reverse-arrow.src.js", + "ecma-features/arrowFunctions/error-strict-default-param-eval.src.js", + "ecma-features/arrowFunctions/error-strict-eval-return.src.js", + "ecma-features/arrowFunctions/error-strict-eval.src.js", + "ecma-features/arrowFunctions/error-strict-param-arguments.src.js", + "ecma-features/arrowFunctions/error-strict-param-eval.src.js", + "ecma-features/arrowFunctions/error-strict-param-names.src.js", + "ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.src.js", + "ecma-features/arrowFunctions/error-strict-param-no-paren-eval.src.js", + "ecma-features/arrowFunctions/error-wrapped-param.src.js", + "ecma-features/arrowFunctions/expression.src.js", + "ecma-features/arrowFunctions/iife.src.js", + "ecma-features/arrowFunctions/multiple-params.src.js", + "ecma-features/arrowFunctions/no-auto-return.src.js", + "ecma-features/arrowFunctions/not-strict-arguments.src.js", + "ecma-features/arrowFunctions/not-strict-eval-params.src.js", + "ecma-features/arrowFunctions/not-strict-eval.src.js", + "ecma-features/arrowFunctions/not-strict-octal.src.js", + "ecma-features/arrowFunctions/return-arrow-function.src.js", + "ecma-features/arrowFunctions/return-sequence.src.js", + "ecma-features/arrowFunctions/single-param-parens.src.js", + "ecma-features/arrowFunctions/single-param-return-identifier.src.js", + "ecma-features/arrowFunctions/single-param.src.js", + "ecma-features/binaryLiterals/**/*.src.js", + "ecma-features/blockBindings/**/*.src.js", + "ecma-features/classes/class-accessor-properties.src.js", + "ecma-features/classes/class-computed-static-method.src.js", + "ecma-features/classes/class-expression.src.js", + "ecma-features/classes/class-method-named-prototype.src.js", + "ecma-features/classes/class-method-named-static.src.js", + "ecma-features/classes/class-method-named-with-space.src.js", + "ecma-features/classes/class-one-method.src.js", + "ecma-features/classes/class-static-method-named-prototype.src.js", + "ecma-features/classes/class-static-method-named-static.src.js", + "ecma-features/classes/class-static-method.src.js", + "ecma-features/classes/class-static-methods-and-accessor-properties.src.js", + "ecma-features/classes/class-two-computed-static-methods.src.js", + "ecma-features/classes/class-two-methods-computed-constructor.src.js", + "ecma-features/classes/class-two-methods-semi.src.js", + "ecma-features/classes/class-two-methods-three-semi.src.js", + "ecma-features/classes/class-two-methods-two-semi.src.js", + "ecma-features/classes/class-two-methods.src.js", + "ecma-features/classes/class-two-static-methods-named-constructor.src.js", + "ecma-features/classes/class-with-constructor-parameters.src.js", + "ecma-features/classes/class-with-constructor-with-space.src.js", + "ecma-features/classes/class-with-constructor.src.js", + "ecma-features/classes/derived-class-assign-to-var.src.js", + "ecma-features/classes/derived-class-expression.src.js", + "ecma-features/classes/empty-class-double-semi.src.js", + "ecma-features/classes/empty-class-semi.src.js", + "ecma-features/classes/empty-class.src.js", + "ecma-features/classes/empty-literal-derived-class.src.js", + "ecma-features/classes/named-class-expression.src.js", + "ecma-features/classes/named-derived-class-expression.src.js", + "ecma-features/defaultParams/**/*.src.js", + "ecma-features/destructuring/array-member.src.js", + "ecma-features/destructuring/array-to-array.src.js", + "ecma-features/destructuring/array-var-undefined.src.js", + "ecma-features/destructuring/class-constructor-params-array.src.js", + "ecma-features/destructuring/class-constructor-params-defaults-array.src.js", + "ecma-features/destructuring/class-constructor-params-defaults-object.src.js", + "ecma-features/destructuring/class-constructor-params-object.src.js", + "ecma-features/destructuring/class-method-params-array.src.js", + "ecma-features/destructuring/class-method-params-defaults-array.src.js", + "ecma-features/destructuring/class-method-params-defaults-object.src.js", + "ecma-features/destructuring/class-method-params-object.src.js", + "ecma-features/destructuring/defaults-array-all.src.js", + "ecma-features/destructuring/defaults-array-longform-nested-multi.src.js", + "ecma-features/destructuring/defaults-array-multi.src.js", + "ecma-features/destructuring/defaults-array-nested-all.src.js", + "ecma-features/destructuring/defaults-array-nested-multi.src.js", + "ecma-features/destructuring/defaults-array.src.js", + "ecma-features/destructuring/defaults-object-all.src.js", + "ecma-features/destructuring/defaults-object-longform-all.src.js", + "ecma-features/destructuring/defaults-object-longform-multi.src.js", + "ecma-features/destructuring/defaults-object-longform.src.js", + "ecma-features/destructuring/defaults-object-mixed-multi.src.js", + "ecma-features/destructuring/defaults-object-multi.src.js", + "ecma-features/destructuring/defaults-object-nested-all.src.js", + "ecma-features/destructuring/defaults-object-nested-multi.src.js", + "ecma-features/destructuring/defaults-object.src.js", + "ecma-features/destructuring/destructured-array-catch.src.js", + "ecma-features/destructuring/destructured-object-catch.src.js", + "ecma-features/destructuring/named-param.src.js", + "ecma-features/destructuring/nested-array.src.js", + "ecma-features/destructuring/nested-object.src.js", + "ecma-features/destructuring/object-var-named.src.js", + "ecma-features/destructuring/object-var-undefined.src.js", + "ecma-features/destructuring/param-defaults-array.src.js", + "ecma-features/destructuring/param-defaults-object-nested.src.js", + "ecma-features/destructuring/param-defaults-object.src.js", + "ecma-features/destructuring/params-array-wrapped.src.js", + "ecma-features/destructuring/params-array.src.js", + "ecma-features/destructuring/params-multi-object.src.js", + "ecma-features/destructuring/params-nested-array.src.js", + "ecma-features/destructuring/params-nested-object.src.js", + "ecma-features/destructuring/params-object-wrapped.src.js", + "ecma-features/destructuring/params-object.src.js", + "ecma-features/destructuring/sparse-array.src.js", + "ecma-features/destructuring-and-arrowFunctions/**/*.src.js", + "ecma-features/destructuring-and-blockBindings/**/*.src.js", + "ecma-features/destructuring-and-defaultParams/**/*.src.js", + "ecma-features/destructuring-and-forOf/**/*.src.js", + "ecma-features/destructuring-and-spread/complex-destructured.src.js", + "ecma-features/destructuring-and-spread/destructured-array-literal.src.js", + "ecma-features/destructuring-and-spread/destructuring-param.src.js", + "ecma-features/destructuring-and-spread/multi-destructured.src.js", + "ecma-features/destructuring-and-spread/single-destructured.src.js", + "ecma-features/destructuring-and-spread/var-complex-destructured.src.js", + "ecma-features/destructuring-and-spread/var-destructured-array-literal.src.js", + "ecma-features/destructuring-and-spread/var-multi-destructured.src.js", + "ecma-features/destructuring-and-spread/var-single-destructured.src.js", + "ecma-features/experimentalAsyncIteration/**/*.src.js", + "ecma-features/experimentalDynamicImport/**/*.src.js", + "ecma-features/exponentiationOperators/**/*.src.js", + "ecma-features/forOf/for-of-with-var-and-braces.src.js", + "ecma-features/forOf/for-of-with-var-and-no-braces.src.js", + "ecma-features/forOf/invalid-for-of-with-const-and-no-braces.src.js", + "ecma-features/forOf/invalid-for-of-with-let-and-no-braces.src.js", + "ecma-features/generators/**/*.src.js", + "ecma-features/globalReturn/**/*.src.js", + "ecma-features/modules/error-function.src.js", + "ecma-features/modules/invalid-export-batch-missing-from-clause.src.js", + "ecma-features/modules/invalid-export-batch-token.src.js", + "ecma-features/modules/invalid-export-default-equal.src.js", + "ecma-features/modules/invalid-export-default-token.src.js (1ms)", + "ecma-features/modules/invalid-export-named-extra-comma.src.js", + "ecma-features/modules/invalid-export-named-middle-comma.src.js", + "ecma-features/modules/invalid-import-default-after-named-after-default.src.js", + "ecma-features/modules/invalid-import-default-after-named.src.js", + "ecma-features/modules/invalid-import-default-missing-module-specifier.src.js", + "ecma-features/modules/invalid-import-default.src.js (1ms)", + "ecma-features/modules/invalid-import-missing-module-specifier.src.js", + "ecma-features/modules/invalid-import-named-after-named.src.js", + "ecma-features/modules/invalid-import-named-after-namespace.src.js", + "ecma-features/modules/invalid-import-named-as-missing-from.src.js", + "ecma-features/modules/invalid-import-named-extra-comma.src.js", + "ecma-features/modules/invalid-import-named-middle-comma.src.js (1ms)", + "ecma-features/modules/invalid-import-namespace-after-named.src.js", + "ecma-features/modules/invalid-import-namespace-missing-as.src.js", + "ecma-features/newTarget/simple-new-target.src.js", + "ecma-features/objectLiteralComputedProperties/**/*.src.js", + "ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js", + "ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js", + "ecma-features/objectLiteralShorthandMethods/**/*.src.js", + "ecma-features/objectLiteralShorthandProperties/**/*.src.js", + "ecma-features/octalLiterals/**/*.src.js", + "ecma-features/regex/**/*.src.js", + "ecma-features/regexUFlag/**/*.src.js", + "ecma-features/regexYFlag/**/*.src.js", + "ecma-features/restParams/basic-rest.src.js", + "ecma-features/restParams/class-constructor.src.js", + "ecma-features/restParams/class-method.src.js", + "ecma-features/restParams/func-expression-multi.src.js", + "ecma-features/restParams/func-expression.src.js", + "ecma-features/restParams/invalid-rest-param.src.js", + "ecma-features/restParams/single-rest.src.js", + "ecma-features/spread/**/*.src.js", + "ecma-features/unicodeCodePointEscapes/**/*.src.js", + + jsxPattern, + + "jsx-useJSXTextNode/**/*.src.js", + + /** + * The TypeScript compiler gives us the "externalModuleIndicator" to allow typescript-eslint-parser do dynamically detect the "sourceType". + * Babylon does not have an equivalent feature (although perhaps it might come in the future https://github.com/babel/babylon/issues/440), + * so we have to specify the "sourceType" we want to use. + * + * By default we have configured babylon to use "script", but for the examples below we need "module". + * Maybe fixed by https://github.com/babel/babylon/commit/00ad6d8310ce826dcdd59c7a819dbd50955058d7? + */ + { + pattern: "comments/export-default-anonymous-class.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-array.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-class.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-expression.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-function.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-named-class.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-named-function.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-number.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-object.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-default-value.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-from-batch.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-from-default.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-from-named-as-default.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-from-named-as-specifier.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-from-named-as-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-from-specifier.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-from-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-function.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-as-default.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-as-specifier.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-as-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-class.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-empty.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-specifier.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-specifiers-comma.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-named-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-var-anonymous-function.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-var-number.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/export-var.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-default-and-named-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-default-and-namespace-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-default-as.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-default.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-jquery.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-module.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-named-as-specifier.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-named-as-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-named-empty.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-named-specifier.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-named-specifiers-comma.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-named-specifiers.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-namespace-specifier.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/import-null-as-nil.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/invalid-await.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "ecma-features/modules/invalid-class.src.js", + config: { babylonParserOptions: { sourceType: "module" } } + } + + /** + * Lots of issues, needs to be broken down + */ + // "typescript/**/*.src.ts" // lots and lots of issues... ]; +// Either a string of the pattern, or an object containing the pattern and some additional config const fixturesToTest = []; fixturePatternsToTest.forEach(fixturePattern => { - const matchingFixtures = glob.sync(`${fixturesDirPath}/${fixturePattern}`, {}); - matchingFixtures.forEach(filename => fixturesToTest.push(filename)); + const globPattern = (typeof fixturePattern === "string") ? fixturePattern : fixturePattern.pattern; + const matchingFixtures = glob.sync(`${fixturesDirPath}/${globPattern}`, {}); + matchingFixtures.forEach(filename => { + if (typeof fixturePattern === "string") { + fixturesToTest.push(filename); + } else { + fixturesToTest.push({ + filename, + config: fixturePattern.config + }); + } + }); }); /** @@ -64,6 +475,12 @@ function preprocessBabylonAST(ast) { return true; } }, + { + key: "directive", + predicate() { + return true; + } + }, { key: "innerComments", predicate() { @@ -75,33 +492,107 @@ function preprocessBabylonAST(ast) { predicate() { return true; } + }, + { + key: "trailingComments", + predicate() { + return true; + } + }, + { + key: "guardedHandlers", + predicate() { + return true; + } } ]); } -fixturesToTest.forEach(filename => { +/** + * There is currently a really awkward difference in location data for Program nodes + * between different parsers in the ecosystem. Hack around this by removing the data + * before comparing the ASTs. + * + * See: https://github.com/babel/babylon/issues/673 + * + * @param {Object} ast the raw AST with a Program node at its top level + * @returns {Object} the ast with the location data removed from the Program node + */ +function removeLocationDataFromProgramNode(ast) { + delete ast.loc; + delete ast.range; + return ast; +} +fixturesToTest.forEach(fixture => { + + const filename = (typeof fixture === "string") ? fixture : fixture.filename; const source = fs.readFileSync(filename, "utf8").replace(/\r\n/g, "\n"); /** * Parse with typescript-eslint-parser */ - const typeScriptESLintParserAST = parse(source, { - parser: "typescript-eslint-parser" + const typeScriptESLintParserResult = parse(source, { + parser: "typescript-eslint-parser", + typeScriptESLintParserOptions: (fixture.config && fixture.config.typeScriptESLintParserOptions) ? fixture.config.typeScriptESLintParserOptions : null + }); + + /** + * Parse the source with babylon typescript-plugin + */ + const babylonTypeScriptPluginResult = parse(source, { + parser: "babylon-plugin-typescript", + babylonParserOptions: (fixture.config && fixture.config.babylonParserOptions) ? fixture.config.babylonParserOptions : null }); /** - * Parse the source with babylon typescript-plugin, and perform some extra formatting steps + * If babylon fails to parse the source, ensure that typescript-eslint-parser has the same fundamental issue + */ + if (babylonTypeScriptPluginResult.parseError) { + /** + * FAIL: babylon errored but typescript-eslint-parser did not + */ + if (!typeScriptESLintParserResult.parseError) { + test(`TEST FAIL [BABYLON ERRORED, BUT TSEP DID NOT] - ${filename}`, () => { + expect(typeScriptESLintParserResult.parseError).toEqual(babylonTypeScriptPluginResult.parseError); + }); + return; + } + /** + * Both parsers errored - this is OK as long as the errors are of the same "type" + */ + test(`[Both parsers error as expected] - ${filename}`, () => { + expect(babylonTypeScriptPluginResult.parseError.name).toEqual(typeScriptESLintParserResult.parseError.name); + }); + return; + } + + /** + * FAIL: typescript-eslint-parser errored but babylon did not */ - const babylonTypeScriptPluginAST = preprocessBabylonAST(parse(source, { - parser: "babylon-plugin-typescript" - })); + if (typeScriptESLintParserResult.parseError) { + test(`TEST FAIL [TSEP ERRORED, BUT BABYLON DID NOT] - ${filename}`, () => { + expect(babylonTypeScriptPluginResult.parseError).toEqual(typeScriptESLintParserResult.parseError); + }); + return; + } /** - * Assert the two ASTs match + * No errors, assert the two ASTs match */ test(`${filename}`, () => { - expect(babylonTypeScriptPluginAST).toEqual(typeScriptESLintParserAST); + expect(babylonTypeScriptPluginResult.ast).toBeTruthy(); + expect(typeScriptESLintParserResult.ast).toBeTruthy(); + /** + * Perform some extra formatting steps on the babylon AST before comparing + */ + expect( + removeLocationDataFromProgramNode( + preprocessBabylonAST(babylonTypeScriptPluginResult.ast) + ) + ).toEqual( + removeLocationDataFromProgramNode(typeScriptESLintParserResult.ast) + ); }); }); diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/utils.js b/packages/typescript-eslint-parser/tests/ast-alignment/utils.js index e9a52a269528..bf8460a0fa61 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/utils.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/utils.js @@ -34,6 +34,7 @@ function omitDeep(obj, keysToOmit) { } return false; } + for (const key in obj) { if (!obj.hasOwnProperty(key)) { continue; @@ -42,19 +43,26 @@ function omitDeep(obj, keysToOmit) { if (isPlainObject(val)) { if (shouldOmit(key, val)) { delete obj[key]; - break; + // re-run with the same arguments + // in case the object has multiple keys to omit + return omitDeep(obj, keysToOmit); } omitDeep(val, keysToOmit); } else if (Array.isArray(val)) { if (shouldOmit(key, val)) { delete obj[key]; - break; + // re-run with the same arguments + // in case the object has multiple keys to omit + return omitDeep(obj, keysToOmit); } for (const i of val) { omitDeep(i, keysToOmit); } } else if (shouldOmit(key, val)) { delete obj[key]; + // re-run with the same arguments + // in case the object has multiple keys to omit + return omitDeep(obj, keysToOmit); } } return obj; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js index f27ea48bae31..5549093124c0 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/arrowFunctions/basic-in-binary-expression.src.js @@ -1,5 +1,2 @@ (a => ({})) + 1; -(a => ({})) = 1; ((a => ({})) + 1); -((a => ({})) = 1); - diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js index b45ac689fa8f..5f3ddae50e29 100644 --- a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/destructuring/named-param.src.js @@ -1 +1 @@ -({ responseText: text }) = res; \ No newline at end of file +({ responseText: text } = res); \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/jsx-known-issues.js b/packages/typescript-eslint-parser/tests/jsx-known-issues.js new file mode 100644 index 000000000000..92cb4d661cc9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/jsx-known-issues.js @@ -0,0 +1,11 @@ +"use strict"; + +/** + * Export the list to allow it to be used within both unit and AST comparison tests + */ +module.exports = [ + "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 + "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 + "jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411 + "jsx/invalid-namespace-value-with-dots" // https://github.com/Microsoft/TypeScript/issues/7411 +]; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 4129aae7d37d..4ebfe052e7de 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -2131,18 +2131,18 @@ Object { "body": Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 2, }, "start": Object { - "column": 7, + "column": 8, "line": 2, }, }, "properties": Array [], "range": Array [ - 24, - 26, + 25, + 27, ], "type": "ObjectExpression", }, @@ -2151,11 +2151,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 2, }, "start": Object { - "column": 1, + "column": 2, "line": 2, }, }, @@ -2163,67 +2163,67 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 3, "line": 2, }, "start": Object { - "column": 1, + "column": 2, "line": 2, }, }, "name": "a", "range": Array [ - 18, 19, + 20, ], "type": "Identifier", }, ], "range": Array [ - 18, - 27, + 19, + 28, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 2, }, "start": Object { - "column": 0, + "column": 1, "line": 2, }, }, - "operator": "=", + "operator": "+", "range": Array [ - 17, - 32, + 18, + 33, ], "right": Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 2, }, "start": Object { - "column": 14, + "column": 15, "line": 2, }, }, "range": Array [ - 31, 32, + 33, ], "raw": "1", "type": "Literal", "value": 1, }, - "type": "AssignmentExpression", + "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 2, }, "start": Object { @@ -2233,233 +2233,7 @@ Object { }, "range": Array [ 17, - 33, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "left": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "properties": Array [], - "range": Array [ - 42, - 44, - ], - "type": "ObjectExpression", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 36, - 45, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 1, - "line": 3, - }, - }, - "operator": "+", - "range": Array [ - 35, - 50, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 34, - 52, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "left": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "properties": Array [], - "range": Array [ - 61, - 63, - ], - "type": "ObjectExpression", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "name": "a", - "range": Array [ - 55, - 56, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 55, - 64, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "operator": "=", - "range": Array [ - 54, - 69, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 4, - }, - }, - "range": Array [ - 68, - 69, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "AssignmentExpression", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 53, - 71, + 35, ], "type": "ExpressionStatement", }, @@ -2467,7 +2241,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 3, }, "start": Object { "column": 0, @@ -2476,7 +2250,7 @@ Object { }, "range": Array [ 0, - 73, + 36, ], "sourceType": "script", "tokens": Array [ @@ -2711,44 +2485,44 @@ Object { 18, 19, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 2, }, "start": Object { - "column": 3, + "column": 2, "line": 2, }, }, "range": Array [ + 19, 20, - 22, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 2, }, "start": Object { - "column": 6, + "column": 4, "line": 2, }, }, "range": Array [ + 21, 23, - 24, ], "type": "Punctuator", - "value": "(", + "value": "=>", }, Object { "loc": Object { @@ -2766,7 +2540,7 @@ Object { 25, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { @@ -2784,7 +2558,7 @@ Object { 26, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { @@ -2802,7 +2576,7 @@ Object { 27, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { @@ -2825,38 +2599,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 2, }, "start": Object { - "column": 12, + "column": 11, "line": 2, }, }, "range": Array [ + 28, 29, - 30, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 2, }, "start": Object { - "column": 14, + "column": 13, "line": 2, }, }, "range": Array [ + 30, 31, - 32, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "+", }, Object { "loc": Object { @@ -2873,438 +2647,6 @@ Object { 32, 33, ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 1, - "line": 3, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 38, - 40, - ], - "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 41, - 42, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 42, - 43, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "range": Array [ - 43, - 44, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 3, - }, - "start": Object { - "column": 11, - "line": 3, - }, - }, - "range": Array [ - 45, - 46, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "range": Array [ - 47, - 48, - ], - "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 49, - 50, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 3, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 3, - }, - "start": Object { - "column": 17, - "line": 3, - }, - }, - "range": Array [ - 51, - 52, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 53, - 54, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 4, - }, - "start": Object { - "column": 1, - "line": 4, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 2, - "line": 4, - }, - }, - "range": Array [ - 55, - 56, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 57, - 59, - ], - "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 4, - }, - "start": Object { - "column": 7, - "line": 4, - }, - }, - "range": Array [ - 60, - 61, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 4, - }, - }, - "range": Array [ - 61, - 62, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 4, - }, - "start": Object { - "column": 9, - "line": 4, - }, - }, - "range": Array [ - 62, - 63, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 4, - }, - "start": Object { - "column": 10, - "line": 4, - }, - }, - "range": Array [ - 63, - 64, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 4, - }, - "start": Object { - "column": 11, - "line": 4, - }, - }, - "range": Array [ - 64, - 65, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 4, - }, - }, - "range": Array [ - 66, - 67, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 4, - }, - }, - "range": Array [ - 68, - 69, - ], "type": "Numeric", "value": "1", }, @@ -3312,16 +2654,16 @@ Object { "loc": Object { "end": Object { "column": 17, - "line": 4, + "line": 2, }, "start": Object { "column": 16, - "line": 4, + "line": 2, }, }, "range": Array [ - 69, - 70, + 33, + 34, ], "type": "Punctuator", "value": ")", @@ -3330,16 +2672,16 @@ Object { "loc": Object { "end": Object { "column": 18, - "line": 4, + "line": 2, }, "start": Object { "column": 17, - "line": 4, + "line": 2, }, }, "range": Array [ - 70, - 71, + 34, + 35, ], "type": "Punctuator", "value": ";", @@ -38660,34 +38002,34 @@ Object { }, "loc": Object { "end": Object { - "column": 30, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 1, "line": 1, }, }, "operator": "=", "range": Array [ - 0, - 30, + 1, + 29, ], "right": Object { "loc": Object { "end": Object { - "column": 30, + "column": 29, "line": 1, }, "start": Object { - "column": 27, + "column": 26, "line": 1, }, }, "name": "res", "range": Array [ - 27, - 30, + 26, + 29, ], "type": "Identifier", }, @@ -38837,38 +38179,38 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 25, "line": 1, }, "start": Object { - "column": 23, + "column": 24, "line": 1, }, }, "range": Array [ - 23, 24, + 25, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 29, "line": 1, }, "start": Object { - "column": 25, + "column": 26, "line": 1, }, }, "range": Array [ - 25, 26, + 29, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "res", }, Object { "loc": Object { @@ -38877,16 +38219,16 @@ Object { "line": 1, }, "start": Object { - "column": 27, + "column": 29, "line": 1, }, }, "range": Array [ - 27, + 29, 30, ], - "type": "Identifier", - "value": "res", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.js b/packages/typescript-eslint-parser/tests/lib/jsx.js index 60e0bdb2562b..edc705d0fbaa 100644 --- a/packages/typescript-eslint-parser/tests/lib/jsx.js +++ b/packages/typescript-eslint-parser/tests/lib/jsx.js @@ -13,7 +13,8 @@ const path = require("path"), shelljs = require("shelljs"), - testUtils = require("../../tools/test-utils"); + testUtils = require("../../tools/test-utils"), + filesWithKnownIssues = require("../jsx-known-issues"); //------------------------------------------------------------------------------ // Setup @@ -21,16 +22,9 @@ const path = require("path"), const JSX_FIXTURES_DIR = "./tests/fixtures/jsx"; -const filesWithOutsandingTSIssues = [ - "jsx/embedded-tags", // https://github.com/Microsoft/TypeScript/issues/7410 - "jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411 - "jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411 - "jsx/invalid-namespace-value-with-dots" // https://github.com/Microsoft/TypeScript/issues/7411 -]; - const jsxTestFiles = shelljs.find(JSX_FIXTURES_DIR) .filter(filename => filename.indexOf(".src.js") > -1) - .filter(filename => filesWithOutsandingTSIssues.every(fileName => filename.indexOf(fileName) === -1)) + .filter(filename => filesWithKnownIssues.every(fileName => filename.indexOf(fileName) === -1)) // strip off ".src.js" .map(filename => filename.substring(JSX_FIXTURES_DIR.length - 1, filename.length - 7)); From 8e5404f102e5979ed5b33b91ec1d8998df42df88 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 19 Aug 2017 15:00:52 +0100 Subject: [PATCH 194/326] Chore: Breakout and label TS-specific AST comparison tests (#360) --- .../tests/ast-alignment/spec.js | 134 +++++++++++++++++- 1 file changed, 131 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index ee8d16900b35..67e4af3599d1 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -407,12 +407,140 @@ const fixturePatternsToTest = [ { pattern: "ecma-features/modules/invalid-class.src.js", config: { babylonParserOptions: { sourceType: "module" } } - } + }, + + /* ================================================== */ + + /** + * TYPESCRIPT-SPECIFIC FILES + */ /** - * Lots of issues, needs to be broken down + * No issues */ - // "typescript/**/*.src.ts" // lots and lots of issues... + "typescript/basics/async-function-expression.src.ts", + "typescript/basics/async-function-with-var-declaration.src.ts", + "typescript/basics/function-with-await.src.ts", + "typescript/errorRecovery/class-extends-empty-implements.src.ts" + + /** + * TypeScript-specific tests taken from "errorRecovery". Babylon is not being as forgiving as the TypeScript compiler here. + */ + // "typescript/errorRecovery/class-empty-extends-implements.src.ts", // babylon parse errors + // "typescript/errorRecovery/class-empty-extends.src.ts", // babylon parse errors + // "typescript/errorRecovery/decorator-on-enum-declaration.src.ts", // babylon parse errors + // "typescript/errorRecovery/interface-property-modifiers.src.ts", // babylon parse errors + + /** + * Other babylon parse errors. TODO: Need to coordinate with TS Team. + */ + // "typescript/basics/abstract-class-with-abstract-constructor.src.ts", // babylon parse errors + // "typescript/basics/abstract-class-with-abstract-method.src.ts", // babylon parse errors + // "typescript/basics/abstract-class-with-optional-method.src.ts", // babylon parse errors + // "typescript/basics/abstract-interface.src.ts", // babylon parse errors + // "typescript/basics/class-with-export-parameter-properties.src.ts", // babylon parse errors + // "typescript/basics/class-with-optional-methods.src.ts", // babylon parse errors + // "typescript/basics/class-with-static-parameter-properties.src.ts", // babylon parse errors + // "typescript/basics/declare-class-with-optional-method.src.ts", // babylon parse errors + // "typescript/basics/export-type-alias-declaration.src.ts", // babylon parse errors + // "typescript/basics/export-type-class-declaration.src.ts", // babylon parse errors + // "typescript/basics/export-type-function-declaration.src.ts", // babylon parse errors + // "typescript/basics/interface-with-all-property-types.src.ts", // babylon parse errors + // "typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts", // babylon parse errors + + /** + * typescript-eslint-parser erroring, but babylon not. + */ + // "typescript/basics/arrow-function-with-type-parameters.src.ts" // typescript-eslint-parser parse errors + + /** + * TypeScript AST differences which need to be resolved + */ + // "typescript/babylon-convergence/type-parameters.src.ts", + // "typescript/basics/abstract-class-with-abstract-properties.src.ts", + // "typescript/basics/abstract-class-with-abstract-readonly-property.src.ts", + // "typescript/basics/class-with-accessibility-modifiers.src.ts", + // "typescript/basics/class-with-extends-generic-multiple.src.ts", + // "typescript/basics/class-with-extends-generic.src.ts", + // "typescript/basics/class-with-generic-method-default.src.ts", + // "typescript/basics/class-with-generic-method.src.ts", + // "typescript/basics/class-with-implements-generic-multiple.src.ts", + // "typescript/basics/class-with-implements-generic.src.ts", + // "typescript/basics/class-with-implements.src.ts", + // "typescript/basics/class-with-mixin.src.ts", + // "typescript/basics/class-with-optional-computed-property.src.ts", + // "typescript/basics/class-with-optional-properties.src.ts", + // "typescript/basics/class-with-optional-property-undefined.src.ts", + // "typescript/basics/class-with-private-parameter-properties.src.ts", + // "typescript/basics/class-with-protected-parameter-properties.src.ts", + // "typescript/basics/class-with-public-parameter-properties.src.ts", + // "typescript/basics/class-with-readonly-parameter-properties.src.ts", + // "typescript/basics/class-with-readonly-property.src.ts", + // "typescript/basics/class-with-type-parameter-default.src.ts", + // "typescript/basics/class-with-type-parameter-underscore.src.ts", + // "typescript/basics/class-with-type-parameter.src.ts", + // "typescript/basics/declare-function.src.ts", + // "typescript/basics/destructuring-assignment.src.ts", + // "typescript/basics/export-assignment.src.ts", + // "typescript/basics/export-default-class-with-generic.src.ts", + // "typescript/basics/export-default-class-with-multiple-generics.src.ts", + // "typescript/basics/export-named-class-with-generic.src.ts", + // "typescript/basics/export-named-class-with-multiple-generics.src.ts", + // "typescript/basics/function-with-object-type-with-optional-properties.src.ts", + // "typescript/basics/function-with-object-type-without-annotation.src.ts", + // "typescript/basics/function-with-type-parameters-that-have-comments.src.ts", + // "typescript/basics/function-with-type-parameters-with-constraint.src.ts", + // "typescript/basics/function-with-type-parameters.src.ts", + // "typescript/basics/function-with-types-assignation.src.ts", + // "typescript/basics/function-with-types.src.ts", + // "typescript/basics/interface-extends-multiple.src.ts", + // "typescript/basics/interface-extends.src.ts", + // "typescript/basics/interface-type-parameters.src.ts", + // "typescript/basics/interface-with-extends-type-parameters.src.ts", + // "typescript/basics/interface-with-generic.src.ts", + // "typescript/basics/interface-with-jsdoc.src.ts", + // "typescript/basics/interface-with-optional-properties.src.ts", + // "typescript/basics/interface-without-type-annotation.src.ts", + // "typescript/basics/nested-type-arguments.src.ts", + // "typescript/basics/non-null-assertion-operator.src.ts", + // "typescript/basics/null-and-undefined-type-annotations.src.ts", + // "typescript/basics/object-with-escaped-properties.src.ts", + // "typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts", + // "typescript/basics/type-alias-declaration.src.ts", + // "typescript/basics/type-alias-object-without-annotation.src.ts", + // "typescript/basics/type-guard.src.ts", + // "typescript/basics/type-parameters-comments.src.ts", + // "typescript/basics/typed-this.src.ts", + // "typescript/basics/var-with-dotted-type.src.ts", + // "typescript/basics/var-with-type.src.ts", + // "typescript/basics/variable-declaration-type-annotation-spacing.src.ts", + // "typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts", + // "typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts", + // "typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts", + // "typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts", + // "typescript/decorators/class-decorators/class-decorator-factory.src.ts", + // "typescript/decorators/class-decorators/class-decorator.src.ts", + // "typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts", + // "typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts", + // "typescript/decorators/method-decorators/method-decorator-instance-member.src.ts", + // "typescript/decorators/method-decorators/method-decorator-static-member.src.ts", + // "typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts", + // "typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts", + // "typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts", + // "typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts", + // "typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts", + // "typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts", + // "typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts", + // "typescript/decorators/property-decorators/property-decorator-instance-member.src.ts", + // "typescript/decorators/property-decorators/property-decorator-static-member.src.ts", + // "typescript/errorRecovery/interface-empty-extends.src.ts", + // "typescript/expressions/call-expression-type-arguments.src.ts", + // "typescript/expressions/new-expression-type-arguments.src.ts", + // "typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts", + // "typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts", + // "typescript/namespaces-and-modules/module-with-default-exports.src.ts", + // "typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts" + ]; // Either a string of the pattern, or an object containing the pattern and some additional config From fc414203d0fb26991725c4b98c8c7cd1f2b673aa Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Sat, 19 Aug 2017 11:22:53 -0400 Subject: [PATCH 195/326] Fix: Allow other orderings of implements/extends clauses (fixes #361) (#363) --- .../typescript-eslint-parser/lib/convert.js | 20 +- .../class-with-extends-and-implements.src.ts | 1 + .../class-with-implements-and-extends.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 593 +++++++++++++++++- 4 files changed, 600 insertions(+), 15 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-and-implements.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-and-extends.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 8c5ebd7d6c46..648e1a8007ce 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1277,19 +1277,13 @@ module.exports = function convert(config) { } const openBrace = nodeUtils.findNextToken(lastClassToken, ast); - const hasExtends = (heritageClauses.length && node.heritageClauses[0].token === SyntaxKind.ExtendsKeyword); + const superClass = heritageClauses.find(clause => clause.token === SyntaxKind.ExtendsKeyword); - let hasImplements = false; - let superClass; - - if (hasExtends && heritageClauses[0].types.length > 0) { - superClass = heritageClauses.shift(); - if (superClass.types[0] && superClass.types[0].typeArguments) { - result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); - } + if (superClass && superClass.types[0] && superClass.types[0].typeArguments) { + result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); } - hasImplements = heritageClauses.length > 0; + const implementsClause = heritageClauses.find(clause => clause.token === SyntaxKind.ImplementsKeyword); Object.assign(result, { type: classNodeType, @@ -1302,11 +1296,11 @@ module.exports = function convert(config) { range: [openBrace.getStart(), result.range[1]], loc: nodeUtils.getLocFor(openBrace.getStart(), node.end, ast) }, - superClass: (superClass ? convertChild(superClass.types[0].expression) : null) + superClass: (superClass && superClass.types[0] ? convertChild(superClass.types[0].expression) : null) }); - if (hasImplements) { - result.implements = heritageClauses[0].types.map(convertClassImplements); + if (implementsClause) { + result.implements = implementsClause.types.map(convertClassImplements); } if (node.decorators) { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-and-implements.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-and-implements.src.ts new file mode 100644 index 000000000000..fe7ea2560e59 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-extends-and-implements.src.ts @@ -0,0 +1 @@ +class ClassWithParentAndInterface extends MyOtherClass implements MyInterface {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-and-extends.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-and-extends.src.ts new file mode 100644 index 000000000000..fe44fc7ba1b2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-implements-and-extends.src.ts @@ -0,0 +1 @@ +class ClassWithParentAndInterface implements MyInterface extends MyOtherClass {} diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 7996a112de2c..4073d805c02c 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -6250,6 +6250,283 @@ Object { } `; +exports[`typescript fixtures/basics/class-with-extends-and-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 80, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "ClassWithParentAndInterface", + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "name": "MyInterface", + "range": Array [ + 66, + 77, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 77, + ], + "type": "ClassImplements", + }, + ], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 80, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "MyOtherClass", + "range": Array [ + 42, + 54, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + "value": "ClassWithParentAndInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 54, + ], + "type": "Identifier", + "value": "MyOtherClass", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 65, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 77, + ], + "type": "Identifier", + "value": "MyInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/class-with-extends-generic.src 1`] = ` Object { "body": Array [ @@ -8321,6 +8598,283 @@ Object { } `; +exports[`typescript fixtures/basics/class-with-implements-and-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 80, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "ClassWithParentAndInterface", + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "name": "MyInterface", + "range": Array [ + 45, + 56, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 56, + ], + "type": "ClassImplements", + }, + ], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 80, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "name": "MyOtherClass", + "range": Array [ + 65, + 77, + ], + "type": "Identifier", + }, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + "value": "ClassWithParentAndInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 44, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 56, + ], + "type": "Identifier", + "value": "MyInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 64, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 77, + ], + "type": "Identifier", + "value": "MyOtherClass", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/class-with-implements-generic.src 1`] = ` Object { "body": Array [ @@ -52279,7 +52833,6 @@ Object { ], "type": "Identifier", }, - "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -52449,7 +53002,43 @@ Object { ], "type": "Identifier", }, - "implements": Array [], + "implements": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Bar", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "ClassImplements", + }, + ], "loc": Object { "end": Object { "column": 1, From aebab326510cc5341160296698a8640d0127e2f1 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 19 Aug 2017 16:39:27 +0100 Subject: [PATCH 196/326] Breaking: Explicitly handle TSEnumDeclaration (fixes #345) (#364) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 30 ++ .../typescript-eslint-parser/package.json | 2 +- .../tests/ast-alignment/spec.js | 7 +- .../basics/export-named-enum.src.ts | 4 + .../lib/__snapshots__/typescript.js.snap | 374 +++++++++++++++++- 6 files changed, 404 insertions(+), 14 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-enum.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 66de023490c3..3b9f20a85dff 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -109,6 +109,7 @@ module.exports = { TSConstructSignature: "TSConstructSignature", TSDeclareKeyword: "TSDeclareKeyword", TSEnumDeclaration: "TSEnumDeclaration", + TSEnumMember: "TSEnumMember", TSExportAssignment: "TSExportAssigment", TSIndexSignature: "TSIndexSignature", TSInterfaceBody: "TSInterfaceBody", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 648e1a8007ce..247e16201e19 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1994,6 +1994,36 @@ module.exports = function convert(config) { }); break; + case SyntaxKind.EnumDeclaration: { + Object.assign(result, { + type: AST_NODE_TYPES.TSEnumDeclaration, + id: convertChild(node.name), + members: node.members.map(convertChild) + }); + // check for exports + result = nodeUtils.fixExports(node, result, ast); + /** + * Semantically, decorators are not allowed on enum declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + result.decorators = convertDecorators(node.decorators); + } + break; + } + + case SyntaxKind.EnumMember: { + Object.assign(result, { + type: AST_NODE_TYPES.TSEnumMember, + id: convertChild(node.name) + }); + if (node.initializer) { + result.initializer = convertChild(node.initializer); + } + break; + } + default: deeplyCopy(); } diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 91e31ee9f3a3..011d5c43f0c1 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -19,7 +19,7 @@ "license": "BSD-2-Clause", "devDependencies": { "babel-code-frame": "^6.22.0", - "babylon": "^7.0.0-beta.19", + "babylon": "^7.0.0-beta.20", "eslint": "3.19.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "4.2.2", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index 67e4af3599d1..fbae9005cded 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -421,7 +421,12 @@ const fixturePatternsToTest = [ "typescript/basics/async-function-expression.src.ts", "typescript/basics/async-function-with-var-declaration.src.ts", "typescript/basics/function-with-await.src.ts", - "typescript/errorRecovery/class-extends-empty-implements.src.ts" + "typescript/errorRecovery/class-extends-empty-implements.src.ts", + + { + pattern: "typescript/basics/export-named-enum.src.ts", + config: { babylonParserOptions: { sourceType: "module" } } + } /** * TypeScript-specific tests taken from "errorRecovery". Babylon is not being as forgiving as the TypeScript compiler here. diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-enum.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-enum.src.ts new file mode 100644 index 000000000000..b651108672c9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-named-enum.src.ts @@ -0,0 +1,4 @@ +export enum Foo { + foo = 1, + bar +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 4073d805c02c..aa365e09a82d 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -21856,6 +21856,356 @@ Object { } `; +exports[`typescript fixtures/basics/export-named-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "TSEnumMember", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 40, + ], + "type": "TSEnumDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/export-type-alias-declaration.src 1`] = ` Object { "body": Array [ @@ -53468,18 +53818,7 @@ Object { "type": "Decorator", }, ], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "members": Array [], - "name": Object { + "id": Object { "loc": Object { "end": Object { "column": 11, @@ -53497,6 +53836,17 @@ Object { ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], "range": Array [ 0, 14, From 946c12e84eeecb3e4109e5b6d5f4afea51595d49 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sat, 19 Aug 2017 11:41:22 -0400 Subject: [PATCH 197/326] Build: changelog update for 6.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 783812ba49cc..ccc906f7e73c 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,15 @@ +v6.0.0 - August 19, 2017 + +* 32c0cc8 Breaking: Explicitly handle TSEnumDeclaration (fixes #345) (#364) (James Henry) +* 5f741a9 Fix: Allow other orderings of implements/extends clauses (fixes #361) (#363) (Jed Fox) +* f5bd145 Chore: Breakout and label TS-specific AST comparison tests (#360) (James Henry) +* f6e56b3 Chore: Build out AST comparison tests and categorize issues (#358) (James Henry) +* ab4e05e Breaking: Only add .implements/.accessibility/.decorators if truthy (#354) (James Henry) +* 275897b Fix: Location data for methods and constructors (#357) (James Henry) +* 5fce5e7 Fix: Exp. operator assignment is AssignmentExpression (fixes #355) (#356) (James Henry) +* 67971de Fix: Include newlines at the end of source in AST (fixes #352) (#353) (James Henry) +* 8406209 Fix: Remove start and end values from JSX tokens (fixes #341) (#351) (James Henry) + v5.0.1 - August 9, 2017 * 81e20c0 Fix: Only warn about an unsupported TypeScript version once (#347) (Jed Fox) From bad870fb37091258ec06ae979a6be014cb1190cd Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sat, 19 Aug 2017 11:41:23 -0400 Subject: [PATCH 198/326] 6.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 011d5c43f0c1..37da99424af7 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "5.0.1", + "version": "6.0.0", "files": [ "lib", "parser.js" From a3839719ff59e2ae4980e5c6249108b99650f77f Mon Sep 17 00:00:00 2001 From: James Henry Date: Sat, 19 Aug 2017 18:18:12 +0100 Subject: [PATCH 199/326] Fix: Ensure modifiers are applied to enums (fixes #365) (#366) --- .../lib/ast-node-types.js | 7 + .../typescript-eslint-parser/lib/convert.js | 50 +- .../tests/ast-alignment/spec.js | 2 + .../typescript/basics/const-enum.src.ts | 4 + .../errorRecovery/enum-with-keywords.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 749 ++++++++++++++++++ 6 files changed, 812 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/const-enum.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 3b9f20a85dff..fcd6ab6ccb17 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -101,9 +101,11 @@ module.exports = { * TS-prefixed nodes */ TSAbstractClassProperty: "TSAbstractClassProperty", + TSAbstractKeyword: "TSAbstractKeyword", TSAbstractMethodDefinition: "TSAbstractMethodDefinition", TSAnyKeyword: "TSAnyKeyword", TSArrayType: "TSArrayType", + TSAsyncKeyword: "TSAsyncKeyword", TSBooleanKeyword: "TSBooleanKeyword", TSConstructorType: "TSConstructorType", TSConstructSignature: "TSConstructSignature", @@ -125,9 +127,14 @@ module.exports = { TSNumberKeyword: "TSNumberKeyword", TSObjectKeyword: "TSObjectKeyword", TSParameterProperty: "TSParameterProperty", + TSPrivateKeyword: "TSPrivateKeyword", TSPropertySignature: "TSPropertySignature", + TSProtectedKeyword: "TSProtectedKeyword", + TSPublicKeyword: "TSPublicKeyword", TSQualifiedName: "TSQualifiedName", TSQuestionToken: "TSQuestionToken", + TSReadonlyKeyword: "TSReadonlyKeyword", + TSStaticKeyword: "TSStaticKeyword", TSStringKeyword: "TSStringKeyword", TSTypeLiteral: "TSTypeLiteral", TSTypePredicate: "TSTypePredicate", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 247e16201e19..9e6301ea3b7a 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -330,6 +330,52 @@ module.exports = function convert(config) { return tagNameToken; } + /** + * Applies the given TS modifiers to the given result object. + * @param {TSNode[]} modifiers original TSNodes from the node.modifiers array + * @returns {void} (the current result object will be mutated) + */ + function applyModifiersToResult(modifiers) { + if (!modifiers || !modifiers.length) { + return; + } + /** + * Some modifiers are explicitly handled by applying them as + * boolean values on the result node. As well as adding them + * to the result, we remove them from the array, so that they + * are not handled twice. + */ + const handledModifierIndices = {}; + for (let i = 0; i < modifiers.length; i++) { + const modifier = modifiers[i]; + switch (modifier.kind) { + /** + * Ignore ExportKeyword and DefaultKeyword, they are handled + * via the fixExports utility function + */ + case SyntaxKind.ExportKeyword: + case SyntaxKind.DefaultKeyword: + handledModifierIndices[i] = true; + break; + case SyntaxKind.ConstKeyword: + result.const = true; + handledModifierIndices[i] = true; + break; + default: + } + } + /** + * If there are still valid modifiers available which have + * not been explicitly handled above, we just convert and + * add the modifiers array to the result node. + */ + const remainingModifiers = modifiers.filter((_, i) => !handledModifierIndices[i]); + if (!remainingModifiers || !remainingModifiers.length) { + return; + } + result.modifiers = remainingModifiers.map(convertChild); + } + /** * The core of the conversion logic: * Identify and convert each relevant TypeScript SyntaxKind @@ -2000,7 +2046,9 @@ module.exports = function convert(config) { id: convertChild(node.name), members: node.members.map(convertChild) }); - // check for exports + // apply modifiers first... + applyModifiersToResult(node.modifiers); + // ...then check for exports result = nodeUtils.fixExports(node, result, ast); /** * Semantically, decorators are not allowed on enum declarations, diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index fbae9005cded..a98120d98c34 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -422,6 +422,7 @@ const fixturePatternsToTest = [ "typescript/basics/async-function-with-var-declaration.src.ts", "typescript/basics/function-with-await.src.ts", "typescript/errorRecovery/class-extends-empty-implements.src.ts", + "typescript/basics/const-enum.src.ts", { pattern: "typescript/basics/export-named-enum.src.ts", @@ -435,6 +436,7 @@ const fixturePatternsToTest = [ // "typescript/errorRecovery/class-empty-extends.src.ts", // babylon parse errors // "typescript/errorRecovery/decorator-on-enum-declaration.src.ts", // babylon parse errors // "typescript/errorRecovery/interface-property-modifiers.src.ts", // babylon parse errors + // "typescript/errorRecovery/enum-with-keywords.src.ts" // babylon parse errors /** * Other babylon parse errors. TODO: Need to coordinate with TS Team. diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/const-enum.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/const-enum.src.ts new file mode 100644 index 000000000000..40f9491211d2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/const-enum.src.ts @@ -0,0 +1,4 @@ +const enum Foo { + foo = 1, + bar +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts new file mode 100644 index 000000000000..a568bf4fcc43 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/enum-with-keywords.src.ts @@ -0,0 +1 @@ +export private public protected static readonly abstract async enum X {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index aa365e09a82d..2f23cc1839c2 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -19403,6 +19403,338 @@ Object { } `; +exports[`typescript fixtures/basics/const-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "const": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSEnumMember", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 0, + 39, + ], + "type": "TSEnumDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/declare-class-with-optional-method.src 1`] = ` Object { "body": Array [ @@ -53983,6 +54315,423 @@ Object { } `; +exports[`typescript fixtures/errorRecovery/enum-with-keywords.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "members": Array [], + "modifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "TSPrivateKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSPublicKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 31, + ], + "type": "TSProtectedKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStaticKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 47, + ], + "type": "TSReadonlyKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 56, + ], + "type": "TSAbstractKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 62, + ], + "type": "TSAsyncKeyword", + }, + ], + "range": Array [ + 63, + 72, + ], + "type": "TSEnumDeclaration", + }, + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 31, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 47, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 56, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 62, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 67, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/errorRecovery/interface-empty-extends.src 1`] = ` Object { "body": Array [ From aadff2a3f7ecb4664d8fab1aaf11948f9746013b Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sat, 19 Aug 2017 13:24:00 -0400 Subject: [PATCH 200/326] Build: changelog update for 6.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index ccc906f7e73c..f07018671f9e 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v6.0.1 - August 19, 2017 + +* 7bcc0d6 Fix: Ensure modifiers are applied to enums (fixes #365) (#366) (James Henry) + v6.0.0 - August 19, 2017 * 32c0cc8 Breaking: Explicitly handle TSEnumDeclaration (fixes #345) (#364) (James Henry) From ba92285a29262500ede3741fac7e32dbc6c538ae Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sat, 19 Aug 2017 13:24:01 -0400 Subject: [PATCH 201/326] 6.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 37da99424af7..ef9a983f15a1 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "6.0.0", + "version": "6.0.1", "files": [ "lib", "parser.js" From 1f1b27acfaa9697bbc7cde934a5928aeb1461413 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 20 Aug 2017 14:25:46 +0100 Subject: [PATCH 202/326] Fix: Typo in TSExportAssignment node type (#367) --- packages/typescript-eslint-parser/lib/ast-node-types.js | 2 +- .../typescript-eslint-parser/tests/ast-alignment/spec.js | 5 ++++- .../tests/lib/__snapshots__/typescript.js.snap | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index fcd6ab6ccb17..69236ed85a0f 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -112,7 +112,7 @@ module.exports = { TSDeclareKeyword: "TSDeclareKeyword", TSEnumDeclaration: "TSEnumDeclaration", TSEnumMember: "TSEnumMember", - TSExportAssignment: "TSExportAssigment", + TSExportAssignment: "TSExportAssignment", TSIndexSignature: "TSIndexSignature", TSInterfaceBody: "TSInterfaceBody", TSInterfaceDeclaration: "TSInterfaceDeclaration", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index a98120d98c34..188ff0c5558b 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -427,6 +427,10 @@ const fixturePatternsToTest = [ { pattern: "typescript/basics/export-named-enum.src.ts", config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "typescript/basics/export-assignment.src.ts", + config: { babylonParserOptions: { sourceType: "module" } } } /** @@ -488,7 +492,6 @@ const fixturePatternsToTest = [ // "typescript/basics/class-with-type-parameter.src.ts", // "typescript/basics/declare-function.src.ts", // "typescript/basics/destructuring-assignment.src.ts", - // "typescript/basics/export-assignment.src.ts", // "typescript/basics/export-default-class-with-generic.src.ts", // "typescript/basics/export-default-class-with-multiple-generics.src.ts", // "typescript/basics/export-named-class-with-generic.src.ts", diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 2f23cc1839c2..bb6bfe6ced29 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -20900,7 +20900,7 @@ Object { 0, 13, ], - "type": "TSExportAssigment", + "type": "TSExportAssignment", }, ], "loc": Object { From 13607fd070cc0b04383e8115a995ded0d0938a70 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 21 Aug 2017 17:39:52 +0100 Subject: [PATCH 203/326] Breaking: Handle TSModuleDeclaration and refactor (fixes #371) (#372) --- .../typescript-eslint-parser/lib/convert.js | 16 ++ .../tests/ast-alignment/spec.js | 4 + .../lib/__snapshots__/typescript.js.snap | 148 ++++++------------ 3 files changed, 67 insertions(+), 101 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 9e6301ea3b7a..e6ada8379629 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -361,6 +361,10 @@ module.exports = function convert(config) { result.const = true; handledModifierIndices[i] = true; break; + case SyntaxKind.DeclareKeyword: + result.declare = true; + handledModifierIndices[i] = true; + break; default: } } @@ -2072,6 +2076,18 @@ module.exports = function convert(config) { break; } + case SyntaxKind.ModuleDeclaration: { + Object.assign(result, { + type: AST_NODE_TYPES.TSModuleDeclaration, + id: convertChild(node.name) + }); + applyModifiersToResult(node.modifiers); + if (node.body) { + result.body = convertChild(node.body); + } + break; + } + default: deeplyCopy(); } diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index 188ff0c5558b..a014341e0b4d 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -549,6 +549,10 @@ const fixturePatternsToTest = [ // "typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts", // "typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts", // "typescript/namespaces-and-modules/module-with-default-exports.src.ts", + + /** + * Requires fix in https://github.com/babel/babylon/pull/684 + */ // "typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts" ]; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index bb6bfe6ced29..70650d0bd09c 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -60668,36 +60668,8 @@ Object { ], "type": "TSModuleBlock", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "modifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "TSDeclareKeyword", - }, - ], - "name": Object { + "declare": true, + "id": Object { "loc": Object { "end": Object { "column": 29, @@ -60716,6 +60688,16 @@ Object { "type": "Literal", "value": "i-use-things", }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, 56, @@ -61165,36 +61147,8 @@ Object { ], "type": "TSModuleBlock", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "modifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "TSDeclareKeyword", - }, - ], - "name": Object { + "declare": true, + "id": Object { "loc": Object { "end": Object { "column": 20, @@ -61212,6 +61166,16 @@ Object { ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, 84, @@ -61881,17 +61845,7 @@ Object { ], "type": "TSModuleBlock", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 6, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": Object { + "id": Object { "loc": Object { "end": Object { "column": 12, @@ -61910,6 +61864,16 @@ Object { "type": "Literal", "value": "foo", }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, 112, @@ -62410,36 +62374,8 @@ exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-dec Object { "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "modifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "TSDeclareKeyword", - }, - ], - "name": Object { + "declare": true, + "id": Object { "loc": Object { "end": Object { "column": 31, @@ -62458,6 +62394,16 @@ Object { "type": "Literal", "value": "hot-new-module", }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, 32, From 89154fdaacd618b26e1367e69f241adbff54dd53 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 21 Aug 2017 17:41:17 +0100 Subject: [PATCH 204/326] Breaking: Check for isTypeKeyword in type params (fixes #373) (#374) --- .../typescript-eslint-parser/lib/convert.js | 43 +++-- .../lib/node-utils.js | 24 ++- .../tests/ast-alignment/spec.js | 6 +- .../lib/__snapshots__/typescript.js.snap | 169 +----------------- 4 files changed, 62 insertions(+), 180 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index e6ada8379629..d0467d6761ee 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -110,18 +110,30 @@ module.exports = function convert(config) { greaterThanToken.end ], loc: nodeUtils.getLocFor(firstTypeArgument.pos - 1, greaterThanToken.end, ast), - params: typeArguments.map(typeArgument => ({ - type: AST_NODE_TYPES.TSTypeReference, - range: [ - typeArgument.getStart(), - typeArgument.getEnd() - ], - loc: nodeUtils.getLoc(typeArgument, ast), - typeName: convertChild(typeArgument.typeName || typeArgument), - typeParameters: (typeArgument.typeArguments) - ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) - : null - })) + params: typeArguments.map(typeArgument => { + if (nodeUtils.isTypeKeyword(typeArgument.kind)) { + return { + type: AST_NODE_TYPES[`TS${SyntaxKind[typeArgument.kind]}`], + range: [ + typeArgument.getStart(), + typeArgument.getEnd() + ], + loc: nodeUtils.getLoc(typeArgument, ast) + }; + } + return { + type: AST_NODE_TYPES.TSTypeReference, + range: [ + typeArgument.getStart(), + typeArgument.getEnd() + ], + loc: nodeUtils.getLoc(typeArgument, ast), + typeName: convertChild(typeArgument.typeName || typeArgument), + typeParameters: (typeArgument.typeArguments) + ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) + : undefined + }; + }) }; } @@ -794,10 +806,13 @@ module.exports = function convert(config) { value: convertChild(node.initializer), computed: nodeUtils.isComputedProperty(node.name), static: nodeUtils.hasStaticModifierFlag(node), - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), - typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) }); + if (node.type) { + result.typeAnnotation = convertTypeAnnotation(node.type); + } + if (node.decorators) { result.decorators = convertDecorators(node.decorators); } diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index d10207efd51b..40fb339401f1 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -183,7 +183,8 @@ module.exports = { convertToken, convertTokens, getNodeContainer, - isWithinTypeAnnotation + isWithinTypeAnnotation, + isTypeKeyword }; /* eslint-enable no-use-before-define */ @@ -313,6 +314,27 @@ function isJSXToken(node) { ); } +/** + * Returns true if the given TSNode.kind value corresponds to a type keyword + * @param {number} kind TypeScript SyntaxKind + * @returns {boolean} is a type keyword + */ +function isTypeKeyword(kind) { + switch (kind) { + case SyntaxKind.AnyKeyword: + case SyntaxKind.BooleanKeyword: + case SyntaxKind.NeverKeyword: + case SyntaxKind.NumberKeyword: + case SyntaxKind.ObjectKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.SymbolKeyword: + case SyntaxKind.VoidKeyword: + return true; + default: + return false; + } +} + /** * Returns the declaration kind of the given TSNode * @param {TSNode} node TypeScript AST node diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index a014341e0b4d..ddcbea540c90 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -423,6 +423,9 @@ const fixturePatternsToTest = [ "typescript/basics/function-with-await.src.ts", "typescript/errorRecovery/class-extends-empty-implements.src.ts", "typescript/basics/const-enum.src.ts", + "typescript/basics/class-with-readonly-property.src.ts", + "typescript/expressions/call-expression-type-arguments.src.ts", + "typescript/expressions/new-expression-type-arguments.src.ts", { pattern: "typescript/basics/export-named-enum.src.ts", @@ -486,7 +489,6 @@ const fixturePatternsToTest = [ // "typescript/basics/class-with-protected-parameter-properties.src.ts", // "typescript/basics/class-with-public-parameter-properties.src.ts", // "typescript/basics/class-with-readonly-parameter-properties.src.ts", - // "typescript/basics/class-with-readonly-property.src.ts", // "typescript/basics/class-with-type-parameter-default.src.ts", // "typescript/basics/class-with-type-parameter-underscore.src.ts", // "typescript/basics/class-with-type-parameter.src.ts", @@ -544,8 +546,6 @@ const fixturePatternsToTest = [ // "typescript/decorators/property-decorators/property-decorator-instance-member.src.ts", // "typescript/decorators/property-decorators/property-decorator-static-member.src.ts", // "typescript/errorRecovery/interface-empty-extends.src.ts", - // "typescript/expressions/call-expression-type-arguments.src.ts", - // "typescript/expressions/new-expression-type-arguments.src.ts", // "typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts", // "typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts", // "typescript/namespaces-and-modules/module-with-default-exports.src.ts", diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 70650d0bd09c..a4fbe665c084 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -887,25 +887,7 @@ Object { 76, 82, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 2, - }, - "start": Object { - "column": 37, - "line": 2, - }, - }, - "range": Array [ - 76, - 82, - ], - "type": "TSStringKeyword", - }, - "typeParameters": null, + "type": "TSStringKeyword", }, ], "range": Array [ @@ -1342,7 +1324,6 @@ Object { "readonly": false, "static": false, "type": "TSAbstractClassProperty", - "typeAnnotation": null, "value": null, }, Object { @@ -1382,7 +1363,6 @@ Object { "readonly": false, "static": false, "type": "TSAbstractClassProperty", - "typeAnnotation": null, "value": Object { "loc": Object { "end": Object { @@ -1755,7 +1735,6 @@ Object { "readonly": true, "static": false, "type": "TSAbstractClassProperty", - "typeAnnotation": null, "value": Object { "loc": Object { "end": Object { @@ -2209,25 +2188,7 @@ Object { 68, 74, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 68, - 74, - ], - "type": "TSStringKeyword", - }, - "typeParameters": null, + "type": "TSStringKeyword", }, ], "range": Array [ @@ -6645,7 +6606,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -7050,7 +7010,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, Object { "loc": Object { @@ -7086,7 +7045,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -8996,7 +8954,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -9329,7 +9286,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, Object { "loc": Object { @@ -9365,7 +9321,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -9908,7 +9863,6 @@ Object { ], "type": "TSTypeLiteral", }, - "typeParameters": null, }, ], "range": Array [ @@ -10112,25 +10066,7 @@ Object { 104, 107, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 18, - "line": 5, - }, - }, - "range": Array [ - 104, - 107, - ], - "type": "TSAnyKeyword", - }, - "typeParameters": null, + "type": "TSAnyKeyword", }, ], "range": Array [ @@ -11722,7 +11658,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": Object { "loc": Object { "end": Object { @@ -12843,7 +12778,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, Object { @@ -13438,7 +13372,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": Object { "loc": Object { "end": Object { @@ -17862,7 +17795,6 @@ Object { "readonly": true, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": Object { "loc": Object { "end": Object { @@ -27743,25 +27675,7 @@ Object { 62, 68, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 68, - "line": 1, - }, - "start": Object { - "column": 62, - "line": 1, - }, - }, - "range": Array [ - 62, - 68, - ], - "type": "TSStringKeyword", - }, - "typeParameters": null, + "type": "TSStringKeyword", }, ], "range": Array [ @@ -32967,7 +32881,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -35058,25 +34971,7 @@ Object { 35, 41, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSStringKeyword", - }, - "typeParameters": null, + "type": "TSStringKeyword", }, ], "range": Array [ @@ -36897,7 +36792,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": Object { "loc": Object { "end": Object { @@ -37743,7 +37637,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -38221,7 +38114,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -39785,7 +39677,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -51284,7 +51175,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, Object { @@ -51379,7 +51269,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": Object { "arguments": Array [], "callee": Object { @@ -51987,7 +51876,6 @@ Object { "readonly": false, "static": true, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, Object { @@ -52102,7 +51990,6 @@ Object { "readonly": false, "static": true, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, ], @@ -52619,7 +52506,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, Object { @@ -52696,7 +52582,6 @@ Object { "readonly": false, "static": false, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, ], @@ -53069,7 +52954,6 @@ Object { "readonly": false, "static": true, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, Object { @@ -53146,7 +53030,6 @@ Object { "readonly": false, "static": true, "type": "ClassProperty", - "typeAnnotation": null, "value": null, }, ], @@ -59796,7 +59679,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -59885,25 +59767,7 @@ Object { 14, 20, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 20, - ], - "type": "TSNumberKeyword", - }, - "typeParameters": null, + "type": "TSNumberKeyword", }, ], "range": Array [ @@ -60308,7 +60172,6 @@ Object { ], "type": "Identifier", }, - "typeParameters": null, }, ], "range": Array [ @@ -61081,25 +60944,7 @@ Object { 77, 80, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 2, - }, - "start": Object { - "column": 54, - "line": 2, - }, - }, - "range": Array [ - 77, - 80, - ], - "type": "TSAnyKeyword", - }, - "typeParameters": null, + "type": "TSAnyKeyword", }, ], "range": Array [ From 7c5fc48411d94024533eab85c25da97cd5c7e7ff Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 21 Aug 2017 18:23:03 +0100 Subject: [PATCH 205/326] Fix: Ensure exports applied to TSModuleDeclaration (#375) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 5 +- .../tests/ast-alignment/spec.js | 1 + .../nested-internal-module.src.ts | 12 + .../lib/__snapshots__/typescript.js.snap | 1450 +++++++++++++++++ 5 files changed, 1468 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 69236ed85a0f..f577b292ed28 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -113,6 +113,7 @@ module.exports = { TSEnumDeclaration: "TSEnumDeclaration", TSEnumMember: "TSEnumMember", TSExportAssignment: "TSExportAssignment", + TSExportKeyword: "TSExportKeyword", TSIndexSignature: "TSIndexSignature", TSInterfaceBody: "TSInterfaceBody", TSInterfaceDeclaration: "TSInterfaceDeclaration", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index d0467d6761ee..533fc32a1dab 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -2096,10 +2096,13 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.TSModuleDeclaration, id: convertChild(node.name) }); - applyModifiersToResult(node.modifiers); if (node.body) { result.body = convertChild(node.body); } + // apply modifiers first... + applyModifiersToResult(node.modifiers); + // ...then check for exports + result = nodeUtils.fixExports(node, result, ast); break; } diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index ddcbea540c90..2073b7c370f3 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -461,6 +461,7 @@ const fixturePatternsToTest = [ // "typescript/basics/export-type-function-declaration.src.ts", // babylon parse errors // "typescript/basics/interface-with-all-property-types.src.ts", // babylon parse errors // "typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts", // babylon parse errors + // "typescript/namespaces-and-modules/nested-internal-module.src.ts", // babylon parse errors /** * typescript-eslint-parser erroring, but babylon not. diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts new file mode 100644 index 000000000000..3b55650bc894 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/namespaces-and-modules/nested-internal-module.src.ts @@ -0,0 +1,12 @@ +module A { + + export var x = 'hello world' + export class Point { + constructor(public x: number, public y: number) { } + } + export module B { + export interface Id { + name: string; + } + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index a4fbe665c084..39816a1569c5 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -62215,6 +62215,1456 @@ Object { } `; +exports[`typescript fixtures/namespaces-and-modules/nested-internal-module.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "raw": "'hello world'", + "type": "Literal", + "value": "hello world", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 44, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 44, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "constructor", + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 129, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "params": Array [ + Object { + "accessibility": "public", + "export": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 97, + 106, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "range": Array [ + 90, + 106, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "export": false, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "parameter": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "name": "y", + "range": Array [ + 115, + 124, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "range": Array [ + 108, + 124, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 89, + 129, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 135, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "name": "Point", + "range": Array [ + 62, + 67, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 56, + 135, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 49, + 135, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "computed": false, + "export": false, + "initializer": null, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "name": "name", + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 200, + 213, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 206, + 212, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 206, + 212, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 223, + ], + "type": "TSInterfaceBody", + }, + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "name": "Id", + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 223, + ], + "type": "TSInterfaceDeclaration", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 223, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 229, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "name": "B", + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 147, + 229, + ], + "type": "TSModuleDeclaration", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 140, + 229, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 231, + ], + "type": "TSModuleBlock", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "String", + "value": "'hello world'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 62, + 67, + ], + "type": "Identifier", + "value": "Point", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 36, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 108, + 114, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 140, + 146, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 147, + 153, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 172, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 182, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "value": "Id", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 206, + 212, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 24, + "line": 9, + }, + }, + "range": Array [ + 212, + 213, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 222, + 223, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/namespaces-and-modules/shorthand-ambient-module-declaration.src 1`] = ` Object { "body": Array [ From 2158fc6ed4d26fc03e938f79f3a22bff29016f74 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 22 Aug 2017 07:27:57 -0400 Subject: [PATCH 206/326] Build: changelog update for 7.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index f07018671f9e..49d903ea5cc1 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,10 @@ +v7.0.0 - August 22, 2017 + +* 01c34f4 Fix: Ensure exports applied to TSModuleDeclaration (#375) (James Henry) +* 38bd1ae Breaking: Check for isTypeKeyword in type params (fixes #373) (#374) (James Henry) +* 3727956 Breaking: Handle TSModuleDeclaration and refactor (fixes #371) (#372) (James Henry) +* d67ee6c Fix: Typo in TSExportAssignment node type (#367) (James Henry) + v6.0.1 - August 19, 2017 * 7bcc0d6 Fix: Ensure modifiers are applied to enums (fixes #365) (#366) (James Henry) From 823b215a51eda7110642cbb53d49c5d42d00bcae Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 22 Aug 2017 07:27:58 -0400 Subject: [PATCH 207/326] 7.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index ef9a983f15a1..e45f79d07d57 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "6.0.1", + "version": "7.0.0", "files": [ "lib", "parser.js" From 1432db02f4f31eade7655b01e33ad6e47b16ef7c Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 5 Sep 2017 17:11:25 +0100 Subject: [PATCH 208/326] Fix: Location data for typeAnnotations (#378) --- .../typescript-eslint-parser/lib/convert.js | 79 +- .../lib/node-utils.js | 18 + .../typescript-eslint-parser/package.json | 14 +- .../tests/ast-alignment/parse.js | 5 - .../tests/ast-alignment/spec.js | 202 ++- .../type-parameter-whitespace-loc.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 1146 +++++++++-------- .../tests/lib/typescript.js | 2 +- 8 files changed, 800 insertions(+), 667 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 533fc32a1dab..0a22a33176b9 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -85,10 +85,12 @@ module.exports = function convert(config) { */ function convertTypeAnnotation(child) { const annotation = convertChild(child); + const annotationStartCol = child.getFullStart() - 1; + const loc = nodeUtils.getLocFor(annotationStartCol, child.end, ast); return { type: AST_NODE_TYPES.TypeAnnotation, - loc: annotation.loc, - range: annotation.range, + loc, + range: [annotationStartCol, child.end], typeAnnotation: annotation }; } @@ -160,7 +162,7 @@ module.exports = function convert(config) { const constraint = typeParameter.constraint ? convert({ node: typeParameter.constraint, parent: typeParameter, ast, additionalOptions }) - : null; + : undefined; const defaultParameter = typeParameter.default ? convert({ node: typeParameter.default, parent: typeParameter, ast, additionalOptions }) @@ -279,7 +281,7 @@ module.exports = function convert(config) { result.type = customType; Object .keys(node) - .filter(key => !(/^(?:kind|parent|pos|end|flags|modifierFlagsCache|jsDoc)$/.test(key))) + .filter(key => !(/^(?:_children|kind|parent|pos|end|flags|modifierFlagsCache|jsDoc)$/.test(key))) .forEach(key => { if (key === "type") { result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; @@ -392,6 +394,19 @@ module.exports = function convert(config) { result.modifiers = remainingModifiers.map(convertChild); } + /** + * Uses the current TSNode's end location for its `type` to adjust the location data of the given + * ESTreeNode, which should be the parent of the final typeAnnotation node + * @param {ESTreeNode} typeAnnotationParent The node that will have its location data mutated + * @returns {void} + */ + function fixTypeAnnotationParentLocation(typeAnnotationParent) { + const end = node.type.getEnd(); + typeAnnotationParent.range[1] = end; + const loc = nodeUtils.getLocFor(typeAnnotationParent.range[0], typeAnnotationParent.range[1], ast); + typeAnnotationParent.loc = loc; + } + /** * The core of the conversion logic: * Identify and convert each relevant TypeScript SyntaxKind @@ -619,15 +634,7 @@ module.exports = function convert(config) { if (node.type) { result.id.typeAnnotation = convertTypeAnnotation(node.type); - result.id.range[1] = node.type.getEnd(); - - const identifierEnd = node.name.getEnd(); - const numCharsBetweenTypeAndIdentifier = node.type.getStart() - (node.type.getFullStart() - identifierEnd - ":".length) - identifierEnd; - - result.id.typeAnnotation.range = [ - result.id.typeAnnotation.range[0] - numCharsBetweenTypeAndIdentifier, - result.id.typeAnnotation.range[1] - ]; + fixTypeAnnotationParentLocation(result.id); } break; } @@ -704,7 +711,7 @@ module.exports = function convert(config) { node, parentNode => (parentNode.kind === SyntaxKind.BinaryExpression || parentNode.kind === SyntaxKind.ArrowFunction) - ); + ); const objectAssignNode = ( ancestorNode && ancestorNode.kind === SyntaxKind.BinaryExpression && @@ -806,7 +813,7 @@ module.exports = function convert(config) { value: convertChild(node.initializer), computed: nodeUtils.isComputedProperty(node.name), static: nodeUtils.hasStaticModifierFlag(node), - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined }); if (node.type) { @@ -836,7 +843,12 @@ module.exports = function convert(config) { case SyntaxKind.SetAccessor: case SyntaxKind.MethodDeclaration: { - const openingParen = nodeUtils.findNextToken(node.name, ast); + const openingParen = nodeUtils.findFirstMatchingToken(node.name, ast, token => { + if (!token || !token.kind) { + return false; + } + return nodeUtils.getTextForTokenKind(token.kind) === "("; + }); const methodLoc = ast.getLineAndCharacterOfPosition(openingParen.getStart()), nodeIsMethod = (node.kind === SyntaxKind.MethodDeclaration), @@ -1273,7 +1285,7 @@ module.exports = function convert(config) { if (node.type) { parameter.typeAnnotation = convertTypeAnnotation(node.type); - parameter.range[1] = node.type.getEnd(); + fixTypeAnnotationParentLocation(parameter); } if (node.questionToken) { @@ -1285,10 +1297,10 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.TSParameterProperty, range: [node.getStart(), node.end], loc: nodeUtils.getLoc(node, ast), - accessibility: nodeUtils.getTSNodeAccessibility(node), - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), - static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node), + accessibility: nodeUtils.getTSNodeAccessibility(node) || undefined, + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined, parameter: result }; } @@ -1941,9 +1953,9 @@ module.exports = function convert(config) { key: convertChild(node.name), params: convertParameters(node.parameters), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined }); const accessibility = nodeUtils.getTSNodeAccessibility(node); @@ -1961,14 +1973,14 @@ module.exports = function convert(config) { case SyntaxKind.PropertySignature: { Object.assign(result, { type: AST_NODE_TYPES.TSPropertySignature, - optional: nodeUtils.isOptional(node), + optional: nodeUtils.isOptional(node) || undefined, computed: nodeUtils.isComputedProperty(node.name), key: convertChild(node.name), - typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, - initializer: convertChild(node.initializer), - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), - static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) + typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : undefined, + initializer: convertChild(node.initializer) || undefined, + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined }); const accessibility = nodeUtils.getTSNodeAccessibility(node); @@ -1984,9 +1996,9 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.TSIndexSignature, index: convertChild(node.parameters[0]), typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node), + readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) + export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined }); const accessibility = nodeUtils.getTSNodeAccessibility(node); @@ -2057,6 +2069,11 @@ module.exports = function convert(config) { parameterName: convertChild(node.parameterName), typeAnnotation: convertTypeAnnotation(node.type) }); + /** + * Specific fix for type-guard location data + */ + result.typeAnnotation.loc = result.typeAnnotation.typeAnnotation.loc; + result.typeAnnotation.range = result.typeAnnotation.typeAnnotation.range; break; case SyntaxKind.EnumDeclaration: { diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 40fb339401f1..da5ffdfc5b91 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -170,6 +170,7 @@ module.exports = { getTSNodeAccessibility, hasStaticModifierFlag, findNextToken, + findFirstMatchingToken, findChildOfKind, findFirstMatchingAncestor, findAncestorOfKind, @@ -413,6 +414,23 @@ function findNextToken(previousToken, parent) { return ts.findNextToken(previousToken, parent); } +/** + * Find the first matching token based on the given predicate function. + * @param {TSToken} previousToken The previous TSToken + * @param {TSNode} parent The parent TSNode + * @param {Function} predicate The predicate function to apply to each checked token + * @returns {TSToken|undefined} a matching TSToken + */ +function findFirstMatchingToken(previousToken, parent, predicate) { + while (previousToken) { + if (predicate(previousToken)) { + return previousToken; + } + previousToken = findNextToken(previousToken, parent); + } + return undefined; +} + /** * Finds the first child TSNode which matches the given kind * @param {TSNode} node The parent TSNode diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index e45f79d07d57..3962a12155c3 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -18,17 +18,17 @@ }, "license": "BSD-2-Clause", "devDependencies": { - "babel-code-frame": "^6.22.0", - "babylon": "^7.0.0-beta.20", - "eslint": "3.19.0", + "babel-code-frame": "^6.26.0", + "babylon": "^7.0.0-beta.22", + "eslint": "4.6.1", "eslint-config-eslint": "4.0.0", - "eslint-plugin-node": "4.2.2", + "eslint-plugin-node": "5.1.1", "eslint-release": "0.10.3", "glob": "^7.1.2", - "jest": "20.0.4", + "jest": "21.0.1", "lodash.isplainobject": "^4.0.6", "npm-license": "0.3.3", - "shelljs": "0.7.7", + "shelljs": "0.7.8", "shelljs-nodecli": "0.1.1", "typescript": "~2.4.0" }, @@ -54,7 +54,7 @@ }, "dependencies": { "lodash.unescape": "4.0.1", - "semver": "5.3.0" + "semver": "5.4.1" }, "peerDependencies": { "typescript": "*" diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js index 9ef4013735b2..11614f60c11d 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js @@ -24,16 +24,11 @@ function parseWithBabylonPluginTypescript(text, parserOptions) { // eslint-disab plugins: [ "jsx", "typescript", - "doExpressions", "objectRestSpread", "decorators", "classProperties", - "exportExtensions", "asyncGenerators", - "functionBind", - "functionSent", "dynamicImport", - "numericSeparator", "estree" ] }, parserOptions)); diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index 2073b7c370f3..d746ef270e81 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -426,7 +426,53 @@ const fixturePatternsToTest = [ "typescript/basics/class-with-readonly-property.src.ts", "typescript/expressions/call-expression-type-arguments.src.ts", "typescript/expressions/new-expression-type-arguments.src.ts", - + "typescript/basics/function-with-types.src.ts", + "typescript/basics/non-null-assertion-operator.src.ts", + "typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts", + "typescript/basics/class-with-accessibility-modifiers.src.ts", + "typescript/basics/class-with-optional-computed-property.src.ts", + "typescript/basics/object-with-escaped-properties.src.ts", + "typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts", + "typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts", + "typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts", + "typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts", + "typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts", + "typescript/basics/function-with-object-type-with-optional-properties.src.ts", + "typescript/basics/function-with-object-type-without-annotation.src.ts", + "typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts", + "typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts", + "typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts", + "typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts", + "typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts", + "typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts", + "typescript/decorators/method-decorators/method-decorator-instance-member.src.ts", + "typescript/decorators/method-decorators/method-decorator-static-member.src.ts", + "typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts", + "typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts", + "typescript/decorators/property-decorators/property-decorator-instance-member.src.ts", + "typescript/decorators/property-decorators/property-decorator-static-member.src.ts", + "typescript/decorators/class-decorators/class-decorator-factory.src.ts", + "typescript/decorators/class-decorators/class-decorator.src.ts", + "typescript/babylon-convergence/type-parameters.src.ts", + "typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts", + "typescript/basics/class-with-type-parameter-default.src.ts", + "typescript/basics/class-with-type-parameter-underscore.src.ts", + "typescript/basics/class-with-type-parameter.src.ts", + "typescript/basics/function-with-type-parameters-that-have-comments.src.ts", + "typescript/basics/function-with-type-parameters-with-constraint.src.ts", + "typescript/basics/function-with-type-parameters.src.ts", + "typescript/basics/type-parameters-comments.src.ts", + "typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts", + "typescript/basics/var-with-type.src.ts", + "typescript/basics/class-with-extends-generic-multiple.src.ts", + "typescript/basics/class-with-extends-generic.src.ts", + "typescript/basics/nested-type-arguments.src.ts", + "typescript/basics/null-and-undefined-type-annotations.src.ts", + "typescript/basics/var-with-dotted-type.src.ts", + "typescript/basics/variable-declaration-type-annotation-spacing.src.ts", + "typescript/basics/class-with-generic-method-default.src.ts", + "typescript/basics/class-with-generic-method.src.ts", + "typescript/basics/type-guard.src.ts", { pattern: "typescript/basics/export-named-enum.src.ts", config: { babylonParserOptions: { sourceType: "module" } } @@ -434,6 +480,22 @@ const fixturePatternsToTest = [ { pattern: "typescript/basics/export-assignment.src.ts", config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "typescript/basics/export-default-class-with-generic.src.ts", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "typescript/basics/export-default-class-with-multiple-generics.src.ts", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "typescript/basics/export-named-class-with-generic.src.ts", + config: { babylonParserOptions: { sourceType: "module" } } + }, + { + pattern: "typescript/basics/export-named-class-with-multiple-generics.src.ts", + config: { babylonParserOptions: { sourceType: "module" } } } /** @@ -446,66 +508,73 @@ const fixturePatternsToTest = [ // "typescript/errorRecovery/enum-with-keywords.src.ts" // babylon parse errors /** - * Other babylon parse errors. TODO: Need to coordinate with TS Team. + * Other babylon parse errors relating to invalid syntax. */ // "typescript/basics/abstract-class-with-abstract-constructor.src.ts", // babylon parse errors - // "typescript/basics/abstract-class-with-abstract-method.src.ts", // babylon parse errors - // "typescript/basics/abstract-class-with-optional-method.src.ts", // babylon parse errors - // "typescript/basics/abstract-interface.src.ts", // babylon parse errors // "typescript/basics/class-with-export-parameter-properties.src.ts", // babylon parse errors // "typescript/basics/class-with-optional-methods.src.ts", // babylon parse errors // "typescript/basics/class-with-static-parameter-properties.src.ts", // babylon parse errors - // "typescript/basics/declare-class-with-optional-method.src.ts", // babylon parse errors - // "typescript/basics/export-type-alias-declaration.src.ts", // babylon parse errors - // "typescript/basics/export-type-class-declaration.src.ts", // babylon parse errors - // "typescript/basics/export-type-function-declaration.src.ts", // babylon parse errors // "typescript/basics/interface-with-all-property-types.src.ts", // babylon parse errors // "typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts", // babylon parse errors - // "typescript/namespaces-and-modules/nested-internal-module.src.ts", // babylon parse errors /** * typescript-eslint-parser erroring, but babylon not. */ // "typescript/basics/arrow-function-with-type-parameters.src.ts" // typescript-eslint-parser parse errors + /* ================================================== */ + /** * TypeScript AST differences which need to be resolved */ - // "typescript/babylon-convergence/type-parameters.src.ts", + + /** + * Identified major AST differences + */ + + /** + * Babylon: ClassDeclaration + abstract: true + * tsep: TSAbstractClassDeclaration + */ // "typescript/basics/abstract-class-with-abstract-properties.src.ts", + + /** + * Babylon: ClassProperty + abstract: true + * tsep: TSAbstractClassProperty + */ // "typescript/basics/abstract-class-with-abstract-readonly-property.src.ts", - // "typescript/basics/class-with-accessibility-modifiers.src.ts", - // "typescript/basics/class-with-extends-generic-multiple.src.ts", - // "typescript/basics/class-with-extends-generic.src.ts", - // "typescript/basics/class-with-generic-method-default.src.ts", - // "typescript/basics/class-with-generic-method.src.ts", + + /** + * Babylon: TSExpressionWithTypeArguments + * tsep: ClassImplements + */ // "typescript/basics/class-with-implements-generic-multiple.src.ts", // "typescript/basics/class-with-implements-generic.src.ts", // "typescript/basics/class-with-implements.src.ts", - // "typescript/basics/class-with-mixin.src.ts", - // "typescript/basics/class-with-optional-computed-property.src.ts", - // "typescript/basics/class-with-optional-properties.src.ts", - // "typescript/basics/class-with-optional-property-undefined.src.ts", - // "typescript/basics/class-with-private-parameter-properties.src.ts", - // "typescript/basics/class-with-protected-parameter-properties.src.ts", - // "typescript/basics/class-with-public-parameter-properties.src.ts", - // "typescript/basics/class-with-readonly-parameter-properties.src.ts", - // "typescript/basics/class-with-type-parameter-default.src.ts", - // "typescript/basics/class-with-type-parameter-underscore.src.ts", - // "typescript/basics/class-with-type-parameter.src.ts", + + /** + * Babylon: TSDeclareFunction + declare: true + * tsep: DeclareFunction + */ // "typescript/basics/declare-function.src.ts", - // "typescript/basics/destructuring-assignment.src.ts", - // "typescript/basics/export-default-class-with-generic.src.ts", - // "typescript/basics/export-default-class-with-multiple-generics.src.ts", - // "typescript/basics/export-named-class-with-generic.src.ts", - // "typescript/basics/export-named-class-with-multiple-generics.src.ts", - // "typescript/basics/function-with-object-type-with-optional-properties.src.ts", - // "typescript/basics/function-with-object-type-without-annotation.src.ts", - // "typescript/basics/function-with-type-parameters-that-have-comments.src.ts", - // "typescript/basics/function-with-type-parameters-with-constraint.src.ts", - // "typescript/basics/function-with-type-parameters.src.ts", + + /** + * Babylon: TSDeclareFunction + * tsep: TSNamespaceFunctionDeclaration + */ + // "typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts", + + /** + * Babylon: FunctionDeclaration + * tsep: TSNamespaceFunctionDeclaration + */ + // "typescript/namespaces-and-modules/module-with-default-exports.src.ts", + + /** + * Other major AST differences (e.g. fundamentally different node types) + */ + // "typescript/basics/class-with-mixin.src.ts", // "typescript/basics/function-with-types-assignation.src.ts", - // "typescript/basics/function-with-types.src.ts", // "typescript/basics/interface-extends-multiple.src.ts", // "typescript/basics/interface-extends.src.ts", // "typescript/basics/interface-type-parameters.src.ts", @@ -514,48 +583,39 @@ const fixturePatternsToTest = [ // "typescript/basics/interface-with-jsdoc.src.ts", // "typescript/basics/interface-with-optional-properties.src.ts", // "typescript/basics/interface-without-type-annotation.src.ts", - // "typescript/basics/nested-type-arguments.src.ts", - // "typescript/basics/non-null-assertion-operator.src.ts", - // "typescript/basics/null-and-undefined-type-annotations.src.ts", - // "typescript/basics/object-with-escaped-properties.src.ts", // "typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts", // "typescript/basics/type-alias-declaration.src.ts", // "typescript/basics/type-alias-object-without-annotation.src.ts", - // "typescript/basics/type-guard.src.ts", - // "typescript/basics/type-parameters-comments.src.ts", // "typescript/basics/typed-this.src.ts", - // "typescript/basics/var-with-dotted-type.src.ts", - // "typescript/basics/var-with-type.src.ts", - // "typescript/basics/variable-declaration-type-annotation-spacing.src.ts", - // "typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts", - // "typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts", - // "typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts", - // "typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts", - // "typescript/decorators/class-decorators/class-decorator-factory.src.ts", - // "typescript/decorators/class-decorators/class-decorator.src.ts", - // "typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts", - // "typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts", - // "typescript/decorators/method-decorators/method-decorator-instance-member.src.ts", - // "typescript/decorators/method-decorators/method-decorator-static-member.src.ts", - // "typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts", - // "typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts", - // "typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts", - // "typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts", - // "typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts", - // "typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts", - // "typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts", - // "typescript/decorators/property-decorators/property-decorator-instance-member.src.ts", - // "typescript/decorators/property-decorators/property-decorator-static-member.src.ts", // "typescript/errorRecovery/interface-empty-extends.src.ts", - // "typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts", - // "typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts", - // "typescript/namespaces-and-modules/module-with-default-exports.src.ts", + // "typescript/basics/class-with-optional-properties.src.ts", + // "typescript/basics/class-with-optional-property-undefined.src.ts", + // "typescript/namespaces-and-modules/nested-internal-module.src.ts", + // "typescript/basics/export-type-function-declaration.src.ts", + // "typescript/basics/export-type-class-declaration.src.ts", + // "typescript/basics/abstract-interface.src.ts", /** - * Requires fix in https://github.com/babel/babylon/pull/684 + * tsep bug - Program.body[0].expression.left.properties[0].value.right is currently showing up + * as `ArrayPattern`, babylon, acorn and espree say it should be `ArrayExpression` + * TODO: Fix this */ - // "typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts" + // "typescript/basics/destructuring-assignment.src.ts", + /** + * Babylon bug for optional or abstract methods? + */ + // "typescript/basics/abstract-class-with-abstract-method.src.ts", // babylon parse errors + // "typescript/basics/abstract-class-with-optional-method.src.ts", // babylon parse errors + // "typescript/basics/declare-class-with-optional-method.src.ts", // babylon parse errors + + /** + * Awaiting feedback on Babylon issue https://github.com/babel/babylon/issues/700 + */ + // "typescript/basics/class-with-private-parameter-properties.src.ts", + // "typescript/basics/class-with-protected-parameter-properties.src.ts", + // "typescript/basics/class-with-public-parameter-properties.src.ts", + // "typescript/basics/class-with-readonly-parameter-properties.src.ts", ]; // Either a string of the pattern, or an object containing the pattern and some additional config diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts new file mode 100644 index 000000000000..56d367c193d4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts @@ -0,0 +1 @@ +function f< T >() {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 39816a1569c5..1983b2d0a968 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -1,5 +1,286 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`typescript fixtures/babylon-convergence/type-parameter-whitespace-loc.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 24, + ], + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "TypeParameter", + }, + ], + "range": Array [ + 10, + 19, + ], + "type": "TypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/babylon-convergence/type-parameters.src 1`] = ` Object { "body": Array [ @@ -817,12 +1098,12 @@ Object { "line": 2, }, "start": Object { - "column": 29, + "column": 27, "line": 2, }, }, "range": Array [ - 68, + 66, 83, ], "type": "TypeAnnotation", @@ -1321,7 +1602,6 @@ Object { 25, 38, ], - "readonly": false, "static": false, "type": "TSAbstractClassProperty", "value": null, @@ -1360,7 +1640,6 @@ Object { 43, 60, ], - "readonly": false, "static": false, "type": "TSAbstractClassProperty", "value": Object { @@ -2102,7 +2381,7 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 17, "line": 2, }, }, @@ -2118,12 +2397,12 @@ Object { "line": 2, }, "start": Object { - "column": 21, + "column": 19, "line": 2, }, }, "range": Array [ - 60, + 58, 75, ], "type": "TypeAnnotation", @@ -2866,7 +3145,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -2887,12 +3166,12 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, + 5, 8, ], "type": "TypeAnnotation", @@ -2945,12 +3224,12 @@ Object { "line": 1, }, "start": Object { - "column": 11, + "column": 9, "line": 1, }, }, "range": Array [ - 11, + 9, 12, ], "type": "TypeAnnotation", @@ -3004,7 +3283,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 2, @@ -4431,7 +4709,6 @@ Object { 14, 35, ], - "readonly": false, "static": false, "type": "ClassProperty", "typeAnnotation": Object { @@ -4441,12 +4718,12 @@ Object { "line": 2, }, "start": Object { - "column": 16, + "column": 14, "line": 2, }, }, "range": Array [ - 28, + 26, 34, ], "type": "TypeAnnotation", @@ -4505,7 +4782,6 @@ Object { 38, 65, ], - "readonly": false, "static": true, "type": "ClassProperty", "typeAnnotation": Object { @@ -4515,12 +4791,12 @@ Object { "line": 3, }, "start": Object { - "column": 22, + "column": 20, "line": 3, }, }, "range": Array [ - 58, + 56, 64, ], "type": "TypeAnnotation", @@ -4876,7 +5152,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 32, "line": 7, }, "start": Object { @@ -4897,12 +5173,12 @@ Object { "line": 7, }, "start": Object { - "column": 26, + "column": 24, "line": 7, }, }, "range": Array [ - 138, + 136, 144, ], "type": "TypeAnnotation", @@ -5823,7 +6099,6 @@ Object { }, "params": Array [ Object { - "accessibility": null, "export": true, "loc": Object { "end": Object { @@ -5838,7 +6113,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 2, }, "start": Object { @@ -5859,12 +6134,12 @@ Object { "line": 2, }, "start": Object { - "column": 26, + "column": 24, "line": 2, }, }, "range": Array [ - 38, + 36, 44, ], "type": "TypeAnnotation", @@ -5891,8 +6166,6 @@ Object { 28, 44, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, ], @@ -6628,7 +6901,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 11, @@ -7509,7 +7781,7 @@ Object { "line": 2, }, "start": Object { - "column": 8, + "column": 11, "line": 2, }, }, @@ -7532,7 +7804,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 10, @@ -7921,7 +8192,7 @@ Object { "line": 2, }, "start": Object { - "column": 8, + "column": 17, "line": 2, }, }, @@ -7944,7 +8215,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "default": Object { "loc": Object { "end": Object { @@ -9697,7 +9967,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, + "column": 45, "line": 1, }, "start": Object { @@ -9718,12 +9988,12 @@ Object { "line": 1, }, "start": Object { - "column": 44, + "column": 42, "line": 1, }, }, "range": Array [ - 44, + 42, 45, ], "type": "TypeAnnotation", @@ -10224,7 +10494,7 @@ Object { "argument": Object { "loc": Object { "end": Object { - "column": 34, + "column": 41, "line": 9, }, "start": Object { @@ -10245,12 +10515,12 @@ Object { "line": 9, }, "start": Object { - "column": 36, + "column": 34, "line": 9, }, }, "range": Array [ - 194, + 192, 199, ], "type": "TypeAnnotation", @@ -10319,12 +10589,12 @@ Object { "line": 9, }, "start": Object { - "column": 46, + "column": 44, "line": 9, }, }, "range": Array [ - 204, + 202, 205, ], "type": "TypeAnnotation", @@ -10394,7 +10664,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 18, @@ -11655,7 +11924,6 @@ Object { 14, 43, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": Object { @@ -12023,7 +12291,7 @@ Object { "line": 2, }, "start": Object { - "column": 5, + "column": 6, "line": 2, }, }, @@ -12085,7 +12353,7 @@ Object { "line": 3, }, "start": Object { - "column": 5, + "column": 6, "line": 3, }, }, @@ -12101,12 +12369,12 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 32, + 30, 38, ], "type": "TypeAnnotation", @@ -12182,7 +12450,7 @@ Object { "line": 4, }, "start": Object { - "column": 13, + "column": 14, "line": 4, }, }, @@ -12198,12 +12466,12 @@ Object { "line": 4, }, "start": Object { - "column": 18, + "column": 16, "line": 4, }, }, "range": Array [ - 58, + 56, 64, ], "type": "TypeAnnotation", @@ -12775,7 +13043,6 @@ Object { 14, 19, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": null, @@ -12815,7 +13082,6 @@ Object { 22, 36, ], - "readonly": false, "static": false, "type": "ClassProperty", "typeAnnotation": Object { @@ -12825,12 +13091,12 @@ Object { "line": 3, }, "start": Object { - "column": 9, + "column": 7, "line": 3, }, }, "range": Array [ - 29, + 27, 35, ], "type": "TypeAnnotation", @@ -12890,7 +13156,6 @@ Object { 39, 61, ], - "readonly": false, "static": false, "type": "ClassProperty", "typeAnnotation": Object { @@ -12900,12 +13165,12 @@ Object { "line": 4, }, "start": Object { - "column": 17, + "column": 15, "line": 4, }, }, "range": Array [ - 54, + 52, 60, ], "type": "TypeAnnotation", @@ -13369,7 +13634,6 @@ Object { 12, 37, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": Object { @@ -13724,7 +13988,6 @@ Object { "params": Array [ Object { "accessibility": "private", - "export": false, "loc": Object { "end": Object { "column": 39, @@ -13738,7 +14001,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 2, }, "start": Object { @@ -13759,12 +14022,12 @@ Object { "line": 2, }, "start": Object { - "column": 33, + "column": 31, "line": 2, }, }, "range": Array [ - 45, + 43, 51, ], "type": "TypeAnnotation", @@ -13791,13 +14054,10 @@ Object { 26, 51, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": false, "loc": Object { "end": Object { "column": 47, @@ -13811,7 +14071,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 39, + "column": 47, "line": 3, }, "start": Object { @@ -13832,12 +14092,12 @@ Object { "line": 3, }, "start": Object { - "column": 41, + "column": 39, "line": 3, }, }, "range": Array [ - 94, + 92, 100, ], "type": "TypeAnnotation", @@ -13865,12 +14125,10 @@ Object { 100, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": false, "loc": Object { "end": Object { "column": 38, @@ -13885,7 +14143,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 25, + "column": 33, "line": 4, }, "start": Object { @@ -13906,12 +14164,12 @@ Object { "line": 4, }, "start": Object { - "column": 27, + "column": 25, "line": 4, }, }, "range": Array [ - 129, + 127, 135, ], "type": "TypeAnnotation", @@ -13973,13 +14231,10 @@ Object { 116, 140, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": false, "loc": Object { "end": Object { "column": 55, @@ -13994,7 +14249,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 38, + "column": 47, "line": 5, }, "start": Object { @@ -14015,12 +14270,12 @@ Object { "line": 5, }, "start": Object { - "column": 40, + "column": 38, "line": 5, }, }, "range": Array [ - 182, + 180, 189, ], "type": "TypeAnnotation", @@ -14083,7 +14338,6 @@ Object { 197, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, ], @@ -14859,7 +15113,6 @@ Object { "params": Array [ Object { "accessibility": "protected", - "export": false, "loc": Object { "end": Object { "column": 41, @@ -14873,7 +15126,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { @@ -14894,12 +15147,12 @@ Object { "line": 2, }, "start": Object { - "column": 35, + "column": 33, "line": 2, }, }, "range": Array [ - 47, + 45, 53, ], "type": "TypeAnnotation", @@ -14926,13 +15179,10 @@ Object { 26, 53, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "protected", - "export": false, "loc": Object { "end": Object { "column": 49, @@ -14946,7 +15196,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 41, + "column": 49, "line": 3, }, "start": Object { @@ -14967,12 +15217,12 @@ Object { "line": 3, }, "start": Object { - "column": 43, + "column": 41, "line": 3, }, }, "range": Array [ - 98, + 96, 104, ], "type": "TypeAnnotation", @@ -15000,12 +15250,10 @@ Object { 104, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "protected", - "export": false, "loc": Object { "end": Object { "column": 40, @@ -15020,7 +15268,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 27, + "column": 35, "line": 4, }, "start": Object { @@ -15041,12 +15289,12 @@ Object { "line": 4, }, "start": Object { - "column": 29, + "column": 27, "line": 4, }, }, "range": Array [ - 135, + 133, 141, ], "type": "TypeAnnotation", @@ -15108,13 +15356,10 @@ Object { 120, 146, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "protected", - "export": false, "loc": Object { "end": Object { "column": 57, @@ -15129,7 +15374,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 40, + "column": 49, "line": 5, }, "start": Object { @@ -15150,12 +15395,12 @@ Object { "line": 5, }, "start": Object { - "column": 42, + "column": 40, "line": 5, }, }, "range": Array [ - 190, + 188, 197, ], "type": "TypeAnnotation", @@ -15218,7 +15463,6 @@ Object { 205, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, ], @@ -15994,7 +16238,6 @@ Object { "params": Array [ Object { "accessibility": "public", - "export": false, "loc": Object { "end": Object { "column": 38, @@ -16008,7 +16251,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 30, + "column": 38, "line": 2, }, "start": Object { @@ -16029,12 +16272,12 @@ Object { "line": 2, }, "start": Object { - "column": 32, + "column": 30, "line": 2, }, }, "range": Array [ - 44, + 42, 50, ], "type": "TypeAnnotation", @@ -16061,13 +16304,10 @@ Object { 26, 50, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": false, "loc": Object { "end": Object { "column": 46, @@ -16081,7 +16321,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 38, + "column": 46, "line": 3, }, "start": Object { @@ -16102,12 +16342,12 @@ Object { "line": 3, }, "start": Object { - "column": 40, + "column": 38, "line": 3, }, }, "range": Array [ - 92, + 90, 98, ], "type": "TypeAnnotation", @@ -16135,12 +16375,10 @@ Object { 98, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": false, "loc": Object { "end": Object { "column": 37, @@ -16155,7 +16393,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 4, }, "start": Object { @@ -16176,12 +16414,12 @@ Object { "line": 4, }, "start": Object { - "column": 26, + "column": 24, "line": 4, }, }, "range": Array [ - 126, + 124, 132, ], "type": "TypeAnnotation", @@ -16243,13 +16481,10 @@ Object { 114, 137, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": false, "loc": Object { "end": Object { "column": 54, @@ -16264,7 +16499,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 37, + "column": 46, "line": 5, }, "start": Object { @@ -16285,12 +16520,12 @@ Object { "line": 5, }, "start": Object { - "column": 39, + "column": 37, "line": 5, }, }, "range": Array [ - 178, + 176, 185, ], "type": "TypeAnnotation", @@ -16353,7 +16588,6 @@ Object { 193, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, ], @@ -17128,8 +17362,6 @@ Object { }, "params": Array [ Object { - "accessibility": null, - "export": false, "loc": Object { "end": Object { "column": 40, @@ -17143,7 +17375,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 32, + "column": 40, "line": 2, }, "start": Object { @@ -17164,12 +17396,12 @@ Object { "line": 2, }, "start": Object { - "column": 34, + "column": 32, "line": 2, }, }, "range": Array [ - 46, + 44, 52, ], "type": "TypeAnnotation", @@ -17197,12 +17429,9 @@ Object { 52, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, Object { - "accessibility": null, - "export": false, "loc": Object { "end": Object { "column": 49, @@ -17217,7 +17446,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 3, }, "start": Object { @@ -17238,12 +17467,12 @@ Object { "line": 3, }, "start": Object { - "column": 33, + "column": 31, "line": 3, }, }, "range": Array [ - 87, + 85, 93, ], "type": "TypeAnnotation", @@ -17306,7 +17535,6 @@ Object { 103, ], "readonly": true, - "static": false, "type": "TSParameterProperty", }, ], @@ -18147,8 +18375,6 @@ Object { }, "params": Array [ Object { - "accessibility": null, - "export": false, "loc": Object { "end": Object { "column": 32, @@ -18162,7 +18388,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 2, }, "start": Object { @@ -18183,12 +18409,12 @@ Object { "line": 2, }, "start": Object { - "column": 26, + "column": 24, "line": 2, }, }, "range": Array [ - 38, + 36, 44, ], "type": "TypeAnnotation", @@ -18215,7 +18441,6 @@ Object { 28, 44, ], - "readonly": false, "static": true, "type": "TSParameterProperty", }, @@ -18604,7 +18829,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 11, @@ -18847,7 +19071,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "default": Object { "loc": Object { "end": Object { @@ -19161,7 +19384,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 11, @@ -19723,7 +19945,7 @@ Object { "line": 2, }, "start": Object { - "column": 7, + "column": 8, "line": 2, }, }, @@ -19739,12 +19961,12 @@ Object { "line": 2, }, "start": Object { - "column": 12, + "column": 10, "line": 2, }, }, "range": Array [ - 32, + 30, 35, ], "type": "TypeAnnotation", @@ -20099,7 +20321,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 1, }, "start": Object { @@ -20120,12 +20342,12 @@ Object { "line": 1, }, "start": Object { - "column": 26, + "column": 24, "line": 1, }, }, "range": Array [ - 26, + 24, 32, ], "type": "TypeAnnotation", @@ -20160,12 +20382,12 @@ Object { "line": 1, }, "start": Object { - "column": 35, + "column": 33, "line": 1, }, }, "range": Array [ - 35, + 33, 41, ], "type": "TypeAnnotation", @@ -20981,7 +21203,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 22, @@ -21242,7 +21463,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 22, @@ -21261,7 +21481,6 @@ Object { "type": "TypeParameter", }, Object { - "constraint": null, "loc": Object { "end": Object { "column": 25, @@ -21575,7 +21794,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 18, @@ -21855,7 +22073,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 18, @@ -21874,7 +22091,6 @@ Object { "type": "TypeParameter", }, Object { - "constraint": null, "loc": Object { "end": Object { "column": 21, @@ -22805,8 +23021,6 @@ Object { "members": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -22835,13 +23049,10 @@ Object { "line": 2, }, }, - "optional": false, "range": Array [ 35, 48, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -22850,12 +23061,12 @@ Object { "line": 2, }, "start": Object { - "column": 11, + "column": 9, "line": 2, }, }, "range": Array [ - 42, + 40, 48, ], "type": "TypeAnnotation", @@ -23179,7 +23390,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 37, "line": 1, }, "start": Object { @@ -23200,12 +23411,12 @@ Object { "line": 1, }, "start": Object { - "column": 31, + "column": 29, "line": 1, }, }, "range": Array [ - 31, + 29, 37, ], "type": "TypeAnnotation", @@ -23241,12 +23452,12 @@ Object { "line": 1, }, "start": Object { - "column": 42, + "column": 40, "line": 1, }, }, "range": Array [ - 42, + 40, 46, ], "type": "TypeAnnotation", @@ -23969,7 +24180,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 45, "line": 1, }, "start": Object { @@ -24105,12 +24316,12 @@ Object { "line": 1, }, "start": Object { - "column": 25, + "column": 23, "line": 1, }, }, "range": Array [ - 25, + 23, 45, ], "type": "TypeAnnotation", @@ -24128,8 +24339,6 @@ Object { "members": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -24163,8 +24372,6 @@ Object { 26, 39, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -24173,12 +24380,12 @@ Object { "line": 1, }, "start": Object { - "column": 32, + "column": 30, "line": 1, }, }, "range": Array [ - 32, + 30, 38, ], "type": "TypeAnnotation", @@ -24203,8 +24410,6 @@ Object { }, Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -24238,10 +24443,7 @@ Object { 40, 44, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", - "typeAnnotation": null, }, ], "range": Array [ @@ -24716,7 +24918,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 43, "line": 1, }, "start": Object { @@ -24852,12 +25054,12 @@ Object { "line": 1, }, "start": Object { - "column": 25, + "column": 23, "line": 1, }, }, "range": Array [ - 25, + 23, 43, ], "type": "TypeAnnotation", @@ -24875,8 +25077,6 @@ Object { "members": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -24905,13 +25105,10 @@ Object { "line": 1, }, }, - "optional": false, "range": Array [ 26, 38, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -24920,12 +25117,12 @@ Object { "line": 1, }, "start": Object { - "column": 31, + "column": 29, "line": 1, }, }, "range": Array [ - 31, + 29, 37, ], "type": "TypeAnnotation", @@ -24950,8 +25147,6 @@ Object { }, Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -24980,15 +25175,11 @@ Object { "line": 1, }, }, - "optional": false, "range": Array [ 39, 42, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", - "typeAnnotation": null, }, ], "range": Array [ @@ -25463,7 +25654,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { @@ -25484,12 +25675,12 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 15, "line": 1, }, }, "range": Array [ - 17, + 15, 18, ], "type": "TypeAnnotation", @@ -25542,12 +25733,12 @@ Object { "line": 1, }, "start": Object { - "column": 21, + "column": 19, "line": 1, }, }, "range": Array [ - 21, + 19, 22, ], "type": "TypeAnnotation", @@ -25601,7 +25792,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 12, @@ -26027,7 +26217,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 29, @@ -26330,7 +26519,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 29, "line": 1, }, "start": Object { @@ -26351,12 +26540,12 @@ Object { "line": 1, }, "start": Object { - "column": 28, + "column": 26, "line": 1, }, }, "range": Array [ - 28, + 26, 29, ], "type": "TypeAnnotation", @@ -26409,12 +26598,12 @@ Object { "line": 1, }, "start": Object { - "column": 32, + "column": 30, "line": 1, }, }, "range": Array [ - 32, + 30, 33, ], "type": "TypeAnnotation", @@ -26986,7 +27175,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { @@ -27007,12 +27196,12 @@ Object { "line": 1, }, "start": Object { - "column": 22, + "column": 21, "line": 1, }, }, "range": Array [ - 22, + 21, 28, ], "type": "TypeAnnotation", @@ -27047,12 +27236,12 @@ Object { "line": 1, }, "start": Object { - "column": 30, + "column": 29, "line": 1, }, }, "range": Array [ - 30, + 29, 36, ], "type": "TypeAnnotation", @@ -27443,7 +27632,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { @@ -27464,12 +27653,12 @@ Object { "line": 1, }, "start": Object { - "column": 22, + "column": 21, "line": 1, }, }, "range": Array [ - 22, + 21, 28, ], "type": "TypeAnnotation", @@ -27496,7 +27685,7 @@ Object { "left": Object { "loc": Object { "end": Object { - "column": 33, + "column": 40, "line": 1, }, "start": Object { @@ -27517,12 +27706,12 @@ Object { "line": 1, }, "start": Object { - "column": 34, + "column": 33, "line": 1, }, }, "range": Array [ - 34, + 33, 40, ], "type": "TypeAnnotation", @@ -27584,7 +27773,7 @@ Object { "argument": Object { "loc": Object { "end": Object { - "column": 55, + "column": 69, "line": 1, }, "start": Object { @@ -27605,12 +27794,12 @@ Object { "line": 1, }, "start": Object { - "column": 56, + "column": 55, "line": 1, }, }, "range": Array [ - 56, + 55, 69, ], "type": "TypeAnnotation", @@ -27715,12 +27904,12 @@ Object { "line": 1, }, "start": Object { - "column": 71, + "column": 70, "line": 1, }, }, "range": Array [ - 71, + 70, 77, ], "type": "TypeAnnotation", @@ -28859,7 +29048,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 15, @@ -29042,8 +29230,6 @@ Object { "body": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -29072,13 +29258,10 @@ Object { "line": 2, }, }, - "optional": false, "range": Array [ 20, 32, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -29087,12 +29270,12 @@ Object { "line": 2, }, "start": Object { - "column": 9, + "column": 7, "line": 2, }, }, "range": Array [ - 25, + 23, 31, ], "type": "TypeAnnotation", @@ -29117,8 +29300,6 @@ Object { }, Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -29152,8 +29333,6 @@ Object { 37, 50, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -29162,12 +29341,12 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 43, + 41, 49, ], "type": "TypeAnnotation", @@ -29192,8 +29371,6 @@ Object { }, Object { "computed": true, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -29222,13 +29399,10 @@ Object { "line": 4, }, }, - "optional": false, "range": Array [ 55, 69, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -29237,12 +29411,12 @@ Object { "line": 4, }, "start": Object { - "column": 11, + "column": 9, "line": 4, }, }, "range": Array [ - 62, + 60, 68, ], "type": "TypeAnnotation", @@ -29267,8 +29441,6 @@ Object { }, Object { "computed": true, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -29302,8 +29474,6 @@ Object { 74, 89, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -29312,12 +29482,12 @@ Object { "line": 5, }, "start": Object { - "column": 12, + "column": 10, "line": 5, }, }, "range": Array [ - 82, + 80, 88, ], "type": "TypeAnnotation", @@ -29341,11 +29511,10 @@ Object { }, }, Object { - "export": false, "index": Object { "loc": Object { "end": Object { - "column": 8, + "column": 16, "line": 6, }, "start": Object { @@ -29366,12 +29535,12 @@ Object { "line": 6, }, "start": Object { - "column": 10, + "column": 8, "line": 6, }, }, "range": Array [ - 100, + 98, 106, ], "type": "TypeAnnotation", @@ -29408,7 +29577,6 @@ Object { 94, 116, ], - "readonly": false, "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -29418,12 +29586,12 @@ Object { "line": 6, }, "start": Object { - "column": 19, + "column": 17, "line": 6, }, }, "range": Array [ - 109, + 107, 115, ], "type": "TypeAnnotation", @@ -29447,11 +29615,10 @@ Object { }, }, Object { - "export": false, "index": Object { "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 7, }, "start": Object { @@ -29473,12 +29640,12 @@ Object { "line": 7, }, "start": Object { - "column": 11, + "column": 9, "line": 7, }, }, "range": Array [ - 128, + 126, 134, ], "type": "TypeAnnotation", @@ -29515,7 +29682,6 @@ Object { 121, 144, ], - "readonly": false, "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -29525,12 +29691,12 @@ Object { "line": 7, }, "start": Object { - "column": 20, + "column": 18, "line": 7, }, }, "range": Array [ - 137, + 135, 143, ], "type": "TypeAnnotation", @@ -29555,7 +29721,6 @@ Object { }, Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -29590,7 +29755,6 @@ Object { 149, 161, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -29600,12 +29764,12 @@ Object { "line": 8, }, "start": Object { - "column": 11, + "column": 9, "line": 8, }, }, "range": Array [ - 156, + 154, 160, ], "type": "TypeAnnotation", @@ -29630,7 +29794,6 @@ Object { }, Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -29720,7 +29883,6 @@ Object { 166, 186, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -29730,12 +29892,12 @@ Object { "line": 9, }, "start": Object { - "column": 19, + "column": 17, "line": 9, }, }, "range": Array [ - 181, + 179, 185, ], "type": "TypeAnnotation", @@ -29760,7 +29922,6 @@ Object { }, Object { "computed": true, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -29850,7 +30011,6 @@ Object { 191, 213, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -29860,12 +30020,12 @@ Object { "line": 10, }, "start": Object { - "column": 21, + "column": 19, "line": 10, }, }, "range": Array [ - 208, + 206, 212, ], "type": "TypeAnnotation", @@ -29890,7 +30050,6 @@ Object { }, Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -29980,7 +30139,6 @@ Object { 218, 240, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -29990,12 +30148,12 @@ Object { "line": 11, }, "start": Object { - "column": 21, + "column": 19, "line": 11, }, }, "range": Array [ - 235, + 233, 239, ], "type": "TypeAnnotation", @@ -30030,7 +30188,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 9, @@ -30118,12 +30275,12 @@ Object { "line": 12, }, "start": Object { - "column": 17, + "column": 15, "line": 12, }, }, "range": Array [ - 258, + 256, 264, ], "type": "TypeAnnotation", @@ -30208,12 +30365,12 @@ Object { "line": 13, }, "start": Object { - "column": 20, + "column": 18, "line": 13, }, }, "range": Array [ - 286, + 284, 292, ], "type": "TypeAnnotation", @@ -30248,7 +30405,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 10, @@ -32385,7 +32541,6 @@ Object { "params": Array [ Object { "accessibility": "public", - "export": false, "loc": Object { "end": Object { "column": 17, @@ -32418,13 +32573,10 @@ Object { 26, 34, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": false, "loc": Object { "end": Object { "column": 28, @@ -32457,8 +32609,6 @@ Object { 36, 45, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, ], @@ -32937,7 +33087,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 15, @@ -33271,7 +33420,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 16, @@ -33454,7 +33602,6 @@ Object { "body": Array [ Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -33508,7 +33655,6 @@ Object { 76, 85, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": null, @@ -33758,8 +33904,6 @@ Object { "body": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -33793,15 +33937,10 @@ Object { 21, 26, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", - "typeAnnotation": null, }, Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -33835,8 +33974,6 @@ Object { 31, 44, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -33845,12 +33982,12 @@ Object { "line": 3, }, "start": Object { - "column": 10, + "column": 8, "line": 3, }, }, "range": Array [ - 37, + 35, 43, ], "type": "TypeAnnotation", @@ -33875,7 +34012,6 @@ Object { }, Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -33927,7 +34063,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 26, "line": 4, }, "start": Object { @@ -33949,12 +34085,12 @@ Object { "line": 4, }, "start": Object { - "column": 20, + "column": 18, "line": 4, }, }, "range": Array [ - 65, + 63, 71, ], "type": "TypeAnnotation", @@ -34001,7 +34137,6 @@ Object { 49, 79, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": null, @@ -34557,8 +34692,6 @@ Object { "body": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -34587,15 +34720,11 @@ Object { "line": 2, }, }, - "optional": false, "range": Array [ 21, 25, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", - "typeAnnotation": null, }, ], "loc": Object { @@ -34788,7 +34917,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 44, "line": 1, }, "start": Object { @@ -34809,7 +34938,7 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 15, "line": 1, }, }, @@ -35546,7 +35675,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 33, "line": 1, }, "start": Object { @@ -35568,12 +35697,12 @@ Object { "line": 1, }, "start": Object { - "column": 27, + "column": 25, "line": 1, }, }, "range": Array [ - 27, + 25, 33, ], "type": "TypeAnnotation", @@ -36066,7 +36195,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 5, + "column": 11, "line": 1, }, "start": Object { @@ -36087,7 +36216,7 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, @@ -36156,7 +36285,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 5, + "column": 16, "line": 2, }, "start": Object { @@ -36177,7 +36306,7 @@ Object { "line": 2, }, "start": Object { - "column": 7, + "column": 5, "line": 2, }, }, @@ -36789,7 +36918,6 @@ Object { 68, 79, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": Object { @@ -37711,7 +37839,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 13, @@ -38579,8 +38706,6 @@ Object { "members": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -38609,13 +38734,10 @@ Object { "line": 1, }, }, - "optional": false, "range": Array [ 12, 24, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -38624,12 +38746,12 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 15, "line": 1, }, }, "range": Array [ - 17, + 15, 23, ], "type": "TypeAnnotation", @@ -38654,8 +38776,6 @@ Object { }, Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -38684,15 +38804,11 @@ Object { "line": 1, }, }, - "optional": false, "range": Array [ 25, 28, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", - "typeAnnotation": null, }, ], "range": Array [ @@ -39104,7 +39220,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 24, "line": 1, }, "start": Object { @@ -39125,12 +39241,12 @@ Object { "line": 1, }, "start": Object { - "column": 21, + "column": 19, "line": 1, }, }, "range": Array [ - 21, + 19, 24, ], "type": "TypeAnnotation", @@ -39165,12 +39281,12 @@ Object { "line": 1, }, "start": Object { - "column": 27, + "column": 25, "line": 1, }, }, "range": Array [ - 27, + 25, 38, ], "type": "TypeAnnotation", @@ -39771,7 +39887,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "loc": Object { "end": Object { "column": 25, @@ -39866,7 +39981,6 @@ Object { }, "params": Array [ Object { - "constraint": null, "default": Object { "loc": Object { "end": Object { @@ -40444,7 +40558,6 @@ Object { "body": Array [ Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -40478,7 +40591,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 57, "line": 2, }, "start": Object { @@ -40499,12 +40612,12 @@ Object { "line": 2, }, "start": Object { - "column": 27, + "column": 25, "line": 2, }, }, "range": Array [ - 49, + 47, 79, ], "type": "TypeAnnotation", @@ -40523,7 +40636,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 38, "line": 2, }, "start": Object { @@ -40544,12 +40657,12 @@ Object { "line": 2, }, "start": Object { - "column": 34, + "column": 32, "line": 2, }, }, "range": Array [ - 56, + 54, 60, ], "type": "TypeAnnotation", @@ -40575,7 +40688,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, + "column": 48, "line": 2, }, "start": Object { @@ -40596,12 +40709,12 @@ Object { "line": 2, }, "start": Object { - "column": 43, + "column": 41, "line": 2, }, }, "range": Array [ - 65, + 63, 70, ], "type": "TypeAnnotation", @@ -40655,12 +40768,12 @@ Object { "line": 2, }, "start": Object { - "column": 53, + "column": 51, "line": 2, }, }, "range": Array [ - 75, + 73, 79, ], "type": "TypeAnnotation", @@ -40691,7 +40804,6 @@ Object { 23, 87, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -40701,12 +40813,12 @@ Object { "line": 2, }, "start": Object { - "column": 60, + "column": 58, "line": 2, }, }, "range": Array [ - 82, + 80, 86, ], "type": "TypeAnnotation", @@ -41226,7 +41338,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 1, }, "start": Object { @@ -41247,7 +41359,7 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, @@ -41591,7 +41703,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 1, }, "start": Object { @@ -41612,7 +41724,7 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 8, "line": 1, }, }, @@ -41699,7 +41811,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 2, }, "start": Object { @@ -41720,7 +41832,7 @@ Object { "line": 2, }, "start": Object { - "column": 9, + "column": 7, "line": 2, }, }, @@ -42084,7 +42196,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 5, + "column": 21, "line": 1, }, "start": Object { @@ -42105,7 +42217,7 @@ Object { "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, @@ -47786,7 +47898,7 @@ Object { ], "loc": Object { "end": Object { - "column": 42, + "column": 53, "line": 2, }, "start": Object { @@ -47807,12 +47919,12 @@ Object { "line": 2, }, "start": Object { - "column": 44, + "column": 42, "line": 2, }, }, "range": Array [ - 60, + 58, 69, ], "type": "TypeAnnotation", @@ -48540,7 +48652,7 @@ Object { ], "loc": Object { "end": Object { - "column": 26, + "column": 34, "line": 2, }, "start": Object { @@ -48561,12 +48673,12 @@ Object { "line": 2, }, "start": Object { - "column": 28, + "column": 26, "line": 2, }, }, "range": Array [ - 40, + 38, 46, ], "type": "TypeAnnotation", @@ -49132,7 +49244,7 @@ Object { ], "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { @@ -49153,12 +49265,12 @@ Object { "line": 2, }, "start": Object { - "column": 35, + "column": 33, "line": 2, }, }, "range": Array [ - 53, + 51, 59, ], "type": "TypeAnnotation", @@ -49814,7 +49926,7 @@ Object { ], "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 2, }, "start": Object { @@ -49835,12 +49947,12 @@ Object { "line": 2, }, "start": Object { - "column": 26, + "column": 24, "line": 2, }, }, "range": Array [ - 42, + 40, 48, ], "type": "TypeAnnotation", @@ -50550,7 +50662,7 @@ Object { ], "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 2, }, "start": Object { @@ -50571,12 +50683,12 @@ Object { "line": 2, }, "start": Object { - "column": 33, + "column": 31, "line": 2, }, }, "range": Array [ - 55, + 53, 61, ], "type": "TypeAnnotation", @@ -51172,7 +51284,6 @@ Object { 26, 40, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": null, @@ -51266,7 +51377,6 @@ Object { 45, 86, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": Object { @@ -51873,7 +51983,6 @@ Object { 14, 47, ], - "readonly": false, "static": true, "type": "ClassProperty", "value": null, @@ -51987,7 +52096,6 @@ Object { 53, 91, ], - "readonly": false, "static": true, "type": "ClassProperty", "value": null, @@ -52503,7 +52611,6 @@ Object { 14, 21, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": null, @@ -52579,7 +52686,6 @@ Object { 26, 37, ], - "readonly": false, "static": false, "type": "ClassProperty", "value": null, @@ -52951,7 +53057,6 @@ Object { 14, 28, ], - "readonly": false, "static": true, "type": "ClassProperty", "value": null, @@ -53027,7 +53132,6 @@ Object { 33, 51, ], - "readonly": false, "static": true, "type": "ClassProperty", "value": null, @@ -54794,7 +54898,6 @@ Object { "body": Array [ Object { "computed": false, - "export": false, "initializer": Object { "loc": Object { "end": Object { @@ -54842,13 +54945,10 @@ Object { "line": 2, }, }, - "optional": false, "range": Array [ 20, 38, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -54857,12 +54957,12 @@ Object { "line": 2, }, "start": Object { - "column": 9, + "column": 7, "line": 2, }, }, "range": Array [ - 25, + 23, 31, ], "type": "TypeAnnotation", @@ -54888,8 +54988,6 @@ Object { Object { "accessibility": "public", "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -54918,13 +55016,10 @@ Object { "line": 3, }, }, - "optional": false, "range": Array [ 43, 60, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -54933,12 +55028,12 @@ Object { "line": 3, }, "start": Object { - "column": 14, + "column": 12, "line": 3, }, }, "range": Array [ - 53, + 51, 59, ], "type": "TypeAnnotation", @@ -54964,8 +55059,6 @@ Object { Object { "accessibility": "private", "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -54994,13 +55087,10 @@ Object { "line": 4, }, }, - "optional": false, "range": Array [ 65, 83, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -55009,12 +55099,12 @@ Object { "line": 4, }, "start": Object { - "column": 15, + "column": 13, "line": 4, }, }, "range": Array [ - 76, + 74, 82, ], "type": "TypeAnnotation", @@ -55040,8 +55130,6 @@ Object { Object { "accessibility": "protected", "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -55070,13 +55158,10 @@ Object { "line": 5, }, }, - "optional": false, "range": Array [ 88, 108, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -55085,12 +55170,12 @@ Object { "line": 5, }, "start": Object { - "column": 17, + "column": 15, "line": 5, }, }, "range": Array [ - 101, + 99, 107, ], "type": "TypeAnnotation", @@ -55115,8 +55200,6 @@ Object { }, Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -55145,12 +55228,10 @@ Object { "line": 6, }, }, - "optional": false, "range": Array [ 113, 130, ], - "readonly": false, "static": true, "type": "TSPropertySignature", "typeAnnotation": Object { @@ -55160,12 +55241,12 @@ Object { "line": 6, }, "start": Object { - "column": 14, + "column": 12, "line": 6, }, }, "range": Array [ - 123, + 121, 129, ], "type": "TypeAnnotation", @@ -55191,7 +55272,6 @@ Object { Object { "computed": false, "export": true, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -55220,13 +55300,10 @@ Object { "line": 7, }, }, - "optional": false, "range": Array [ 135, 152, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -55235,12 +55312,12 @@ Object { "line": 7, }, "start": Object { - "column": 14, + "column": 12, "line": 7, }, }, "range": Array [ - 145, + 143, 151, ], "type": "TypeAnnotation", @@ -55265,8 +55342,6 @@ Object { }, Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -55295,13 +55370,11 @@ Object { "line": 8, }, }, - "optional": false, "range": Array [ 157, 176, ], "readonly": true, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -55310,12 +55383,12 @@ Object { "line": 8, }, "start": Object { - "column": 16, + "column": 14, "line": 8, }, }, "range": Array [ - 169, + 167, 175, ], "type": "TypeAnnotation", @@ -55340,11 +55413,10 @@ Object { }, Object { "accessibility": "public", - "export": false, "index": Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 10, }, "start": Object { @@ -55365,12 +55437,12 @@ Object { "line": 10, }, "start": Object { - "column": 17, + "column": 15, "line": 10, }, }, "range": Array [ - 195, + 193, 201, ], "type": "TypeAnnotation", @@ -55407,7 +55479,6 @@ Object { 182, 211, ], - "readonly": false, "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -55417,12 +55488,12 @@ Object { "line": 10, }, "start": Object { - "column": 26, + "column": 24, "line": 10, }, }, "range": Array [ - 204, + 202, 210, ], "type": "TypeAnnotation", @@ -55447,11 +55518,10 @@ Object { }, Object { "accessibility": "private", - "export": false, "index": Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 11, }, "start": Object { @@ -55472,12 +55542,12 @@ Object { "line": 11, }, "start": Object { - "column": 18, + "column": 16, "line": 11, }, }, "range": Array [ - 230, + 228, 236, ], "type": "TypeAnnotation", @@ -55514,7 +55584,6 @@ Object { 216, 246, ], - "readonly": false, "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -55524,12 +55593,12 @@ Object { "line": 11, }, "start": Object { - "column": 27, + "column": 25, "line": 11, }, }, "range": Array [ - 239, + 237, 245, ], "type": "TypeAnnotation", @@ -55554,11 +55623,10 @@ Object { }, Object { "accessibility": "protected", - "export": false, "index": Object { "loc": Object { "end": Object { - "column": 18, + "column": 26, "line": 12, }, "start": Object { @@ -55579,12 +55647,12 @@ Object { "line": 12, }, "start": Object { - "column": 20, + "column": 18, "line": 12, }, }, "range": Array [ - 267, + 265, 273, ], "type": "TypeAnnotation", @@ -55621,7 +55689,6 @@ Object { 251, 283, ], - "readonly": false, "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -55631,12 +55698,12 @@ Object { "line": 12, }, "start": Object { - "column": 29, + "column": 27, "line": 12, }, }, "range": Array [ - 276, + 274, 282, ], "type": "TypeAnnotation", @@ -55660,11 +55727,10 @@ Object { }, }, Object { - "export": false, "index": Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 13, }, "start": Object { @@ -55685,12 +55751,12 @@ Object { "line": 13, }, "start": Object { - "column": 17, + "column": 15, "line": 13, }, }, "range": Array [ - 301, + 299, 307, ], "type": "TypeAnnotation", @@ -55727,7 +55793,6 @@ Object { 288, 317, ], - "readonly": false, "static": true, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -55737,12 +55802,12 @@ Object { "line": 13, }, "start": Object { - "column": 26, + "column": 24, "line": 13, }, }, "range": Array [ - 310, + 308, 316, ], "type": "TypeAnnotation", @@ -55770,7 +55835,7 @@ Object { "index": Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 14, }, "start": Object { @@ -55791,12 +55856,12 @@ Object { "line": 14, }, "start": Object { - "column": 17, + "column": 15, "line": 14, }, }, "range": Array [ - 335, + 333, 341, ], "type": "TypeAnnotation", @@ -55833,7 +55898,6 @@ Object { 322, 351, ], - "readonly": false, "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -55843,12 +55907,12 @@ Object { "line": 14, }, "start": Object { - "column": 26, + "column": 24, "line": 14, }, }, "range": Array [ - 344, + 342, 350, ], "type": "TypeAnnotation", @@ -55872,11 +55936,10 @@ Object { }, }, Object { - "export": false, "index": Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 15, }, "start": Object { @@ -55897,12 +55960,12 @@ Object { "line": 15, }, "start": Object { - "column": 19, + "column": 17, "line": 15, }, }, "range": Array [ - 371, + 369, 377, ], "type": "TypeAnnotation", @@ -55949,12 +56012,12 @@ Object { "line": 15, }, "start": Object { - "column": 28, + "column": 26, "line": 15, }, }, "range": Array [ - 380, + 378, 386, ], "type": "TypeAnnotation", @@ -55980,7 +56043,6 @@ Object { Object { "accessibility": "public", "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -56014,7 +56076,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 17, }, "start": Object { @@ -56035,12 +56097,12 @@ Object { "line": 17, }, "start": Object { - "column": 18, + "column": 16, "line": 17, }, }, "range": Array [ - 407, + 405, 413, ], "type": "TypeAnnotation", @@ -56068,7 +56130,6 @@ Object { 393, 421, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -56078,12 +56139,12 @@ Object { "line": 17, }, "start": Object { - "column": 27, + "column": 25, "line": 17, }, }, "range": Array [ - 416, + 414, 420, ], "type": "TypeAnnotation", @@ -56109,7 +56170,6 @@ Object { Object { "accessibility": "private", "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -56143,7 +56203,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 18, }, "start": Object { @@ -56164,12 +56224,12 @@ Object { "line": 18, }, "start": Object { - "column": 19, + "column": 17, "line": 18, }, }, "range": Array [ - 441, + 439, 447, ], "type": "TypeAnnotation", @@ -56197,7 +56257,6 @@ Object { 426, 455, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -56207,12 +56266,12 @@ Object { "line": 18, }, "start": Object { - "column": 28, + "column": 26, "line": 18, }, }, "range": Array [ - 450, + 448, 454, ], "type": "TypeAnnotation", @@ -56238,7 +56297,6 @@ Object { Object { "accessibility": "protected", "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -56272,7 +56330,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 27, "line": 19, }, "start": Object { @@ -56293,12 +56351,12 @@ Object { "line": 19, }, "start": Object { - "column": 21, + "column": 19, "line": 19, }, }, "range": Array [ - 477, + 475, 483, ], "type": "TypeAnnotation", @@ -56326,7 +56384,6 @@ Object { 460, 491, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -56336,12 +56393,12 @@ Object { "line": 19, }, "start": Object { - "column": 30, + "column": 28, "line": 19, }, }, "range": Array [ - 486, + 484, 490, ], "type": "TypeAnnotation", @@ -56366,7 +56423,6 @@ Object { }, Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -56400,7 +56456,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 20, }, "start": Object { @@ -56421,12 +56477,12 @@ Object { "line": 20, }, "start": Object { - "column": 18, + "column": 16, "line": 20, }, }, "range": Array [ - 510, + 508, 516, ], "type": "TypeAnnotation", @@ -56454,7 +56510,6 @@ Object { 496, 524, ], - "readonly": false, "static": true, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -56464,12 +56519,12 @@ Object { "line": 20, }, "start": Object { - "column": 27, + "column": 25, "line": 20, }, }, "range": Array [ - 519, + 517, 523, ], "type": "TypeAnnotation", @@ -56528,7 +56583,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 21, }, "start": Object { @@ -56549,12 +56604,12 @@ Object { "line": 21, }, "start": Object { - "column": 18, + "column": 16, "line": 21, }, }, "range": Array [ - 543, + 541, 549, ], "type": "TypeAnnotation", @@ -56582,7 +56637,6 @@ Object { 529, 557, ], - "readonly": false, "static": false, "type": "TSMethodSignature", "typeAnnotation": Object { @@ -56592,12 +56646,12 @@ Object { "line": 21, }, "start": Object { - "column": 27, + "column": 25, "line": 21, }, }, "range": Array [ - 552, + 550, 556, ], "type": "TypeAnnotation", @@ -56622,7 +56676,6 @@ Object { }, Object { "computed": false, - "export": false, "key": Object { "loc": Object { "end": Object { @@ -56656,7 +56709,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 26, "line": 22, }, "start": Object { @@ -56677,12 +56730,12 @@ Object { "line": 22, }, "start": Object { - "column": 20, + "column": 18, "line": 22, }, }, "range": Array [ - 578, + 576, 584, ], "type": "TypeAnnotation", @@ -56720,12 +56773,12 @@ Object { "line": 22, }, "start": Object { - "column": 29, + "column": 27, "line": 22, }, }, "range": Array [ - 587, + 585, 591, ], "type": "TypeAnnotation", @@ -60813,7 +60866,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 41, "line": 2, }, "start": Object { @@ -60834,12 +60887,12 @@ Object { "line": 2, }, "start": Object { - "column": 35, + "column": 33, "line": 2, }, }, "range": Array [ - 58, + 56, 64, ], "type": "TypeAnnotation", @@ -60874,12 +60927,12 @@ Object { "line": 2, }, "start": Object { - "column": 44, + "column": 42, "line": 2, }, }, "range": Array [ - 67, + 65, 81, ], "type": "TypeAnnotation", @@ -61483,12 +61536,12 @@ Object { "line": 3, }, "start": Object { - "column": 18, + "column": 16, "line": 3, }, }, "range": Array [ - 62, + 60, 63, ], "type": "TypeAnnotation", @@ -62391,7 +62444,6 @@ Object { "params": Array [ Object { "accessibility": "public", - "export": false, "loc": Object { "end": Object { "column": 36, @@ -62405,7 +62457,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 28, + "column": 36, "line": 5, }, "start": Object { @@ -62426,12 +62478,12 @@ Object { "line": 5, }, "start": Object { - "column": 30, + "column": 28, "line": 5, }, }, "range": Array [ - 100, + 98, 106, ], "type": "TypeAnnotation", @@ -62458,13 +62510,10 @@ Object { 90, 106, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": false, "loc": Object { "end": Object { "column": 54, @@ -62478,7 +62527,7 @@ Object { "parameter": Object { "loc": Object { "end": Object { - "column": 46, + "column": 54, "line": 5, }, "start": Object { @@ -62499,12 +62548,12 @@ Object { "line": 5, }, "start": Object { - "column": 48, + "column": 46, "line": 5, }, }, "range": Array [ - 118, + 116, 124, ], "type": "TypeAnnotation", @@ -62531,8 +62580,6 @@ Object { 108, 124, ], - "readonly": false, - "static": false, "type": "TSParameterProperty", }, ], @@ -62624,8 +62671,6 @@ Object { "body": Array [ Object { "computed": false, - "export": false, - "initializer": null, "key": Object { "loc": Object { "end": Object { @@ -62654,13 +62699,10 @@ Object { "line": 9, }, }, - "optional": false, "range": Array [ 200, 213, ], - "readonly": false, - "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -62669,12 +62711,12 @@ Object { "line": 9, }, "start": Object { - "column": 18, + "column": 16, "line": 9, }, }, "range": Array [ - 206, + 204, 212, ], "type": "TypeAnnotation", diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index 84d6ba24b02d..3710605c5dc4 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -23,7 +23,7 @@ const FIXTURES_DIR = "./tests/fixtures/typescript"; const testFiles = shelljs.find(FIXTURES_DIR) .filter(filename => filename.indexOf(".src.ts") > -1) - // strip off ".src.ts" + // strip off ".src.ts" .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)); //------------------------------------------------------------------------------ From ded5e1f8cc04c8c8dcff77ac33cb174d55bd18b8 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 5 Sep 2017 17:27:53 +0100 Subject: [PATCH 209/326] Breaking: Support TypeScript 2.5 (fixes #368) (#369) (#370) --- packages/typescript-eslint-parser/README.md | 2 +- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 2 +- .../typescript-eslint-parser/package.json | 2 +- .../tests/ast-alignment/spec.js | 1 + .../optional-catch-binding-finally.src.js | 1 + .../optional-catch-binding.src.js | 1 + .../typescript/basics/never-type-param.src.ts | 2 + .../lib/__snapshots__/ecma-features.js.snap | 481 ++++++++++++++ .../lib/__snapshots__/typescript.js.snap | 600 ++++++++++++++++++ 10 files changed, 1090 insertions(+), 3 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/never-type-param.src.ts diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 8d3cd4d1d67c..ca6dc1d4c3f4 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -8,7 +8,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.4.0`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~2.5.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index f577b292ed28..29d337785c99 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -124,6 +124,7 @@ module.exports = { TSModuleDeclaration: "TSModuleDeclaration", TSNamespaceFunctionDeclaration: "TSNamespaceFunctionDeclaration", TSNonNullExpression: "TSNonNullExpression", + TSNeverKeyword: "TSNeverKeyword", TSNullKeyword: "TSNullKeyword", TSNumberKeyword: "TSNumberKeyword", TSObjectKeyword: "TSObjectKeyword", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 0a22a33176b9..11e572cff9ac 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -528,7 +528,7 @@ module.exports = function convert(config) { case SyntaxKind.CatchClause: Object.assign(result, { type: AST_NODE_TYPES.CatchClause, - param: convertChild(node.variableDeclaration.name), + param: node.variableDeclaration ? convertChild(node.variableDeclaration.name) : null, body: convertChild(node.block) }); break; diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 3962a12155c3..9e8257e1bbe8 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -30,7 +30,7 @@ "npm-license": "0.3.3", "shelljs": "0.7.8", "shelljs-nodecli": "0.1.1", - "typescript": "~2.4.0" + "typescript": "~2.5.1" }, "keywords": [ "ast", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index d746ef270e81..d07bbb396e7e 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -473,6 +473,7 @@ const fixturePatternsToTest = [ "typescript/basics/class-with-generic-method-default.src.ts", "typescript/basics/class-with-generic-method.src.ts", "typescript/basics/type-guard.src.ts", + "typescript/basics/never-type-param.src.ts", { pattern: "typescript/basics/export-named-enum.src.ts", config: { babylonParserOptions: { sourceType: "module" } } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js new file mode 100644 index 000000000000..7ac791c528ec --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js @@ -0,0 +1 @@ +try {} catch {} finally {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding.src.js new file mode 100644 index 000000000000..0c6986fd88c6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/experimentalOptionalCatchBinding/optional-catch-binding.src.js @@ -0,0 +1 @@ +try {} catch {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/never-type-param.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/never-type-param.src.ts new file mode 100644 index 000000000000..bff38e99ba01 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/never-type-param.src.ts @@ -0,0 +1,2 @@ +const x: X; +Observable.empty(); diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 4ebfe052e7de..0f57b862c3c2 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -64563,6 +64563,487 @@ Object { } `; +exports[`ecmaFeatures fixtures/experimentalOptionalCatchBinding/optional-catch-binding.src 1`] = ` +Object { + "body": Array [ + Object { + "block": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "param": null, + "range": Array [ + 7, + 15, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalOptionalCatchBinding/optional-catch-binding-finally.src 1`] = ` +Object { + "body": Array [ + Object { + "block": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "BlockStatement", + }, + "finalizer": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "param": null, + "range": Array [ + 7, + 15, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "Keyword", + "value": "finally", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`ecmaFeatures fixtures/exponentiationOperators/exponential-operators.src 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 1983b2d0a968..2c6556c4ae86 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -35419,6 +35419,606 @@ Object { } `; +exports[`typescript fixtures/basics/never-type-param.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 10, + 17, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "Observable", + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "empty", + "range": Array [ + 30, + 35, + ], + "type": "Identifier", + }, + "range": Array [ + 19, + 35, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 44, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 35, + 42, + ], + "type": "TypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 45, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "value": "Observable", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "Identifier", + "value": "empty", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/non-null-assertion-operator.src 1`] = ` Object { "body": Array [ From 68aabd1a4bcc51391de77bf5a2ca0ad59c27bd67 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 5 Sep 2017 12:48:44 -0400 Subject: [PATCH 210/326] Build: changelog update for 8.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 49d903ea5cc1..92cf471fdea7 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v8.0.0 - September 5, 2017 + +* 9877e98 Breaking: Support TypeScript 2.5 (fixes #368) (#369) (#370) (James Henry) +* 5b49870 Fix: Location data for typeAnnotations (#378) (James Henry) + v7.0.0 - August 22, 2017 * 01c34f4 Fix: Ensure exports applied to TSModuleDeclaration (#375) (James Henry) From 7d1b61880c9544004a674c0f9a25ff3f4ed4eb2e Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 5 Sep 2017 12:48:45 -0400 Subject: [PATCH 211/326] 8.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 9e8257e1bbe8..646e8a3d4f82 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "7.0.0", + "version": "8.0.0", "files": [ "lib", "parser.js" From d81798a47d7d28e370367de00fe5d68ebf21e39c Mon Sep 17 00:00:00 2001 From: James Henry Date: Thu, 7 Sep 2017 11:23:14 +0100 Subject: [PATCH 212/326] Chore: Minor cleanup, fix jQuery foundation copyright (#383) --- .../lib/ast-converter.js | 1 + .../lib/ast-node-types.js | 1 + .../lib/convert-comments.js | 2 +- .../typescript-eslint-parser/lib/convert.js | 1 + .../lib/node-utils.js | 2 +- .../tests/ast-alignment/known-issues.js | 10 ++-- .../tests/ast-alignment/spec.js | 53 +++++++------------ .../tests/lib/basics.js | 1 + .../tests/lib/comments.js | 24 ++------- .../tests/lib/ecma-features.js | 1 + .../typescript-eslint-parser/tests/lib/jsx.js | 1 + .../tests/lib/parse.js | 1 + .../tests/lib/typescript.js | 1 + .../tools/test-utils.js | 2 +- 14 files changed, 40 insertions(+), 61 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 066dc4797747..4bc072b828b6 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -1,6 +1,7 @@ /** * @fileoverview Converts TypeScript AST into ESTree format. * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 29d337785c99..1e048da386a6 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -1,6 +1,7 @@ /** * @fileoverview The AST node types produced by the parser. * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/lib/convert-comments.js b/packages/typescript-eslint-parser/lib/convert-comments.js index e51cec996b5a..866aa4435674 100644 --- a/packages/typescript-eslint-parser/lib/convert-comments.js +++ b/packages/typescript-eslint-parser/lib/convert-comments.js @@ -1,6 +1,6 @@ /** * @fileoverview Convert comment using TypeScript token scanner - * @author James Henry + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 11e572cff9ac..c6a3deb822c6 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1,6 +1,7 @@ /** * @fileoverview Converts TypeScript AST into ESTree format. * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index da5ffdfc5b91..928ff14b25b5 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -1,6 +1,6 @@ /** * @fileoverview Utilities for finding and converting TSNodes into ESTreeNodes - * @author James Henry + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js b/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js index e00cd9bcf7ac..ab98bbf9a952 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js @@ -1,10 +1,12 @@ +"use strict"; + /** * ================================================== * KNOWN/DIAGNOSED ISSUES * ================================================== */ -// const fixturePatternsToTest = [ +module.exports = [ /** * "ExperimentalSpreadProperty" in espree/typescript-eslint-parser vs "SpreadElement" in Babylon * comes up a lot in this section @@ -41,7 +43,7 @@ * Babylon parse error because of more strict spec enforcement than other parsers. */ - /** + /** * super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this. */ // "ecma-features/classes/class-one-method-super.src.js", // babylon parse errors @@ -78,11 +80,11 @@ // pattern: "ecma-features/modules/error-delete.src.js", // config: { babylonParserOptions: { sourceType: "module" } } // }, - /** + /** * 'with' in strict mode */ // { // pattern: "ecma-features/modules/error-strict.src.js", // config: { babylonParserOptions: { sourceType: "module" } } // }, -// ]; +]; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index d07bbb396e7e..4f2c5ff1b711 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -226,7 +226,6 @@ const fixturePatternsToTest = [ * so we have to specify the "sourceType" we want to use. * * By default we have configured babylon to use "script", but for the examples below we need "module". - * Maybe fixed by https://github.com/babel/babylon/commit/00ad6d8310ce826dcdd59c7a819dbd50955058d7? */ { pattern: "comments/export-default-anonymous-class.src.js", @@ -637,6 +636,14 @@ fixturePatternsToTest.forEach(fixturePattern => { }); }); +/* eslint-disable */ +/** + * Common predicates for Babylon AST preprocessing + */ +const always = () => true; +const ifNumber = (val) => typeof val === "number"; +/* eslint-enable */ + /** * - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now... * - Remove "start" and "end" values from Babylon nodes to reduce unimportant noise in diffs ("loc" data will still be in @@ -649,65 +656,45 @@ function preprocessBabylonAST(ast) { return parseUtils.omitDeep(ast.program, [ { key: "start", - predicate(val) { - // only remove the "start" number (not the "start" object within loc) - return typeof val === "number"; - } + // only remove the "start" number (not the "start" object within loc) + predicate: ifNumber }, { key: "end", - predicate(val) { - // only remove the "end" number (not the "end" object within loc) - return typeof val === "number"; - } + // only remove the "end" number (not the "end" object within loc) + predicate: ifNumber }, { key: "identifierName", - predicate() { - return true; - } + predicate: always }, { key: "extra", - predicate() { - return true; - } + predicate: always }, { key: "directives", - predicate() { - return true; - } + predicate: always }, { key: "directive", - predicate() { - return true; - } + predicate: always }, { key: "innerComments", - predicate() { - return true; - } + predicate: always }, { key: "leadingComments", - predicate() { - return true; - } + predicate: always }, { key: "trailingComments", - predicate() { - return true; - } + predicate: always }, { key: "guardedHandlers", - predicate() { - return true; - } + predicate: always } ]); } diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index 7f3f4d01d6e9..8a727e8e8b3b 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -1,6 +1,7 @@ /** * @fileoverview Tests for basic expressions * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/tests/lib/comments.js b/packages/typescript-eslint-parser/tests/lib/comments.js index 36f79870eaea..ec54992c2b13 100644 --- a/packages/typescript-eslint-parser/tests/lib/comments.js +++ b/packages/typescript-eslint-parser/tests/lib/comments.js @@ -1,27 +1,9 @@ /** * @fileoverview Tests for parsing and attaching comments. * @author Nicholas C. Zakas - * @copyright 2014 Nicholas C. Zakas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @author James Henry + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License */ "use strict"; diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index b7b152110fbc..8e417179fe4a 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -1,6 +1,7 @@ /** * @fileoverview Tests for ECMA feature flags * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.js b/packages/typescript-eslint-parser/tests/lib/jsx.js index edc705d0fbaa..fc0a72025d74 100644 --- a/packages/typescript-eslint-parser/tests/lib/jsx.js +++ b/packages/typescript-eslint-parser/tests/lib/jsx.js @@ -1,6 +1,7 @@ /** * @fileoverview Tests for ECMA feature flags * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js index edeeaa892f40..c84499233819 100644 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ b/packages/typescript-eslint-parser/tests/lib/parse.js @@ -1,6 +1,7 @@ /** * @fileoverview Tests for tokenize(). * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index 3710605c5dc4..8e2d6a6c493e 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -1,6 +1,7 @@ /** * @fileoverview Tests for ECMA feature flags * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ diff --git a/packages/typescript-eslint-parser/tools/test-utils.js b/packages/typescript-eslint-parser/tools/test-utils.js index 8ae966033bed..1321d98c1a3d 100644 --- a/packages/typescript-eslint-parser/tools/test-utils.js +++ b/packages/typescript-eslint-parser/tools/test-utils.js @@ -1,6 +1,7 @@ /** * @fileoverview Tools for running test cases * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ @@ -29,7 +30,6 @@ function getRaw(ast) { if ((key === "start" || key === "end") && typeof value === "number") { return undefined; } - return value; })); } From 103c207600d44fd1bc015d7daa1cc7c535340fd7 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 25 Sep 2017 22:27:00 +0100 Subject: [PATCH 213/326] Chore: Refactor alignment tests, now on by default (#387) --- packages/typescript-eslint-parser/.gitignore | 3 +- .../typescript-eslint-parser/package.json | 4 +- .../tests/ast-alignment/fixtures-to-test.js | 493 ++++++++++++ .../tests/ast-alignment/known-issues.js | 90 --- .../tests/ast-alignment/spec.js | 721 +----------------- .../tests/ast-alignment/utils.js | 82 +- 6 files changed, 584 insertions(+), 809 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js delete mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js diff --git a/packages/typescript-eslint-parser/.gitignore b/packages/typescript-eslint-parser/.gitignore index d2ccb92068f3..2ff496493963 100644 --- a/packages/typescript-eslint-parser/.gitignore +++ b/packages/typescript-eslint-parser/.gitignore @@ -3,4 +3,5 @@ coverage node_modules npm-debug.log _test.js -.DS_Store \ No newline at end of file +.DS_Store +.vscode \ No newline at end of file diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 646e8a3d4f82..4b8a2c61ecbb 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -19,7 +19,7 @@ "license": "BSD-2-Clause", "devDependencies": { "babel-code-frame": "^6.26.0", - "babylon": "^7.0.0-beta.22", + "babylon": "7.0.0-beta.24", "eslint": "4.6.1", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "5.1.1", @@ -42,7 +42,7 @@ "eslint" ], "scripts": { - "test": "node Makefile.js test", + "test": "node Makefile.js test && npm run ast-alignment-tests", "jest": "jest", "ast-alignment-tests": "jest --config={} ./tests/ast-alignment/spec.js", "lint": "node Makefile.js lint", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js new file mode 100644 index 000000000000..c9632d45c245 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -0,0 +1,493 @@ +"use strict"; + +const path = require("path"); +const glob = require("glob"); + +/** + * JSX fixtures which have known issues for typescript-eslint-parser + */ +const jsxFilesWithKnownIssues = require("../jsx-known-issues").map(f => f.replace("jsx/", "")); + +/** + * Current random error difference on jsx/invalid-no-tag-name.src.js + * TSEP - SyntaxError + * Babylon - RangeError + * + * Reported here: https://github.com/babel/babylon/issues/674 + */ +jsxFilesWithKnownIssues.push("invalid-no-tag-name"); + +/** + * Custom constructs/concepts used in this file: + * + * type Pattern = string; // used for node-glob matching + * + * interface FixturePatternConfig { + * pattern: Pattern, + * config?: { + * babylonParserOptions: any, + * typeScriptESLintParserOptions: any + * } + * } + */ + +/** + * Globally track which fixtures need to be parsed with sourceType: "module" + * so that they can be added with the correct FixturePatternConfig + */ +let fixturesRequiringSourceTypeModule = []; + +/** + * Utility to generate a FixturePatternConfig object containing the glob pattern for specific subsections of the fixtures/ directory, + * including the capability to ignore specific nested patterns. + * + * @param {string} fixturesSubPath the sub-path within the fixtures/ directory + * @param {Object?} config an optional configuration object with optional sub-paths to ignore and/or parse with sourceType: module + * @returns {FixturePatternConfig} an object containing the glob pattern and optional additional config + */ +function createFixturePatternConfigFor(fixturesSubPath, config) { + if (!fixturesSubPath) { + return ""; + } + config = config || {}; + config.ignore = config.ignore || []; + config.fileType = config.fileType || "js"; + config.parseWithSourceTypeModule = config.parseWithSourceTypeModule || []; + /** + * The TypeScript compiler gives us the "externalModuleIndicator" to allow typescript-eslint-parser do dynamically detect the "sourceType". + * Babylon does not have an equivalent feature (although perhaps it might come in the future https://github.com/babel/babylon/issues/440), + * so we have to specify the "sourceType" we want to use. + * + * By default we have configured babylon to use "script", but for any fixtures specified in the parseWithSourceTypeModule array we need "module". + * + * First merge the fixtures which need to be parsed with sourceType: "module" into the + * ignore list, and then add their full config into the global array. + */ + if (config.parseWithSourceTypeModule.length) { + config.ignore = [].concat(config.ignore, config.parseWithSourceTypeModule); + fixturesRequiringSourceTypeModule = [].concat(fixturesRequiringSourceTypeModule, config.parseWithSourceTypeModule.map( + fixture => ({ + // It needs to be the full path from within fixtures/ for the pattern + pattern: `${fixturesSubPath}/${fixture}.src.${config.fileType}`, + config: { babylonParserOptions: { sourceType: "module" } } + }) + )); + } + return { + pattern: `${fixturesSubPath}/!(${config.ignore.join("|")}).src.${config.fileType}` + }; +} + +/** + * An array of FixturePatternConfigs + */ +let fixturePatternConfigsToTest = [ + createFixturePatternConfigFor("basics"), + + createFixturePatternConfigFor("comments", { + ignore: [ + "export-default-anonymous-class", // needs to be parsed with `sourceType: "module"` + /** + * Template strings seem to also be affected by the difference in opinion between different parsers in: + * https://github.com/babel/babylon/issues/673 + */ + "no-comment-template", // Purely AST diffs + "template-string-block" // Purely AST diffs + ] + }), + + createFixturePatternConfigFor("ecma-features/templateStrings", { + ignore: [ + "**/*" + ] + }), + + createFixturePatternConfigFor("ecma-features/experimentalObjectRestSpread", { + ignore: [ + /** + * "ExperimentalSpreadProperty" in espree/typescript-eslint-parser vs "SpreadElement" in Babylon + * comes up a lot in this section + */ + "**/*" + ] + }), + + createFixturePatternConfigFor("ecma-features/arrowFunctions", { + ignore: [ + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "error-dup-params", // babylon parse errors + "error-dup-params", // babylon parse errors + "error-strict-dup-params", // babylon parse errors + "error-strict-octal", // babylon parse errors + "error-two-lines" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/binaryLiterals"), + createFixturePatternConfigFor("ecma-features/blockBindings"), + + createFixturePatternConfigFor("ecma-features/classes", { + ignore: [ + /** + * super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this. + */ + "class-one-method-super", // babylon parse errors + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "invalid-class-declaration", // babylon parse errors + "invalid-class-setter-declaration" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/defaultParams"), + + createFixturePatternConfigFor("ecma-features/destructuring", { + ignore: [ + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "invalid-defaults-object-assign" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/destructuring-and-arrowFunctions"), + createFixturePatternConfigFor("ecma-features/destructuring-and-blockBindings"), + createFixturePatternConfigFor("ecma-features/destructuring-and-defaultParams"), + createFixturePatternConfigFor("ecma-features/destructuring-and-forOf"), + + createFixturePatternConfigFor("ecma-features/destructuring-and-spread", { + ignore: [ + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "error-complex-destructured-spread-first" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/experimentalAsyncIteration"), + createFixturePatternConfigFor("ecma-features/experimentalDynamicImport"), + createFixturePatternConfigFor("ecma-features/exponentiationOperators"), + + createFixturePatternConfigFor("ecma-features/forOf", { + ignore: [ + /** + * TypeScript, espree and acorn parse this fine - esprima, flow and babylon do not... + */ + "for-of-with-function-initializer" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/generators"), + createFixturePatternConfigFor("ecma-features/globalReturn"), + + createFixturePatternConfigFor("ecma-features/modules", { + ignore: [ + /** + * TypeScript, flow and babylon parse this fine - esprima, espree and acorn do not... + */ + "invalid-export-default", // typescript-eslint-parser parse errors + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "invalid-export-named-default", // babylon parse errors + "invalid-import-default-module-specifier", // babylon parse errors + "invalid-import-module-specifier", // babylon parse errors + /** + * Deleting local variable in strict mode + */ + "error-delete", // babylon parse errors + /** + * 'with' in strict mode + */ + "error-strict" // babylon parse errors + ], + parseWithSourceTypeModule: [ + "export-default-array", + "export-default-class", + "export-default-expression", + "export-default-function", + "export-default-named-class", + "export-default-named-function", + "export-default-number", + "export-default-object", + "export-default-value", + "export-from-batch", + "export-from-default", + "export-from-named-as-default", + "export-from-named-as-specifier", + "export-from-named-as-specifiers", + "export-from-specifier", + "export-from-specifiers", + "export-function", + "export-named-as-default", + "export-named-as-specifier", + "export-named-as-specifiers", + "export-named-class", + "export-named-empty", + "export-named-specifier", + "export-named-specifiers-comma", + "export-named-specifiers", + "export-var-anonymous-function", + "export-var-number", + "export-var", + "import-default-and-named-specifiers", + "import-default-and-namespace-specifiers", + "import-default-as", + "import-default", + "import-jquery", + "import-module", + "import-named-as-specifier", + "import-named-as-specifiers", + "import-named-empty", + "import-named-specifier", + "import-named-specifiers-comma", + "import-named-specifiers", + "import-namespace-specifier", + "import-null-as-nil", + "invalid-await", + "invalid-class" + ] + }), + + createFixturePatternConfigFor("ecma-features/newTarget", { + ignore: [ + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "invalid-new-target", // babylon parse errors + "invalid-unknown-property" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/objectLiteralComputedProperties"), + + createFixturePatternConfigFor("ecma-features/objectLiteralDuplicateProperties", { + ignore: [ + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "error-proto-property", // babylon parse errors + "error-proto-string-property" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/objectLiteralShorthandMethods"), + createFixturePatternConfigFor("ecma-features/objectLiteralShorthandProperties"), + createFixturePatternConfigFor("ecma-features/octalLiterals"), + createFixturePatternConfigFor("ecma-features/regex"), + createFixturePatternConfigFor("ecma-features/regexUFlag"), + createFixturePatternConfigFor("ecma-features/regexYFlag"), + + createFixturePatternConfigFor("ecma-features/restParams", { + ignore: [ + /** + * Expected babylon parse errors - all of these files below produce parse errors in espree + * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser + * does not actually error on them and will produce an AST. + */ + "error-no-default", // babylon parse errors + "error-not-last" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("ecma-features/spread"), + createFixturePatternConfigFor("ecma-features/unicodeCodePointEscapes"), + createFixturePatternConfigFor("jsx", { ignore: jsxFilesWithKnownIssues }), + createFixturePatternConfigFor("jsx-useJSXTextNode"), + + /* ================================================== */ + + /** + * TYPESCRIPT-SPECIFIC FILES + */ + + createFixturePatternConfigFor("typescript/babylon-convergence", { fileType: "ts" }), + + createFixturePatternConfigFor("typescript/basics", { + fileType: "ts", + ignore: [ + /** + * Other babylon parse errors relating to invalid syntax. + */ + "abstract-class-with-abstract-constructor", // babylon parse errors + "class-with-export-parameter-properties", // babylon parse errors + "class-with-optional-methods", // babylon parse errors + "class-with-static-parameter-properties", // babylon parse errors + "interface-with-all-property-types", // babylon parse errors + "interface-with-construct-signature-with-parameter-accessibility", // babylon parse errors + "class-with-implements-and-extends", // babylon parse errors + /** + * typescript-eslint-parser erroring, but babylon not. + */ + "arrow-function-with-type-parameters", // typescript-eslint-parser parse errors + /** + * Babylon: ClassDeclaration + abstract: true + * tsep: TSAbstractClassDeclaration + */ + "abstract-class-with-abstract-properties", + /** + * Babylon: ClassProperty + abstract: true + * tsep: TSAbstractClassProperty + */ + "abstract-class-with-abstract-readonly-property", + /** + * Babylon: TSExpressionWithTypeArguments + * tsep: ClassImplements + */ + "class-with-implements-generic-multiple", + "class-with-implements-generic", + "class-with-implements", + "class-with-extends-and-implements", + /** + * Babylon: TSDeclareFunction + declare: true + * tsep: DeclareFunction + */ + "declare-function", + /** + * Other major AST differences (e.g. fundamentally different node types) + */ + "class-with-mixin", + "function-with-types-assignation", + "interface-extends-multiple", + "interface-extends", + "interface-type-parameters", + "interface-with-extends-type-parameters", + "interface-with-generic", + "interface-with-jsdoc", + "interface-with-optional-properties", + "interface-without-type-annotation", + "type-alias-declaration-with-constrained-type-parameter", + "type-alias-declaration", + "type-alias-object-without-annotation", + "typed-this", + "class-with-optional-properties", + "class-with-optional-property-undefined", + "export-type-function-declaration", + "export-type-class-declaration", + "abstract-interface", + "export-type-alias-declaration", + /** + * tsep bug - Program.body[0].expression.left.properties[0].value.right is currently showing up + * as `ArrayPattern`, babylon, acorn and espree say it should be `ArrayExpression` + * TODO: Fix this + */ + "destructuring-assignment", + /** + * Babylon bug for optional or abstract methods? + */ + "abstract-class-with-abstract-method", // babylon parse errors + "abstract-class-with-optional-method", // babylon parse errors + "declare-class-with-optional-method", // babylon parse errors + /** + * Awaiting feedback on Babylon issue https://github.com/babel/babylon/issues/700 + */ + "class-with-private-parameter-properties", + "class-with-protected-parameter-properties", + "class-with-public-parameter-properties", + "class-with-readonly-parameter-properties" + ], + parseWithSourceTypeModule: [ + "export-named-enum", + "export-assignment", + "export-default-class-with-generic", + "export-default-class-with-multiple-generics", + "export-named-class-with-generic", + "export-named-class-with-multiple-generics" + ] + }), + + createFixturePatternConfigFor("typescript/decorators/accessor-decorators", { fileType: "ts" }), + createFixturePatternConfigFor("typescript/decorators/class-decorators", { fileType: "ts" }), + createFixturePatternConfigFor("typescript/decorators/method-decorators", { fileType: "ts" }), + createFixturePatternConfigFor("typescript/decorators/parameter-decorators", { fileType: "ts" }), + createFixturePatternConfigFor("typescript/decorators/property-decorators", { fileType: "ts" }), + + createFixturePatternConfigFor("typescript/expressions", { fileType: "ts" }), + + createFixturePatternConfigFor("typescript/errorRecovery", { + fileType: "ts", + ignore: [ + /** + * AST difference + */ + "interface-empty-extends", + /** + * TypeScript-specific tests taken from "errorRecovery". Babylon is not being as forgiving as the TypeScript compiler here. + */ + "class-empty-extends-implements", // babylon parse errors + "class-empty-extends", // babylon parse errors + "decorator-on-enum-declaration", // babylon parse errors + "interface-property-modifiers", // babylon parse errors + "enum-with-keywords" // babylon parse errors + ] + }), + + createFixturePatternConfigFor("typescript/namespaces-and-modules", { + fileType: "ts", + ignore: [ + /** + * Minor AST difference + */ + "nested-internal-module", + /** + * Babylon: TSDeclareFunction + * tsep: TSNamespaceFunctionDeclaration + */ + "declare-namespace-with-exported-function", + /** + * Babylon: FunctionDeclaration + * tsep: TSNamespaceFunctionDeclaration + */ + "module-with-default-exports" + ] + }) +]; + +/** + * Add in all the fixtures which need to be parsed with sourceType: "module" + */ +fixturePatternConfigsToTest = [].concat(fixturePatternConfigsToTest, fixturesRequiringSourceTypeModule); + +/** + * interface Fixture { + * filename: string, + * config?: any + * } + */ +const fixturesToTest = []; +const fixturesDirPath = path.join(__dirname, "../fixtures"); + +/** + * Resolve the glob patterns into actual Fixture files that we can run assertions for... + */ +fixturePatternConfigsToTest.forEach(fixturePatternConfig => { + /** + * Find the fixture files which match the given pattern + */ + const matchingFixtures = glob.sync(`${fixturesDirPath}/${fixturePatternConfig.pattern}`, {}); + matchingFixtures.forEach(filename => { + fixturesToTest.push({ + filename, + config: fixturePatternConfig.config + }); + }); +}); + +module.exports = fixturesToTest; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js b/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js deleted file mode 100644 index ab98bbf9a952..000000000000 --- a/packages/typescript-eslint-parser/tests/ast-alignment/known-issues.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; - -/** - * ================================================== - * KNOWN/DIAGNOSED ISSUES - * ================================================== - */ - -module.exports = [ - /** - * "ExperimentalSpreadProperty" in espree/typescript-eslint-parser vs "SpreadElement" in Babylon - * comes up a lot in this section - */ - // "ecma-features/experimentalObjectRestSpread/**/*.src.js", // mixture of babylon parse errors and AST diffs - - /* ================================================== */ - - /** - * Template strings seem to also be affected by the difference in opinion between different parsers in: - * https://github.com/babel/babylon/issues/673 - */ - // "comments/no-comment-template.src.js", // Purely AST diffs - // "comments/template-string-block.src.js", // Purely AST diffs - // "ecma-features/templateStrings/**/*.src.js", // mixture of babylon parse errors and AST diffs - - /* ================================================== */ - - /** - * TypeScript, espree and acorn parse this fine - esprima, flow and babylon do not... - */ - // "ecma-features/forOf/for-of-with-function-initializer.src.js", // babylon parse errors - - /* ================================================== */ - - /** - * TypeScript, flow and babylon parse this fine - esprima, espree and acorn do not... - */ - // "ecma-features/modules/invalid-export-default.src.js",, // typescript-eslint-parser parse errors - - /* ================================================== */ - - /** - * Babylon parse error because of more strict spec enforcement than other parsers. - */ - - /** - * super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this. - */ - // "ecma-features/classes/class-one-method-super.src.js", // babylon parse errors - - /* ================================================== */ - - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - // "ecma-features/arrowFunctions/error-dup-params.src.js", // babylon parse errors - // "ecma-features/arrowFunctions/error-dup-params.src.js", // babylon parse errors - // "ecma-features/arrowFunctions/error-strict-dup-params.src.js", // babylon parse errors - // "ecma-features/arrowFunctions/error-strict-octal.src.js", // babylon parse errors - // "ecma-features/arrowFunctions/error-two-lines.src.js", // babylon parse errors - // "ecma-features/classes/invalid-class-declaration.src.js", // babylon parse errors - // "ecma-features/classes/invalid-class-setter-declaration.src.js", // babylon parse errors - // "ecma-features/destructuring/invalid-defaults-object-assign.src.js", // babylon parse errors - // "ecma-features/destructuring-and-spread/error-complex-destructured-spread-first.src.js", // babylon parse errors - // "ecma-features/objectLiteralDuplicateProperties/error-proto-property.src.js", // babylon parse errors - // "ecma-features/objectLiteralDuplicateProperties/error-proto-string-property.src.js", // babylon parse errors - // "ecma-features/modules/invalid-export-named-default.src.js", // babylon parse errors - // "ecma-features/modules/invalid-import-default-module-specifier.src.js", // babylon parse errors - // "ecma-features/modules/invalid-import-module-specifier.src.js", // babylon parse errors - // "ecma-features/newTarget/invalid-new-target.src.js", // babylon parse errors - // "ecma-features/newTarget/invalid-unknown-property.src.js", // babylon parse errors - // "ecma-features/restParams/error-no-default.src.js", // babylon parse errors - // "ecma-features/restParams/error-not-last.src.js", // babylon parse errors - /** - * Deleting local variable in strict mode - */ - // { - // pattern: "ecma-features/modules/error-delete.src.js", - // config: { babylonParserOptions: { sourceType: "module" } } - // }, - /** - * 'with' in strict mode - */ - // { - // pattern: "ecma-features/modules/error-strict.src.js", - // config: { babylonParserOptions: { sourceType: "module" } } - // }, -]; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js index 4f2c5ff1b711..3c9114a784db 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js @@ -1,723 +1,14 @@ "use strict"; const fs = require("fs"); -const path = require("path"); -const glob = require("glob"); + const parse = require("./parse"); const parseUtils = require("./utils"); - -/** - * JSX fixtures which have known issues for typescript-eslint-parser - */ -const jsxFilesWithKnownIssues = require("../jsx-known-issues"); - -/** - * Current random error difference on jsx/invalid-no-tag-name.src.js - * TSEP - SyntaxError - * Babylon - RangeError - * - * Reported here: https://github.com/babel/babylon/issues/674 - */ -jsxFilesWithKnownIssues.push("jsx/invalid-no-tag-name"); - -const jsxPattern = `jsx/!(${jsxFilesWithKnownIssues.map(f => f.replace("jsx/", "")).join("|")}).src.js`; - -const fixturesDirPath = path.join(__dirname, "../fixtures"); - -// Either a string of the pattern, or an object containing the pattern and some additional config -const fixturePatternsToTest = [ - "basics/**/*.src.js", - - "comments/block-trailing-comment.src.js", - "comments/comment-within-condition.src.js", - "comments/jsx-block-comment.src.js", - "comments/jsx-tag-comments.src.js", - "comments/line-comment-with-block-syntax.src.js", - "comments/mix-line-and-block-comments.src.js", - "comments/no-comment-regex.src.js", - "comments/surrounding-call-comments.src.js", - "comments/surrounding-debugger-comments.src.js", - "comments/surrounding-return-comments.src.js", - "comments/surrounding-throw-comments.src.js", - "comments/surrounding-while-loop-comments.src.js", - "comments/switch-fallthrough-comment-in-function.src.js", - "comments/switch-fallthrough-comment.src.js", - "comments/switch-no-default-comment-in-function.src.js", - "comments/switch-no-default-comment-in-nested-functions.src.js", - "comments/switch-no-default-comment.src.js", - - "ecma-features/arrowFunctions/as-param-with-params.src.js", - "ecma-features/arrowFunctions/as-param.src.js", - "ecma-features/arrowFunctions/basic.src.js", - "ecma-features/arrowFunctions/basic-in-binary-expression.src.js", - "ecma-features/arrowFunctions/block-body-not-object.src.js", - "ecma-features/arrowFunctions/block-body.src.js", - "ecma-features/arrowFunctions/error-missing-paren.src.js", - "ecma-features/arrowFunctions/error-not-arrow.src.js", - "ecma-features/arrowFunctions/error-numeric-param-multi.src.js", - "ecma-features/arrowFunctions/error-numeric-param.src.js", - "ecma-features/arrowFunctions/error-reverse-arrow.src.js", - "ecma-features/arrowFunctions/error-strict-default-param-eval.src.js", - "ecma-features/arrowFunctions/error-strict-eval-return.src.js", - "ecma-features/arrowFunctions/error-strict-eval.src.js", - "ecma-features/arrowFunctions/error-strict-param-arguments.src.js", - "ecma-features/arrowFunctions/error-strict-param-eval.src.js", - "ecma-features/arrowFunctions/error-strict-param-names.src.js", - "ecma-features/arrowFunctions/error-strict-param-no-paren-arguments.src.js", - "ecma-features/arrowFunctions/error-strict-param-no-paren-eval.src.js", - "ecma-features/arrowFunctions/error-wrapped-param.src.js", - "ecma-features/arrowFunctions/expression.src.js", - "ecma-features/arrowFunctions/iife.src.js", - "ecma-features/arrowFunctions/multiple-params.src.js", - "ecma-features/arrowFunctions/no-auto-return.src.js", - "ecma-features/arrowFunctions/not-strict-arguments.src.js", - "ecma-features/arrowFunctions/not-strict-eval-params.src.js", - "ecma-features/arrowFunctions/not-strict-eval.src.js", - "ecma-features/arrowFunctions/not-strict-octal.src.js", - "ecma-features/arrowFunctions/return-arrow-function.src.js", - "ecma-features/arrowFunctions/return-sequence.src.js", - "ecma-features/arrowFunctions/single-param-parens.src.js", - "ecma-features/arrowFunctions/single-param-return-identifier.src.js", - "ecma-features/arrowFunctions/single-param.src.js", - "ecma-features/binaryLiterals/**/*.src.js", - "ecma-features/blockBindings/**/*.src.js", - "ecma-features/classes/class-accessor-properties.src.js", - "ecma-features/classes/class-computed-static-method.src.js", - "ecma-features/classes/class-expression.src.js", - "ecma-features/classes/class-method-named-prototype.src.js", - "ecma-features/classes/class-method-named-static.src.js", - "ecma-features/classes/class-method-named-with-space.src.js", - "ecma-features/classes/class-one-method.src.js", - "ecma-features/classes/class-static-method-named-prototype.src.js", - "ecma-features/classes/class-static-method-named-static.src.js", - "ecma-features/classes/class-static-method.src.js", - "ecma-features/classes/class-static-methods-and-accessor-properties.src.js", - "ecma-features/classes/class-two-computed-static-methods.src.js", - "ecma-features/classes/class-two-methods-computed-constructor.src.js", - "ecma-features/classes/class-two-methods-semi.src.js", - "ecma-features/classes/class-two-methods-three-semi.src.js", - "ecma-features/classes/class-two-methods-two-semi.src.js", - "ecma-features/classes/class-two-methods.src.js", - "ecma-features/classes/class-two-static-methods-named-constructor.src.js", - "ecma-features/classes/class-with-constructor-parameters.src.js", - "ecma-features/classes/class-with-constructor-with-space.src.js", - "ecma-features/classes/class-with-constructor.src.js", - "ecma-features/classes/derived-class-assign-to-var.src.js", - "ecma-features/classes/derived-class-expression.src.js", - "ecma-features/classes/empty-class-double-semi.src.js", - "ecma-features/classes/empty-class-semi.src.js", - "ecma-features/classes/empty-class.src.js", - "ecma-features/classes/empty-literal-derived-class.src.js", - "ecma-features/classes/named-class-expression.src.js", - "ecma-features/classes/named-derived-class-expression.src.js", - "ecma-features/defaultParams/**/*.src.js", - "ecma-features/destructuring/array-member.src.js", - "ecma-features/destructuring/array-to-array.src.js", - "ecma-features/destructuring/array-var-undefined.src.js", - "ecma-features/destructuring/class-constructor-params-array.src.js", - "ecma-features/destructuring/class-constructor-params-defaults-array.src.js", - "ecma-features/destructuring/class-constructor-params-defaults-object.src.js", - "ecma-features/destructuring/class-constructor-params-object.src.js", - "ecma-features/destructuring/class-method-params-array.src.js", - "ecma-features/destructuring/class-method-params-defaults-array.src.js", - "ecma-features/destructuring/class-method-params-defaults-object.src.js", - "ecma-features/destructuring/class-method-params-object.src.js", - "ecma-features/destructuring/defaults-array-all.src.js", - "ecma-features/destructuring/defaults-array-longform-nested-multi.src.js", - "ecma-features/destructuring/defaults-array-multi.src.js", - "ecma-features/destructuring/defaults-array-nested-all.src.js", - "ecma-features/destructuring/defaults-array-nested-multi.src.js", - "ecma-features/destructuring/defaults-array.src.js", - "ecma-features/destructuring/defaults-object-all.src.js", - "ecma-features/destructuring/defaults-object-longform-all.src.js", - "ecma-features/destructuring/defaults-object-longform-multi.src.js", - "ecma-features/destructuring/defaults-object-longform.src.js", - "ecma-features/destructuring/defaults-object-mixed-multi.src.js", - "ecma-features/destructuring/defaults-object-multi.src.js", - "ecma-features/destructuring/defaults-object-nested-all.src.js", - "ecma-features/destructuring/defaults-object-nested-multi.src.js", - "ecma-features/destructuring/defaults-object.src.js", - "ecma-features/destructuring/destructured-array-catch.src.js", - "ecma-features/destructuring/destructured-object-catch.src.js", - "ecma-features/destructuring/named-param.src.js", - "ecma-features/destructuring/nested-array.src.js", - "ecma-features/destructuring/nested-object.src.js", - "ecma-features/destructuring/object-var-named.src.js", - "ecma-features/destructuring/object-var-undefined.src.js", - "ecma-features/destructuring/param-defaults-array.src.js", - "ecma-features/destructuring/param-defaults-object-nested.src.js", - "ecma-features/destructuring/param-defaults-object.src.js", - "ecma-features/destructuring/params-array-wrapped.src.js", - "ecma-features/destructuring/params-array.src.js", - "ecma-features/destructuring/params-multi-object.src.js", - "ecma-features/destructuring/params-nested-array.src.js", - "ecma-features/destructuring/params-nested-object.src.js", - "ecma-features/destructuring/params-object-wrapped.src.js", - "ecma-features/destructuring/params-object.src.js", - "ecma-features/destructuring/sparse-array.src.js", - "ecma-features/destructuring-and-arrowFunctions/**/*.src.js", - "ecma-features/destructuring-and-blockBindings/**/*.src.js", - "ecma-features/destructuring-and-defaultParams/**/*.src.js", - "ecma-features/destructuring-and-forOf/**/*.src.js", - "ecma-features/destructuring-and-spread/complex-destructured.src.js", - "ecma-features/destructuring-and-spread/destructured-array-literal.src.js", - "ecma-features/destructuring-and-spread/destructuring-param.src.js", - "ecma-features/destructuring-and-spread/multi-destructured.src.js", - "ecma-features/destructuring-and-spread/single-destructured.src.js", - "ecma-features/destructuring-and-spread/var-complex-destructured.src.js", - "ecma-features/destructuring-and-spread/var-destructured-array-literal.src.js", - "ecma-features/destructuring-and-spread/var-multi-destructured.src.js", - "ecma-features/destructuring-and-spread/var-single-destructured.src.js", - "ecma-features/experimentalAsyncIteration/**/*.src.js", - "ecma-features/experimentalDynamicImport/**/*.src.js", - "ecma-features/exponentiationOperators/**/*.src.js", - "ecma-features/forOf/for-of-with-var-and-braces.src.js", - "ecma-features/forOf/for-of-with-var-and-no-braces.src.js", - "ecma-features/forOf/invalid-for-of-with-const-and-no-braces.src.js", - "ecma-features/forOf/invalid-for-of-with-let-and-no-braces.src.js", - "ecma-features/generators/**/*.src.js", - "ecma-features/globalReturn/**/*.src.js", - "ecma-features/modules/error-function.src.js", - "ecma-features/modules/invalid-export-batch-missing-from-clause.src.js", - "ecma-features/modules/invalid-export-batch-token.src.js", - "ecma-features/modules/invalid-export-default-equal.src.js", - "ecma-features/modules/invalid-export-default-token.src.js (1ms)", - "ecma-features/modules/invalid-export-named-extra-comma.src.js", - "ecma-features/modules/invalid-export-named-middle-comma.src.js", - "ecma-features/modules/invalid-import-default-after-named-after-default.src.js", - "ecma-features/modules/invalid-import-default-after-named.src.js", - "ecma-features/modules/invalid-import-default-missing-module-specifier.src.js", - "ecma-features/modules/invalid-import-default.src.js (1ms)", - "ecma-features/modules/invalid-import-missing-module-specifier.src.js", - "ecma-features/modules/invalid-import-named-after-named.src.js", - "ecma-features/modules/invalid-import-named-after-namespace.src.js", - "ecma-features/modules/invalid-import-named-as-missing-from.src.js", - "ecma-features/modules/invalid-import-named-extra-comma.src.js", - "ecma-features/modules/invalid-import-named-middle-comma.src.js (1ms)", - "ecma-features/modules/invalid-import-namespace-after-named.src.js", - "ecma-features/modules/invalid-import-namespace-missing-as.src.js", - "ecma-features/newTarget/simple-new-target.src.js", - "ecma-features/objectLiteralComputedProperties/**/*.src.js", - "ecma-features/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js", - "ecma-features/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js", - "ecma-features/objectLiteralShorthandMethods/**/*.src.js", - "ecma-features/objectLiteralShorthandProperties/**/*.src.js", - "ecma-features/octalLiterals/**/*.src.js", - "ecma-features/regex/**/*.src.js", - "ecma-features/regexUFlag/**/*.src.js", - "ecma-features/regexYFlag/**/*.src.js", - "ecma-features/restParams/basic-rest.src.js", - "ecma-features/restParams/class-constructor.src.js", - "ecma-features/restParams/class-method.src.js", - "ecma-features/restParams/func-expression-multi.src.js", - "ecma-features/restParams/func-expression.src.js", - "ecma-features/restParams/invalid-rest-param.src.js", - "ecma-features/restParams/single-rest.src.js", - "ecma-features/spread/**/*.src.js", - "ecma-features/unicodeCodePointEscapes/**/*.src.js", - - jsxPattern, - - "jsx-useJSXTextNode/**/*.src.js", - - /** - * The TypeScript compiler gives us the "externalModuleIndicator" to allow typescript-eslint-parser do dynamically detect the "sourceType". - * Babylon does not have an equivalent feature (although perhaps it might come in the future https://github.com/babel/babylon/issues/440), - * so we have to specify the "sourceType" we want to use. - * - * By default we have configured babylon to use "script", but for the examples below we need "module". - */ - { - pattern: "comments/export-default-anonymous-class.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-array.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-class.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-expression.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-function.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-named-class.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-named-function.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-number.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-object.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-default-value.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-from-batch.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-from-default.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-from-named-as-default.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-from-named-as-specifier.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-from-named-as-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-from-specifier.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-from-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-function.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-as-default.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-as-specifier.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-as-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-class.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-empty.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-specifier.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-specifiers-comma.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-named-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-var-anonymous-function.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-var-number.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/export-var.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-default-and-named-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-default-and-namespace-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-default-as.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-default.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-jquery.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-module.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-named-as-specifier.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-named-as-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-named-empty.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-named-specifier.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-named-specifiers-comma.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-named-specifiers.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-namespace-specifier.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/import-null-as-nil.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/invalid-await.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "ecma-features/modules/invalid-class.src.js", - config: { babylonParserOptions: { sourceType: "module" } } - }, - - /* ================================================== */ - - /** - * TYPESCRIPT-SPECIFIC FILES - */ - - /** - * No issues - */ - "typescript/basics/async-function-expression.src.ts", - "typescript/basics/async-function-with-var-declaration.src.ts", - "typescript/basics/function-with-await.src.ts", - "typescript/errorRecovery/class-extends-empty-implements.src.ts", - "typescript/basics/const-enum.src.ts", - "typescript/basics/class-with-readonly-property.src.ts", - "typescript/expressions/call-expression-type-arguments.src.ts", - "typescript/expressions/new-expression-type-arguments.src.ts", - "typescript/basics/function-with-types.src.ts", - "typescript/basics/non-null-assertion-operator.src.ts", - "typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts", - "typescript/basics/class-with-accessibility-modifiers.src.ts", - "typescript/basics/class-with-optional-computed-property.src.ts", - "typescript/basics/object-with-escaped-properties.src.ts", - "typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts", - "typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts", - "typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts", - "typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts", - "typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts", - "typescript/basics/function-with-object-type-with-optional-properties.src.ts", - "typescript/basics/function-with-object-type-without-annotation.src.ts", - "typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts", - "typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts", - "typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts", - "typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts", - "typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts", - "typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts", - "typescript/decorators/method-decorators/method-decorator-instance-member.src.ts", - "typescript/decorators/method-decorators/method-decorator-static-member.src.ts", - "typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts", - "typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts", - "typescript/decorators/property-decorators/property-decorator-instance-member.src.ts", - "typescript/decorators/property-decorators/property-decorator-static-member.src.ts", - "typescript/decorators/class-decorators/class-decorator-factory.src.ts", - "typescript/decorators/class-decorators/class-decorator.src.ts", - "typescript/babylon-convergence/type-parameters.src.ts", - "typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts", - "typescript/basics/class-with-type-parameter-default.src.ts", - "typescript/basics/class-with-type-parameter-underscore.src.ts", - "typescript/basics/class-with-type-parameter.src.ts", - "typescript/basics/function-with-type-parameters-that-have-comments.src.ts", - "typescript/basics/function-with-type-parameters-with-constraint.src.ts", - "typescript/basics/function-with-type-parameters.src.ts", - "typescript/basics/type-parameters-comments.src.ts", - "typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts", - "typescript/basics/var-with-type.src.ts", - "typescript/basics/class-with-extends-generic-multiple.src.ts", - "typescript/basics/class-with-extends-generic.src.ts", - "typescript/basics/nested-type-arguments.src.ts", - "typescript/basics/null-and-undefined-type-annotations.src.ts", - "typescript/basics/var-with-dotted-type.src.ts", - "typescript/basics/variable-declaration-type-annotation-spacing.src.ts", - "typescript/basics/class-with-generic-method-default.src.ts", - "typescript/basics/class-with-generic-method.src.ts", - "typescript/basics/type-guard.src.ts", - "typescript/basics/never-type-param.src.ts", - { - pattern: "typescript/basics/export-named-enum.src.ts", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "typescript/basics/export-assignment.src.ts", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "typescript/basics/export-default-class-with-generic.src.ts", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "typescript/basics/export-default-class-with-multiple-generics.src.ts", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "typescript/basics/export-named-class-with-generic.src.ts", - config: { babylonParserOptions: { sourceType: "module" } } - }, - { - pattern: "typescript/basics/export-named-class-with-multiple-generics.src.ts", - config: { babylonParserOptions: { sourceType: "module" } } - } - - /** - * TypeScript-specific tests taken from "errorRecovery". Babylon is not being as forgiving as the TypeScript compiler here. - */ - // "typescript/errorRecovery/class-empty-extends-implements.src.ts", // babylon parse errors - // "typescript/errorRecovery/class-empty-extends.src.ts", // babylon parse errors - // "typescript/errorRecovery/decorator-on-enum-declaration.src.ts", // babylon parse errors - // "typescript/errorRecovery/interface-property-modifiers.src.ts", // babylon parse errors - // "typescript/errorRecovery/enum-with-keywords.src.ts" // babylon parse errors - - /** - * Other babylon parse errors relating to invalid syntax. - */ - // "typescript/basics/abstract-class-with-abstract-constructor.src.ts", // babylon parse errors - // "typescript/basics/class-with-export-parameter-properties.src.ts", // babylon parse errors - // "typescript/basics/class-with-optional-methods.src.ts", // babylon parse errors - // "typescript/basics/class-with-static-parameter-properties.src.ts", // babylon parse errors - // "typescript/basics/interface-with-all-property-types.src.ts", // babylon parse errors - // "typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts", // babylon parse errors - - /** - * typescript-eslint-parser erroring, but babylon not. - */ - // "typescript/basics/arrow-function-with-type-parameters.src.ts" // typescript-eslint-parser parse errors - - /* ================================================== */ - - /** - * TypeScript AST differences which need to be resolved - */ - - /** - * Identified major AST differences - */ - - /** - * Babylon: ClassDeclaration + abstract: true - * tsep: TSAbstractClassDeclaration - */ - // "typescript/basics/abstract-class-with-abstract-properties.src.ts", - - /** - * Babylon: ClassProperty + abstract: true - * tsep: TSAbstractClassProperty - */ - // "typescript/basics/abstract-class-with-abstract-readonly-property.src.ts", - - /** - * Babylon: TSExpressionWithTypeArguments - * tsep: ClassImplements - */ - // "typescript/basics/class-with-implements-generic-multiple.src.ts", - // "typescript/basics/class-with-implements-generic.src.ts", - // "typescript/basics/class-with-implements.src.ts", - - /** - * Babylon: TSDeclareFunction + declare: true - * tsep: DeclareFunction - */ - // "typescript/basics/declare-function.src.ts", - - /** - * Babylon: TSDeclareFunction - * tsep: TSNamespaceFunctionDeclaration - */ - // "typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts", - - /** - * Babylon: FunctionDeclaration - * tsep: TSNamespaceFunctionDeclaration - */ - // "typescript/namespaces-and-modules/module-with-default-exports.src.ts", - - /** - * Other major AST differences (e.g. fundamentally different node types) - */ - // "typescript/basics/class-with-mixin.src.ts", - // "typescript/basics/function-with-types-assignation.src.ts", - // "typescript/basics/interface-extends-multiple.src.ts", - // "typescript/basics/interface-extends.src.ts", - // "typescript/basics/interface-type-parameters.src.ts", - // "typescript/basics/interface-with-extends-type-parameters.src.ts", - // "typescript/basics/interface-with-generic.src.ts", - // "typescript/basics/interface-with-jsdoc.src.ts", - // "typescript/basics/interface-with-optional-properties.src.ts", - // "typescript/basics/interface-without-type-annotation.src.ts", - // "typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts", - // "typescript/basics/type-alias-declaration.src.ts", - // "typescript/basics/type-alias-object-without-annotation.src.ts", - // "typescript/basics/typed-this.src.ts", - // "typescript/errorRecovery/interface-empty-extends.src.ts", - // "typescript/basics/class-with-optional-properties.src.ts", - // "typescript/basics/class-with-optional-property-undefined.src.ts", - // "typescript/namespaces-and-modules/nested-internal-module.src.ts", - // "typescript/basics/export-type-function-declaration.src.ts", - // "typescript/basics/export-type-class-declaration.src.ts", - // "typescript/basics/abstract-interface.src.ts", - - /** - * tsep bug - Program.body[0].expression.left.properties[0].value.right is currently showing up - * as `ArrayPattern`, babylon, acorn and espree say it should be `ArrayExpression` - * TODO: Fix this - */ - // "typescript/basics/destructuring-assignment.src.ts", - - /** - * Babylon bug for optional or abstract methods? - */ - // "typescript/basics/abstract-class-with-abstract-method.src.ts", // babylon parse errors - // "typescript/basics/abstract-class-with-optional-method.src.ts", // babylon parse errors - // "typescript/basics/declare-class-with-optional-method.src.ts", // babylon parse errors - - /** - * Awaiting feedback on Babylon issue https://github.com/babel/babylon/issues/700 - */ - // "typescript/basics/class-with-private-parameter-properties.src.ts", - // "typescript/basics/class-with-protected-parameter-properties.src.ts", - // "typescript/basics/class-with-public-parameter-properties.src.ts", - // "typescript/basics/class-with-readonly-parameter-properties.src.ts", -]; - -// Either a string of the pattern, or an object containing the pattern and some additional config -const fixturesToTest = []; - -fixturePatternsToTest.forEach(fixturePattern => { - const globPattern = (typeof fixturePattern === "string") ? fixturePattern : fixturePattern.pattern; - const matchingFixtures = glob.sync(`${fixturesDirPath}/${globPattern}`, {}); - matchingFixtures.forEach(filename => { - if (typeof fixturePattern === "string") { - fixturesToTest.push(filename); - } else { - fixturesToTest.push({ - filename, - config: fixturePattern.config - }); - } - }); -}); - -/* eslint-disable */ -/** - * Common predicates for Babylon AST preprocessing - */ -const always = () => true; -const ifNumber = (val) => typeof val === "number"; -/* eslint-enable */ - -/** - * - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now... - * - Remove "start" and "end" values from Babylon nodes to reduce unimportant noise in diffs ("loc" data will still be in - * each final AST and compared). - * - * @param {Object} ast raw babylon AST - * @returns {Object} processed babylon AST - */ -function preprocessBabylonAST(ast) { - return parseUtils.omitDeep(ast.program, [ - { - key: "start", - // only remove the "start" number (not the "start" object within loc) - predicate: ifNumber - }, - { - key: "end", - // only remove the "end" number (not the "end" object within loc) - predicate: ifNumber - }, - { - key: "identifierName", - predicate: always - }, - { - key: "extra", - predicate: always - }, - { - key: "directives", - predicate: always - }, - { - key: "directive", - predicate: always - }, - { - key: "innerComments", - predicate: always - }, - { - key: "leadingComments", - predicate: always - }, - { - key: "trailingComments", - predicate: always - }, - { - key: "guardedHandlers", - predicate: always - } - ]); -} - -/** - * There is currently a really awkward difference in location data for Program nodes - * between different parsers in the ecosystem. Hack around this by removing the data - * before comparing the ASTs. - * - * See: https://github.com/babel/babylon/issues/673 - * - * @param {Object} ast the raw AST with a Program node at its top level - * @returns {Object} the ast with the location data removed from the Program node - */ -function removeLocationDataFromProgramNode(ast) { - delete ast.loc; - delete ast.range; - return ast; -} +const fixturesToTest = require("./fixtures-to-test"); fixturesToTest.forEach(fixture => { - const filename = (typeof fixture === "string") ? fixture : fixture.filename; + const filename = fixture.filename; const source = fs.readFileSync(filename, "utf8").replace(/\r\n/g, "\n"); /** @@ -778,11 +69,11 @@ fixturesToTest.forEach(fixture => { * Perform some extra formatting steps on the babylon AST before comparing */ expect( - removeLocationDataFromProgramNode( - preprocessBabylonAST(babylonTypeScriptPluginResult.ast) + parseUtils.removeLocationDataFromProgramNode( + parseUtils.preprocessBabylonAST(babylonTypeScriptPluginResult.ast) ) ).toEqual( - removeLocationDataFromProgramNode(typeScriptESLintParserResult.ast) + parseUtils.removeLocationDataFromProgramNode(typeScriptESLintParserResult.ast) ); }); diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/utils.js b/packages/typescript-eslint-parser/tests/ast-alignment/utils.js index bf8460a0fa61..22cca72545b7 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/utils.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/utils.js @@ -68,7 +68,87 @@ function omitDeep(obj, keysToOmit) { return obj; } +/* eslint-disable */ +/** + * Common predicates for Babylon AST preprocessing + */ +const always = () => true; +const ifNumber = (val) => typeof val === "number"; +/* eslint-enable */ + +/** + * - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now... + * - Remove "start" and "end" values from Babylon nodes to reduce unimportant noise in diffs ("loc" data will still be in + * each final AST and compared). + * + * @param {Object} ast raw babylon AST + * @returns {Object} processed babylon AST + */ +function preprocessBabylonAST(ast) { + return omitDeep(ast.program, [ + { + key: "start", + // only remove the "start" number (not the "start" object within loc) + predicate: ifNumber + }, + { + key: "end", + // only remove the "end" number (not the "end" object within loc) + predicate: ifNumber + }, + { + key: "identifierName", + predicate: always + }, + { + key: "extra", + predicate: always + }, + { + key: "directives", + predicate: always + }, + { + key: "directive", + predicate: always + }, + { + key: "innerComments", + predicate: always + }, + { + key: "leadingComments", + predicate: always + }, + { + key: "trailingComments", + predicate: always + }, + { + key: "guardedHandlers", + predicate: always + } + ]); +} + +/** + * There is currently a really awkward difference in location data for Program nodes + * between different parsers in the ecosystem. Hack around this by removing the data + * before comparing the ASTs. + * + * See: https://github.com/babel/babylon/issues/673 + * + * @param {Object} ast the raw AST with a Program node at its top level + * @returns {Object} the ast with the location data removed from the Program node + */ +function removeLocationDataFromProgramNode(ast) { + delete ast.loc; + delete ast.range; + return ast; +} + module.exports = { normalizeNodeTypes, - omitDeep + preprocessBabylonAST, + removeLocationDataFromProgramNode }; From 6a28e31883475e53a45a13b197388c4c70689154 Mon Sep 17 00:00:00 2001 From: Ika Date: Mon, 25 Sep 2017 16:28:51 -0500 Subject: [PATCH 214/326] Fix: add missing TSSymbolKeyword type (#385) --- .../lib/ast-node-types.js | 1 + .../basics/symbol-type-param.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 458 ++++++++++++++++++ 3 files changed, 460 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/symbol-type-param.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 1e048da386a6..373ba72a1dfc 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -139,6 +139,7 @@ module.exports = { TSReadonlyKeyword: "TSReadonlyKeyword", TSStaticKeyword: "TSStaticKeyword", TSStringKeyword: "TSStringKeyword", + TSSymbolKeyword: "TSSymbolKeyword", TSTypeLiteral: "TSTypeLiteral", TSTypePredicate: "TSTypePredicate", TSTypeReference: "TSTypeReference", diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/symbol-type-param.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/symbol-type-param.src.ts new file mode 100644 index 000000000000..b5b19ced740e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/symbol-type-param.src.ts @@ -0,0 +1 @@ +function test(abc: Map) {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 2c6556c4ae86..1dbca465ff6d 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -38244,6 +38244,464 @@ Object { } `; +exports[`typescript fixtures/basics/symbol-type-param.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "abc", + "range": Array [ + 14, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 38, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "Map", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "TSSymbolKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 22, + 38, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 42, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "abc", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "Map", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` Object { "body": Array [ From a14b666089e3aad4f32fc1c1bf0452eb1eccf393 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 22 Oct 2017 16:43:27 +0100 Subject: [PATCH 215/326] Chore: Add a way to test TSX specific issues (fixes #376) (#398) --- .../tests/ast-alignment/fixtures-to-test.js | 16 + .../fixtures/tsx/react-typed-props.src.tsx | 12 + .../tests/lib/__snapshots__/tsx.js.snap | 1368 +++++++++++++++++ .../typescript-eslint-parser/tests/lib/jsx.js | 2 +- .../typescript-eslint-parser/tests/lib/tsx.js | 50 + .../tests/lib/typescript.js | 2 +- 6 files changed, 1448 insertions(+), 2 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tsx/react-typed-props.src.tsx create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap create mode 100644 packages/typescript-eslint-parser/tests/lib/tsx.js diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index c9632d45c245..f2d19f6d14cd 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -314,6 +314,22 @@ let fixturePatternConfigsToTest = [ /* ================================================== */ + /** + * TSX-SPECIFIC FILES + */ + + createFixturePatternConfigFor("tsx", { + fileType: "tsx", + ignore: [ + /** + * AST difference + */ + "react-typed-props" + ] + }), + + /* ================================================== */ + /** * TYPESCRIPT-SPECIFIC FILES */ diff --git a/packages/typescript-eslint-parser/tests/fixtures/tsx/react-typed-props.src.tsx b/packages/typescript-eslint-parser/tests/fixtures/tsx/react-typed-props.src.tsx new file mode 100644 index 000000000000..ebeccee4f4f1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tsx/react-typed-props.src.tsx @@ -0,0 +1,12 @@ +import * as React from 'react' +type Props = { + title: string +} + +export default function App(props: Props) { + return ( +

+ {props.title} +

+ ) +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap new file mode 100644 index 000000000000..661ffa91cafd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap @@ -0,0 +1,1368 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`TSX fixtures/react-typed-props.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 30, + ], + "raw": "'react'", + "type": "Literal", + "value": "react", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "React", + "range": Array [ + 12, + 17, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 17, + ], + "type": "ImportNamespaceSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Props", + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "title", + "range": Array [ + 48, + 53, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 48, + 61, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 44, + 63, + ], + "type": "TSTypeLiteral", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 36, + 63, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 31, + 63, + ], + "type": "VariableDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 128, + 135, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "name": "props", + "range": Array [ + 136, + 141, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "name": "title", + "range": Array [ + 142, + 147, + ], + "type": "Identifier", + }, + "range": Array [ + 136, + 147, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 135, + 148, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 148, + 153, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "name": "h1", + "range": Array [ + 155, + 157, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 153, + 158, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "name": "h1", + "range": Array [ + 125, + 127, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 124, + 128, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 124, + 158, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 111, + 162, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 107, + 164, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "name": "App", + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 28, + "line": 6, + }, + }, + "name": "props", + "range": Array [ + 93, + 105, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 98, + 105, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 100, + 105, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "name": "Props", + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + }, + }, + }, + }, + ], + "range": Array [ + 80, + 164, + ], + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 65, + 164, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 164, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 17, + ], + "type": "Identifier", + "value": "React", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 30, + ], + "type": "String", + "value": "'react'", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + "value": "Props", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 48, + 53, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 72, + 79, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "App", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 28, + "line": 6, + }, + }, + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + "value": "Props", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 111, + 117, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 125, + 127, + ], + "type": "JSXIdentifier", + "value": "h1", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 128, + 135, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "range": Array [ + 136, + 141, + ], + "type": "JSXIdentifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 142, + 147, + ], + "type": "JSXIdentifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 148, + 153, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "range": Array [ + 155, + 157, + ], + "type": "JSXIdentifier", + "value": "h1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.js b/packages/typescript-eslint-parser/tests/lib/jsx.js index fc0a72025d74..ba1dce33917a 100644 --- a/packages/typescript-eslint-parser/tests/lib/jsx.js +++ b/packages/typescript-eslint-parser/tests/lib/jsx.js @@ -1,5 +1,5 @@ /** - * @fileoverview Tests for ECMA feature flags + * @fileoverview Tests for JSX * @author Nicholas C. Zakas * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ diff --git a/packages/typescript-eslint-parser/tests/lib/tsx.js b/packages/typescript-eslint-parser/tests/lib/tsx.js new file mode 100644 index 000000000000..a29b57fdb073 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/tsx.js @@ -0,0 +1,50 @@ +/** + * @fileoverview Tests for TSX-specific constructs + * @author James Henry + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const path = require("path"), + shelljs = require("shelljs"), + testUtils = require("../../tools/test-utils"); + +//------------------------------------------------------------------------------ +// Setup +//------------------------------------------------------------------------------ + +const TSX_FIXTURES_DIR = "./tests/fixtures/tsx"; + +const testFiles = shelljs.find(TSX_FIXTURES_DIR) + .filter(filename => filename.indexOf(".src.tsx") > -1) + // strip off ".src.tsx" + .map(filename => filename.substring(TSX_FIXTURES_DIR.length - 1, filename.length - 8)); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("TSX", () => { + testFiles.forEach(filename => { + // Uncomment and fill in filename to focus on a single file + // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; + const code = shelljs.cat(`${path.resolve(TSX_FIXTURES_DIR, filename)}.src.tsx`); + const config = { + loc: true, + range: true, + tokens: true, + errorOnUnknownASTType: true, + useJSXTextNode: true, + ecmaFeatures: { + jsx: true + } + }; + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); + }); +}); diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index 8e2d6a6c493e..8032dac66263 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -1,5 +1,5 @@ /** - * @fileoverview Tests for ECMA feature flags + * @fileoverview Tests for TypeScript-specific constructs * @author Nicholas C. Zakas * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ From 90deceb9b124fbd3500321fa478b96d37be39675 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 22 Oct 2017 17:13:46 +0100 Subject: [PATCH 216/326] Fix: Calculate typeArguments loc data correctly if empty (fixes #395) (#396) --- .../typescript-eslint-parser/lib/convert.js | 29 +- .../errorRecovery/empty-type-arguments.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 259 ++++++++++++++++++ 3 files changed, 282 insertions(+), 7 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index c6a3deb822c6..61d17b9e6142 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -102,17 +102,32 @@ module.exports = function convert(config) { * @returns {TypeParameterInstantiation} TypeParameterInstantiation node */ function convertTypeArgumentsToTypeParameters(typeArguments) { - const firstTypeArgument = typeArguments[0]; - const lastTypeArgument = typeArguments[typeArguments.length - 1]; - const greaterThanToken = nodeUtils.findNextToken(lastTypeArgument, ast); - + /** + * Even if typeArguments is an empty array, TypeScript sets a `pos` and `end` + * property on the array object so we can safely read the values here + */ + const start = typeArguments.pos - 1; + let end = typeArguments.end + 1; + if (typeArguments && typeArguments.length) { + const firstTypeArgument = typeArguments[0]; + const typeArgumentsParent = firstTypeArgument.parent; + /** + * In the case of the parent being a CallExpression we have to use slightly different + * logic to calculate the correct end position + */ + if (typeArgumentsParent && typeArgumentsParent.kind === SyntaxKind.CallExpression) { + const lastTypeArgument = typeArguments[typeArguments.length - 1]; + const greaterThanToken = nodeUtils.findNextToken(lastTypeArgument, ast); + end = greaterThanToken.end; + } + } return { type: AST_NODE_TYPES.TypeParameterInstantiation, range: [ - firstTypeArgument.pos - 1, - greaterThanToken.end + start, + end ], - loc: nodeUtils.getLocFor(firstTypeArgument.pos - 1, greaterThanToken.end, ast), + loc: nodeUtils.getLocFor(start, end, ast), params: typeArguments.map(typeArgument => { if (nodeUtils.isTypeKeyword(typeArgument.kind)) { return { diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts new file mode 100644 index 000000000000..d0a415f25ae5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/empty-type-arguments.src.ts @@ -0,0 +1 @@ +const foo: Foo<> \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 1dbca465ff6d..81f17a572a01 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -55360,6 +55360,265 @@ Object { } `; +exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 14, + 16, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/errorRecovery/enum-with-keywords.src 1`] = ` Object { "body": Array [ From a02b5d839f27055149bb40b32223564ec2b7917f Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 22 Oct 2017 12:17:06 -0400 Subject: [PATCH 217/326] Build: changelog update for 8.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 92cf471fdea7..e3197a9a8a03 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,11 @@ +v8.0.1 - October 22, 2017 + +* 0401ffc Fix: Calculate typeArguments loc data correctly if empty (fixes #395) (#396) (James Henry) +* a214f71 Chore: Add a way to test TSX specific issues (fixes #376) (#398) (James Henry) +* 9c71a62 Fix: add missing TSSymbolKeyword type (#385) (Ika) +* e10aab8 Chore: Refactor alignment tests, now on by default (#387) (James Henry) +* 9e17d0b Chore: Minor cleanup, fix jQuery foundation copyright (#383) (James Henry) + v8.0.0 - September 5, 2017 * 9877e98 Breaking: Support TypeScript 2.5 (fixes #368) (#369) (#370) (James Henry) From 7894d68653ede4d360eb7bbe115d8195887b39c0 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 22 Oct 2017 12:17:07 -0400 Subject: [PATCH 218/326] 8.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 4b8a2c61ecbb..c90f9c9e742c 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "8.0.0", + "version": "8.0.1", "files": [ "lib", "parser.js" From 6ada8feddaba5afd3435502b9f17eaa43a57637c Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 10 Nov 2017 19:24:22 +0000 Subject: [PATCH 219/326] Breaking: Support TypeScript 2.6 (fixes #394) (#397) --- packages/typescript-eslint-parser/.travis.yml | 1 + packages/typescript-eslint-parser/README.md | 2 +- packages/typescript-eslint-parser/package.json | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index 4649f0356776..44a75f7ebf78 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -6,5 +6,6 @@ node_js: - "6" - "7" - "8" + - "9" after_success: - npm run coveralls diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index ca6dc1d4c3f4..73c3802053df 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -8,7 +8,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.5.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~2.6.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index c90f9c9e742c..18e95fe4e2a5 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -18,19 +18,19 @@ }, "license": "BSD-2-Clause", "devDependencies": { - "babel-code-frame": "^6.26.0", + "babel-code-frame": "6.26.0", "babylon": "7.0.0-beta.24", - "eslint": "4.6.1", + "eslint": "4.10.0", "eslint-config-eslint": "4.0.0", - "eslint-plugin-node": "5.1.1", + "eslint-plugin-node": "5.2.1", "eslint-release": "0.10.3", - "glob": "^7.1.2", - "jest": "21.0.1", - "lodash.isplainobject": "^4.0.6", + "glob": "7.1.2", + "jest": "21.2.1", + "lodash.isplainobject": "4.0.6", "npm-license": "0.3.3", "shelljs": "0.7.8", "shelljs-nodecli": "0.1.1", - "typescript": "~2.5.1" + "typescript": "~2.6.1" }, "keywords": [ "ast", From cc8ae633f937575547516347adcc737eb8de1f2d Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 10 Nov 2017 14:25:49 -0500 Subject: [PATCH 220/326] Build: changelog update for 9.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index e3197a9a8a03..b0a99322d5b4 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v9.0.0 - November 10, 2017 + +* 46479e8 Breaking: Support TypeScript 2.6 (fixes #394) (#397) (James Henry) + v8.0.1 - October 22, 2017 * 0401ffc Fix: Calculate typeArguments loc data correctly if empty (fixes #395) (#396) (James Henry) From 5e9d38cdc07cd2b1eb005fd5a34caa35f7fe5890 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 10 Nov 2017 14:25:49 -0500 Subject: [PATCH 221/326] 9.0.0 --- .../package-lock.json | 4780 +++++++++++++++++ .../typescript-eslint-parser/package.json | 2 +- 2 files changed, 4781 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/package-lock.json diff --git a/packages/typescript-eslint-parser/package-lock.json b/packages/typescript-eslint-parser/package-lock.json new file mode 100644 index 000000000000..05ee5e6aeab5 --- /dev/null +++ b/packages/typescript-eslint-parser/package-lock.json @@ -0,0 +1,4780 @@ +{ + "name": "typescript-eslint-parser", + "version": "9.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "abab": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", + "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=", + "dev": true + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "acorn": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", + "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", + "dev": true + }, + "acorn-globals": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz", + "integrity": "sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8=", + "dev": true, + "requires": { + "acorn": "4.0.13" + }, + "dependencies": { + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", + "dev": true + } + } + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "3.3.0" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, + "ajv": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", + "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", + "dev": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "ajv-keywords": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", + "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "2.3.11", + "normalize-path": "2.1.1" + } + }, + "append-transform": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", + "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", + "dev": true, + "requires": { + "default-require-extensions": "1.0.0" + } + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "astral-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", + "dev": true + }, + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "dev": true, + "requires": { + "lodash": "4.17.4" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "dev": true + }, + "axios": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.10.0.tgz", + "integrity": "sha1-Ww7A1ftT55uYt7+EwOmxz5Av38Q=", + "dev": true, + "requires": { + "follow-redirects": "0.0.7" + } + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + } + }, + "babel-core": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-generator": "6.26.0", + "babel-helpers": "6.24.1", + "babel-messages": "6.23.0", + "babel-register": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "convert-source-map": "1.5.0", + "debug": "2.6.9", + "json5": "0.5.1", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "path-is-absolute": "1.0.1", + "private": "0.1.8", + "slash": "1.0.0", + "source-map": "0.5.7" + }, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "babel-generator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", + "dev": true, + "requires": { + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "detect-indent": "4.0.0", + "jsesc": "1.3.0", + "lodash": "4.17.4", + "source-map": "0.5.7", + "trim-right": "1.0.1" + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-jest": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.2.0.tgz", + "integrity": "sha512-O0W2qLoWu1QOoOGgxiR2JID4O6WSpxPiQanrkyi9SSlM0PJ60Ptzlck47lhtnr9YZO3zYOsxHwnyeWJ6AffoBQ==", + "dev": true, + "requires": { + "babel-plugin-istanbul": "4.1.5", + "babel-preset-jest": "21.2.0" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-istanbul": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz", + "integrity": "sha1-Z2DN2Xf0EdPhdbsGTyvDJ9mbK24=", + "dev": true, + "requires": { + "find-up": "2.1.0", + "istanbul-lib-instrument": "1.9.1", + "test-exclude": "4.1.1" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + } + } + }, + "babel-plugin-jest-hoist": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz", + "integrity": "sha512-yi5QuiVyyvhBUDLP4ButAnhYzkdrUwWDtvUJv71hjH3fclhnZg4HkDeqaitcR2dZZx/E67kGkRcPVjtVu+SJfQ==", + "dev": true + }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", + "dev": true + }, + "babel-preset-jest": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz", + "integrity": "sha512-hm9cBnr2h3J7yXoTtAVV0zg+3vg0Q/gT2GYuzlreTU0EPkJRtlNgKJJ3tBKEn0+VjAi3JykV6xCJkuUYttEEfA==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "21.2.0", + "babel-plugin-syntax-object-rest-spread": "6.13.0" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "6.26.0", + "babel-runtime": "6.26.0", + "core-js": "2.5.1", + "home-or-tmp": "2.0.0", + "lodash": "4.17.4", + "mkdirp": "0.5.1", + "source-map-support": "0.4.18" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.4" + }, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + } + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.9", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + }, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "7.0.0-beta.24", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.24.tgz", + "integrity": "sha512-k1yiJYz1Zt6/xfxx0OC7obTNOF5WktZ8P8z1y+7kwP4INOygqqgzolO5fse4jYIb3CzHyU7WNC38EjYa1wjEGQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, + "browser-resolve": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", + "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", + "dev": true, + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "bser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz", + "integrity": "sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk=", + "dev": true, + "requires": { + "node-int64": "0.4.0" + } + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "2.1.1", + "map-obj": "1.0.1" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "ci-info": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.1.tgz", + "integrity": "sha512-vHDDF/bP9RYpTWtUhpJRhCFdvvp3iDWvEbuDbWgvjUrNGV1MXJrE0MPcwGtEled04m61iwdBLUIHZtDgzWS4ZQ==", + "dev": true + }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "optional": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + } + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "color-convert": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", + "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + } + }, + "content-type-parser": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", + "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==", + "dev": true + }, + "convert-source-map": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", + "dev": true + }, + "core-js": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "dev": true, + "requires": { + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + } + } + }, + "cssom": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", + "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=", + "dev": true + }, + "cssstyle": { + "version": "0.2.37", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", + "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", + "dev": true, + "requires": { + "cssom": "0.3.2" + } + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "1.0.2" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "dateformat": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", + "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", + "dev": true, + "requires": { + "get-stdin": "4.0.1", + "meow": "3.7.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "default-require-extensions": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", + "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", + "dev": true, + "requires": { + "strip-bom": "2.0.0" + } + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "5.0.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.0", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "rimraf": "2.6.2" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "dezalgo": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", + "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", + "dev": true, + "requires": { + "asap": "2.0.6", + "wrappy": "1.0.2" + } + }, + "diff": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", + "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==", + "dev": true + }, + "doctrine": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + "dev": true, + "requires": { + "esutils": "2.0.2", + "isarray": "1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "errno": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", + "integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=", + "dev": true, + "requires": { + "prr": "0.0.0" + } + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", + "dev": true, + "requires": { + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.5.7" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + } + } + }, + "eslint": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", + "integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "babel-code-frame": "6.26.0", + "chalk": "2.3.0", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.0.0", + "eslint-scope": "3.7.1", + "espree": "3.5.1", + "esquery": "1.0.0", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.2", + "globals": "9.18.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.0.0", + "js-yaml": "3.10.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "require-uncached": "1.0.3", + "semver": "5.4.1", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "eslint-config-eslint": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-eslint/-/eslint-config-eslint-4.0.0.tgz", + "integrity": "sha1-pGOpZiHkyKgOqR60wHh7ujoPe+s=", + "dev": true, + "requires": { + "js-yaml": "3.10.0" + } + }, + "eslint-plugin-node": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz", + "integrity": "sha512-xhPXrh0Vl/b7870uEbaumb2Q+LxaEcOQ3kS1jtIXanBAwpMre1l5q/l2l/hESYJGEFKuI78bp6Uw50hlpr7B+g==", + "dev": true, + "requires": { + "ignore": "3.3.7", + "minimatch": "3.0.4", + "resolve": "1.5.0", + "semver": "5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true + } + } + }, + "eslint-release": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/eslint-release/-/eslint-release-0.10.3.tgz", + "integrity": "sha1-kCd4FIxPO++dHiL+4ir1z7pweBM=", + "dev": true, + "requires": { + "dateformat": "1.0.12", + "github-api": "2.3.0", + "linefix": "0.1.1", + "npm-license": "0.3.3", + "semver": "5.4.1", + "shelljs": "0.5.3" + }, + "dependencies": { + "shelljs": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", + "integrity": "sha1-xUmCuZbHbvDB5rWfvcWCX1txMRM=", + "dev": true + } + } + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.0", + "estraverse": "4.2.0" + } + }, + "espree": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", + "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "dev": true, + "requires": { + "acorn": "5.2.1", + "acorn-jsx": "3.0.1" + } + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true + }, + "esquery": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "dev": true, + "requires": { + "estraverse": "4.2.0", + "object-assign": "4.1.1" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "exec-sh": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz", + "integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==", + "dev": true, + "requires": { + "merge": "1.2.0" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "2.2.3" + } + }, + "expect": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-21.2.1.tgz", + "integrity": "sha512-orfQQqFRTX0jH7znRIGi8ZMR8kTNpXklTTz8+HGTpmTKZo3Occ6JNB5FXMb8cRuiiC/GyDqsr30zUa66ACYlYw==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "jest-diff": "21.2.1", + "jest-get-type": "21.2.0", + "jest-matcher-utils": "21.2.1", + "jest-message-util": "21.2.1", + "jest-regex-util": "21.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + } + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "dev": true + }, + "external-editor": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", + "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", + "dev": true, + "requires": { + "iconv-lite": "0.4.19", + "jschardet": "1.6.0", + "tmp": "0.0.33" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fb-watchman": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", + "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", + "dev": true, + "requires": { + "bser": "2.0.0" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "1.3.0", + "object-assign": "4.1.1" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fileset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "dev": true, + "requires": { + "glob": "7.1.2", + "minimatch": "3.0.4" + } + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + }, + "flat-cache": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", + "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.11", + "write": "0.2.1" + } + }, + "follow-redirects": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-0.0.7.tgz", + "integrity": "sha1-NLkLqyqRGqNHVx2pDyK9NuzYqRk=", + "dev": true, + "requires": { + "debug": "2.6.9", + "stream-consume": "0.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "github-api": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/github-api/-/github-api-2.3.0.tgz", + "integrity": "sha1-7udoRgsp6G6RuWqeefhVXO9rUyU=", + "dev": true, + "requires": { + "axios": "0.10.0", + "debug": "2.6.9", + "es6-promise": "3.3.1", + "js-base64": "2.3.2", + "utf8": "2.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "arrify": "1.0.1", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growly": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", + "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", + "dev": true + }, + "handlebars": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "dev": true, + "requires": { + "async": "1.5.2", + "optimist": "0.6.1", + "source-map": "0.4.4", + "uglify-js": "2.8.29" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": "1.0.1" + } + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, + "requires": { + "ajv": "5.3.0", + "har-schema": "2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "dev": true, + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "sntp": "2.1.0" + } + }, + "hoek": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "hosted-git-info": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "dev": true + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, + "requires": { + "whatwg-encoding": "1.0.3" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "ignore": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.0.5", + "figures": "2.0.0", + "lodash": "4.17.4", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "interpret": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", + "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=", + "dev": true + }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true, + "requires": { + "loose-envify": "1.3.1" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" + } + }, + "is-ci": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", + "integrity": "sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4=", + "dev": true, + "requires": { + "ci-info": "1.1.1" + } + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "dev": true, + "requires": { + "is-path-inside": "1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-resolvable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", + "dev": true, + "requires": { + "tryit": "1.0.3" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul-api": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.2.1.tgz", + "integrity": "sha512-oFCwXvd65amgaPCzqrR+a2XjanS1MvpXN6l/MlMUTv6uiA1NOgGX+I0uyq8Lg3GDxsxPsaP1049krz3hIJ5+KA==", + "dev": true, + "requires": { + "async": "2.6.0", + "fileset": "2.0.3", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-hook": "1.1.0", + "istanbul-lib-instrument": "1.9.1", + "istanbul-lib-report": "1.1.2", + "istanbul-lib-source-maps": "1.2.2", + "istanbul-reports": "1.1.3", + "js-yaml": "3.10.0", + "mkdirp": "0.5.1", + "once": "1.4.0" + } + }, + "istanbul-lib-coverage": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", + "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz", + "integrity": "sha512-U3qEgwVDUerZ0bt8cfl3dSP3S6opBoOtk3ROO5f2EfBr/SRiD9FQqzwaZBqFORu8W7O0EXpai+k7kxHK13beRg==", + "dev": true, + "requires": { + "append-transform": "0.4.0" + } + }, + "istanbul-lib-instrument": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz", + "integrity": "sha512-RQmXeQ7sphar7k7O1wTNzVczF9igKpaeGQAG9qR2L+BS4DCJNTI9nytRmIVYevwO0bbq+2CXvJmYDuz0gMrywA==", + "dev": true, + "requires": { + "babel-generator": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "istanbul-lib-coverage": "1.1.1", + "semver": "5.4.1" + }, + "dependencies": { + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + } + } + }, + "istanbul-lib-report": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz", + "integrity": "sha512-UTv4VGx+HZivJQwAo1wnRwe1KTvFpfi/NYwN7DcsrdzMXwpRT/Yb6r4SBPoHWj4VuQPakR32g4PUUeyKkdDkBA==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "path-parse": "1.0.5", + "supports-color": "3.2.3" + }, + "dependencies": { + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz", + "integrity": "sha512-8BfdqSfEdtip7/wo1RnrvLpHVEd8zMZEDmOFEnpC6dg0vXflHt9nvoAyQUzig2uMSXfF2OBEYBV3CVjIL9JvaQ==", + "dev": true, + "requires": { + "debug": "3.1.0", + "istanbul-lib-coverage": "1.1.1", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "source-map": "0.5.7" + } + }, + "istanbul-reports": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.3.tgz", + "integrity": "sha512-ZEelkHh8hrZNI5xDaKwPMFwDsUf5wIEI2bXAFGp1e6deR2mnEKBPhLJEgr4ZBt8Gi6Mj38E/C8kcy9XLggVO2Q==", + "dev": true, + "requires": { + "handlebars": "4.0.11" + } + }, + "jest": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest/-/jest-21.2.1.tgz", + "integrity": "sha512-mXN0ppPvWYoIcC+R+ctKxAJ28xkt/Z5Js875padm4GbgUn6baeR5N4Ng6LjatIRpUQDZVJABT7Y4gucFjPryfw==", + "dev": true, + "requires": { + "jest-cli": "21.2.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "jest-cli": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.2.1.tgz", + "integrity": "sha512-T1BzrbFxDIW/LLYQqVfo94y/hhaj1NzVQkZgBumAC+sxbjMROI7VkihOdxNR758iYbQykL2ZOWUBurFgkQrzdg==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "is-ci": "1.0.10", + "istanbul-api": "1.2.1", + "istanbul-lib-coverage": "1.1.1", + "istanbul-lib-instrument": "1.9.1", + "istanbul-lib-source-maps": "1.2.2", + "jest-changed-files": "21.2.0", + "jest-config": "21.2.1", + "jest-environment-jsdom": "21.2.1", + "jest-haste-map": "21.2.0", + "jest-message-util": "21.2.1", + "jest-regex-util": "21.2.0", + "jest-resolve-dependencies": "21.2.0", + "jest-runner": "21.2.1", + "jest-runtime": "21.2.1", + "jest-snapshot": "21.2.1", + "jest-util": "21.2.1", + "micromatch": "2.3.11", + "node-notifier": "5.1.2", + "pify": "3.0.0", + "slash": "1.0.0", + "string-length": "2.0.0", + "strip-ansi": "4.0.0", + "which": "1.3.0", + "worker-farm": "1.5.1", + "yargs": "9.0.1" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-changed-files": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.2.0.tgz", + "integrity": "sha512-+lCNP1IZLwN1NOIvBcV5zEL6GENK6TXrDj4UxWIeLvIsIDa+gf6J7hkqsW2qVVt/wvH65rVvcPwqXdps5eclTQ==", + "dev": true, + "requires": { + "throat": "4.1.0" + } + }, + "jest-config": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.2.1.tgz", + "integrity": "sha512-fJru5HtlD/5l2o25eY9xT0doK3t2dlglrqoGpbktduyoI0T5CwuB++2YfoNZCrgZipTwPuAGonYv0q7+8yDc/A==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "glob": "7.1.2", + "jest-environment-jsdom": "21.2.1", + "jest-environment-node": "21.2.1", + "jest-get-type": "21.2.0", + "jest-jasmine2": "21.2.1", + "jest-regex-util": "21.2.0", + "jest-resolve": "21.2.0", + "jest-util": "21.2.1", + "jest-validate": "21.2.1", + "pretty-format": "21.2.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-diff": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.2.1.tgz", + "integrity": "sha512-E5fu6r7PvvPr5qAWE1RaUwIh/k6Zx/3OOkZ4rk5dBJkEWRrUuSgbMt2EO8IUTPTd6DOqU3LW6uTIwX5FRvXoFA==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "diff": "3.4.0", + "jest-get-type": "21.2.0", + "pretty-format": "21.2.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-docblock": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", + "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==", + "dev": true + }, + "jest-environment-jsdom": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz", + "integrity": "sha512-mecaeNh0eWmzNrUNMWARysc0E9R96UPBamNiOCYL28k7mksb1d0q6DD38WKP7ABffjnXyUWJPVaWRgUOivwXwg==", + "dev": true, + "requires": { + "jest-mock": "21.2.0", + "jest-util": "21.2.1", + "jsdom": "9.12.0" + } + }, + "jest-environment-node": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.2.1.tgz", + "integrity": "sha512-R211867wx9mVBVHzrjGRGTy5cd05K7eqzQl/WyZixR/VkJ4FayS8qkKXZyYnwZi6Rxo6WEV81cDbiUx/GfuLNw==", + "dev": true, + "requires": { + "jest-mock": "21.2.0", + "jest-util": "21.2.1" + } + }, + "jest-get-type": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.2.0.tgz", + "integrity": "sha512-y2fFw3C+D0yjNSDp7ab1kcd6NUYfy3waPTlD8yWkAtiocJdBRQqNoRqVfMNxgj+IjT0V5cBIHJO0z9vuSSZ43Q==", + "dev": true + }, + "jest-haste-map": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-21.2.0.tgz", + "integrity": "sha512-5LhsY/loPH7wwOFRMs+PT4aIAORJ2qwgbpMFlbWbxfN0bk3ZCwxJ530vrbSiTstMkYLao6JwBkLhCJ5XbY7ZHw==", + "dev": true, + "requires": { + "fb-watchman": "2.0.0", + "graceful-fs": "4.1.11", + "jest-docblock": "21.2.0", + "micromatch": "2.3.11", + "sane": "2.2.0", + "worker-farm": "1.5.1" + } + }, + "jest-jasmine2": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz", + "integrity": "sha512-lw8FXXIEekD+jYNlStfgNsUHpfMWhWWCgHV7n0B7mA/vendH7vBFs8xybjQsDzJSduptBZJHqQX9SMssya9+3A==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "expect": "21.2.1", + "graceful-fs": "4.1.11", + "jest-diff": "21.2.1", + "jest-matcher-utils": "21.2.1", + "jest-message-util": "21.2.1", + "jest-snapshot": "21.2.1", + "p-cancelable": "0.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-matcher-utils": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz", + "integrity": "sha512-kn56My+sekD43dwQPrXBl9Zn9tAqwoy25xxe7/iY4u+mG8P3ALj5IK7MLHZ4Mi3xW7uWVCjGY8cm4PqgbsqMCg==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "jest-get-type": "21.2.0", + "pretty-format": "21.2.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-message-util": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-21.2.1.tgz", + "integrity": "sha512-EbC1X2n0t9IdeMECJn2BOg7buOGivCvVNjqKMXTzQOu7uIfLml+keUfCALDh8o4rbtndIeyGU8/BKfoTr/LVDQ==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "micromatch": "2.3.11", + "slash": "1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-mock": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.2.0.tgz", + "integrity": "sha512-aZDfyVf0LEoABWiY6N0d+O963dUQSyUa4qgzurHR3TBDPen0YxKCJ6l2i7lQGh1tVdsuvdrCZ4qPj+A7PievCw==", + "dev": true + }, + "jest-regex-util": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.2.0.tgz", + "integrity": "sha512-BKQ1F83EQy0d9Jen/mcVX7D+lUt2tthhK/2gDWRgLDJRNOdRgSp1iVqFxP8EN1ARuypvDflRfPzYT8fQnoBQFQ==", + "dev": true + }, + "jest-resolve": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.2.0.tgz", + "integrity": "sha512-vefQ/Lr+VdNvHUZFQXWtOqHX3HEdOc2MtSahBO89qXywEbUxGPB9ZLP9+BHinkxb60UT2Q/tTDOS6rYc6Mwigw==", + "dev": true, + "requires": { + "browser-resolve": "1.11.2", + "chalk": "2.3.0", + "is-builtin-module": "1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-resolve-dependencies": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz", + "integrity": "sha512-ok8ybRFU5ScaAcfufIQrCbdNJSRZ85mkxJ1EhUp8Bhav1W1/jv/rl1Q6QoVQHObNxmKnbHVKrfLZbCbOsXQ+bQ==", + "dev": true, + "requires": { + "jest-regex-util": "21.2.0" + } + }, + "jest-runner": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.2.1.tgz", + "integrity": "sha512-Anb72BOQlHqF/zETqZ2K20dbYsnqW/nZO7jV8BYENl+3c44JhMrA8zd1lt52+N7ErnsQMd2HHKiVwN9GYSXmrg==", + "dev": true, + "requires": { + "jest-config": "21.2.1", + "jest-docblock": "21.2.0", + "jest-haste-map": "21.2.0", + "jest-jasmine2": "21.2.1", + "jest-message-util": "21.2.1", + "jest-runtime": "21.2.1", + "jest-util": "21.2.1", + "pify": "3.0.0", + "throat": "4.1.0", + "worker-farm": "1.5.1" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "jest-runtime": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-21.2.1.tgz", + "integrity": "sha512-6omlpA3+NSE+rHwD0PQjNEjZeb2z+oRmuehMfM1tWQVum+E0WV3pFt26Am0DUfQkkPyTABvxITRjCUclYgSOsA==", + "dev": true, + "requires": { + "babel-core": "6.26.0", + "babel-jest": "21.2.0", + "babel-plugin-istanbul": "4.1.5", + "chalk": "2.3.0", + "convert-source-map": "1.5.0", + "graceful-fs": "4.1.11", + "jest-config": "21.2.1", + "jest-haste-map": "21.2.0", + "jest-regex-util": "21.2.0", + "jest-resolve": "21.2.0", + "jest-util": "21.2.1", + "json-stable-stringify": "1.0.1", + "micromatch": "2.3.11", + "slash": "1.0.0", + "strip-bom": "3.0.0", + "write-file-atomic": "2.3.0", + "yargs": "9.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-snapshot": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.2.1.tgz", + "integrity": "sha512-bpaeBnDpdqaRTzN8tWg0DqOTo2DvD3StOemxn67CUd1p1Po+BUpvePAp44jdJ7Pxcjfg+42o4NHw1SxdCA2rvg==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "jest-diff": "21.2.1", + "jest-matcher-utils": "21.2.1", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "pretty-format": "21.2.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-util": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.2.1.tgz", + "integrity": "sha512-r20W91rmHY3fnCoO7aOAlyfC51x2yeV3xF+prGsJAUsYhKeV670ZB8NO88Lwm7ASu8SdH0S+U+eFf498kjhA4g==", + "dev": true, + "requires": { + "callsites": "2.0.0", + "chalk": "2.3.0", + "graceful-fs": "4.1.11", + "jest-message-util": "21.2.1", + "jest-mock": "21.2.0", + "jest-validate": "21.2.1", + "mkdirp": "0.5.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "jest-validate": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.2.1.tgz", + "integrity": "sha512-k4HLI1rZQjlU+EC682RlQ6oZvLrE5SCh3brseQc24vbZTxzT/k/3urar5QMCVgjadmSO7lECeGdc6YxnM3yEGg==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "jest-get-type": "21.2.0", + "leven": "2.1.0", + "pretty-format": "21.2.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "js-base64": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.3.2.tgz", + "integrity": "sha512-Y2/+DnfJJXT1/FCwUebUhLWb3QihxiSC42+ctHLGogmW2jPY6LCapMdFZXRvVP2z6qyKW7s6qncE/9gSqZiArw==", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jschardet": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", + "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", + "dev": true + }, + "jsdom": { + "version": "9.12.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz", + "integrity": "sha1-6MVG//ywbADUgzyoRBD+1/igl9Q=", + "dev": true, + "requires": { + "abab": "1.0.4", + "acorn": "4.0.13", + "acorn-globals": "3.1.0", + "array-equal": "1.0.0", + "content-type-parser": "1.0.2", + "cssom": "0.3.2", + "cssstyle": "0.2.37", + "escodegen": "1.9.0", + "html-encoding-sniffer": "1.0.2", + "nwmatcher": "1.4.3", + "parse5": "1.5.1", + "request": "2.83.0", + "sax": "1.2.4", + "symbol-tree": "3.2.2", + "tough-cookie": "2.3.3", + "webidl-conversions": "4.0.2", + "whatwg-encoding": "1.0.3", + "whatwg-url": "4.8.0", + "xml-name-validator": "2.0.1" + }, + "dependencies": { + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", + "dev": true + } + } + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", + "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "1.0.0" + } + }, + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "linefix": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/linefix/-/linefix-0.1.1.tgz", + "integrity": "sha1-WB9UspNf++nfJVdw8Ko7A0E4I5M=", + "dev": true + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "strip-bom": "2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true + }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=" + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "3.0.2" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "0.4.1", + "signal-exit": "3.0.2" + } + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "makeerror": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "dev": true, + "requires": { + "tmpl": "1.0.4" + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "1.1.0" + } + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "2.1.0", + "decamelize": "1.2.0", + "loud-rejection": "1.6.0", + "map-obj": "1.0.1", + "minimist": "1.2.0", + "normalize-package-data": "2.4.0", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "redent": "1.0.0", + "trim-newlines": "1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "merge": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", + "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", + "dev": true + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "dev": true, + "requires": { + "mime-db": "1.30.0" + } + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", + "dev": true + }, + "node-notifier": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.1.2.tgz", + "integrity": "sha1-L6nhJgX6EACdRFSdb82KY93g5P8=", + "dev": true, + "requires": { + "growly": "1.3.0", + "semver": "5.4.1", + "shellwords": "0.1.1", + "which": "1.3.0" + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1.1.1" + } + }, + "nopt-usage": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/nopt-usage/-/nopt-usage-0.1.0.tgz", + "integrity": "sha1-sYuMGD4YEEfKnmO3zefPxwLMpXk=", + "dev": true + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "2.5.0", + "is-builtin-module": "1.0.0", + "semver": "5.4.1", + "validate-npm-package-license": "3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "npm-license": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/npm-license/-/npm-license-0.3.3.tgz", + "integrity": "sha1-9n9LwjyGP24GLN5jlBTgURbc24I=", + "dev": true, + "requires": { + "mkdirp": "0.5.1", + "nopt": "3.0.6", + "nopt-usage": "0.1.0", + "package-license": "0.1.2", + "pkginfo": "0.3.1", + "read-installed": "4.0.3", + "treeify": "1.0.1", + "underscore": "1.4.4" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "nwmatcher": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", + "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.1.0" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "0.0.8", + "wordwrap": "0.0.3" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "0.7.0", + "lcid": "1.0.0", + "mem": "1.1.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", + "dev": true + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "1.1.0" + } + }, + "package-license": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/package-license/-/package-license-0.1.2.tgz", + "integrity": "sha1-9cRJp6UPrfSiI0HilJCZ+RpCAos=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "parse5": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", + "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=", + "dev": true + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "pkginfo": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", + "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=", + "dev": true + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "pretty-format": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", + "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", + "dev": true, + "requires": { + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + } + } + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "prr": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz", + "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "read-installed": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz", + "integrity": "sha1-/5uLZ/GH0eTCm5/rMfayI6zRkGc=", + "dev": true, + "requires": { + "debuglog": "1.0.1", + "graceful-fs": "4.1.11", + "read-package-json": "2.0.12", + "readdir-scoped-modules": "1.0.2", + "semver": "5.4.1", + "slide": "1.1.6", + "util-extend": "1.0.3" + } + }, + "read-package-json": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", + "integrity": "sha512-m7/I0+tP6D34EVvSlzCtuVA4D/dHL6OpLcn2e4XVP5X57pCKGUy1JjRSBVKHWpB+vUU91sL85h84qX0MdXzBSw==", + "dev": true, + "requires": { + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "json-parse-better-errors": "1.0.1", + "normalize-package-data": "2.4.0", + "slash": "1.0.0" + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "1.1.0", + "normalize-package-data": "2.4.0", + "path-type": "1.1.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "1.1.2", + "read-pkg": "1.1.0" + } + }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "readdir-scoped-modules": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz", + "integrity": "sha1-n6+jfShr5dksuuve4DDcm19AZ0c=", + "dev": true, + "requires": { + "debuglog": "1.0.1", + "dezalgo": "1.0.3", + "graceful-fs": "4.1.11", + "once": "1.4.0" + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "1.5.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "2.1.0", + "strip-indent": "1.0.1" + } + }, + "regenerator-runtime": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + } + }, + "request": { + "version": "2.83.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "dev": true, + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.1", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.6.0", + "uuid": "3.1.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "0.1.0", + "resolve-from": "1.0.1" + } + }, + "resolve": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "4.0.8" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "sane": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/sane/-/sane-2.2.0.tgz", + "integrity": "sha512-OSJxhHO0CgPUw3lUm3GhfREAfza45smvEI9ozuFrxKG10GHVo0ryW9FK5VYlLvxj0SV7HVKHW0voYJIRu27GWg==", + "dev": true, + "requires": { + "anymatch": "1.3.2", + "exec-sh": "0.2.1", + "fb-watchman": "2.0.0", + "minimatch": "3.0.4", + "minimist": "1.2.0", + "walker": "1.0.7", + "watch": "0.18.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "dev": true, + "requires": { + "glob": "7.1.2", + "interpret": "1.0.4", + "rechoir": "0.6.2" + } + }, + "shelljs-nodecli": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shelljs-nodecli/-/shelljs-nodecli-0.1.1.tgz", + "integrity": "sha1-8b61VjdUxHXQb30IM+D2B15GLTs=", + "dev": true, + "requires": { + "shelljs": "0.2.6" + }, + "dependencies": { + "shelljs": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz", + "integrity": "sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=", + "dev": true + } + } + }, + "shellwords": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", + "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + } + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "dev": true + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "0.5.7" + } + }, + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true, + "requires": { + "spdx-license-ids": "1.2.2" + } + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "dev": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "stream-consume": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz", + "integrity": "sha1-pB6tGm1ggc63n2WwYZAbbY89HQ8=", + "dev": true + }, + "string-length": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", + "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", + "dev": true, + "requires": { + "astral-regex": "1.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "0.2.1" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "4.0.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "symbol-tree": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", + "dev": true + }, + "table": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", + "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "ajv-keywords": "2.1.1", + "chalk": "2.3.0", + "lodash": "4.17.4", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "test-exclude": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", + "integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==", + "dev": true, + "requires": { + "arrify": "1.0.1", + "micromatch": "2.3.11", + "object-assign": "4.1.1", + "read-pkg-up": "1.0.1", + "require-main-filename": "1.0.1" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "throat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", + "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "tmpl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "tough-cookie": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "treeify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.0.1.tgz", + "integrity": "sha1-abPNAiAioWhCTnz6HO1EyTnT6y8=", + "dev": true + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "tryit": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", + "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz", + "integrity": "sha1-7znN6ierrAtQAkLWcmq5DgyEZjE=", + "dev": true + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "underscore": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", + "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=", + "dev": true + }, + "utf8": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", + "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "util-extend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz", + "integrity": "sha1-p8IW0mdUUWljeztu3GypEZ4v+T8=", + "dev": true + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true, + "requires": { + "spdx-correct": "1.0.2", + "spdx-expression-parse": "1.0.4" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, + "walker": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "dev": true, + "requires": { + "makeerror": "1.0.11" + } + }, + "watch": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", + "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", + "dev": true, + "requires": { + "exec-sh": "0.2.1", + "minimist": "1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "whatwg-encoding": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", + "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", + "dev": true, + "requires": { + "iconv-lite": "0.4.19" + } + }, + "whatwg-url": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz", + "integrity": "sha1-0pgaqRSMHgCkHFphMRZqtGg7vMA=", + "dev": true, + "requires": { + "tr46": "0.0.3", + "webidl-conversions": "3.0.1" + }, + "dependencies": { + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + } + } + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "worker-farm": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.1.tgz", + "integrity": "sha512-T5NH6Wqsd8MwGD4AK8BBllUy6LmHaqjEOyo/YIUEegZui6/v5Bqde//3jwyE3PGiGYMmWi06exFBi5LNhhPFNw==", + "dev": true, + "requires": { + "errno": "0.1.4", + "xtend": "4.0.1" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "0.5.1" + } + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "imurmurhash": "0.1.4", + "signal-exit": "3.0.2" + } + }, + "xml-name-validator": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz", + "integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", + "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", + "dev": true, + "requires": { + "camelcase": "4.1.0", + "cliui": "3.2.0", + "decamelize": "1.2.0", + "get-caller-file": "1.0.2", + "os-locale": "2.1.0", + "read-pkg-up": "2.0.0", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "3.2.1", + "yargs-parser": "7.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "dev": true, + "requires": { + "camelcase": "4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + } + } +} diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 18e95fe4e2a5..65abd79688f6 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "8.0.1", + "version": "9.0.0", "files": [ "lib", "parser.js" From 5f3c87835961e9c29cadf148b50ee348fd58bc51 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 29 Nov 2017 21:00:00 +0000 Subject: [PATCH 222/326] Fix: Explicitly convert AbstractKeyword (fixes #407) (#408) --- packages/typescript-eslint-parser/lib/convert.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 61d17b9e6142..a65126163e62 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -2124,6 +2124,13 @@ module.exports = function convert(config) { break; } + case SyntaxKind.AbstractKeyword: { + Object.assign(result, { + type: AST_NODE_TYPES.TSAbstractKeyword + }); + break; + } + case SyntaxKind.ModuleDeclaration: { Object.assign(result, { type: AST_NODE_TYPES.TSModuleDeclaration, From 8223748411f7495f5ab9bb96718ffb2576560a53 Mon Sep 17 00:00:00 2001 From: Lucas Duailibe Date: Wed, 29 Nov 2017 18:16:49 -0300 Subject: [PATCH 223/326] Fix: Calculate end position of TypeInstantiation (fixes #406) (#405) --- .../typescript-eslint-parser/lib/convert.js | 6 +- .../basics/type-reference-comments.src.ts | 3 + .../lib/__snapshots__/typescript.js.snap | 475 ++++++++++++++++++ 3 files changed, 481 insertions(+), 3 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-reference-comments.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index a65126163e62..243cd655e892 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -112,10 +112,10 @@ module.exports = function convert(config) { const firstTypeArgument = typeArguments[0]; const typeArgumentsParent = firstTypeArgument.parent; /** - * In the case of the parent being a CallExpression we have to use slightly different - * logic to calculate the correct end position + * In the case of the parent being a CallExpression or a TypeReference we have to use + * slightly different logic to calculate the correct end position */ - if (typeArgumentsParent && typeArgumentsParent.kind === SyntaxKind.CallExpression) { + if (typeArgumentsParent && (typeArgumentsParent.kind === SyntaxKind.CallExpression || typeArgumentsParent.kind === SyntaxKind.TypeReference)) { const lastTypeArgument = typeArguments[typeArguments.length - 1]; const greaterThanToken = nodeUtils.findNextToken(lastTypeArgument, ast); end = greaterThanToken.end; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-reference-comments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-reference-comments.src.ts new file mode 100644 index 000000000000..3ca1f8dbb282 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/type-reference-comments.src.ts @@ -0,0 +1,3 @@ +class AudioBufferList { + mBuffers: interop.Reference; +} diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 81f17a572a01..b6ceb7032de3 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -41607,6 +41607,481 @@ Object { } `; +exports[`typescript fixtures/basics/type-reference-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "mBuffers", + "range": Array [ + 26, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 51, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 26, + 75, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 34, + 74, + ], + "type": "TypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "interop", + "range": Array [ + 36, + 43, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 53, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "Reference", + "range": Array [ + 44, + 53, + ], + "type": "Identifier", + }, + "type": "TSQualifiedName", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 53, + 74, + ], + "type": "TypeParameterInstantiation", + }, + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 77, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "AudioBufferList", + "range": Array [ + 6, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 77, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 21, + ], + "type": "Identifier", + "value": "AudioBufferList", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Identifier", + "value": "mBuffers", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Identifier", + "value": "interop", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 44, + 53, + ], + "type": "Identifier", + "value": "Reference", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 49, + "line": 2, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/typed-this.src 1`] = ` Object { "body": Array [ From fe68684757c4cb6256c76dafb4fc6b84448d958e Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 29 Nov 2017 16:18:39 -0500 Subject: [PATCH 224/326] Build: changelog update for 9.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index b0a99322d5b4..680cbef3255e 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v9.0.1 - November 29, 2017 + +* 153cdb8 Fix: Calculate end position of TypeInstantiation (fixes #406) (#405) (Lucas Duailibe) +* 678907b Fix: Explicitly convert AbstractKeyword (fixes #407) (#408) (James Henry) + v9.0.0 - November 10, 2017 * 46479e8 Breaking: Support TypeScript 2.6 (fixes #394) (#397) (James Henry) From b125dd9fb783e48e6f235719a0d0cdb1ec96bf85 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 29 Nov 2017 16:18:39 -0500 Subject: [PATCH 225/326] 9.0.1 --- packages/typescript-eslint-parser/package-lock.json | 2 +- packages/typescript-eslint-parser/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/package-lock.json b/packages/typescript-eslint-parser/package-lock.json index 05ee5e6aeab5..072dd3a5a090 100644 --- a/packages/typescript-eslint-parser/package-lock.json +++ b/packages/typescript-eslint-parser/package-lock.json @@ -1,6 +1,6 @@ { "name": "typescript-eslint-parser", - "version": "9.0.0", + "version": "9.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 65abd79688f6..c7b3edaad450 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "9.0.0", + "version": "9.0.1", "files": [ "lib", "parser.js" From 957a1bce421af583ba26a35519223843c149ce61 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 29 Nov 2017 21:44:27 +0000 Subject: [PATCH 226/326] Chore: No package-lock like other ESLint repos (#409) --- packages/typescript-eslint-parser/.npmrc | 1 + .../package-lock.json | 4780 ----------------- 2 files changed, 1 insertion(+), 4780 deletions(-) create mode 100644 packages/typescript-eslint-parser/.npmrc delete mode 100644 packages/typescript-eslint-parser/package-lock.json diff --git a/packages/typescript-eslint-parser/.npmrc b/packages/typescript-eslint-parser/.npmrc new file mode 100644 index 000000000000..9cf9495031ec --- /dev/null +++ b/packages/typescript-eslint-parser/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/packages/typescript-eslint-parser/package-lock.json b/packages/typescript-eslint-parser/package-lock.json deleted file mode 100644 index 072dd3a5a090..000000000000 --- a/packages/typescript-eslint-parser/package-lock.json +++ /dev/null @@ -1,4780 +0,0 @@ -{ - "name": "typescript-eslint-parser", - "version": "9.0.1", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "abab": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", - "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=", - "dev": true - }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "acorn": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", - "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", - "dev": true - }, - "acorn-globals": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-3.1.0.tgz", - "integrity": "sha1-/YJw9x+7SZawBPqIDuXUZXOnMb8=", - "dev": true, - "requires": { - "acorn": "4.0.13" - }, - "dependencies": { - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - } - } - }, - "acorn-jsx": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", - "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", - "dev": true, - "requires": { - "acorn": "3.3.0" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", - "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", - "dev": true - } - } - }, - "ajv": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", - "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", - "dev": true, - "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "fast-json-stable-stringify": "2.0.0", - "json-schema-traverse": "0.3.1" - } - }, - "ajv-keywords": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", - "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", - "dev": true - }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true, - "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" - } - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, - "ansi-escapes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "anymatch": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", - "dev": true, - "requires": { - "micromatch": "2.3.11", - "normalize-path": "2.1.1" - } - }, - "append-transform": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-0.4.0.tgz", - "integrity": "sha1-126/jKlNJ24keja61EpLdKthGZE=", - "dev": true, - "requires": { - "default-require-extensions": "1.0.0" - } - }, - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "dev": true, - "requires": { - "sprintf-js": "1.0.3" - } - }, - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true, - "requires": { - "arr-flatten": "1.1.0" - } - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "array-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", - "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", - "dev": true - }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", - "dev": true - }, - "array-union": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", - "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", - "dev": true, - "requires": { - "array-uniq": "1.0.3" - } - }, - "array-uniq": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", - "dev": true - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", - "dev": true - }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", - "dev": true - }, - "asn1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true - }, - "astral-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", - "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true - }, - "async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", - "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", - "dev": true, - "requires": { - "lodash": "4.17.4" - } - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", - "dev": true - }, - "aws4": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", - "dev": true - }, - "axios": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.10.0.tgz", - "integrity": "sha1-Ww7A1ftT55uYt7+EwOmxz5Av38Q=", - "dev": true, - "requires": { - "follow-redirects": "0.0.7" - } - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.2" - } - }, - "babel-core": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", - "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", - "dev": true, - "requires": { - "babel-code-frame": "6.26.0", - "babel-generator": "6.26.0", - "babel-helpers": "6.24.1", - "babel-messages": "6.23.0", - "babel-register": "6.26.0", - "babel-runtime": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "convert-source-map": "1.5.0", - "debug": "2.6.9", - "json5": "0.5.1", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "path-is-absolute": "1.0.1", - "private": "0.1.8", - "slash": "1.0.0", - "source-map": "0.5.7" - }, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "babel-generator": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", - "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", - "dev": true, - "requires": { - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "detect-indent": "4.0.0", - "jsesc": "1.3.0", - "lodash": "4.17.4", - "source-map": "0.5.7", - "trim-right": "1.0.1" - } - }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "dev": true, - "requires": { - "babel-runtime": "6.26.0", - "babel-template": "6.26.0" - } - }, - "babel-jest": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-21.2.0.tgz", - "integrity": "sha512-O0W2qLoWu1QOoOGgxiR2JID4O6WSpxPiQanrkyi9SSlM0PJ60Ptzlck47lhtnr9YZO3zYOsxHwnyeWJ6AffoBQ==", - "dev": true, - "requires": { - "babel-plugin-istanbul": "4.1.5", - "babel-preset-jest": "21.2.0" - } - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true, - "requires": { - "babel-runtime": "6.26.0" - } - }, - "babel-plugin-istanbul": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz", - "integrity": "sha1-Z2DN2Xf0EdPhdbsGTyvDJ9mbK24=", - "dev": true, - "requires": { - "find-up": "2.1.0", - "istanbul-lib-instrument": "1.9.1", - "test-exclude": "4.1.1" - }, - "dependencies": { - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "2.0.0" - } - } - } - }, - "babel-plugin-jest-hoist": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz", - "integrity": "sha512-yi5QuiVyyvhBUDLP4ButAnhYzkdrUwWDtvUJv71hjH3fclhnZg4HkDeqaitcR2dZZx/E67kGkRcPVjtVu+SJfQ==", - "dev": true - }, - "babel-plugin-syntax-object-rest-spread": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", - "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", - "dev": true - }, - "babel-preset-jest": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz", - "integrity": "sha512-hm9cBnr2h3J7yXoTtAVV0zg+3vg0Q/gT2GYuzlreTU0EPkJRtlNgKJJ3tBKEn0+VjAi3JykV6xCJkuUYttEEfA==", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "21.2.0", - "babel-plugin-syntax-object-rest-spread": "6.13.0" - } - }, - "babel-register": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", - "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", - "dev": true, - "requires": { - "babel-core": "6.26.0", - "babel-runtime": "6.26.0", - "core-js": "2.5.1", - "home-or-tmp": "2.0.0", - "lodash": "4.17.4", - "mkdirp": "0.5.1", - "source-map-support": "0.4.18" - } - }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dev": true, - "requires": { - "core-js": "2.5.1", - "regenerator-runtime": "0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "dev": true, - "requires": { - "babel-runtime": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "lodash": "4.17.4" - }, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - } - } - }, - "babel-traverse": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "dev": true, - "requires": { - "babel-code-frame": "6.26.0", - "babel-messages": "6.23.0", - "babel-runtime": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "debug": "2.6.9", - "globals": "9.18.0", - "invariant": "2.2.2", - "lodash": "4.17.4" - }, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "babel-types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "dev": true, - "requires": { - "babel-runtime": "6.26.0", - "esutils": "2.0.2", - "lodash": "4.17.4", - "to-fast-properties": "1.0.3" - } - }, - "babylon": { - "version": "7.0.0-beta.24", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.24.tgz", - "integrity": "sha512-k1yiJYz1Zt6/xfxx0OC7obTNOF5WktZ8P8z1y+7kwP4INOygqqgzolO5fse4jYIb3CzHyU7WNC38EjYa1wjEGQ==", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "0.14.5" - } - }, - "boom": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", - "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", - "dev": true, - "requires": { - "hoek": "4.2.0" - } - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true, - "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" - } - }, - "browser-resolve": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", - "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", - "dev": true, - "requires": { - "resolve": "1.1.7" - }, - "dependencies": { - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - } - } - }, - "bser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.0.0.tgz", - "integrity": "sha1-mseNPtXZFYBP2HrLFYvHlxR6Fxk=", - "dev": true, - "requires": { - "node-int64": "0.4.0" - } - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "caller-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", - "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", - "dev": true, - "requires": { - "callsites": "0.2.0" - } - }, - "callsites": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", - "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", - "dev": true - }, - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "dev": true, - "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", - "dev": true - }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "optional": true, - "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" - } - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "ci-info": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.1.tgz", - "integrity": "sha512-vHDDF/bP9RYpTWtUhpJRhCFdvvp3iDWvEbuDbWgvjUrNGV1MXJrE0MPcwGtEled04m61iwdBLUIHZtDgzWS4ZQ==", - "dev": true - }, - "circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "dev": true - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "2.0.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "optional": true, - "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true, - "optional": true - } - } - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "color-convert": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", - "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", - "dev": true, - "requires": { - "delayed-stream": "1.0.0" - } - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" - } - }, - "content-type-parser": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", - "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==", - "dev": true - }, - "convert-source-map": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", - "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", - "dev": true - }, - "core-js": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", - "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "shebang-command": "1.2.0", - "which": "1.3.0" - } - }, - "cryptiles": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", - "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", - "dev": true, - "requires": { - "boom": "5.2.0" - }, - "dependencies": { - "boom": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", - "dev": true, - "requires": { - "hoek": "4.2.0" - } - } - } - }, - "cssom": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", - "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=", - "dev": true - }, - "cssstyle": { - "version": "0.2.37", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", - "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", - "dev": true, - "requires": { - "cssom": "0.3.2" - } - }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "dev": true, - "requires": { - "array-find-index": "1.0.2" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "dev": true, - "requires": { - "assert-plus": "1.0.0" - } - }, - "dateformat": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", - "integrity": "sha1-nxJLZ1lMk3/3BpMuSmQsyo27/uk=", - "dev": true, - "requires": { - "get-stdin": "4.0.1", - "meow": "3.7.0" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "debuglog": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", - "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "default-require-extensions": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-1.0.0.tgz", - "integrity": "sha1-836hXT4T/9m0N9M+GnW1+5eHTLg=", - "dev": true, - "requires": { - "strip-bom": "2.0.0" - } - }, - "del": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", - "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", - "dev": true, - "requires": { - "globby": "5.0.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "rimraf": "2.6.2" - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true, - "requires": { - "repeating": "2.0.1" - } - }, - "dezalgo": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", - "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", - "dev": true, - "requires": { - "asap": "2.0.6", - "wrappy": "1.0.2" - } - }, - "diff": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", - "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==", - "dev": true - }, - "doctrine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", - "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", - "dev": true, - "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" - } - }, - "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "dev": true, - "optional": true, - "requires": { - "jsbn": "0.1.1" - } - }, - "errno": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", - "integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=", - "dev": true, - "requires": { - "prr": "0.0.0" - } - }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", - "dev": true, - "requires": { - "is-arrayish": "0.2.1" - } - }, - "es6-promise": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", - "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", - "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", - "dev": true, - "requires": { - "esprima": "3.1.3", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.5.7" - }, - "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - } - } - }, - "eslint": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", - "integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", - "dev": true, - "requires": { - "ajv": "5.3.0", - "babel-code-frame": "6.26.0", - "chalk": "2.3.0", - "concat-stream": "1.6.0", - "cross-spawn": "5.1.0", - "debug": "3.1.0", - "doctrine": "2.0.0", - "eslint-scope": "3.7.1", - "espree": "3.5.1", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "functional-red-black-tree": "1.0.1", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "inquirer": "3.3.0", - "is-resolvable": "1.0.0", - "js-yaml": "3.10.0", - "json-stable-stringify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "7.0.0", - "progress": "2.0.0", - "require-uncached": "1.0.3", - "semver": "5.4.1", - "strip-ansi": "4.0.0", - "strip-json-comments": "2.0.1", - "table": "4.0.2", - "text-table": "0.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "eslint-config-eslint": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-eslint/-/eslint-config-eslint-4.0.0.tgz", - "integrity": "sha1-pGOpZiHkyKgOqR60wHh7ujoPe+s=", - "dev": true, - "requires": { - "js-yaml": "3.10.0" - } - }, - "eslint-plugin-node": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz", - "integrity": "sha512-xhPXrh0Vl/b7870uEbaumb2Q+LxaEcOQ3kS1jtIXanBAwpMre1l5q/l2l/hESYJGEFKuI78bp6Uw50hlpr7B+g==", - "dev": true, - "requires": { - "ignore": "3.3.7", - "minimatch": "3.0.4", - "resolve": "1.5.0", - "semver": "5.3.0" - }, - "dependencies": { - "semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", - "dev": true - } - } - }, - "eslint-release": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/eslint-release/-/eslint-release-0.10.3.tgz", - "integrity": "sha1-kCd4FIxPO++dHiL+4ir1z7pweBM=", - "dev": true, - "requires": { - "dateformat": "1.0.12", - "github-api": "2.3.0", - "linefix": "0.1.1", - "npm-license": "0.3.3", - "semver": "5.4.1", - "shelljs": "0.5.3" - }, - "dependencies": { - "shelljs": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", - "integrity": "sha1-xUmCuZbHbvDB5rWfvcWCX1txMRM=", - "dev": true - } - } - }, - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "4.2.0", - "estraverse": "4.2.0" - } - }, - "espree": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", - "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", - "dev": true, - "requires": { - "acorn": "5.2.1", - "acorn-jsx": "3.0.1" - } - }, - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true - }, - "esquery": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", - "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", - "dev": true, - "requires": { - "estraverse": "4.2.0" - } - }, - "esrecurse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", - "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", - "dev": true, - "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" - } - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "exec-sh": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.1.tgz", - "integrity": "sha512-aLt95pexaugVtQerpmE51+4QfWrNc304uez7jvj6fWnN8GeEHpttB8F36n8N7uVhUMbH/1enbxQ9HImZ4w/9qg==", - "dev": true, - "requires": { - "merge": "1.2.0" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "5.1.0", - "get-stream": "3.0.0", - "is-stream": "1.1.0", - "npm-run-path": "2.0.2", - "p-finally": "1.0.0", - "signal-exit": "3.0.2", - "strip-eof": "1.0.0" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true, - "requires": { - "is-posix-bracket": "0.1.1" - } - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true, - "requires": { - "fill-range": "2.2.3" - } - }, - "expect": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-21.2.1.tgz", - "integrity": "sha512-orfQQqFRTX0jH7znRIGi8ZMR8kTNpXklTTz8+HGTpmTKZo3Occ6JNB5FXMb8cRuiiC/GyDqsr30zUa66ACYlYw==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "jest-diff": "21.2.1", - "jest-get-type": "21.2.0", - "jest-matcher-utils": "21.2.1", - "jest-message-util": "21.2.1", - "jest-regex-util": "21.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - } - } - }, - "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", - "dev": true - }, - "external-editor": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", - "dev": true, - "requires": { - "iconv-lite": "0.4.19", - "jschardet": "1.6.0", - "tmp": "0.0.33" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - }, - "fast-deep-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", - "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "fb-watchman": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", - "integrity": "sha1-VOmr99+i8mzZsWNsWIwa/AXeXVg=", - "dev": true, - "requires": { - "bser": "2.0.0" - } - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "1.0.5" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", - "dev": true, - "requires": { - "flat-cache": "1.3.0", - "object-assign": "4.1.1" - } - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, - "fileset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", - "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", - "dev": true, - "requires": { - "glob": "7.1.2", - "minimatch": "3.0.4" - } - }, - "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", - "dev": true, - "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" - } - }, - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "dev": true, - "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } - }, - "flat-cache": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", - "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", - "dev": true, - "requires": { - "circular-json": "0.3.3", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" - } - }, - "follow-redirects": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-0.0.7.tgz", - "integrity": "sha1-NLkLqyqRGqNHVx2pDyK9NuzYqRk=", - "dev": true, - "requires": { - "debug": "2.6.9", - "stream-consume": "0.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "1.0.2" - } - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "form-data": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", - "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", - "dev": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true - }, - "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", - "dev": true - }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "dev": true, - "requires": { - "assert-plus": "1.0.0" - } - }, - "github-api": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/github-api/-/github-api-2.3.0.tgz", - "integrity": "sha1-7udoRgsp6G6RuWqeefhVXO9rUyU=", - "dev": true, - "requires": { - "axios": "0.10.0", - "debug": "2.6.9", - "es6-promise": "3.3.1", - "js-base64": "2.3.2", - "utf8": "2.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true, - "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" - } - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true, - "requires": { - "is-glob": "2.0.1" - } - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "globby": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", - "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", - "dev": true, - "requires": { - "array-union": "1.0.2", - "arrify": "1.0.1", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "growly": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz", - "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", - "dev": true - }, - "handlebars": { - "version": "4.0.11", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", - "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", - "dev": true, - "requires": { - "async": "1.5.2", - "optimist": "0.6.1", - "source-map": "0.4.4", - "uglify-js": "2.8.29" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, - "source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", - "dev": true, - "requires": { - "amdefine": "1.0.1" - } - } - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", - "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", - "dev": true, - "requires": { - "ajv": "5.3.0", - "har-schema": "2.0.0" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "hawk": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", - "dev": true, - "requires": { - "boom": "4.3.1", - "cryptiles": "3.1.2", - "hoek": "4.2.0", - "sntp": "2.1.0" - } - }, - "hoek": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", - "dev": true - }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true, - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", - "dev": true - }, - "html-encoding-sniffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", - "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", - "dev": true, - "requires": { - "whatwg-encoding": "1.0.3" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "jsprim": "1.4.1", - "sshpk": "1.13.1" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "ignore": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", - "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "dev": true, - "requires": { - "repeating": "2.0.1" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", - "dev": true, - "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.0", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.0.5", - "figures": "2.0.0", - "lodash": "4.17.4", - "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "interpret": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.4.tgz", - "integrity": "sha1-ggzdWIuGj/sZGoCVBtbJyPISsbA=", - "dev": true - }, - "invariant": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", - "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", - "dev": true, - "requires": { - "loose-envify": "1.3.1" - } - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true, - "requires": { - "builtin-modules": "1.1.1" - } - }, - "is-ci": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", - "integrity": "sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4=", - "dev": true, - "requires": { - "ci-info": "1.1.1" - } - }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true, - "requires": { - "is-primitive": "2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - } - }, - "is-path-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", - "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", - "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", - "dev": true, - "requires": { - "is-path-inside": "1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", - "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", - "dev": true, - "requires": { - "path-is-inside": "1.0.2" - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-resolvable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", - "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", - "dev": true, - "requires": { - "tryit": "1.0.3" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", - "dev": true - }, - "istanbul-api": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.2.1.tgz", - "integrity": "sha512-oFCwXvd65amgaPCzqrR+a2XjanS1MvpXN6l/MlMUTv6uiA1NOgGX+I0uyq8Lg3GDxsxPsaP1049krz3hIJ5+KA==", - "dev": true, - "requires": { - "async": "2.6.0", - "fileset": "2.0.3", - "istanbul-lib-coverage": "1.1.1", - "istanbul-lib-hook": "1.1.0", - "istanbul-lib-instrument": "1.9.1", - "istanbul-lib-report": "1.1.2", - "istanbul-lib-source-maps": "1.2.2", - "istanbul-reports": "1.1.3", - "js-yaml": "3.10.0", - "mkdirp": "0.5.1", - "once": "1.4.0" - } - }, - "istanbul-lib-coverage": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", - "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==", - "dev": true - }, - "istanbul-lib-hook": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz", - "integrity": "sha512-U3qEgwVDUerZ0bt8cfl3dSP3S6opBoOtk3ROO5f2EfBr/SRiD9FQqzwaZBqFORu8W7O0EXpai+k7kxHK13beRg==", - "dev": true, - "requires": { - "append-transform": "0.4.0" - } - }, - "istanbul-lib-instrument": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz", - "integrity": "sha512-RQmXeQ7sphar7k7O1wTNzVczF9igKpaeGQAG9qR2L+BS4DCJNTI9nytRmIVYevwO0bbq+2CXvJmYDuz0gMrywA==", - "dev": true, - "requires": { - "babel-generator": "6.26.0", - "babel-template": "6.26.0", - "babel-traverse": "6.26.0", - "babel-types": "6.26.0", - "babylon": "6.18.0", - "istanbul-lib-coverage": "1.1.1", - "semver": "5.4.1" - }, - "dependencies": { - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - } - } - }, - "istanbul-lib-report": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz", - "integrity": "sha512-UTv4VGx+HZivJQwAo1wnRwe1KTvFpfi/NYwN7DcsrdzMXwpRT/Yb6r4SBPoHWj4VuQPakR32g4PUUeyKkdDkBA==", - "dev": true, - "requires": { - "istanbul-lib-coverage": "1.1.1", - "mkdirp": "0.5.1", - "path-parse": "1.0.5", - "supports-color": "3.2.3" - }, - "dependencies": { - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "1.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz", - "integrity": "sha512-8BfdqSfEdtip7/wo1RnrvLpHVEd8zMZEDmOFEnpC6dg0vXflHt9nvoAyQUzig2uMSXfF2OBEYBV3CVjIL9JvaQ==", - "dev": true, - "requires": { - "debug": "3.1.0", - "istanbul-lib-coverage": "1.1.1", - "mkdirp": "0.5.1", - "rimraf": "2.6.2", - "source-map": "0.5.7" - } - }, - "istanbul-reports": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.1.3.tgz", - "integrity": "sha512-ZEelkHh8hrZNI5xDaKwPMFwDsUf5wIEI2bXAFGp1e6deR2mnEKBPhLJEgr4ZBt8Gi6Mj38E/C8kcy9XLggVO2Q==", - "dev": true, - "requires": { - "handlebars": "4.0.11" - } - }, - "jest": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-21.2.1.tgz", - "integrity": "sha512-mXN0ppPvWYoIcC+R+ctKxAJ28xkt/Z5Js875padm4GbgUn6baeR5N4Ng6LjatIRpUQDZVJABT7Y4gucFjPryfw==", - "dev": true, - "requires": { - "jest-cli": "21.2.1" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "jest-cli": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-21.2.1.tgz", - "integrity": "sha512-T1BzrbFxDIW/LLYQqVfo94y/hhaj1NzVQkZgBumAC+sxbjMROI7VkihOdxNR758iYbQykL2ZOWUBurFgkQrzdg==", - "dev": true, - "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.3.0", - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "is-ci": "1.0.10", - "istanbul-api": "1.2.1", - "istanbul-lib-coverage": "1.1.1", - "istanbul-lib-instrument": "1.9.1", - "istanbul-lib-source-maps": "1.2.2", - "jest-changed-files": "21.2.0", - "jest-config": "21.2.1", - "jest-environment-jsdom": "21.2.1", - "jest-haste-map": "21.2.0", - "jest-message-util": "21.2.1", - "jest-regex-util": "21.2.0", - "jest-resolve-dependencies": "21.2.0", - "jest-runner": "21.2.1", - "jest-runtime": "21.2.1", - "jest-snapshot": "21.2.1", - "jest-util": "21.2.1", - "micromatch": "2.3.11", - "node-notifier": "5.1.2", - "pify": "3.0.0", - "slash": "1.0.0", - "string-length": "2.0.0", - "strip-ansi": "4.0.0", - "which": "1.3.0", - "worker-farm": "1.5.1", - "yargs": "9.0.1" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-changed-files": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-21.2.0.tgz", - "integrity": "sha512-+lCNP1IZLwN1NOIvBcV5zEL6GENK6TXrDj4UxWIeLvIsIDa+gf6J7hkqsW2qVVt/wvH65rVvcPwqXdps5eclTQ==", - "dev": true, - "requires": { - "throat": "4.1.0" - } - }, - "jest-config": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-21.2.1.tgz", - "integrity": "sha512-fJru5HtlD/5l2o25eY9xT0doK3t2dlglrqoGpbktduyoI0T5CwuB++2YfoNZCrgZipTwPuAGonYv0q7+8yDc/A==", - "dev": true, - "requires": { - "chalk": "2.3.0", - "glob": "7.1.2", - "jest-environment-jsdom": "21.2.1", - "jest-environment-node": "21.2.1", - "jest-get-type": "21.2.0", - "jest-jasmine2": "21.2.1", - "jest-regex-util": "21.2.0", - "jest-resolve": "21.2.0", - "jest-util": "21.2.1", - "jest-validate": "21.2.1", - "pretty-format": "21.2.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-diff": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-21.2.1.tgz", - "integrity": "sha512-E5fu6r7PvvPr5qAWE1RaUwIh/k6Zx/3OOkZ4rk5dBJkEWRrUuSgbMt2EO8IUTPTd6DOqU3LW6uTIwX5FRvXoFA==", - "dev": true, - "requires": { - "chalk": "2.3.0", - "diff": "3.4.0", - "jest-get-type": "21.2.0", - "pretty-format": "21.2.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-docblock": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", - "integrity": "sha512-5IZ7sY9dBAYSV+YjQ0Ovb540Ku7AO9Z5o2Cg789xj167iQuZ2cG+z0f3Uct6WeYLbU6aQiM2pCs7sZ+4dotydw==", - "dev": true - }, - "jest-environment-jsdom": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz", - "integrity": "sha512-mecaeNh0eWmzNrUNMWARysc0E9R96UPBamNiOCYL28k7mksb1d0q6DD38WKP7ABffjnXyUWJPVaWRgUOivwXwg==", - "dev": true, - "requires": { - "jest-mock": "21.2.0", - "jest-util": "21.2.1", - "jsdom": "9.12.0" - } - }, - "jest-environment-node": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-21.2.1.tgz", - "integrity": "sha512-R211867wx9mVBVHzrjGRGTy5cd05K7eqzQl/WyZixR/VkJ4FayS8qkKXZyYnwZi6Rxo6WEV81cDbiUx/GfuLNw==", - "dev": true, - "requires": { - "jest-mock": "21.2.0", - "jest-util": "21.2.1" - } - }, - "jest-get-type": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.2.0.tgz", - "integrity": "sha512-y2fFw3C+D0yjNSDp7ab1kcd6NUYfy3waPTlD8yWkAtiocJdBRQqNoRqVfMNxgj+IjT0V5cBIHJO0z9vuSSZ43Q==", - "dev": true - }, - "jest-haste-map": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-21.2.0.tgz", - "integrity": "sha512-5LhsY/loPH7wwOFRMs+PT4aIAORJ2qwgbpMFlbWbxfN0bk3ZCwxJ530vrbSiTstMkYLao6JwBkLhCJ5XbY7ZHw==", - "dev": true, - "requires": { - "fb-watchman": "2.0.0", - "graceful-fs": "4.1.11", - "jest-docblock": "21.2.0", - "micromatch": "2.3.11", - "sane": "2.2.0", - "worker-farm": "1.5.1" - } - }, - "jest-jasmine2": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz", - "integrity": "sha512-lw8FXXIEekD+jYNlStfgNsUHpfMWhWWCgHV7n0B7mA/vendH7vBFs8xybjQsDzJSduptBZJHqQX9SMssya9+3A==", - "dev": true, - "requires": { - "chalk": "2.3.0", - "expect": "21.2.1", - "graceful-fs": "4.1.11", - "jest-diff": "21.2.1", - "jest-matcher-utils": "21.2.1", - "jest-message-util": "21.2.1", - "jest-snapshot": "21.2.1", - "p-cancelable": "0.3.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-matcher-utils": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz", - "integrity": "sha512-kn56My+sekD43dwQPrXBl9Zn9tAqwoy25xxe7/iY4u+mG8P3ALj5IK7MLHZ4Mi3xW7uWVCjGY8cm4PqgbsqMCg==", - "dev": true, - "requires": { - "chalk": "2.3.0", - "jest-get-type": "21.2.0", - "pretty-format": "21.2.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-message-util": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-21.2.1.tgz", - "integrity": "sha512-EbC1X2n0t9IdeMECJn2BOg7buOGivCvVNjqKMXTzQOu7uIfLml+keUfCALDh8o4rbtndIeyGU8/BKfoTr/LVDQ==", - "dev": true, - "requires": { - "chalk": "2.3.0", - "micromatch": "2.3.11", - "slash": "1.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-mock": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-21.2.0.tgz", - "integrity": "sha512-aZDfyVf0LEoABWiY6N0d+O963dUQSyUa4qgzurHR3TBDPen0YxKCJ6l2i7lQGh1tVdsuvdrCZ4qPj+A7PievCw==", - "dev": true - }, - "jest-regex-util": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-21.2.0.tgz", - "integrity": "sha512-BKQ1F83EQy0d9Jen/mcVX7D+lUt2tthhK/2gDWRgLDJRNOdRgSp1iVqFxP8EN1ARuypvDflRfPzYT8fQnoBQFQ==", - "dev": true - }, - "jest-resolve": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-21.2.0.tgz", - "integrity": "sha512-vefQ/Lr+VdNvHUZFQXWtOqHX3HEdOc2MtSahBO89qXywEbUxGPB9ZLP9+BHinkxb60UT2Q/tTDOS6rYc6Mwigw==", - "dev": true, - "requires": { - "browser-resolve": "1.11.2", - "chalk": "2.3.0", - "is-builtin-module": "1.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-resolve-dependencies": { - "version": "21.2.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz", - "integrity": "sha512-ok8ybRFU5ScaAcfufIQrCbdNJSRZ85mkxJ1EhUp8Bhav1W1/jv/rl1Q6QoVQHObNxmKnbHVKrfLZbCbOsXQ+bQ==", - "dev": true, - "requires": { - "jest-regex-util": "21.2.0" - } - }, - "jest-runner": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-21.2.1.tgz", - "integrity": "sha512-Anb72BOQlHqF/zETqZ2K20dbYsnqW/nZO7jV8BYENl+3c44JhMrA8zd1lt52+N7ErnsQMd2HHKiVwN9GYSXmrg==", - "dev": true, - "requires": { - "jest-config": "21.2.1", - "jest-docblock": "21.2.0", - "jest-haste-map": "21.2.0", - "jest-jasmine2": "21.2.1", - "jest-message-util": "21.2.1", - "jest-runtime": "21.2.1", - "jest-util": "21.2.1", - "pify": "3.0.0", - "throat": "4.1.0", - "worker-farm": "1.5.1" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } - } - }, - "jest-runtime": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-21.2.1.tgz", - "integrity": "sha512-6omlpA3+NSE+rHwD0PQjNEjZeb2z+oRmuehMfM1tWQVum+E0WV3pFt26Am0DUfQkkPyTABvxITRjCUclYgSOsA==", - "dev": true, - "requires": { - "babel-core": "6.26.0", - "babel-jest": "21.2.0", - "babel-plugin-istanbul": "4.1.5", - "chalk": "2.3.0", - "convert-source-map": "1.5.0", - "graceful-fs": "4.1.11", - "jest-config": "21.2.1", - "jest-haste-map": "21.2.0", - "jest-regex-util": "21.2.0", - "jest-resolve": "21.2.0", - "jest-util": "21.2.1", - "json-stable-stringify": "1.0.1", - "micromatch": "2.3.11", - "slash": "1.0.0", - "strip-bom": "3.0.0", - "write-file-atomic": "2.3.0", - "yargs": "9.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-snapshot": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-21.2.1.tgz", - "integrity": "sha512-bpaeBnDpdqaRTzN8tWg0DqOTo2DvD3StOemxn67CUd1p1Po+BUpvePAp44jdJ7Pxcjfg+42o4NHw1SxdCA2rvg==", - "dev": true, - "requires": { - "chalk": "2.3.0", - "jest-diff": "21.2.1", - "jest-matcher-utils": "21.2.1", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "pretty-format": "21.2.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-util": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-21.2.1.tgz", - "integrity": "sha512-r20W91rmHY3fnCoO7aOAlyfC51x2yeV3xF+prGsJAUsYhKeV670ZB8NO88Lwm7ASu8SdH0S+U+eFf498kjhA4g==", - "dev": true, - "requires": { - "callsites": "2.0.0", - "chalk": "2.3.0", - "graceful-fs": "4.1.11", - "jest-message-util": "21.2.1", - "jest-mock": "21.2.0", - "jest-validate": "21.2.1", - "mkdirp": "0.5.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "dev": true - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "jest-validate": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.2.1.tgz", - "integrity": "sha512-k4HLI1rZQjlU+EC682RlQ6oZvLrE5SCh3brseQc24vbZTxzT/k/3urar5QMCVgjadmSO7lECeGdc6YxnM3yEGg==", - "dev": true, - "requires": { - "chalk": "2.3.0", - "jest-get-type": "21.2.0", - "leven": "2.1.0", - "pretty-format": "21.2.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "js-base64": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.3.2.tgz", - "integrity": "sha512-Y2/+DnfJJXT1/FCwUebUhLWb3QihxiSC42+ctHLGogmW2jPY6LCapMdFZXRvVP2z6qyKW7s6qncE/9gSqZiArw==", - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "js-yaml": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", - "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", - "dev": true, - "requires": { - "argparse": "1.0.9", - "esprima": "4.0.0" - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "dev": true, - "optional": true - }, - "jschardet": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", - "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", - "dev": true - }, - "jsdom": { - "version": "9.12.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz", - "integrity": "sha1-6MVG//ywbADUgzyoRBD+1/igl9Q=", - "dev": true, - "requires": { - "abab": "1.0.4", - "acorn": "4.0.13", - "acorn-globals": "3.1.0", - "array-equal": "1.0.0", - "content-type-parser": "1.0.2", - "cssom": "0.3.2", - "cssstyle": "0.2.37", - "escodegen": "1.9.0", - "html-encoding-sniffer": "1.0.2", - "nwmatcher": "1.4.3", - "parse5": "1.5.1", - "request": "2.83.0", - "sax": "1.2.4", - "symbol-tree": "3.2.2", - "tough-cookie": "2.3.3", - "webidl-conversions": "4.0.2", - "whatwg-encoding": "1.0.3", - "whatwg-url": "4.8.0", - "xml-name-validator": "2.0.1" - }, - "dependencies": { - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - } - } - }, - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz", - "integrity": "sha512-xyQpxeWWMKyJps9CuGJYeng6ssI5bpqS9ltQpdVQ90t4ql6NdnxFKh95JcRt2cun/DjMVNrdjniLPuMA69xmCw==", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", - "dev": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true, - "optional": true - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "1.0.0" - } - }, - "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", - "dev": true - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" - } - }, - "linefix": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/linefix/-/linefix-0.1.1.tgz", - "integrity": "sha1-WB9UspNf++nfJVdw8Ko7A0E4I5M=", - "dev": true - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "2.0.0", - "path-exists": "3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - } - } - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - }, - "lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", - "dev": true - }, - "lodash.unescape": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", - "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=" - }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, - "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "dev": true, - "requires": { - "js-tokens": "3.0.2" - } - }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "dev": true, - "requires": { - "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" - } - }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - }, - "makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", - "dev": true, - "requires": { - "tmpl": "1.0.4" - } - }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "dev": true, - "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", - "loud-rejection": "1.6.0", - "map-obj": "1.0.1", - "minimist": "1.2.0", - "normalize-package-data": "2.4.0", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "merge": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", - "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=", - "dev": true - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true, - "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.4" - } - }, - "mime-db": { - "version": "1.30.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", - "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", - "dev": true - }, - "mime-types": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", - "dev": true, - "requires": { - "mime-db": "1.30.0" - } - }, - "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", - "dev": true - }, - "node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", - "dev": true - }, - "node-notifier": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.1.2.tgz", - "integrity": "sha1-L6nhJgX6EACdRFSdb82KY93g5P8=", - "dev": true, - "requires": { - "growly": "1.3.0", - "semver": "5.4.1", - "shellwords": "0.1.1", - "which": "1.3.0" - } - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dev": true, - "requires": { - "abbrev": "1.1.1" - } - }, - "nopt-usage": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/nopt-usage/-/nopt-usage-0.1.0.tgz", - "integrity": "sha1-sYuMGD4YEEfKnmO3zefPxwLMpXk=", - "dev": true - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true, - "requires": { - "hosted-git-info": "2.5.0", - "is-builtin-module": "1.0.0", - "semver": "5.4.1", - "validate-npm-package-license": "3.0.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "1.1.0" - } - }, - "npm-license": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/npm-license/-/npm-license-0.3.3.tgz", - "integrity": "sha1-9n9LwjyGP24GLN5jlBTgURbc24I=", - "dev": true, - "requires": { - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "nopt-usage": "0.1.0", - "package-license": "0.1.2", - "pkginfo": "0.3.1", - "read-installed": "4.0.3", - "treeify": "1.0.1", - "underscore": "1.4.4" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "2.0.1" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "nwmatcher": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", - "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", - "dev": true - }, - "oauth-sign": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true, - "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "0.0.8", - "wordwrap": "0.0.3" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - } - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" - } - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "0.7.0", - "lcid": "1.0.0", - "mem": "1.1.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-cancelable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", - "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", - "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", - "dev": true - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "1.1.0" - } - }, - "package-license": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/package-license/-/package-license-0.1.2.tgz", - "integrity": "sha1-9cRJp6UPrfSiI0HilJCZ+RpCAos=", - "dev": true - }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true, - "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true, - "requires": { - "error-ex": "1.3.1" - } - }, - "parse5": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", - "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=", - "dev": true - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "dev": true, - "requires": { - "pinkie-promise": "2.0.1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", - "dev": true - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", - "dev": true - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "dev": true, - "requires": { - "pinkie": "2.0.4" - } - }, - "pkginfo": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", - "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=", - "dev": true - }, - "pluralize": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, - "pretty-format": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", - "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", - "dev": true, - "requires": { - "ansi-regex": "3.0.0", - "ansi-styles": "3.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - } - } - }, - "private": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", - "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "progress": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", - "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", - "dev": true - }, - "prr": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz", - "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", - "dev": true - }, - "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", - "dev": true, - "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "1.1.6" - } - } - } - }, - "read-installed": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz", - "integrity": "sha1-/5uLZ/GH0eTCm5/rMfayI6zRkGc=", - "dev": true, - "requires": { - "debuglog": "1.0.1", - "graceful-fs": "4.1.11", - "read-package-json": "2.0.12", - "readdir-scoped-modules": "1.0.2", - "semver": "5.4.1", - "slide": "1.1.6", - "util-extend": "1.0.3" - } - }, - "read-package-json": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.0.12.tgz", - "integrity": "sha512-m7/I0+tP6D34EVvSlzCtuVA4D/dHL6OpLcn2e4XVP5X57pCKGUy1JjRSBVKHWpB+vUU91sL85h84qX0MdXzBSw==", - "dev": true, - "requires": { - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "json-parse-better-errors": "1.0.1", - "normalize-package-data": "2.4.0", - "slash": "1.0.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "dev": true, - "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.4.0", - "path-type": "1.1.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "dev": true, - "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" - } - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.1.1", - "string_decoder": "1.0.3", - "util-deprecate": "1.0.2" - } - }, - "readdir-scoped-modules": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz", - "integrity": "sha1-n6+jfShr5dksuuve4DDcm19AZ0c=", - "dev": true, - "requires": { - "debuglog": "1.0.1", - "dezalgo": "1.0.3", - "graceful-fs": "4.1.11", - "once": "1.4.0" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "1.5.0" - } - }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "dev": true, - "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" - } - }, - "regenerator-runtime": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", - "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", - "dev": true - }, - "regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", - "dev": true, - "requires": { - "is-equal-shallow": "0.1.3" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true, - "requires": { - "is-finite": "1.0.2" - } - }, - "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", - "dev": true, - "requires": { - "aws-sign2": "0.7.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.3.1", - "har-validator": "5.0.3", - "hawk": "6.0.2", - "http-signature": "1.2.0", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.17", - "oauth-sign": "0.8.2", - "performance-now": "2.1.0", - "qs": "6.5.1", - "safe-buffer": "5.1.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.3", - "tunnel-agent": "0.6.0", - "uuid": "3.1.0" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "require-uncached": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", - "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", - "dev": true, - "requires": { - "caller-path": "0.1.0", - "resolve-from": "1.0.1" - } - }, - "resolve": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", - "dev": true, - "requires": { - "path-parse": "1.0.5" - } - }, - "resolve-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", - "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "2.0.1", - "signal-exit": "3.0.2" - } - }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "optional": true, - "requires": { - "align-text": "0.1.4" - } - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "7.1.2" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "2.1.0" - } - }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "rx-lite-aggregates": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", - "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", - "dev": true, - "requires": { - "rx-lite": "4.0.8" - } - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "dev": true - }, - "sane": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/sane/-/sane-2.2.0.tgz", - "integrity": "sha512-OSJxhHO0CgPUw3lUm3GhfREAfza45smvEI9ozuFrxKG10GHVo0ryW9FK5VYlLvxj0SV7HVKHW0voYJIRu27GWg==", - "dev": true, - "requires": { - "anymatch": "1.3.2", - "exec-sh": "0.2.1", - "fb-watchman": "2.0.0", - "minimatch": "3.0.4", - "minimist": "1.2.0", - "walker": "1.0.7", - "watch": "0.18.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", - "dev": true, - "requires": { - "glob": "7.1.2", - "interpret": "1.0.4", - "rechoir": "0.6.2" - } - }, - "shelljs-nodecli": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/shelljs-nodecli/-/shelljs-nodecli-0.1.1.tgz", - "integrity": "sha1-8b61VjdUxHXQb30IM+D2B15GLTs=", - "dev": true, - "requires": { - "shelljs": "0.2.6" - }, - "dependencies": { - "shelljs": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz", - "integrity": "sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=", - "dev": true - } - } - }, - "shellwords": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", - "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "slice-ansi": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", - "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0" - } - }, - "slide": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", - "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", - "dev": true - }, - "sntp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", - "dev": true, - "requires": { - "hoek": "4.2.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true, - "requires": { - "source-map": "0.5.7" - } - }, - "spdx-correct": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", - "dev": true, - "requires": { - "spdx-license-ids": "1.2.2" - } - }, - "spdx-expression-parse": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", - "dev": true - }, - "spdx-license-ids": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", - "dev": true, - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - } - }, - "stream-consume": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz", - "integrity": "sha1-pB6tGm1ggc63n2WwYZAbbY89HQ8=", - "dev": true - }, - "string-length": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", - "integrity": "sha1-1A27aGo6zpYMHP/KVivyxF+DY+0=", - "dev": true, - "requires": { - "astral-regex": "1.0.0", - "strip-ansi": "4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "stringstream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "4.0.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "symbol-tree": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", - "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", - "dev": true - }, - "table": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", - "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", - "dev": true, - "requires": { - "ajv": "5.3.0", - "ajv-keywords": "2.1.1", - "chalk": "2.3.0", - "lodash": "4.17.4", - "slice-ansi": "1.0.0", - "string-width": "2.1.1" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" - } - } - } - }, - "test-exclude": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", - "integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==", - "dev": true, - "requires": { - "arrify": "1.0.1", - "micromatch": "2.3.11", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "require-main-filename": "1.0.1" - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, - "throat": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz", - "integrity": "sha1-iQN8vJLFarGJJua6TLsgDhVnKmo=", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "1.0.2" - } - }, - "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", - "dev": true - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - }, - "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", - "dev": true, - "requires": { - "punycode": "1.4.1" - } - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "treeify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.0.1.tgz", - "integrity": "sha1-abPNAiAioWhCTnz6HO1EyTnT6y8=", - "dev": true - }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", - "dev": true - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, - "tryit": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", - "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", - "dev": true - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "dev": true, - "optional": true - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "1.1.2" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "typescript": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz", - "integrity": "sha1-7znN6ierrAtQAkLWcmq5DgyEZjE=", - "dev": true - }, - "uglify-js": { - "version": "2.8.29", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", - "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", - "dev": true, - "optional": true, - "requires": { - "source-map": "0.5.7", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" - }, - "dependencies": { - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", - "dev": true, - "optional": true - }, - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "optional": true, - "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", - "window-size": "0.1.0" - } - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true, - "optional": true - }, - "underscore": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.4.4.tgz", - "integrity": "sha1-YaajIBBiKvoHljvzJSA88SI51gQ=", - "dev": true - }, - "utf8": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", - "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, - "util-extend": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz", - "integrity": "sha1-p8IW0mdUUWljeztu3GypEZ4v+T8=", - "dev": true - }, - "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", - "dev": true, - "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" - } - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "1.3.0" - } - }, - "walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", - "dev": true, - "requires": { - "makeerror": "1.0.11" - } - }, - "watch": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/watch/-/watch-0.18.0.tgz", - "integrity": "sha1-KAlUdsbffJDJYxOJkMClQj60uYY=", - "dev": true, - "requires": { - "exec-sh": "0.2.1", - "minimist": "1.2.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true - } - } - }, - "webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true - }, - "whatwg-encoding": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", - "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", - "dev": true, - "requires": { - "iconv-lite": "0.4.19" - } - }, - "whatwg-url": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz", - "integrity": "sha1-0pgaqRSMHgCkHFphMRZqtGg7vMA=", - "dev": true, - "requires": { - "tr46": "0.0.3", - "webidl-conversions": "3.0.1" - }, - "dependencies": { - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "dev": true - } - } - }, - "which": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", - "dev": true, - "requires": { - "isexe": "2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true, - "optional": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "worker-farm": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.1.tgz", - "integrity": "sha512-T5NH6Wqsd8MwGD4AK8BBllUy6LmHaqjEOyo/YIUEegZui6/v5Bqde//3jwyE3PGiGYMmWi06exFBi5LNhhPFNw==", - "dev": true, - "requires": { - "errno": "0.1.4", - "xtend": "4.0.1" - } - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", - "dev": true, - "requires": { - "mkdirp": "0.5.1" - } - }, - "write-file-atomic": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "imurmurhash": "0.1.4", - "signal-exit": "3.0.2" - } - }, - "xml-name-validator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-2.0.1.tgz", - "integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=", - "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yargs": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-9.0.1.tgz", - "integrity": "sha1-UqzCP+7Kw0BCB47njAwAf1CF20w=", - "dev": true, - "requires": { - "camelcase": "4.1.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "2.1.0", - "read-pkg-up": "2.0.0", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "2.1.1", - "which-module": "2.0.0", - "y18n": "3.2.1", - "yargs-parser": "7.0.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" - }, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - } - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "strip-bom": "3.0.0" - } - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "2.3.0" - } - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "2.0.0", - "normalize-package-data": "2.4.0", - "path-type": "2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "2.1.0", - "read-pkg": "2.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - } - } - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "dev": true, - "requires": { - "camelcase": "4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - } - } - } - } -} From 670f6afd47e9844118727610d1fd3f63e7630ea2 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 11 Dec 2017 12:05:32 +0100 Subject: [PATCH 227/326] Chore: Introduce integration tests (#411) --- packages/typescript-eslint-parser/README.md | 6 +- .../typescript-eslint-parser/package.json | 6 +- .../tests/ast-alignment/jest.config.js | 5 + .../tests/integration/.eslintrc.yml | 2 + .../integration/from-babel-eslint.spec.js | 710 ++++++++++++++++++ .../tests/integration/jest.config.js | 5 + .../tests/integration/typescript.spec.js | 36 + .../tests/integration/utils.js | 91 +++ 8 files changed, 857 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js create mode 100644 packages/typescript-eslint-parser/tests/integration/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js create mode 100644 packages/typescript-eslint-parser/tests/integration/jest.config.js create mode 100644 packages/typescript-eslint-parser/tests/integration/typescript.spec.js create mode 100644 packages/typescript-eslint-parser/tests/integration/utils.js diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 73c3802053df..bd0ccb978103 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -58,8 +58,8 @@ Please check the current list of open and known issues and ensure the bug has no - TypeScript version - TypeScript parser version - ESLint config or rules and plugins currently enabled - -As well include a small code sample that can be used to reproduce the issue. + +As well include a small code sample that can be used to reproduce the issue. ## Contributing @@ -69,6 +69,8 @@ Issues and pull requests will be triaged and responded to as quickly as possible * `npm test` - run all linting and tests * `npm run lint` - run all linting +* `npm run ast-alignment-tests` - run only Babylon AST alignment tests +* `npm run integration-tests` - run only integration tests ## License diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index c7b3edaad450..816da2e93ac6 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -20,6 +20,7 @@ "devDependencies": { "babel-code-frame": "6.26.0", "babylon": "7.0.0-beta.24", + "dedent": "^0.7.0", "eslint": "4.10.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "5.2.1", @@ -42,9 +43,10 @@ "eslint" ], "scripts": { - "test": "node Makefile.js test && npm run ast-alignment-tests", + "test": "node Makefile.js test && npm run integration-tests && npm run ast-alignment-tests", "jest": "jest", - "ast-alignment-tests": "jest --config={} ./tests/ast-alignment/spec.js", + "ast-alignment-tests": "jest --config=./tests/ast-alignment/jest.config.js", + "integration-tests": "jest --config=./tests/integration/jest.config.js", "lint": "node Makefile.js lint", "release": "eslint-release", "ci-release": "eslint-ci-release", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js b/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js new file mode 100644 index 000000000000..0ac0625483b4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + testRegex: "spec\\.js$" +}; diff --git a/packages/typescript-eslint-parser/tests/integration/.eslintrc.yml b/packages/typescript-eslint-parser/tests/integration/.eslintrc.yml new file mode 100644 index 000000000000..e19b2cfa824a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/.eslintrc.yml @@ -0,0 +1,2 @@ +env: + jest: true diff --git a/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js b/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js new file mode 100644 index 000000000000..790eccf9f026 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js @@ -0,0 +1,710 @@ +/** + * LICENCE from babel-eslint + */ +// Copyright (c) 2014-2016 Sebastian McKenzie + +// MIT License + +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: + +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +"use strict"; + +const unpad = require("dedent"); + +const utils = require("./utils"); +const verifyAndAssertMessages = utils.verifyAndAssertMessages; + +describe("Non-regression tests from babel-eslint", () => { + it("arrow function support (issue #1)", () => { + verifyAndAssertMessages("describe('stuff', () => {});", {}, []); + }); + + it("EOL validation (issue #2)", () => { + verifyAndAssertMessages( + "module.exports = \"something\";", + { "eol-last": 1, semi: 1 }, + ["1:30 Newline required at end of file but not found. eol-last"] + ); + }); + + it("Modules support (issue #5)", () => { + verifyAndAssertMessages( + unpad(` + import Foo from 'foo'; + export default Foo; + export const c = 'c'; + export class Store {} + `), + {}, + [], + "module" + ); + }); + + it("Rest parameters (issue #7)", () => { + verifyAndAssertMessages( + "function foo(...args) { return args; }", + { "no-undef": 1 }, + [] + ); + }); + + it("Exported classes should be used (issue #8)", () => { + verifyAndAssertMessages( + "class Foo {} module.exports = Foo;", + { "no-unused-vars": 1 }, + [] + ); + }); + + it("super keyword in class (issue #10)", () => { + verifyAndAssertMessages( + "class Foo { constructor() { super() } }", + { "no-undef": 1 }, + [] + ); + }); + + it("Rest parameter in destructuring assignment (issue #11)", () => { + verifyAndAssertMessages( + "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", + { "no-undef": 1 }, + [], + "script", + { + envs: ["node"] + } + ); + }); + + it("JSX attribute names marked as variables (issue #12)", () => { + verifyAndAssertMessages( + "module.exports =
", + { "no-undef": 1 }, + [], + "script", + { + envs: ["node"] + } + ); + }); + + it("Multiple destructured assignment with compound properties (issue #16)", () => { + verifyAndAssertMessages( + "module.exports = { ...a.a, ...a.b };", + { "no-dupe-keys": 1 }, + [] + ); + }); + + it("Arrow function with non-block bodies (issue #20)", () => { + verifyAndAssertMessages( + "\"use strict\"; () => 1", + { strict: [1, "global"] }, + [], + "script" + ); + }); + + it("#242", () => { + verifyAndAssertMessages( + "\"use strict\"; asdf;", + { "no-irregular-whitespace": 1 }, + [], + {} + ); + }); + + it("await keyword (issue #22)", () => { + verifyAndAssertMessages( + "async function foo() { await bar(); }", + { "no-unused-expressions": 1 }, + [] + ); + }); + + it("arrow functions (issue #27)", () => { + verifyAndAssertMessages( + "[1, 2, 3].map(i => i * 2);", + { "func-names": 1, "space-before-blocks": 1 }, + [] + ); + }); + + it("comment with padded-blocks (issue #33)", () => { + verifyAndAssertMessages( + unpad(` + if (a) { + // i'm a comment! + let b = c + } + `), + { "padded-blocks": [1, "never"] }, + [] + ); + }); + + it("class usage", () => { + verifyAndAssertMessages( + "class Lol {} module.exports = Lol;", + { "no-unused-vars": 1 }, + [] + ); + }); + + it("class definition: gaearon/redux#24", () => { + verifyAndAssertMessages( + unpad(` + export default function root(stores) { + return DecoratedComponent => class ReduxRootDecorator { + a() { DecoratedComponent; stores; } + }; + } + `), + { "no-undef": 1, "no-unused-vars": 1 }, + [] + ); + }); + + it("template strings #31", () => { + verifyAndAssertMessages( + "console.log(`${a}, b`);", + { "comma-spacing": 1 }, + [] + ); + }); + + it("template with destructuring #31", () => { + verifyAndAssertMessages( + unpad(` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `), + { "comma-spacing": 1 }, + [] + ); + }); + + describe("decorators #72", () => { + // it("class declaration", () => { + // verifyAndAssertMessages( + // unpad(` + // import classDeclaration from 'decorator'; + // import decoratorParameter from 'decorator'; + // @classDeclaration((parameter) => parameter) + // @classDeclaration(decoratorParameter) + // @classDeclaration + // export class TextareaAutosize {} + // `), + // { "no-unused-vars": 1 }, + // [], + // "module" + // ); + // }); + + // it("method definition", () => { + // verifyAndAssertMessages( + // unpad(` + // import classMethodDeclarationA from 'decorator'; + // import decoratorParameter from 'decorator'; + // export class TextareaAutosize { + // @classMethodDeclarationA((parameter) => parameter) + // @classMethodDeclarationA(decoratorParameter) + // @classMethodDeclarationA + // methodDeclaration(e) { + // e(); + // } + // } + // `), + // { "no-unused-vars": 1 }, + // [] + // ); + // }); + + // it("method definition get/set", () => { + // verifyAndAssertMessages( + // unpad(` + // import classMethodDeclarationA from 'decorator'; + // import decoratorParameter from 'decorator'; + // export class TextareaAutosize { + // @classMethodDeclarationA((parameter) => parameter) + // @classMethodDeclarationA(decoratorParameter) + // @classMethodDeclarationA + // get bar() { } + // @classMethodDeclarationA((parameter) => parameter) + // @classMethodDeclarationA(decoratorParameter) + // @classMethodDeclarationA + // set bar(val) { val; } + // } + // `), + // { "no-unused-vars": 1 }, + // [] + // ); + // }); + + // it("object property", () => { + // verifyAndAssertMessages( + // unpad(` + // import classMethodDeclarationA from 'decorator'; + // import decoratorParameter from 'decorator'; + // var obj = { + // @classMethodDeclarationA((parameter) => parameter) + // @classMethodDeclarationA(decoratorParameter) + // @classMethodDeclarationA + // methodDeclaration(e) { + // e(); + // } + // }; + // obj; + // `), + // { "no-unused-vars": 1 }, + // [] + // ); + // }); + + // it("object property get/set", () => { + // verifyAndAssertMessages( + // unpad(` + // import classMethodDeclarationA from 'decorator'; + // import decoratorParameter from 'decorator'; + // var obj = { + // @classMethodDeclarationA((parameter) => parameter) + // @classMethodDeclarationA(decoratorParameter) + // @classMethodDeclarationA + // get bar() { }, + // @classMethodDeclarationA((parameter) => parameter) + // @classMethodDeclarationA(decoratorParameter) + // @classMethodDeclarationA + // set bar(val) { val; } + // }; + // obj; + // `), + // { "no-unused-vars": 1 }, + // [] + // ); + // }); + }); + + it("detects minimal no-unused-vars case #120", () => { + verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ + "1:5 'unused' is defined but never used. no-unused-vars" + ]); + }); + + // This two tests are disabled, as the feature to visit properties when + // there is a spread/rest operator has been removed as it caused problems + // with other rules #249 + it.skip("visits excluded properties left of spread #95", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-unused-vars": 1 }, + [] + ); + }); + + it.skip("visits excluded properties left of spread #210", () => { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-unused-vars": 1 }, + [] + ); + }); + + it("does not mark spread variables false-positive", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-undef": 1, "no-redeclare": 1 }, + [] + ); + }); + + it("does not mark spread variables false-positive", () => { + verifyAndAssertMessages( + "const props = { yo: 'yo' }; const { ...otherProps } = props;", + { "no-undef": 1, "no-redeclare": 1 }, + [] + ); + }); + + it("does not mark spread variables as use-before-define #249", () => { + verifyAndAssertMessages( + "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", + { "no-use-before-define": 1 }, + [] + ); + }); + + it("detects no-unused-vars with object destructuring #142", () => { + verifyAndAssertMessages( + "const {Bacona} = require('baconjs')", + { "no-undef": 1, "no-unused-vars": 1 }, + ["1:8 'Bacona' is assigned a value but never used. no-unused-vars"], + "script", + { + envs: ["node"] + } + ); + }); + + it("don't warn no-unused-vars with spread #142", () => { + verifyAndAssertMessages( + unpad(` + export default function test(data) { + return { + foo: 'bar', + ...data + }; + } + `), + { "no-undef": 1, "no-unused-vars": 1 }, + [] + ); + }); + + it("excludes comment tokens #153", () => { + verifyAndAssertMessages( + unpad(` + var a = [ + 1, + 2, // a trailing comment makes this line fail comma-dangle (always-multiline) + ]; + `), + { "comma-dangle": [2, "always-multiline"] }, + [] + ); + + verifyAndAssertMessages( + unpad(` + switch (a) { + // A comment here makes the above line fail brace-style + case 1: + console.log(a); + } + `), + { "brace-style": 2 }, + [] + ); + }); + + it("ternary and parens #149", () => { + verifyAndAssertMessages( + "true ? (true) : false;", + { "space-infix-ops": 1 }, + [] + ); + }); + + it("line comment space-in-parens #124", () => { + verifyAndAssertMessages( + unpad(` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `), + { "space-in-parens": 1 }, + [] + ); + }); + + it("block comment space-in-parens #124", () => { + verifyAndAssertMessages( + unpad(` + React.createClass({ + render() { + /* + return ( +
+ ); // <-- this is the line that is reported + */ + } + }); + `), + { "space-in-parens": 1 }, + [] + ); + }); + + it("no no-undef error with rest #11", () => { + verifyAndAssertMessages( + "const [a, ...rest] = ['1', '2', '3']; a; rest;", + { "no-undef": 1, "no-unused-vars": 1 }, + [] + ); + }); + + it("async function with space-before-function-paren #168", () => { + verifyAndAssertMessages( + "it('handles updates', async function() {});", + { "space-before-function-paren": [1, "never"] }, + [] + ); + }); + + it("no-use-before-define #192", () => { + verifyAndAssertMessages( + unpad(` + console.log(x); + var x = 1; + `), + { "no-use-before-define": 1 }, + ["1:13 'x' was used before it was defined. no-use-before-define"] + ); + }); + + it("jsx and stringliteral #216", () => { + verifyAndAssertMessages("
", {}, []); + }); + + it("getter/setter #218", () => { + verifyAndAssertMessages( + unpad(` + class Person { + set a (v) { } + } + `), + { + "space-before-function-paren": 1, + "keyword-spacing": [1, { before: true }], + indent: 1 + }, + [] + ); + }); + + it("getter/setter #220", () => { + verifyAndAssertMessages( + unpad(` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `), + { "no-dupe-keys": 1 }, + [] + ); + }); + + it("correctly detects redeclares if in script mode #217", () => { + verifyAndAssertMessages( + unpad(` + var a = 321; + var a = 123; + `), + { "no-redeclare": 1 }, + ["2:5 'a' is already defined. no-redeclare"], + "script" + ); + }); + + // it("correctly detects redeclares if in module mode #217", () => { + // verifyAndAssertMessages( + // unpad(` + // var a = 321; + // var a = 123; + // `), + // { "no-redeclare": 1 }, + // ["2:5 'a' is already defined. no-redeclare"], + // "module" + // ); + // }); + + it("no-implicit-globals in script", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [ + "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" + ], + "script", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "script" } + } + ); + }); + + it("no-implicit-globals in module", () => { + verifyAndAssertMessages( + "var leakedGlobal = 1;", + { "no-implicit-globals": 1 }, + [], + "module", + { + env: {}, + parserOptions: { ecmaVersion: 6, sourceType: "module" } + } + ); + }); + + // it("no-implicit-globals in default", () => { + // verifyAndAssertMessages( + // "var leakedGlobal = 1;", + // { "no-implicit-globals": 1 }, + // [], + // null, + // { + // env: {}, + // parserOptions: { ecmaVersion: 6 } + // } + // ); + // }); + + it("with does not crash parsing in script mode (strict off) #171", () => { + verifyAndAssertMessages("with (arguments) { length; }", {}, [], "script"); + }); + + // it("with does crash parsing in module mode (strict on) #171", () => { + // verifyAndAssertMessages("with (arguments) { length; }", {}, [ + // "1:1 Parsing error: 'with' in strict mode" + // ]); + // }); + + it("new.target is not reported as undef #235", () => { + verifyAndAssertMessages( + "function foo () { return new.target }", + { "no-undef": 1 }, + [] + ); + }); + + // it("decorator does not create TypeError #229", () => { + // verifyAndAssertMessages( + // unpad(` + // class A { + // @test + // f() {} + // } + // `), + // { "no-undef": 1 }, + // ["2:4 'test' is not defined. no-undef"] + // ); + // }); + + it("newline-before-return with comments #289", () => { + verifyAndAssertMessages( + unpad(` + function a() { + if (b) { + /* eslint-disable no-console */ + console.log('test'); + /* eslint-enable no-console */ + } + + return hasGlobal; + } + `), + { "newline-before-return": 1 }, + [] + ); + }); + + describe("Class Property Declarations", () => { + // it("no-redeclare false positive 1", () => { + // verifyAndAssertMessages( + // unpad(` + // class Group { + // static propTypes = {}; + // } + // class TypicalForm { + // static propTypes = {}; + // } + // `), + // { "no-redeclare": 1 }, + // [] + // ); + // }); + + // it("no-redeclare false positive 2", () => { + // verifyAndAssertMessages( + // unpad(` + // function validate() {} + // class MyComponent { + // static validate = validate; + // } + // `), + // { "no-redeclare": 1 }, + // [] + // ); + // }); + + // it("check references", () => { + // verifyAndAssertMessages( + // unpad(` + // var a; + // class A { + // prop1; + // prop2 = a; + // prop3 = b; + // } + // new A + // `), + // { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, + // ["5:11 'b' is not defined. no-undef"] + // ); + // }); + }); + + it("dynamic import support", () => { + verifyAndAssertMessages("import('test-module').then(() => {})", {}, []); + }); + + it("regex with es6 unicodeCodePointEscapes", () => { + verifyAndAssertMessages( + "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", + {}, + [] + ); + }); + + it("works with dynamicImport", () => { + verifyAndAssertMessages( + unpad(` + import('a'); + `), + {}, + [] + ); + }); + + it("works with optionalCatchBinding", () => { + verifyAndAssertMessages( + unpad(` + try {} catch {} + try {} catch {} finally {} + `), + {}, + [] + ); + }); +}); + diff --git a/packages/typescript-eslint-parser/tests/integration/jest.config.js b/packages/typescript-eslint-parser/tests/integration/jest.config.js new file mode 100644 index 000000000000..76709269eaac --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/jest.config.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + testRegex: ".*\\.spec\\.js$" +}; diff --git a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js new file mode 100644 index 000000000000..5f2aa9f57bc4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js @@ -0,0 +1,36 @@ +"use strict"; + +const unpad = require("dedent"); + +const utils = require("./utils"); +const verifyAndAssertMessages = utils.verifyAndAssertMessages; + +describe("TypeScript", () => { + it("should fundamentally work with `eslint:all`", () => { + verifyAndAssertMessages( + unpad(` + "use strict"; + const foo: string = "bar"; + `), + {}, + ["2:7 'foo' is assigned a value but never used. no-unused-vars"], + "script", + { + baseConfig: { + extends: ["eslint:all"], + rules: { + "eol-last": "off" + } + } + } + ); + }); + + // it("class properties and no-undef", () => { + // verifyAndAssertMessages( + // "class Lol { foo = 'bar'; }", + // { "no-undef": 1 }, + // [] + // ); + // }); +}); diff --git a/packages/typescript-eslint-parser/tests/integration/utils.js b/packages/typescript-eslint-parser/tests/integration/utils.js new file mode 100644 index 000000000000..4d07ce4ac959 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/utils.js @@ -0,0 +1,91 @@ +/** + * @fileoverview Utilities for running integration tests + * @author James Henry + * @copyright jQuery Foundation and other contributors, https://jquery.org/ + * MIT License + */ +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ +const eslint = require("eslint"); +const unpad = require("dedent"); +const path = require("path"); + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +/* eslint-disable no-use-before-define */ +module.exports = { + verifyAndAssertMessages +}; +/* eslint-enable no-use-before-define */ + +/** + * A utility function to lint the given source code using typescript-eslint-parser + * and assert expectations around the linting feedback + * + * @param {string} code source code to lint + * @param {Object} rules ESLint rules configuration + * @param {string[]} expectedMessages Expected linting feedback + * @param {string} sourceType Either "module" or "script" + * @param {Obejct} overrideConfig Custom configuration options for the CLIEngine + * @returns {void} + */ +function verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig +) { + const cliEngineConfig = { + useEslintrc: false, + parser: require.resolve("../../parser"), + rules, + parserOptions: { + ecmaVersion: 8, + ecmaFeatures: { + jsx: true, + experimentalObjectRestSpread: true, + globalReturn: true + }, + sourceType: sourceType || "script" + }, + cwd: __dirname + }; + + if (overrideConfig) { + Object.assign(cliEngineConfig, overrideConfig); + } + + const cli = new eslint.CLIEngine(cliEngineConfig); + const messages = cli.executeOnText(code, "fake-filename.js").results[0].messages; + + if (messages.length !== expectedMessages.length) { + throw new Error( + `Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify( + messages, + null, + 2 + )}` + ); + } + + messages.forEach((message, i) => { + const formatedMessage = `${message.line}:${message.column} ${message.message}${message.ruleId + ? ` ${message.ruleId}` + : ""}`; + if (formatedMessage !== expectedMessages[i]) { + throw new Error( + unpad(` + Message ${i} does not match: + Expected: ${expectedMessages[i]} + Actual: ${formatedMessage} + `) + ); + } + }); +} From d2af1a4fe940c885989126007e74ab51d4bb9122 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 11 Dec 2017 18:35:43 +0000 Subject: [PATCH 228/326] Breaking: Updates to AST node types of some TSNodes (fixes #386) (#388) --- packages/typescript-eslint-parser/README.md | 1 - .../lib/ast-node-types.js | 10 +- .../typescript-eslint-parser/lib/convert.js | 8 +- .../typescript-eslint-parser/package.json | 6 +- .../tests/lib/__snapshots__/tsx.js.snap | 4 +- .../lib/__snapshots__/typescript.js.snap | 424 +-- packages/typescript-eslint-parser/yarn.lock | 3189 +++++++++++++++++ 7 files changed, 3414 insertions(+), 228 deletions(-) create mode 100644 packages/typescript-eslint-parser/yarn.lock diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index bd0ccb978103..badc1f8c8280 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -75,4 +75,3 @@ Issues and pull requests will be triaged and responded to as quickly as possible ## License TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license. - diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 373ba72a1dfc..42884d45750b 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -97,7 +97,6 @@ module.exports = { ThisExpression: "ThisExpression", ThrowStatement: "ThrowStatement", TryStatement: "TryStatement", - /** * TS-prefixed nodes */ @@ -140,17 +139,16 @@ module.exports = { TSStaticKeyword: "TSStaticKeyword", TSStringKeyword: "TSStringKeyword", TSSymbolKeyword: "TSSymbolKeyword", + TSTypeAnnotation: "TSTypeAnnotation", TSTypeLiteral: "TSTypeLiteral", + TSTypeParameter: "TSTypeParameter", + TSTypeParameterDeclaration: "TSTypeParameterDeclaration", + TSTypeParameterInstantiation: "TSTypeParameterInstantiation", TSTypePredicate: "TSTypePredicate", TSTypeReference: "TSTypeReference", TSUnionType: "TSUnionType", TSUndefinedKeyword: "TSUndefinedKeyword", TSVoidKeyword: "TSVoidKeyword", - - TypeAnnotation: "TypeAnnotation", - TypeParameter: "TypeParameter", - TypeParameterDeclaration: "TypeParameterDeclaration", - TypeParameterInstantiation: "TypeParameterInstantiation", UnaryExpression: "UnaryExpression", UpdateExpression: "UpdateExpression", VariableDeclaration: "VariableDeclaration", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 243cd655e892..02e880e93701 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -89,7 +89,7 @@ module.exports = function convert(config) { const annotationStartCol = child.getFullStart() - 1; const loc = nodeUtils.getLocFor(annotationStartCol, child.end, ast); return { - type: AST_NODE_TYPES.TypeAnnotation, + type: AST_NODE_TYPES.TSTypeAnnotation, loc, range: [annotationStartCol, child.end], typeAnnotation: annotation @@ -122,7 +122,7 @@ module.exports = function convert(config) { } } return { - type: AST_NODE_TYPES.TypeParameterInstantiation, + type: AST_NODE_TYPES.TSTypeParameterInstantiation, range: [ start, end @@ -167,7 +167,7 @@ module.exports = function convert(config) { const greaterThanToken = nodeUtils.findNextToken(lastTypeParameter, ast); return { - type: AST_NODE_TYPES.TypeParameterDeclaration, + type: AST_NODE_TYPES.TSTypeParameterDeclaration, range: [ firstTypeParameter.pos - 1, greaterThanToken.end @@ -185,7 +185,7 @@ module.exports = function convert(config) { : typeParameter.default; return { - type: AST_NODE_TYPES.TypeParameter, + type: AST_NODE_TYPES.TSTypeParameter, range: [ typeParameter.getStart(), typeParameter.getEnd() diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 816da2e93ac6..aa820eb8851d 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -19,9 +19,9 @@ "license": "BSD-2-Clause", "devDependencies": { "babel-code-frame": "6.26.0", - "babylon": "7.0.0-beta.24", - "dedent": "^0.7.0", - "eslint": "4.10.0", + "babylon": "7.0.0-beta.34", + "dedent": "0.7.0", + "eslint": "4.13.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "5.2.1", "eslint-release": "0.10.3", diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap index 661ffa91cafd..a18c507de333 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap @@ -159,7 +159,7 @@ Object { 53, 61, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -526,7 +526,7 @@ Object { 98, 105, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index b6ceb7032de3..2ee0cc0ed582 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -87,14 +87,14 @@ Object { 13, 14, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 10, 19, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -402,14 +402,14 @@ Object { 11, 36, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 10, 37, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -1106,7 +1106,7 @@ Object { 66, 83, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -1175,7 +1175,7 @@ Object { 75, 83, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -2405,7 +2405,7 @@ Object { 58, 75, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -2474,7 +2474,7 @@ Object { 67, 75, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -3174,7 +3174,7 @@ Object { 5, 8, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -3232,7 +3232,7 @@ Object { 9, 12, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -3298,14 +3298,14 @@ Object { 1, 2, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 0, 3, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, "loc": Object { @@ -4726,7 +4726,7 @@ Object { 26, 34, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -4799,7 +4799,7 @@ Object { 56, 64, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -5181,7 +5181,7 @@ Object { 136, 144, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -6142,7 +6142,7 @@ Object { 36, 44, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -6885,7 +6885,7 @@ Object { 24, 27, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, "type": "ClassDeclaration", "typeParameters": Object { @@ -6916,14 +6916,14 @@ Object { 10, 11, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 9, 12, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -7323,7 +7323,7 @@ Object { 34, 40, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, "type": "ClassDeclaration", "typeParameters": Object { @@ -7389,14 +7389,14 @@ Object { 10, 21, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 9, 22, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -7819,14 +7819,14 @@ Object { 21, 22, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 20, 23, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, }, @@ -8265,14 +8265,14 @@ Object { 21, 28, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 20, 29, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, }, @@ -9230,7 +9230,7 @@ Object { 24, 27, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, ], @@ -9597,7 +9597,7 @@ Object { 24, 30, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, ], @@ -9996,7 +9996,7 @@ Object { 42, 45, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -10139,7 +10139,7 @@ Object { 32, 36, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, "loc": Object { @@ -10157,14 +10157,14 @@ Object { 11, 36, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 10, 37, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, Object { @@ -10343,7 +10343,7 @@ Object { 103, 108, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, "type": "ClassDeclaration", @@ -10523,7 +10523,7 @@ Object { 192, 199, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "elementType": Object { "loc": Object { @@ -10597,7 +10597,7 @@ Object { 202, 205, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -10679,14 +10679,14 @@ Object { 175, 176, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 174, 177, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -12377,7 +12377,7 @@ Object { 30, 38, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -12474,7 +12474,7 @@ Object { 56, 64, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -13099,7 +13099,7 @@ Object { 27, 35, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -13173,7 +13173,7 @@ Object { 52, 60, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -14030,7 +14030,7 @@ Object { 43, 51, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -14100,7 +14100,7 @@ Object { 92, 100, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -14172,7 +14172,7 @@ Object { 127, 135, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -14278,7 +14278,7 @@ Object { 180, 189, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -15155,7 +15155,7 @@ Object { 45, 53, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -15225,7 +15225,7 @@ Object { 96, 104, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -15297,7 +15297,7 @@ Object { 133, 141, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -15403,7 +15403,7 @@ Object { 188, 197, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -16280,7 +16280,7 @@ Object { 42, 50, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -16350,7 +16350,7 @@ Object { 90, 98, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -16422,7 +16422,7 @@ Object { 124, 132, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -16528,7 +16528,7 @@ Object { 176, 185, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -17404,7 +17404,7 @@ Object { 44, 52, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -17475,7 +17475,7 @@ Object { 85, 93, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -18417,7 +18417,7 @@ Object { 36, 44, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -18844,14 +18844,14 @@ Object { 10, 11, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 9, 12, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -19121,14 +19121,14 @@ Object { 10, 17, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 9, 18, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -19399,14 +19399,14 @@ Object { 8, 11, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 7, 12, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -19969,7 +19969,7 @@ Object { 30, 35, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -20350,7 +20350,7 @@ Object { 24, 32, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -20390,7 +20390,7 @@ Object { 33, 41, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -21218,14 +21218,14 @@ Object { 21, 22, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 20, 23, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, "loc": Object { @@ -21478,7 +21478,7 @@ Object { 21, 22, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, Object { "loc": Object { @@ -21496,14 +21496,14 @@ Object { 24, 25, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 20, 26, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, "loc": Object { @@ -21809,14 +21809,14 @@ Object { 17, 18, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 16, 19, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, "loc": Object { @@ -22088,7 +22088,7 @@ Object { 17, 18, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, Object { "loc": Object { @@ -22106,14 +22106,14 @@ Object { 20, 21, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 16, 22, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, "loc": Object { @@ -23069,7 +23069,7 @@ Object { 40, 48, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -23419,7 +23419,7 @@ Object { 29, 37, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -23460,7 +23460,7 @@ Object { 40, 46, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -24324,7 +24324,7 @@ Object { 23, 45, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -24388,7 +24388,7 @@ Object { 30, 38, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -25062,7 +25062,7 @@ Object { 23, 43, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -25125,7 +25125,7 @@ Object { 29, 37, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -25683,7 +25683,7 @@ Object { 15, 18, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -25741,7 +25741,7 @@ Object { 19, 22, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -25807,14 +25807,14 @@ Object { 11, 12, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 10, 13, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -26232,14 +26232,14 @@ Object { 28, 29, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 16, 30, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -26548,7 +26548,7 @@ Object { 26, 29, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -26606,7 +26606,7 @@ Object { 30, 33, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -26690,14 +26690,14 @@ Object { 11, 23, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 10, 24, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -27204,7 +27204,7 @@ Object { 21, 28, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -27244,7 +27244,7 @@ Object { 29, 36, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -27661,7 +27661,7 @@ Object { 21, 28, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -27714,7 +27714,7 @@ Object { 33, 40, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -27802,7 +27802,7 @@ Object { 55, 69, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -27871,7 +27871,7 @@ Object { 61, 69, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -27912,7 +27912,7 @@ Object { 70, 77, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29063,14 +29063,14 @@ Object { 14, 15, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 13, 16, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -29278,7 +29278,7 @@ Object { 23, 31, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29349,7 +29349,7 @@ Object { 41, 49, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29419,7 +29419,7 @@ Object { 60, 68, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29490,7 +29490,7 @@ Object { 80, 88, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29543,7 +29543,7 @@ Object { 98, 106, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29594,7 +29594,7 @@ Object { 107, 115, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29648,7 +29648,7 @@ Object { 126, 134, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29699,7 +29699,7 @@ Object { 135, 143, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29772,7 +29772,7 @@ Object { 154, 160, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -29900,7 +29900,7 @@ Object { 179, 185, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -30028,7 +30028,7 @@ Object { 206, 212, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -30156,7 +30156,7 @@ Object { 233, 239, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -30203,14 +30203,14 @@ Object { 222, 223, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 221, 224, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, Object { @@ -30283,7 +30283,7 @@ Object { 256, 264, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -30373,7 +30373,7 @@ Object { 284, 292, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -30420,14 +30420,14 @@ Object { 275, 276, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 274, 277, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -33037,7 +33037,7 @@ Object { 28, 31, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, ], @@ -33102,14 +33102,14 @@ Object { 14, 15, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 13, 16, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -33435,14 +33435,14 @@ Object { 15, 16, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 14, 17, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -33990,7 +33990,7 @@ Object { 35, 43, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -34093,7 +34093,7 @@ Object { 63, 71, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -34946,7 +34946,7 @@ Object { 15, 44, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -35107,7 +35107,7 @@ Object { 34, 42, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, ], @@ -35115,7 +35115,7 @@ Object { 28, 43, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, ], @@ -35123,7 +35123,7 @@ Object { 22, 44, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -35457,7 +35457,7 @@ Object { 7, 17, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -35526,7 +35526,7 @@ Object { 10, 17, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -35672,7 +35672,7 @@ Object { 35, 42, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, "loc": Object { @@ -36305,7 +36305,7 @@ Object { 25, 33, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -36824,7 +36824,7 @@ Object { 5, 11, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -36914,7 +36914,7 @@ Object { 18, 29, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -38330,7 +38330,7 @@ Object { 17, 38, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -38416,7 +38416,7 @@ Object { 22, 38, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -38829,7 +38829,7 @@ Object { 24, 27, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, Object { @@ -38912,14 +38912,14 @@ Object { 12, 13, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 11, 14, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -39305,7 +39305,7 @@ Object { 35, 38, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, Object { @@ -39406,14 +39406,14 @@ Object { 12, 24, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 11, 25, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -39812,7 +39812,7 @@ Object { 15, 23, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -40307,7 +40307,7 @@ Object { 19, 24, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -40347,7 +40347,7 @@ Object { 25, 38, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -40397,7 +40397,7 @@ Object { 32, 38, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -40857,7 +40857,7 @@ Object { 3, 40, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, "loc": Object { @@ -40960,14 +40960,14 @@ Object { 68, 69, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 56, 81, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, Object { @@ -41089,14 +41089,14 @@ Object { 112, 129, ], - "type": "TypeParameter", + "type": "TSTypeParameter", }, ], "range": Array [ 100, 131, ], - "type": "TypeParameterDeclaration", + "type": "TSTypeParameterDeclaration", }, }, ], @@ -41664,7 +41664,7 @@ Object { 34, 74, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -41768,7 +41768,7 @@ Object { 53, 74, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -42153,7 +42153,7 @@ Object { 47, 79, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -42198,7 +42198,7 @@ Object { 54, 60, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -42250,7 +42250,7 @@ Object { 63, 70, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -42309,7 +42309,7 @@ Object { 73, 79, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -42354,7 +42354,7 @@ Object { 80, 86, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -42900,7 +42900,7 @@ Object { 7, 14, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -43265,7 +43265,7 @@ Object { 8, 15, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -43373,7 +43373,7 @@ Object { 37, 45, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -43758,7 +43758,7 @@ Object { 8, 21, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -49460,7 +49460,7 @@ Object { 58, 69, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -50214,7 +50214,7 @@ Object { 38, 46, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -50806,7 +50806,7 @@ Object { 51, 59, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -51488,7 +51488,7 @@ Object { 40, 48, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -52224,7 +52224,7 @@ Object { 53, 61, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -55873,7 +55873,7 @@ Object { 9, 16, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -55924,7 +55924,7 @@ Object { 14, 16, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -56757,7 +56757,7 @@ Object { 23, 31, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -56828,7 +56828,7 @@ Object { 51, 59, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -56899,7 +56899,7 @@ Object { 74, 82, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -56970,7 +56970,7 @@ Object { 99, 107, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57041,7 +57041,7 @@ Object { 121, 129, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57112,7 +57112,7 @@ Object { 143, 151, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57183,7 +57183,7 @@ Object { 167, 175, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57237,7 +57237,7 @@ Object { 193, 201, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57288,7 +57288,7 @@ Object { 202, 210, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57342,7 +57342,7 @@ Object { 228, 236, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57393,7 +57393,7 @@ Object { 237, 245, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57447,7 +57447,7 @@ Object { 265, 273, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57498,7 +57498,7 @@ Object { 274, 282, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57551,7 +57551,7 @@ Object { 299, 307, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57602,7 +57602,7 @@ Object { 308, 316, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57656,7 +57656,7 @@ Object { 333, 341, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57707,7 +57707,7 @@ Object { 342, 350, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57760,7 +57760,7 @@ Object { 369, 377, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57812,7 +57812,7 @@ Object { 378, 386, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57897,7 +57897,7 @@ Object { 405, 413, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -57939,7 +57939,7 @@ Object { 414, 420, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58024,7 +58024,7 @@ Object { 439, 447, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58066,7 +58066,7 @@ Object { 448, 454, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58151,7 +58151,7 @@ Object { 475, 483, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58193,7 +58193,7 @@ Object { 484, 490, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58277,7 +58277,7 @@ Object { 508, 516, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58319,7 +58319,7 @@ Object { 517, 523, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58404,7 +58404,7 @@ Object { 541, 549, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58446,7 +58446,7 @@ Object { 550, 556, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58530,7 +58530,7 @@ Object { 576, 584, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -58573,7 +58573,7 @@ Object { 585, 591, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -61530,7 +61530,7 @@ Object { 3, 6, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, "loc": Object { @@ -61619,7 +61619,7 @@ Object { 13, 21, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, "loc": Object { @@ -62023,7 +62023,7 @@ Object { 15, 18, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, "loc": Object { @@ -62687,7 +62687,7 @@ Object { 56, 64, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -62727,7 +62727,7 @@ Object { 65, 81, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -62796,7 +62796,7 @@ Object { 76, 81, ], - "type": "TypeParameterInstantiation", + "type": "TSTypeParameterInstantiation", }, }, }, @@ -63336,7 +63336,7 @@ Object { 60, 63, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -64278,7 +64278,7 @@ Object { 98, 106, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -64348,7 +64348,7 @@ Object { 116, 124, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -64511,7 +64511,7 @@ Object { 204, 212, ], - "type": "TypeAnnotation", + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-eslint-parser/yarn.lock b/packages/typescript-eslint-parser/yarn.lock new file mode 100644 index 000000000000..af21089a4ded --- /dev/null +++ b/packages/typescript-eslint-parser/yarn.lock @@ -0,0 +1,3189 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +abab@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" + +abbrev@1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" + +acorn-globals@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + dependencies: + acorn "^4.0.4" + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^4.0.4: + version "4.0.13" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" + +acorn@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" + +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" + +ajv@^4.9.1: + version "4.11.8" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: + version "5.5.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.1.tgz#b38bb8876d9e86bee994956a04e721e88b248eb2" + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + +ansi-escapes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +ansi-styles@^3.1.0, ansi-styles@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + +anymatch@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" + dependencies: + micromatch "^2.1.5" + normalize-path "^2.0.0" + +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + dependencies: + default-require-extensions "^1.0.0" + +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + +are-we-there-yet@~1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + dependencies: + arr-flatten "^1.0.1" + +arr-flatten@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + +array-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" + +array-find-index@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + +arrify@^1.0.0, arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +asap@^2.0.0: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + +asn1@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + +assert-plus@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + +astral-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" + +async@^1.4.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + +async@^2.1.4: + version "2.6.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4" + dependencies: + lodash "^4.14.0" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + +aws-sign2@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + +aws4@^1.2.1, aws4@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" + +axios@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.10.0.tgz#5b0ec0d5fb53e79b98b7bf84c0e9b1cf902fdfc4" + dependencies: + follow-redirects "0.0.7" + +babel-code-frame@6.26.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-core@^6.0.0, babel-core@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.0.tgz#af32f78b31a6fcef119c87b0fd8d9753f03a0bb8" + dependencies: + babel-code-frame "^6.26.0" + babel-generator "^6.26.0" + babel-helpers "^6.24.1" + babel-messages "^6.23.0" + babel-register "^6.26.0" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + convert-source-map "^1.5.0" + debug "^2.6.8" + json5 "^0.5.1" + lodash "^4.17.4" + minimatch "^3.0.4" + path-is-absolute "^1.0.1" + private "^0.1.7" + slash "^1.0.0" + source-map "^0.5.6" + +babel-generator@^6.18.0, babel-generator@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" + dependencies: + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.17.4" + source-map "^0.5.6" + trim-right "^1.0.1" + +babel-helpers@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.24.1" + +babel-jest@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-21.2.0.tgz#2ce059519a9374a2c46f2455b6fbef5ad75d863e" + dependencies: + babel-plugin-istanbul "^4.0.0" + babel-preset-jest "^21.2.0" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-istanbul@^4.0.0: + version "4.1.5" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz#6760cdd977f411d3e175bb064f2bc327d99b2b6e" + dependencies: + find-up "^2.1.0" + istanbul-lib-instrument "^1.7.5" + test-exclude "^4.1.1" + +babel-plugin-jest-hoist@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz#2cef637259bd4b628a6cace039de5fcd14dbb006" + +babel-plugin-syntax-object-rest-spread@^6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" + +babel-preset-jest@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz#ff9d2bce08abd98e8a36d9a8a5189b9173b85638" + dependencies: + babel-plugin-jest-hoist "^21.2.0" + babel-plugin-syntax-object-rest-spread "^6.13.0" + +babel-register@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" + dependencies: + babel-core "^6.26.0" + babel-runtime "^6.26.0" + core-js "^2.5.0" + home-or-tmp "^2.0.0" + lodash "^4.17.4" + mkdirp "^0.5.1" + source-map-support "^0.4.15" + +babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-traverse@^6.18.0, babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.18.0, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@7.0.0-beta.34: + version "7.0.0-beta.34" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.34.tgz#2ccdf97bb4fbc1617619a030a6c0390b2c8f16d6" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + +bcrypt-pbkdf@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" + dependencies: + tweetnacl "^0.14.3" + +block-stream@*: + version "0.0.9" + resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + dependencies: + inherits "~2.0.0" + +boom@2.x.x: + version "2.10.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + dependencies: + hoek "2.x.x" + +boom@4.x.x: + version "4.3.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" + dependencies: + hoek "4.x.x" + +boom@5.x.x: + version "5.2.0" + resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" + dependencies: + hoek "4.x.x" + +brace-expansion@^1.1.7: + version "1.1.8" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +browser-resolve@^1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" + +bser@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" + dependencies: + node-int64 "^0.4.0" + +builtin-modules@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +callsites@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" + +camelcase-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" + dependencies: + camelcase "^2.0.0" + map-obj "^1.0.0" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +camelcase@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" + +camelcase@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + +ci-info@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" + +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +color-convert@^1.9.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + +combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + dependencies: + delayed-stream "~1.0.0" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" + dependencies: + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + +content-type-parser@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.2.tgz#caabe80623e63638b2502fd4c7f12ff4ce2352e7" + +convert-source-map@^1.4.0, convert-source-map@^1.5.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" + +core-js@^2.4.0, core-js@^2.5.0: + version "2.5.2" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.2.tgz#bc4648656e7dc9dc80d7d3c7bbc172d96e744e63" + +core-util-is@1.0.2, core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +cross-spawn@^5.0.1, cross-spawn@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + +cryptiles@2.x.x: + version "2.0.5" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + dependencies: + boom "2.x.x" + +cryptiles@3.x.x: + version "3.1.2" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" + dependencies: + boom "5.x.x" + +cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + +"cssstyle@>= 0.2.37 < 0.3.0": + version "0.2.37" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" + dependencies: + cssom "0.3.x" + +currently-unhandled@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + dependencies: + array-find-index "^1.0.1" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + dependencies: + assert-plus "^1.0.0" + +dateformat@^1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-1.0.12.tgz#9f124b67594c937ff706932e4a642cca8dbbfee9" + dependencies: + get-stdin "^4.0.1" + meow "^3.3.0" + +debug@^2.2.0, debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + dependencies: + ms "2.0.0" + +debug@^3.0.1, debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + +debuglog@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" + +decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +dedent@0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + +deep-extend@~0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + dependencies: + strip-bom "^2.0.0" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + dependencies: + repeating "^2.0.0" + +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + +dezalgo@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456" + dependencies: + asap "^2.0.0" + wrappy "1" + +diff@^3.2.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" + +doctrine@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" + dependencies: + esutils "^2.0.2" + +ecc-jsbn@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + dependencies: + jsbn "~0.1.0" + +errno@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.5.tgz#a563781a6052bc2c9ccd89e8cef0eb9506e0c321" + dependencies: + prr "~1.0.1" + +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" + dependencies: + is-arrayish "^0.2.1" + +es6-promise@^3.0.2: + version "3.3.1" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613" + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +escodegen@^1.6.1: + version "1.9.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.0.tgz#9811a2f265dc1cd3894420ee3717064b632b8852" + dependencies: + esprima "^3.1.3" + estraverse "^4.2.0" + esutils "^2.0.2" + optionator "^0.8.1" + optionalDependencies: + source-map "~0.5.6" + +eslint-config-eslint@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-eslint/-/eslint-config-eslint-4.0.0.tgz#a463a96621e4c8a80ea91eb4c0787bba3a0f7beb" + dependencies: + js-yaml "^3.5.1" + +eslint-plugin-node@5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz#80df3253c4d7901045ec87fa660a284e32bdca29" + dependencies: + ignore "^3.3.6" + minimatch "^3.0.4" + resolve "^1.3.3" + semver "5.3.0" + +eslint-release@0.10.3: + version "0.10.3" + resolved "https://registry.yarnpkg.com/eslint-release/-/eslint-release-0.10.3.tgz#902778148c4f3bef9d1e22fee22af5cfba707813" + dependencies: + dateformat "^1.0.12" + github-api "2.3.0" + linefix "^0.1.1" + npm-license "^0.3.1" + semver "^5.1.0" + shelljs "^0.5.3" + +eslint-scope@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint@4.13.0: + version "4.13.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.0.tgz#1991aa359586af83877bde59de9d41f53e20826d" + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.0.1" + doctrine "^2.0.2" + eslint-scope "^3.7.1" + espree "^3.5.2" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "^4.0.1" + text-table "~0.2.0" + +espree@^3.5.2: + version "3.5.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" + dependencies: + acorn "^5.2.1" + acorn-jsx "^3.0.0" + +esprima@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" + +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" + dependencies: + estraverse "^4.1.0" + object-assign "^4.0.1" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +exec-sh@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.1.tgz#163b98a6e89e6b65b47c2a28d215bc1f63989c38" + dependencies: + merge "^1.1.3" + +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + dependencies: + is-posix-bracket "^0.1.0" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + dependencies: + fill-range "^2.1.0" + +expect@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/expect/-/expect-21.2.1.tgz#003ac2ac7005c3c29e73b38a272d4afadd6d1d7b" + dependencies: + ansi-styles "^3.2.0" + jest-diff "^21.2.1" + jest-get-type "^21.2.0" + jest-matcher-utils "^21.2.1" + jest-message-util "^21.2.1" + jest-regex-util "^21.2.0" + +extend@~3.0.0, extend@~3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" + +external-editor@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + dependencies: + is-extglob "^1.0.0" + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + +fast-deep-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +fb-watchman@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" + dependencies: + bser "^2.0.0" + +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + +fileset@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" + dependencies: + glob "^7.0.3" + minimatch "^3.0.3" + +fill-range@^2.1.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^1.1.3" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0, find-up@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + +flat-cache@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +follow-redirects@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-0.0.7.tgz#34b90bab2a911aa347571da90f22bd36ecd8a919" + dependencies: + debug "^2.2.0" + stream-consume "^0.1.0" + +for-in@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + dependencies: + for-in "^1.0.1" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + +form-data@~2.1.1: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +form-data@~2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +fsevents@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8" + dependencies: + nan "^2.3.0" + node-pre-gyp "^0.6.39" + +fstream-ignore@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" + dependencies: + fstream "^1.0.0" + inherits "2" + minimatch "^3.0.0" + +fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: + version "1.0.11" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" + dependencies: + graceful-fs "^4.1.2" + inherits "~2.0.0" + mkdirp ">=0.5 0" + rimraf "2" + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" + +get-caller-file@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + +get-stdin@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + dependencies: + assert-plus "^1.0.0" + +github-api@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/github-api/-/github-api-2.3.0.tgz#eee768460b29e86e91b96a9e79f8555cef6b5325" + dependencies: + axios "^0.10.0" + debug "^2.2.0" + es6-promise "^3.0.2" + js-base64 "^2.1.9" + utf8 "^2.1.1" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + dependencies: + is-glob "^2.0.0" + +glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^11.0.1: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.1.0.tgz#632644457f5f0e3ae711807183700ebf2e4633e4" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +graceful-fs@^4.1.11, graceful-fs@^4.1.2: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +growly@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" + +handlebars@^4.0.3: + version "4.0.11" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + +har-schema@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + +har-validator@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" + dependencies: + ajv "^4.9.1" + har-schema "^1.0.5" + +har-validator@~5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" + dependencies: + ajv "^5.1.0" + har-schema "^2.0.0" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + +hawk@3.1.3, hawk@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + dependencies: + boom "2.x.x" + cryptiles "2.x.x" + hoek "2.x.x" + sntp "1.x.x" + +hawk@~6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" + dependencies: + boom "4.x.x" + cryptiles "3.x.x" + hoek "4.x.x" + sntp "2.x.x" + +hoek@2.x.x: + version "2.16.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + +hoek@4.x.x: + version "4.2.0" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" + +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" + +hosted-git-info@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + +html-encoding-sniffer@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" + dependencies: + whatwg-encoding "^1.0.1" + +http-signature@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + dependencies: + assert-plus "^0.2.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +iconv-lite@0.4.19, iconv-lite@^0.4.17: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + +ignore@^3.3.3, ignore@^3.3.6: + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + dependencies: + repeating "^2.0.0" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +ini@~1.3.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.4" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + +interpret@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" + +invariant@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + +is-ci@^1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" + dependencies: + ci-info "^1.0.0" + +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + dependencies: + is-extglob "^1.0.0" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + dependencies: + kind-of "^3.0.2" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + dependencies: + kind-of "^3.0.2" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" + dependencies: + path-is-inside "^1.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + +isarray@1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + +istanbul-api@^1.1.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.2.1.tgz#0c60a0515eb11c7d65c6b50bba2c6e999acd8620" + dependencies: + async "^2.1.4" + fileset "^2.0.2" + istanbul-lib-coverage "^1.1.1" + istanbul-lib-hook "^1.1.0" + istanbul-lib-instrument "^1.9.1" + istanbul-lib-report "^1.1.2" + istanbul-lib-source-maps "^1.2.2" + istanbul-reports "^1.1.3" + js-yaml "^3.7.0" + mkdirp "^0.5.1" + once "^1.4.0" + +istanbul-lib-coverage@^1.0.1, istanbul-lib-coverage@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" + +istanbul-lib-hook@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz#8538d970372cb3716d53e55523dd54b557a8d89b" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.4.2, istanbul-lib-instrument@^1.7.5, istanbul-lib-instrument@^1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz#250b30b3531e5d3251299fdd64b0b2c9db6b558e" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.18.0" + istanbul-lib-coverage "^1.1.1" + semver "^5.3.0" + +istanbul-lib-report@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz#922be27c13b9511b979bd1587359f69798c1d425" + dependencies: + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + path-parse "^1.0.5" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.1.0, istanbul-lib-source-maps@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz#750578602435f28a0c04ee6d7d9e0f2960e62c1c" + dependencies: + debug "^3.1.0" + istanbul-lib-coverage "^1.1.1" + mkdirp "^0.5.1" + rimraf "^2.6.1" + source-map "^0.5.3" + +istanbul-reports@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.3.tgz#3b9e1e8defb6d18b1d425da8e8b32c5a163f2d10" + dependencies: + handlebars "^4.0.3" + +jest-changed-files@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-21.2.0.tgz#5dbeecad42f5d88b482334902ce1cba6d9798d29" + dependencies: + throat "^4.0.0" + +jest-cli@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-21.2.1.tgz#9c528b6629d651911138d228bdb033c157ec8c00" + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.1" + glob "^7.1.2" + graceful-fs "^4.1.11" + is-ci "^1.0.10" + istanbul-api "^1.1.1" + istanbul-lib-coverage "^1.0.1" + istanbul-lib-instrument "^1.4.2" + istanbul-lib-source-maps "^1.1.0" + jest-changed-files "^21.2.0" + jest-config "^21.2.1" + jest-environment-jsdom "^21.2.1" + jest-haste-map "^21.2.0" + jest-message-util "^21.2.1" + jest-regex-util "^21.2.0" + jest-resolve-dependencies "^21.2.0" + jest-runner "^21.2.1" + jest-runtime "^21.2.1" + jest-snapshot "^21.2.1" + jest-util "^21.2.1" + micromatch "^2.3.11" + node-notifier "^5.0.2" + pify "^3.0.0" + slash "^1.0.0" + string-length "^2.0.0" + strip-ansi "^4.0.0" + which "^1.2.12" + worker-farm "^1.3.1" + yargs "^9.0.0" + +jest-config@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-21.2.1.tgz#c7586c79ead0bcc1f38c401e55f964f13bf2a480" + dependencies: + chalk "^2.0.1" + glob "^7.1.1" + jest-environment-jsdom "^21.2.1" + jest-environment-node "^21.2.1" + jest-get-type "^21.2.0" + jest-jasmine2 "^21.2.1" + jest-regex-util "^21.2.0" + jest-resolve "^21.2.0" + jest-util "^21.2.1" + jest-validate "^21.2.1" + pretty-format "^21.2.1" + +jest-diff@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-21.2.1.tgz#46cccb6cab2d02ce98bc314011764bb95b065b4f" + dependencies: + chalk "^2.0.1" + diff "^3.2.0" + jest-get-type "^21.2.0" + pretty-format "^21.2.1" + +jest-docblock@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" + +jest-environment-jsdom@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz#38d9980c8259b2a608ec232deee6289a60d9d5b4" + dependencies: + jest-mock "^21.2.0" + jest-util "^21.2.1" + jsdom "^9.12.0" + +jest-environment-node@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-21.2.1.tgz#98c67df5663c7fbe20f6e792ac2272c740d3b8c8" + dependencies: + jest-mock "^21.2.0" + jest-util "^21.2.1" + +jest-get-type@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.2.0.tgz#f6376ab9db4b60d81e39f30749c6c466f40d4a23" + +jest-haste-map@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-21.2.0.tgz#1363f0a8bb4338f24f001806571eff7a4b2ff3d8" + dependencies: + fb-watchman "^2.0.0" + graceful-fs "^4.1.11" + jest-docblock "^21.2.0" + micromatch "^2.3.11" + sane "^2.0.0" + worker-farm "^1.3.1" + +jest-jasmine2@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz#9cc6fc108accfa97efebce10c4308548a4ea7592" + dependencies: + chalk "^2.0.1" + expect "^21.2.1" + graceful-fs "^4.1.11" + jest-diff "^21.2.1" + jest-matcher-utils "^21.2.1" + jest-message-util "^21.2.1" + jest-snapshot "^21.2.1" + p-cancelable "^0.3.0" + +jest-matcher-utils@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz#72c826eaba41a093ac2b4565f865eb8475de0f64" + dependencies: + chalk "^2.0.1" + jest-get-type "^21.2.0" + pretty-format "^21.2.1" + +jest-message-util@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-21.2.1.tgz#bfe5d4692c84c827d1dcf41823795558f0a1acbe" + dependencies: + chalk "^2.0.1" + micromatch "^2.3.11" + slash "^1.0.0" + +jest-mock@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-21.2.0.tgz#7eb0770e7317968165f61ea2a7281131534b3c0f" + +jest-regex-util@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-21.2.0.tgz#1b1e33e63143babc3e0f2e6c9b5ba1eb34b2d530" + +jest-resolve-dependencies@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz#9e231e371e1a736a1ad4e4b9a843bc72bfe03d09" + dependencies: + jest-regex-util "^21.2.0" + +jest-resolve@^21.2.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-21.2.0.tgz#068913ad2ba6a20218e5fd32471f3874005de3a6" + dependencies: + browser-resolve "^1.11.2" + chalk "^2.0.1" + is-builtin-module "^1.0.0" + +jest-runner@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-21.2.1.tgz#194732e3e518bfb3d7cbfc0fd5871246c7e1a467" + dependencies: + jest-config "^21.2.1" + jest-docblock "^21.2.0" + jest-haste-map "^21.2.0" + jest-jasmine2 "^21.2.1" + jest-message-util "^21.2.1" + jest-runtime "^21.2.1" + jest-util "^21.2.1" + pify "^3.0.0" + throat "^4.0.0" + worker-farm "^1.3.1" + +jest-runtime@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-21.2.1.tgz#99dce15309c670442eee2ebe1ff53a3cbdbbb73e" + dependencies: + babel-core "^6.0.0" + babel-jest "^21.2.0" + babel-plugin-istanbul "^4.0.0" + chalk "^2.0.1" + convert-source-map "^1.4.0" + graceful-fs "^4.1.11" + jest-config "^21.2.1" + jest-haste-map "^21.2.0" + jest-regex-util "^21.2.0" + jest-resolve "^21.2.0" + jest-util "^21.2.1" + json-stable-stringify "^1.0.1" + micromatch "^2.3.11" + slash "^1.0.0" + strip-bom "3.0.0" + write-file-atomic "^2.1.0" + yargs "^9.0.0" + +jest-snapshot@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-21.2.1.tgz#29e49f16202416e47343e757e5eff948c07fd7b0" + dependencies: + chalk "^2.0.1" + jest-diff "^21.2.1" + jest-matcher-utils "^21.2.1" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + pretty-format "^21.2.1" + +jest-util@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-21.2.1.tgz#a274b2f726b0897494d694a6c3d6a61ab819bb78" + dependencies: + callsites "^2.0.0" + chalk "^2.0.1" + graceful-fs "^4.1.11" + jest-message-util "^21.2.1" + jest-mock "^21.2.0" + jest-validate "^21.2.1" + mkdirp "^0.5.1" + +jest-validate@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-21.2.1.tgz#cc0cbca653cd54937ba4f2a111796774530dd3c7" + dependencies: + chalk "^2.0.1" + jest-get-type "^21.2.0" + leven "^2.1.0" + pretty-format "^21.2.1" + +jest@21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/jest/-/jest-21.2.1.tgz#c964e0b47383768a1438e3ccf3c3d470327604e1" + dependencies: + jest-cli "^21.2.1" + +js-base64@^2.1.9: + version "2.4.0" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa" + +js-tokens@^3.0.0, js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + +js-yaml@^3.5.1, js-yaml@^3.7.0, js-yaml@^3.9.1: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + +jsdom@^9.12.0: + version "9.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" + dependencies: + abab "^1.0.3" + acorn "^4.0.4" + acorn-globals "^3.1.0" + array-equal "^1.0.0" + content-type-parser "^1.0.1" + cssom ">= 0.3.2 < 0.4.0" + cssstyle ">= 0.2.37 < 0.3.0" + escodegen "^1.6.1" + html-encoding-sniffer "^1.0.1" + nwmatcher ">= 1.3.9 < 2.0.0" + parse5 "^1.5.1" + request "^2.79.0" + sax "^1.2.1" + symbol-tree "^3.2.1" + tough-cookie "^2.3.2" + webidl-conversions "^4.0.0" + whatwg-encoding "^1.0.1" + whatwg-url "^4.3.0" + xml-name-validator "^2.0.1" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + +json-parse-better-errors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz#50183cd1b2d25275de069e9e71b467ac9eab973a" + +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + +json5@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +kind-of@^3.0.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + dependencies: + is-buffer "^1.1.5" + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + dependencies: + invert-kv "^1.0.0" + +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +linefix@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/linefix/-/linefix-0.1.1.tgz#581f54b2935ffbe9df255770f0aa3b0341382393" + +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +lodash.isplainobject@4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + +lodash@^4.14.0, lodash@^4.17.4, lodash@^4.3.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +loose-envify@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + dependencies: + js-tokens "^3.0.0" + +loud-rejection@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + dependencies: + currently-unhandled "^0.4.1" + signal-exit "^3.0.0" + +lru-cache@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + +makeerror@1.0.x: + version "1.0.11" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" + dependencies: + tmpl "1.0.x" + +map-obj@^1.0.0, map-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + +mem@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + dependencies: + mimic-fn "^1.0.0" + +meow@^3.3.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" + dependencies: + camelcase-keys "^2.0.0" + decamelize "^1.1.2" + loud-rejection "^1.0.0" + map-obj "^1.0.1" + minimist "^1.1.3" + normalize-package-data "^2.3.4" + object-assign "^4.0.1" + read-pkg-up "^1.0.1" + redent "^1.0.0" + trim-newlines "^1.0.0" + +merge@^1.1.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" + +micromatch@^2.1.5, micromatch@^2.3.11: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +mime-db@~1.30.0: + version "1.30.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" + +mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.7: + version "2.1.17" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" + dependencies: + mime-db "~1.30.0" + +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + +minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +minimist@~0.0.1: + version "0.0.10" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + +"mkdirp@>=0.5 0", mkdirp@^0.5.1, mkdirp@~0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + +nan@^2.3.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + +node-notifier@^5.0.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.1.2.tgz#2fa9e12605fa10009d44549d6fcd8a63dde0e4ff" + dependencies: + growly "^1.3.0" + semver "^5.3.0" + shellwords "^0.1.0" + which "^1.2.12" + +node-pre-gyp@^0.6.39: + version "0.6.39" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649" + dependencies: + detect-libc "^1.0.2" + hawk "3.1.3" + mkdirp "^0.5.1" + nopt "^4.0.1" + npmlog "^4.0.2" + rc "^1.1.7" + request "2.81.0" + rimraf "^2.6.1" + semver "^5.3.0" + tar "^2.2.1" + tar-pack "^3.4.0" + +nopt-usage@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/nopt-usage/-/nopt-usage-0.1.0.tgz#b18b8c183e181047ca9e63b7cde7cfc702cca579" + +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + dependencies: + abbrev "1" + osenv "^0.1.4" + +nopt@~3.0.1: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + dependencies: + abbrev "1" + +normalize-package-data@^2.0.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: + version "2.4.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.0, normalize-path@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" + dependencies: + remove-trailing-separator "^1.0.1" + +npm-license@0.3.3, npm-license@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/npm-license/-/npm-license-0.3.3.tgz#f67f4bc23c863f6e062cde639414e05116dcdb82" + dependencies: + mkdirp "~0.5.0" + nopt "~3.0.1" + nopt-usage "^0.1.0" + package-license "~0.1.1" + pkginfo "^0.3.0" + read-installed "~4.0.3" + treeify "~1.0.1" + underscore "~1.4.4" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + +npmlog@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +"nwmatcher@>= 1.3.9 < 2.0.0": + version "1.4.3" + resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.3.tgz#64348e3b3d80f035b40ac11563d278f8b72db89c" + +oauth-sign@~0.8.1, oauth-sign@~0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +once@^1.3.0, once@^1.3.3, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optionator@^0.8.1, optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +os-locale@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + dependencies: + execa "^0.7.0" + lcid "^1.0.0" + mem "^1.1.0" + +os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +osenv@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.4.tgz#42fe6d5953df06c8064be6f176c3d05aaaa34644" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.0" + +p-cancelable@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-limit@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + +package-license@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/package-license/-/package-license-0.1.2.tgz#f5c449a7a50fadf4a22341e2949099f91a42028b" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +parse5@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + +path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1, path-is-inside@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + dependencies: + pify "^2.0.0" + +performance-now@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + +pify@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pkginfo@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.3.1.tgz#5b29f6a81f70717142e09e765bbeab97b4f81e21" + +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + +pretty-format@^21.2.1: + version "21.2.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + +private@^0.1.7: + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + +prr@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + +qs@~6.4.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" + +qs@~6.5.1: + version "6.5.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" + +randomatic@^1.1.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +rc@^1.1.7: + version "1.2.2" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" + dependencies: + deep-extend "~0.4.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~2.0.1" + +read-installed@~4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/read-installed/-/read-installed-4.0.3.tgz#ff9b8b67f187d1e4c29b9feb31f6b223acd19067" + dependencies: + debuglog "^1.0.1" + read-package-json "^2.0.0" + readdir-scoped-modules "^1.0.0" + semver "2 || 3 || 4 || 5" + slide "~1.1.3" + util-extend "^1.0.1" + optionalDependencies: + graceful-fs "^4.1.2" + +read-package-json@^2.0.0: + version "2.0.12" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.0.12.tgz#68ea45f98b3741cb6e10ae3bbd42a605026a6951" + dependencies: + glob "^7.1.1" + json-parse-better-errors "^1.0.0" + normalize-package-data "^2.0.0" + slash "^1.0.0" + optionalDependencies: + graceful-fs "^4.1.2" + +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + safe-buffer "~5.1.1" + string_decoder "~1.0.3" + util-deprecate "~1.0.1" + +readdir-scoped-modules@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" + dependencies: + debuglog "^1.0.1" + dezalgo "^1.0.0" + graceful-fs "^4.1.2" + once "^1.3.0" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + +redent@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" + dependencies: + indent-string "^2.1.0" + strip-indent "^1.0.1" + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + dependencies: + is-equal-shallow "^0.1.3" + +remove-trailing-separator@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + +repeat-element@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.0.0" + +request@2.81.0: + version "2.81.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~4.2.1" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + performance-now "^0.2.0" + qs "~6.4.0" + safe-buffer "^5.0.1" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "^0.6.0" + uuid "^3.0.0" + +request@^2.79.0: + version "2.83.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.6.0" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.1" + forever-agent "~0.6.1" + form-data "~2.3.1" + har-validator "~5.0.3" + hawk "~6.0.2" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.17" + oauth-sign "~0.8.2" + performance-now "^2.1.0" + qs "~6.5.1" + safe-buffer "^5.1.1" + stringstream "~0.0.5" + tough-cookie "~2.3.3" + tunnel-agent "^0.6.0" + uuid "^3.1.0" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + +require-uncached@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.6, resolve@^1.3.3: + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" + dependencies: + path-parse "^1.0.5" + +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" + dependencies: + glob "^7.0.5" + +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + dependencies: + is-promise "^2.1.0" + +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + +safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + +sane@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/sane/-/sane-2.2.0.tgz#d6d2e2fcab00e3d283c93b912b7c3a20846f1d56" + dependencies: + anymatch "^1.3.0" + exec-sh "^0.2.0" + fb-watchman "^2.0.0" + minimatch "^3.0.2" + minimist "^1.1.1" + walker "~1.0.5" + watch "~0.18.0" + optionalDependencies: + fsevents "^1.1.1" + +sax@^1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" + +"semver@2 || 3 || 4 || 5", semver@5.4.1, semver@^5.1.0, semver@^5.3.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" + +semver@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + +shelljs-nodecli@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shelljs-nodecli/-/shelljs-nodecli-0.1.1.tgz#f1beb5563754c475d06f7d0833e0f6075e462d3b" + dependencies: + shelljs "~0.2" + +shelljs@0.7.8: + version "0.7.8" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +shelljs@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.5.3.tgz#c54982b996c76ef0c1e6b59fbdc5825f5b713113" + +shelljs@~0.2: + version "0.2.6" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.2.6.tgz#90492d72ffcc8159976baba62fb0f6884f0c3378" + +shellwords@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" + +signal-exit@^3.0.0, signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" + +slide@~1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + +sntp@1.x.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + dependencies: + hoek "2.x.x" + +sntp@2.x.x: + version "2.1.0" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" + dependencies: + hoek "4.x.x" + +source-map-support@^0.4.15: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" + dependencies: + source-map "^0.5.6" + +source-map@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + dependencies: + amdefine ">=0.0.4" + +source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +sshpk@^1.7.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + dashdash "^1.12.0" + getpass "^0.1.1" + optionalDependencies: + bcrypt-pbkdf "^1.0.0" + ecc-jsbn "~0.1.1" + jsbn "~0.1.0" + tweetnacl "~0.14.0" + +stream-consume@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/stream-consume/-/stream-consume-0.1.0.tgz#a41ead1a6d6081ceb79f65b061901b6d8f3d1d0f" + +string-length@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" + dependencies: + astral-regex "^1.0.0" + strip-ansi "^4.0.0" + +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" + dependencies: + safe-buffer "~5.1.0" + +stringstream@~0.0.4, stringstream@~0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + +strip-bom@3.0.0, strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + dependencies: + is-utf8 "^0.2.0" + +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + +strip-indent@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" + dependencies: + get-stdin "^4.0.1" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +supports-color@^3.1.2: + version "3.2.3" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" + dependencies: + has-flag "^1.0.0" + +supports-color@^4.0.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" + dependencies: + has-flag "^2.0.0" + +symbol-tree@^3.2.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" + +table@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + +tar-pack@^3.4.0: + version "3.4.1" + resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" + dependencies: + debug "^2.2.0" + fstream "^1.0.10" + fstream-ignore "^1.0.5" + once "^1.3.3" + readable-stream "^2.1.4" + rimraf "^2.5.1" + tar "^2.2.1" + uid-number "^0.0.6" + +tar@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" + dependencies: + block-stream "*" + fstream "^1.0.2" + inherits "2" + +test-exclude@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +throat@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + dependencies: + os-tmpdir "~1.0.2" + +tmpl@1.0.x: + version "1.0.4" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + +tough-cookie@^2.3.2, tough-cookie@~2.3.0, tough-cookie@~2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" + dependencies: + punycode "^1.4.1" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + +treeify@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/treeify/-/treeify-1.0.1.tgz#69b3cd022022a168424e7cfa1ced44c939d3eb2f" + +trim-newlines@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +typescript@~2.6.1: + version "2.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" + +uglify-js@^2.6: + version "2.8.29" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" + dependencies: + source-map "~0.5.1" + yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +uid-number@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + +underscore@~1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.4.4.tgz#61a6a32010622afa07963bf325203cf12239d604" + +utf8@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +util-extend@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/util-extend/-/util-extend-1.0.3.tgz#a7c216d267545169637b3b6edc6ca9119e2ff93f" + +uuid@^3.0.0, uuid@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + dependencies: + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +walker@~1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" + dependencies: + makeerror "1.0.x" + +watch@~0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" + dependencies: + exec-sh "^0.2.0" + minimist "^1.2.0" + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + +webidl-conversions@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + +whatwg-encoding@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz#57c235bc8657e914d24e1a397d3c82daee0a6ba3" + dependencies: + iconv-lite "0.4.19" + +whatwg-url@^4.3.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +which-module@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + +which@^1.2.12, which@^1.2.9: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + +wide-align@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" + dependencies: + string-width "^1.0.2" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +wordwrap@~0.0.2: + version "0.0.3" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +worker-farm@^1.3.1: + version "1.5.2" + resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.5.2.tgz#32b312e5dc3d5d45d79ef44acc2587491cd729ae" + dependencies: + errno "^0.1.4" + xtend "^4.0.1" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write-file-atomic@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab" + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +xml-name-validator@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" + +xtend@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + +yargs-parser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" + dependencies: + camelcase "^4.1.0" + +yargs@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" + dependencies: + camelcase "^4.1.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^2.0.0" + read-pkg-up "^2.0.0" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^2.0.0" + which-module "^2.0.0" + y18n "^3.2.1" + yargs-parser "^7.0.0" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" From 21f30bb53152cdae11896a3fbe88b212ec704431 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 11 Dec 2017 13:37:31 -0500 Subject: [PATCH 229/326] Build: changelog update for 10.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 680cbef3255e..9e96e820b6b9 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,9 @@ +v10.0.0 - December 11, 2017 + +* 59a37f4 Breaking: Updates to AST node types of some TSNodes (fixes #386) (#388) (James Henry) +* 627355e Chore: Introduce integration tests (#411) (James Henry) +* b4d22e7 Chore: No package-lock like other ESLint repos (#409) (James Henry) + v9.0.1 - November 29, 2017 * 153cdb8 Fix: Calculate end position of TypeInstantiation (fixes #406) (#405) (Lucas Duailibe) From 0008055e1e412c95592a8fd54e00eea852018c2e Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 11 Dec 2017 13:37:32 -0500 Subject: [PATCH 230/326] 10.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index aa820eb8851d..acbc30216da2 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "9.0.1", + "version": "10.0.0", "files": [ "lib", "parser.js" From a282e40991531ab9f9747cac6d6e2ca24fec7209 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 13 Dec 2017 10:46:30 +0000 Subject: [PATCH 231/326] Breaking: Implement parseForESLint() function (#412) --- packages/typescript-eslint-parser/README.md | 12 +- .../lib/ast-converter.js | 3 +- .../typescript-eslint-parser/lib/convert.js | 19 + .../typescript-eslint-parser/package.json | 2 +- packages/typescript-eslint-parser/parser.js | 25 +- .../declared-empty-body-functions.js | 21 + .../external-fixtures/jsdoc-indent.js | 12 + .../no-redeclare-overloaded-functions.js | 14 + .../external-fixtures/range-error-indent.js | 4 + .../integration/from-babel-eslint.spec.js | 106 +- .../tests/integration/typescript.spec.js | 174 + .../tests/integration/utils.js | 15 +- packages/typescript-eslint-parser/yarn.lock | 3189 ----------------- 13 files changed, 337 insertions(+), 3259 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/integration/external-fixtures/declared-empty-body-functions.js create mode 100644 packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js create mode 100644 packages/typescript-eslint-parser/tests/integration/external-fixtures/no-redeclare-overloaded-functions.js create mode 100644 packages/typescript-eslint-parser/tests/integration/external-fixtures/range-error-indent.js delete mode 100644 packages/typescript-eslint-parser/yarn.lock diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index badc1f8c8280..85a933197286 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -1,6 +1,6 @@ -# TypeScript ESLint Parser (Experimental) +# TypeScript ESLint Parser -A parser that converts TypeScript into an [ESTree](https://github.com/estree/estree)-compatible form so it can be used in ESLint. +A parser that converts TypeScript source code into an [ESTree](https://github.com/estree/estree)-compatible form. **Important:** This parser is not fully compatible with all ESLint rules and plugins. Some rules will improperly mark source code as failing or not find problems where it should. @@ -20,18 +20,10 @@ The following ESLint rules will fail on acceptable code: - no-undef [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) - no-unused-vars [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) - no-useless-constructor [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) - - space-infix-ops [#224](https://github.com/eslint/typescript-eslint-parser/issues/224) The follow ESLint plugins have issues when used with this parser: - - eslint-plugin-react [#213](https://github.com/eslint/typescript-eslint-parser/issues/213) - eslint-plugin-import - prefer-default-export - Will fail exports inside of Namespaces or Modules - -The following TypeScript syntax will cause rules to fail or ESLint v3 to crash: - - Empty body functions - - Abstract methods - - Function overloading - - Declared functions ## Usage diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index 4bc072b828b6..d99e09b0ee79 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -58,7 +58,8 @@ module.exports = (ast, extra) => { ast, additionalOptions: { errorOnUnknownASTType: extra.errorOnUnknownASTType || false, - useJSXTextNode: extra.useJSXTextNode || false + useJSXTextNode: extra.useJSXTextNode || false, + parseForESLint: extra.parseForESLint } }); diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 02e880e93701..db823d772d60 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -69,6 +69,21 @@ module.exports = function convert(config) { }); } + /** + * If we are parsing for ESLint we need to perform a custom namespacing step + * on functions which have no body so that we do not break any ESLint rules which + * rely on them to have one. + * + * @param {ESTreeNode} functionNode the converted ESTreeNode + * @returns {void} + */ + function namespaceEmptyBodyFunctionForESLint(functionNode) { + if (!config.additionalOptions.parseForESLint || functionNode.body) { + return; + } + functionNode.type = `TSEmptyBody${functionNode.type}`; + } + /** * Converts a TypeScript node into an ESTree node. * @param {TSNode} child the child TSNode @@ -634,6 +649,8 @@ module.exports = function convert(config) { result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); } + namespaceEmptyBodyFunctionForESLint(result); + // check for exports result = nodeUtils.fixExports(node, result, ast); @@ -954,6 +971,8 @@ module.exports = function convert(config) { method.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); } + namespaceEmptyBodyFunctionForESLint(result.value); + break; } diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index acbc30216da2..503ed9f84e0c 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -21,7 +21,7 @@ "babel-code-frame": "6.26.0", "babylon": "7.0.0-beta.34", "dedent": "0.7.0", - "eslint": "4.13.0", + "eslint": "4.13.1", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "5.2.1", "eslint-release": "0.10.3", diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 250eebdcf6dd..da4e0c5ae5bc 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -1,6 +1,7 @@ /** * @fileoverview Parser that converts TypeScript into ESTree format. * @author Nicholas C. Zakas + * @author James Henry * @copyright jQuery Foundation and other contributors, https://jquery.org/ * MIT License */ @@ -45,11 +46,13 @@ function resetExtra() { /** * Parses the given source code to produce a valid AST - * @param {mixed} code TypeScript code - * @param {Object} options configuration object for the parser + * @param {mixed} code TypeScript code + * @param {Object} options configuration object for the parser + * @param {Object} additionalParsingContext additional internal configuration * @returns {Object} the AST */ -function parse(code, options) { +function generateAST(code, options, additionalParsingContext) { + additionalParsingContext = additionalParsingContext || {}; const toString = String; @@ -104,6 +107,13 @@ function parse(code, options) { extra.log = Function.prototype; } + /** + * Provide the context as to whether or not we are parsing for ESLint, + * specifically + */ + if (additionalParsingContext.isParseForESLint) { + extra.parseForESLint = true; + } } if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { @@ -175,7 +185,14 @@ function parse(code, options) { exports.version = require("./package.json").version; -exports.parse = parse; +exports.parse = function parse(code, options) { + return generateAST(code, options, { isParseForESLint: false }); +}; + +exports.parseForESLint = function parseForESLint(code, options) { + const ast = generateAST(code, options, { isParseForESLint: true }); + return { ast }; +}; // Deep copy. /* istanbul ignore next */ diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/declared-empty-body-functions.js b/packages/typescript-eslint-parser/tests/integration/external-fixtures/declared-empty-body-functions.js new file mode 100644 index 000000000000..16eb9c568740 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/external-fixtures/declared-empty-body-functions.js @@ -0,0 +1,21 @@ +"use strict"; + +declare namespace FF { + class Foo extends Bar.Baz { + far(): any; + } +} + +declare module "FF" { + class Foo extends Bar.Baz { + far(): any; + } +} + +declare class Foo extends Bar.Baz { + far(): any; +} + +declare namespace d3 { + export function select(selector: string): Selection; +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js b/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js new file mode 100644 index 000000000000..25641d508252 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js @@ -0,0 +1,12 @@ +/** + * @a + */ +foo; + +/** + * @a + */ +/** + * a + */ +foo; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/no-redeclare-overloaded-functions.js b/packages/typescript-eslint-parser/tests/integration/external-fixtures/no-redeclare-overloaded-functions.js new file mode 100644 index 000000000000..6151c59f1782 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/external-fixtures/no-redeclare-overloaded-functions.js @@ -0,0 +1,14 @@ +export async function readFile( + filename: string, + options?: { flag?: string } +): Promise +export async function readFile( + filename: string, + options?: { encoding: BufferEncoding; flag?: string } +): Promise +export async function readFile( + filename: string, + options?: { encoding?: string; flag?: string } +): Promise { + // ... +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/range-error-indent.js b/packages/typescript-eslint-parser/tests/integration/external-fixtures/range-error-indent.js new file mode 100644 index 000000000000..44b5da534b66 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/external-fixtures/range-error-indent.js @@ -0,0 +1,4 @@ +class a { + /** @b {} c */ + d = e => {} +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js b/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js index 790eccf9f026..51449facfe8c 100644 --- a/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js +++ b/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js @@ -33,11 +33,11 @@ const utils = require("./utils"); const verifyAndAssertMessages = utils.verifyAndAssertMessages; describe("Non-regression tests from babel-eslint", () => { - it("arrow function support (issue #1)", () => { + it("arrow function support", () => { verifyAndAssertMessages("describe('stuff', () => {});", {}, []); }); - it("EOL validation (issue #2)", () => { + it("EOL validation", () => { verifyAndAssertMessages( "module.exports = \"something\";", { "eol-last": 1, semi: 1 }, @@ -45,7 +45,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("Modules support (issue #5)", () => { + it("Modules support", () => { verifyAndAssertMessages( unpad(` import Foo from 'foo'; @@ -59,7 +59,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("Rest parameters (issue #7)", () => { + it("Rest parameters", () => { verifyAndAssertMessages( "function foo(...args) { return args; }", { "no-undef": 1 }, @@ -67,7 +67,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("Exported classes should be used (issue #8)", () => { + it("Exported classes should be used", () => { verifyAndAssertMessages( "class Foo {} module.exports = Foo;", { "no-unused-vars": 1 }, @@ -75,7 +75,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("super keyword in class (issue #10)", () => { + it("super keyword in class", () => { verifyAndAssertMessages( "class Foo { constructor() { super() } }", { "no-undef": 1 }, @@ -83,7 +83,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("Rest parameter in destructuring assignment (issue #11)", () => { + it("Rest parameter in destructuring assignment", () => { verifyAndAssertMessages( "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", { "no-undef": 1 }, @@ -95,7 +95,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("JSX attribute names marked as variables (issue #12)", () => { + it("JSX attribute names marked as variables", () => { verifyAndAssertMessages( "module.exports =
", { "no-undef": 1 }, @@ -107,7 +107,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("Multiple destructured assignment with compound properties (issue #16)", () => { + it("Multiple destructured assignment with compound properties", () => { verifyAndAssertMessages( "module.exports = { ...a.a, ...a.b };", { "no-dupe-keys": 1 }, @@ -115,7 +115,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("Arrow function with non-block bodies (issue #20)", () => { + it("Arrow function with non-block bodies", () => { verifyAndAssertMessages( "\"use strict\"; () => 1", { strict: [1, "global"] }, @@ -124,7 +124,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("#242", () => { + it("babel/babel-eslint#242", () => { verifyAndAssertMessages( "\"use strict\"; asdf;", { "no-irregular-whitespace": 1 }, @@ -133,7 +133,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("await keyword (issue #22)", () => { + it("await keyword", () => { verifyAndAssertMessages( "async function foo() { await bar(); }", { "no-unused-expressions": 1 }, @@ -141,7 +141,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("arrow functions (issue #27)", () => { + it("arrow functions", () => { verifyAndAssertMessages( "[1, 2, 3].map(i => i * 2);", { "func-names": 1, "space-before-blocks": 1 }, @@ -149,7 +149,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("comment with padded-blocks (issue #33)", () => { + it("comment with padded-blocks", () => { verifyAndAssertMessages( unpad(` if (a) { @@ -184,7 +184,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("template strings #31", () => { + it("template strings", () => { verifyAndAssertMessages( "console.log(`${a}, b`);", { "comma-spacing": 1 }, @@ -192,7 +192,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("template with destructuring #31", () => { + it("template with destructuring", () => { verifyAndAssertMessages( unpad(` module.exports = { @@ -207,7 +207,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - describe("decorators #72", () => { + describe("decorators", () => { // it("class declaration", () => { // verifyAndAssertMessages( // unpad(` @@ -307,7 +307,7 @@ describe("Non-regression tests from babel-eslint", () => { // }); }); - it("detects minimal no-unused-vars case #120", () => { + it("detects minimal no-unused-vars case", () => { verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ "1:5 'unused' is defined but never used. no-unused-vars" ]); @@ -315,8 +315,8 @@ describe("Non-regression tests from babel-eslint", () => { // This two tests are disabled, as the feature to visit properties when // there is a spread/rest operator has been removed as it caused problems - // with other rules #249 - it.skip("visits excluded properties left of spread #95", () => { + // with other rules + it.skip("visits excluded properties left of spread", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-unused-vars": 1 }, @@ -324,7 +324,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it.skip("visits excluded properties left of spread #210", () => { + it.skip("visits excluded properties left of spread", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", { "no-unused-vars": 1 }, @@ -348,7 +348,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("does not mark spread variables as use-before-define #249", () => { + it("does not mark spread variables as use-before-define", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", { "no-use-before-define": 1 }, @@ -356,7 +356,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("detects no-unused-vars with object destructuring #142", () => { + it("detects no-unused-vars with object destructuring", () => { verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, @@ -368,7 +368,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("don't warn no-unused-vars with spread #142", () => { + it("don't warn no-unused-vars with spread", () => { verifyAndAssertMessages( unpad(` export default function test(data) { @@ -383,7 +383,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("excludes comment tokens #153", () => { + it("excludes comment tokens", () => { verifyAndAssertMessages( unpad(` var a = [ @@ -408,7 +408,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("ternary and parens #149", () => { + it("ternary and parens", () => { verifyAndAssertMessages( "true ? (true) : false;", { "space-infix-ops": 1 }, @@ -416,7 +416,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("line comment space-in-parens #124", () => { + it("line comment space-in-parens", () => { verifyAndAssertMessages( unpad(` React.createClass({ @@ -432,7 +432,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("block comment space-in-parens #124", () => { + it("block comment space-in-parens", () => { verifyAndAssertMessages( unpad(` React.createClass({ @@ -450,7 +450,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("no no-undef error with rest #11", () => { + it("no no-undef error with rest", () => { verifyAndAssertMessages( "const [a, ...rest] = ['1', '2', '3']; a; rest;", { "no-undef": 1, "no-unused-vars": 1 }, @@ -458,7 +458,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("async function with space-before-function-paren #168", () => { + it("async function with space-before-function-paren", () => { verifyAndAssertMessages( "it('handles updates', async function() {});", { "space-before-function-paren": [1, "never"] }, @@ -466,7 +466,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("no-use-before-define #192", () => { + it("no-use-before-define", () => { verifyAndAssertMessages( unpad(` console.log(x); @@ -477,11 +477,11 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("jsx and stringliteral #216", () => { + it("jsx and stringliteral", () => { verifyAndAssertMessages("
", {}, []); }); - it("getter/setter #218", () => { + it("getter/setter", () => { verifyAndAssertMessages( unpad(` class Person { @@ -497,7 +497,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("getter/setter #220", () => { + it("getter/setter", () => { verifyAndAssertMessages( unpad(` var B = { @@ -514,7 +514,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("correctly detects redeclares if in script mode #217", () => { + it("correctly detects redeclares if in script mode", () => { verifyAndAssertMessages( unpad(` var a = 321; @@ -526,7 +526,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - // it("correctly detects redeclares if in module mode #217", () => { + // it("correctly detects redeclares if in module mode", () => { // verifyAndAssertMessages( // unpad(` // var a = 321; @@ -553,18 +553,18 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - it("no-implicit-globals in module", () => { - verifyAndAssertMessages( - "var leakedGlobal = 1;", - { "no-implicit-globals": 1 }, - [], - "module", - { - env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "module" } - } - ); - }); + // it("no-implicit-globals in module", () => { + // verifyAndAssertMessages( + // "var leakedGlobal = 1;", + // { "no-implicit-globals": 1 }, + // [], + // "module", + // { + // env: {}, + // parserOptions: { ecmaVersion: 6, sourceType: "module" } + // } + // ); + // }); // it("no-implicit-globals in default", () => { // verifyAndAssertMessages( @@ -579,17 +579,17 @@ describe("Non-regression tests from babel-eslint", () => { // ); // }); - it("with does not crash parsing in script mode (strict off) #171", () => { + it("with does not crash parsing in script mode (strict off)", () => { verifyAndAssertMessages("with (arguments) { length; }", {}, [], "script"); }); - // it("with does crash parsing in module mode (strict on) #171", () => { + // it("with does crash parsing in module mode (strict on)", () => { // verifyAndAssertMessages("with (arguments) { length; }", {}, [ // "1:1 Parsing error: 'with' in strict mode" // ]); // }); - it("new.target is not reported as undef #235", () => { + it("new.target is not reported as undef", () => { verifyAndAssertMessages( "function foo () { return new.target }", { "no-undef": 1 }, @@ -597,7 +597,7 @@ describe("Non-regression tests from babel-eslint", () => { ); }); - // it("decorator does not create TypeError #229", () => { + // it("decorator does not create TypeError", () => { // verifyAndAssertMessages( // unpad(` // class A { @@ -610,7 +610,7 @@ describe("Non-regression tests from babel-eslint", () => { // ); // }); - it("newline-before-return with comments #289", () => { + it("newline-before-return with comments", () => { verifyAndAssertMessages( unpad(` function a() { diff --git a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js index 5f2aa9f57bc4..aa1e04111667 100644 --- a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js +++ b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js @@ -4,6 +4,7 @@ const unpad = require("dedent"); const utils = require("./utils"); const verifyAndAssertMessages = utils.verifyAndAssertMessages; +const loadExternalFixture = utils.loadExternalFixture; describe("TypeScript", () => { it("should fundamentally work with `eslint:all`", () => { @@ -26,6 +27,179 @@ describe("TypeScript", () => { ); }); + it("should not cause a RangeError within the indent rule (#333)", () => { + verifyAndAssertMessages( + loadExternalFixture("range-error-indent"), + { + indent: "error" + }, + [] + ); + }); + + it("should not throw in any rules on method overloads (#389)", () => { + verifyAndAssertMessages( + unpad(` + export class Test { + public test(param1: Number): Test; + public test(param1: Test): Test; + public test(param1: any): Test { + return new Test(); + } + } + `), + { + "array-callback-return": "error", + "getter-return": "error", + strict: "error", + "lines-around-directive": "error", + "no-empty-function": "error" + }, + [] + ); + }); + + it("should not throw in any rules on abstract class methods (#400)", () => { + verifyAndAssertMessages( + unpad(` + export abstract class TestAbstract { + onCreated?(): Promise | any; + } + export abstract class AbstractSocket { + abstract createSocket(): Promise; + } + `), + { + "array-callback-return": "error", + "getter-return": "error", + strict: "error", + "lines-around-directive": "error", + "no-empty-function": "error" + }, + [] + ); + }); + + it("should not produce any lint errors on valid JSDoc indentation (#344)", () => { + verifyAndAssertMessages( + loadExternalFixture("jsdoc-indent"), + { + indent: "error" + }, + [] + ); + }); + + it("should not produce a parse error (#403)", () => { + verifyAndAssertMessages( + unpad(` + class X { + data() { + return { + form: { + startDate: undefined + } + }; + } + } + `), + {}, + [], + "script", + { + parserOptions: { + jsx: false + } + } + ); + }); + + it("should not produce any lint errors for no-declare on overloaded functions (#402)", () => { + verifyAndAssertMessages( + loadExternalFixture("no-redeclare-overloaded-functions"), + { + "no-redeclare": "error" + }, + [] + ); + }); + + it("should not throw any TypeErrors when parsing declared empty body functions using eslint:all (#162)", () => { + verifyAndAssertMessages( + loadExternalFixture("declared-empty-body-functions"), + {}, + [ + "3:19 'FF' is not defined. no-undef", + "4:11 'Foo' is defined but never used. no-unused-vars", + "4:23 'Bar' is not defined. no-undef", + "4:31 Block must be padded by blank lines. padded-blocks", + "6:5 Block must be padded by blank lines. padded-blocks", + "10:11 'Foo' is already defined. no-redeclare", + "10:23 'Bar' is not defined. no-undef", + "10:31 Block must be padded by blank lines. padded-blocks", + "12:5 Block must be padded by blank lines. padded-blocks", + "15:15 'Foo' is already defined. no-redeclare", + "15:27 'Bar' is not defined. no-undef", + "15:35 Block must be padded by blank lines. padded-blocks", + "17:1 Block must be padded by blank lines. padded-blocks", + "19:19 'd3' is not defined. no-undef", + "20:21 'select' is not defined. no-undef", + "20:28 'selector' is not defined. no-undef", + "20:47 'Selection' is not defined. no-undef", + "21:2 Newline required at end of file but not found. eol-last" + ], + "script", + { + baseConfig: { + extends: ["eslint:all"] + } + } + ); + }); + + // it("should not produce a false positive for no-restricted-globals rule (#350)", () => { + // verifyAndAssertMessages( + // unpad(` + // type foo = { + // location: any; + // }; + // `), + // { + // "no-restricted-globals": [2, "location"] + // }, + // [] + // ); + // }); + + // it("should correctly apply no-unreachable on TS-constructs (#127)", () => { + // verifyAndAssertMessages( + // unpad(` + // export namespace foo { + // export function bar() { + // return; + // } + // } + // export type Qux = true; + // `), + // { + // "no-unreachable": 2 + // }, + // [] + // ); + // }); + + // it("should not throw a TypeError in the indent rule for invalid code (#309)", () => { + // verifyAndAssertMessages( + // unpad(` + // const + // `), + // { + // indent: "error" + // }, + // [] + // ); + // }); + // it("class properties and no-undef", () => { // verifyAndAssertMessages( // "class Lol { foo = 'bar'; }", diff --git a/packages/typescript-eslint-parser/tests/integration/utils.js b/packages/typescript-eslint-parser/tests/integration/utils.js index 4d07ce4ac959..f3cc76cf5645 100644 --- a/packages/typescript-eslint-parser/tests/integration/utils.js +++ b/packages/typescript-eslint-parser/tests/integration/utils.js @@ -11,6 +11,7 @@ //------------------------------------------------------------------------------ const eslint = require("eslint"); const unpad = require("dedent"); +const fs = require("fs"); const path = require("path"); //------------------------------------------------------------------------------ @@ -19,10 +20,22 @@ const path = require("path"); /* eslint-disable no-use-before-define */ module.exports = { - verifyAndAssertMessages + verifyAndAssertMessages, + loadExternalFixture }; /* eslint-enable no-use-before-define */ +/** + * Loads an external fixture by name + * @param {string} fixtureName the name of the fixture file to load + * @returns {string} stringified file contents + */ +function loadExternalFixture(fixtureName) { + return fs.readFileSync( + path.join(__dirname, "external-fixtures", `${fixtureName}.js`) + ).toString(); +} + /** * A utility function to lint the given source code using typescript-eslint-parser * and assert expectations around the linting feedback diff --git a/packages/typescript-eslint-parser/yarn.lock b/packages/typescript-eslint-parser/yarn.lock deleted file mode 100644 index af21089a4ded..000000000000 --- a/packages/typescript-eslint-parser/yarn.lock +++ /dev/null @@ -1,3189 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -abab@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" - -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" - -acorn-globals@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" - dependencies: - acorn "^4.0.4" - -acorn-jsx@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" - dependencies: - acorn "^3.0.4" - -acorn@^3.0.4: - version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" - -acorn@^4.0.4: - version "4.0.13" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" - -acorn@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" - -ajv-keywords@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" - -ajv@^4.9.1: - version "4.11.8" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" - dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" - -ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0: - version "5.5.1" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.1.tgz#b38bb8876d9e86bee994956a04e721e88b248eb2" - dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" - -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" - dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" - -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - -ansi-escapes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -ansi-styles@^3.1.0, ansi-styles@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" - dependencies: - color-convert "^1.9.0" - -anymatch@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" - dependencies: - micromatch "^2.1.5" - normalize-path "^2.0.0" - -append-transform@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" - dependencies: - default-require-extensions "^1.0.0" - -aproba@^1.0.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - -are-we-there-yet@~1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -argparse@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" - dependencies: - sprintf-js "~1.0.2" - -arr-diff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" - dependencies: - arr-flatten "^1.0.1" - -arr-flatten@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - -array-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" - -array-find-index@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - dependencies: - array-uniq "^1.0.1" - -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - -array-unique@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" - -arrify@^1.0.0, arrify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" - -asap@^2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - -asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - -assert-plus@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" - -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - -async@^1.4.0: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - -async@^2.1.4: - version "2.6.0" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4" - dependencies: - lodash "^4.14.0" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - -aws-sign2@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - -aws4@^1.2.1, aws4@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" - -axios@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.10.0.tgz#5b0ec0d5fb53e79b98b7bf84c0e9b1cf902fdfc4" - dependencies: - follow-redirects "0.0.7" - -babel-code-frame@6.26.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - -babel-core@^6.0.0, babel-core@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.0.tgz#af32f78b31a6fcef119c87b0fd8d9753f03a0bb8" - dependencies: - babel-code-frame "^6.26.0" - babel-generator "^6.26.0" - babel-helpers "^6.24.1" - babel-messages "^6.23.0" - babel-register "^6.26.0" - babel-runtime "^6.26.0" - babel-template "^6.26.0" - babel-traverse "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - convert-source-map "^1.5.0" - debug "^2.6.8" - json5 "^0.5.1" - lodash "^4.17.4" - minimatch "^3.0.4" - path-is-absolute "^1.0.1" - private "^0.1.7" - slash "^1.0.0" - source-map "^0.5.6" - -babel-generator@^6.18.0, babel-generator@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" - dependencies: - babel-messages "^6.23.0" - babel-runtime "^6.26.0" - babel-types "^6.26.0" - detect-indent "^4.0.0" - jsesc "^1.3.0" - lodash "^4.17.4" - source-map "^0.5.6" - trim-right "^1.0.1" - -babel-helpers@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" - dependencies: - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-jest@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-21.2.0.tgz#2ce059519a9374a2c46f2455b6fbef5ad75d863e" - dependencies: - babel-plugin-istanbul "^4.0.0" - babel-preset-jest "^21.2.0" - -babel-messages@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-istanbul@^4.0.0: - version "4.1.5" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz#6760cdd977f411d3e175bb064f2bc327d99b2b6e" - dependencies: - find-up "^2.1.0" - istanbul-lib-instrument "^1.7.5" - test-exclude "^4.1.1" - -babel-plugin-jest-hoist@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz#2cef637259bd4b628a6cace039de5fcd14dbb006" - -babel-plugin-syntax-object-rest-spread@^6.13.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" - -babel-preset-jest@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz#ff9d2bce08abd98e8a36d9a8a5189b9173b85638" - dependencies: - babel-plugin-jest-hoist "^21.2.0" - babel-plugin-syntax-object-rest-spread "^6.13.0" - -babel-register@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" - dependencies: - babel-core "^6.26.0" - babel-runtime "^6.26.0" - core-js "^2.5.0" - home-or-tmp "^2.0.0" - lodash "^4.17.4" - mkdirp "^0.5.1" - source-map-support "^0.4.15" - -babel-runtime@^6.22.0, babel-runtime@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.11.0" - -babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" - dependencies: - babel-runtime "^6.26.0" - babel-traverse "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - lodash "^4.17.4" - -babel-traverse@^6.18.0, babel-traverse@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" - dependencies: - babel-code-frame "^6.26.0" - babel-messages "^6.23.0" - babel-runtime "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - debug "^2.6.8" - globals "^9.18.0" - invariant "^2.2.2" - lodash "^4.17.4" - -babel-types@^6.18.0, babel-types@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" - dependencies: - babel-runtime "^6.26.0" - esutils "^2.0.2" - lodash "^4.17.4" - to-fast-properties "^1.0.3" - -babylon@7.0.0-beta.34: - version "7.0.0-beta.34" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.34.tgz#2ccdf97bb4fbc1617619a030a6c0390b2c8f16d6" - -babylon@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - -bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" - dependencies: - tweetnacl "^0.14.3" - -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" - dependencies: - inherits "~2.0.0" - -boom@2.x.x: - version "2.10.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" - dependencies: - hoek "2.x.x" - -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - dependencies: - hoek "4.x.x" - -brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^1.8.2: - version "1.8.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" - dependencies: - expand-range "^1.8.1" - preserve "^0.2.0" - repeat-element "^1.1.2" - -browser-resolve@^1.11.2: - version "1.11.2" - resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" - dependencies: - resolve "1.1.7" - -bser@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" - dependencies: - node-int64 "^0.4.0" - -builtin-modules@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - -callsites@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" - -camelcase-keys@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" - dependencies: - camelcase "^2.0.0" - map-obj "^1.0.0" - -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" - -camelcase@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" - -camelcase@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" - dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" - -chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" - dependencies: - ansi-styles "^3.1.0" - escape-string-regexp "^1.0.5" - supports-color "^4.0.0" - -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" - -ci-info@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.2.tgz#03561259db48d0474c8bdc90f5b47b068b6bbfb4" - -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" - -cli-cursor@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" - dependencies: - restore-cursor "^2.0.0" - -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" - dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" - -cliui@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi "^2.0.0" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -color-convert@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" - dependencies: - color-name "^1.1.1" - -color-name@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - -combined-stream@^1.0.5, combined-stream@~1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" - dependencies: - delayed-stream "~1.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - -concat-stream@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" - dependencies: - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - -content-type-parser@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.2.tgz#caabe80623e63638b2502fd4c7f12ff4ce2352e7" - -convert-source-map@^1.4.0, convert-source-map@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" - -core-js@^2.4.0, core-js@^2.5.0: - version "2.5.2" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.2.tgz#bc4648656e7dc9dc80d7d3c7bbc172d96e744e63" - -core-util-is@1.0.2, core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -cross-spawn@^5.0.1, cross-spawn@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" - dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" - -cryptiles@2.x.x: - version "2.0.5" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" - dependencies: - boom "2.x.x" - -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - dependencies: - boom "5.x.x" - -cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" - -"cssstyle@>= 0.2.37 < 0.3.0": - version "0.2.37" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" - dependencies: - cssom "0.3.x" - -currently-unhandled@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" - dependencies: - array-find-index "^1.0.1" - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - dependencies: - assert-plus "^1.0.0" - -dateformat@^1.0.12: - version "1.0.12" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-1.0.12.tgz#9f124b67594c937ff706932e4a642cca8dbbfee9" - dependencies: - get-stdin "^4.0.1" - meow "^3.3.0" - -debug@^2.2.0, debug@^2.6.8: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - dependencies: - ms "2.0.0" - -debug@^3.0.1, debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" - dependencies: - ms "2.0.0" - -debuglog@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" - -decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - -dedent@0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" - -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - -default-require-extensions@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" - dependencies: - strip-bom "^2.0.0" - -del@^2.0.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" - dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" - -detect-indent@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" - dependencies: - repeating "^2.0.0" - -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - -dezalgo@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456" - dependencies: - asap "^2.0.0" - wrappy "1" - -diff@^3.2.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" - -doctrine@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.2.tgz#68f96ce8efc56cc42651f1faadb4f175273b0075" - dependencies: - esutils "^2.0.2" - -ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" - dependencies: - jsbn "~0.1.0" - -errno@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.5.tgz#a563781a6052bc2c9ccd89e8cef0eb9506e0c321" - dependencies: - prr "~1.0.1" - -error-ex@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" - dependencies: - is-arrayish "^0.2.1" - -es6-promise@^3.0.2: - version "3.3.1" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613" - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -escodegen@^1.6.1: - version "1.9.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.0.tgz#9811a2f265dc1cd3894420ee3717064b632b8852" - dependencies: - esprima "^3.1.3" - estraverse "^4.2.0" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.5.6" - -eslint-config-eslint@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-eslint/-/eslint-config-eslint-4.0.0.tgz#a463a96621e4c8a80ea91eb4c0787bba3a0f7beb" - dependencies: - js-yaml "^3.5.1" - -eslint-plugin-node@5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz#80df3253c4d7901045ec87fa660a284e32bdca29" - dependencies: - ignore "^3.3.6" - minimatch "^3.0.4" - resolve "^1.3.3" - semver "5.3.0" - -eslint-release@0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/eslint-release/-/eslint-release-0.10.3.tgz#902778148c4f3bef9d1e22fee22af5cfba707813" - dependencies: - dateformat "^1.0.12" - github-api "2.3.0" - linefix "^0.1.1" - npm-license "^0.3.1" - semver "^5.1.0" - shelljs "^0.5.3" - -eslint-scope@^3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint@4.13.0: - version "4.13.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.0.tgz#1991aa359586af83877bde59de9d41f53e20826d" - dependencies: - ajv "^5.3.0" - babel-code-frame "^6.22.0" - chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" - debug "^3.0.1" - doctrine "^2.0.2" - eslint-scope "^3.7.1" - espree "^3.5.2" - esquery "^1.0.0" - estraverse "^4.2.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^11.0.1" - ignore "^3.3.3" - imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^7.0.0" - progress "^2.0.0" - require-uncached "^1.0.3" - semver "^5.3.0" - strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "^4.0.1" - text-table "~0.2.0" - -espree@^3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.2.tgz#756ada8b979e9dcfcdb30aad8d1a9304a905e1ca" - dependencies: - acorn "^5.2.1" - acorn-jsx "^3.0.0" - -esprima@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" - -esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" - -esquery@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" - dependencies: - estraverse "^4.0.0" - -esrecurse@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" - dependencies: - estraverse "^4.1.0" - object-assign "^4.0.1" - -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" - -esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" - -exec-sh@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.1.tgz#163b98a6e89e6b65b47c2a28d215bc1f63989c38" - dependencies: - merge "^1.1.3" - -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" - dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - -expand-brackets@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" - dependencies: - is-posix-bracket "^0.1.0" - -expand-range@^1.8.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" - dependencies: - fill-range "^2.1.0" - -expect@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-21.2.1.tgz#003ac2ac7005c3c29e73b38a272d4afadd6d1d7b" - dependencies: - ansi-styles "^3.2.0" - jest-diff "^21.2.1" - jest-get-type "^21.2.0" - jest-matcher-utils "^21.2.1" - jest-message-util "^21.2.1" - jest-regex-util "^21.2.0" - -extend@~3.0.0, extend@~3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" - -external-editor@^2.0.4: - version "2.1.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" - dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" - tmp "^0.0.33" - -extglob@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" - dependencies: - is-extglob "^1.0.0" - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - -fast-deep-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" - -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" - -fast-levenshtein@~2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - -fb-watchman@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" - dependencies: - bser "^2.0.0" - -figures@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" - dependencies: - escape-string-regexp "^1.0.5" - -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" - dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" - -filename-regex@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" - -fileset@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" - dependencies: - glob "^7.0.3" - minimatch "^3.0.3" - -fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" - dependencies: - is-number "^2.1.0" - isobject "^2.0.0" - randomatic "^1.1.3" - repeat-element "^1.1.2" - repeat-string "^1.5.2" - -find-up@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" - dependencies: - path-exists "^2.0.0" - pinkie-promise "^2.0.0" - -find-up@^2.0.0, find-up@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - dependencies: - locate-path "^2.0.0" - -flat-cache@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" - dependencies: - circular-json "^0.3.1" - del "^2.0.2" - graceful-fs "^4.1.2" - write "^0.2.1" - -follow-redirects@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-0.0.7.tgz#34b90bab2a911aa347571da90f22bd36ecd8a919" - dependencies: - debug "^2.2.0" - stream-consume "^0.1.0" - -for-in@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - -for-own@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" - dependencies: - for-in "^1.0.1" - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - -form-data@~2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - -form-data@~2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.1.tgz#6fb94fbd71885306d73d15cc497fe4cc4ecd44bf" - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -fsevents@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8" - dependencies: - nan "^2.3.0" - node-pre-gyp "^0.6.39" - -fstream-ignore@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" - dependencies: - fstream "^1.0.0" - inherits "2" - minimatch "^3.0.0" - -fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" - dependencies: - graceful-fs "^4.1.2" - inherits "~2.0.0" - mkdirp ">=0.5 0" - rimraf "2" - -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -get-caller-file@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" - -get-stdin@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" - -get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - dependencies: - assert-plus "^1.0.0" - -github-api@2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/github-api/-/github-api-2.3.0.tgz#eee768460b29e86e91b96a9e79f8555cef6b5325" - dependencies: - axios "^0.10.0" - debug "^2.2.0" - es6-promise "^3.0.2" - js-base64 "^2.1.9" - utf8 "^2.1.1" - -glob-base@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" - dependencies: - glob-parent "^2.0.0" - is-glob "^2.0.0" - -glob-parent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" - dependencies: - is-glob "^2.0.0" - -glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.0.1: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.1.0.tgz#632644457f5f0e3ae711807183700ebf2e4633e4" - -globals@^9.18.0: - version "9.18.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" - -globby@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" - dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -graceful-fs@^4.1.11, graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" - -growly@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" - -handlebars@^4.0.3: - version "4.0.11" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" - dependencies: - async "^1.4.0" - optimist "^0.6.1" - source-map "^0.4.4" - optionalDependencies: - uglify-js "^2.6" - -har-schema@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - -har-validator@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" - dependencies: - ajv "^4.9.1" - har-schema "^1.0.5" - -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" - dependencies: - ajv "^5.1.0" - har-schema "^2.0.0" - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - dependencies: - ansi-regex "^2.0.0" - -has-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" - -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - -hawk@3.1.3, hawk@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" - dependencies: - boom "2.x.x" - cryptiles "2.x.x" - hoek "2.x.x" - sntp "1.x.x" - -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" - -hoek@2.x.x: - version "2.16.3" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" - -hoek@4.x.x: - version "4.2.0" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d" - -home-or-tmp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.1" - -hosted-git-info@^2.1.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" - -html-encoding-sniffer@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" - dependencies: - whatwg-encoding "^1.0.1" - -http-signature@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" - dependencies: - assert-plus "^0.2.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -iconv-lite@0.4.19, iconv-lite@^0.4.17: - version "0.4.19" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" - -ignore@^3.3.3, ignore@^3.3.6: - version "3.3.7" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - -indent-string@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" - dependencies: - repeating "^2.0.0" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - -ini@~1.3.0: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" - -inquirer@^3.0.6: - version "3.3.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.0.4" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rx-lite "^4.0.8" - rx-lite-aggregates "^4.0.8" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - -interpret@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" - -invariant@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" - dependencies: - loose-envify "^1.0.0" - -invert-kv@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" - -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - -is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - -is-builtin-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" - dependencies: - builtin-modules "^1.0.0" - -is-ci@^1.0.10: - version "1.0.10" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.0.10.tgz#f739336b2632365061a9d48270cd56ae3369318e" - dependencies: - ci-info "^1.0.0" - -is-dotfile@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" - -is-equal-shallow@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" - dependencies: - is-primitive "^2.0.0" - -is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - -is-extglob@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" - -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - -is-glob@^2.0.0, is-glob@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" - dependencies: - is-extglob "^1.0.0" - -is-number@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" - dependencies: - kind-of "^3.0.2" - -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - dependencies: - kind-of "^3.0.2" - -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" - -is-path-in-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" - dependencies: - is-path-inside "^1.0.0" - -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" - dependencies: - path-is-inside "^1.0.1" - -is-posix-bracket@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" - -is-primitive@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" - -is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - -is-resolvable@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" - dependencies: - tryit "^1.0.1" - -is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - -is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - -is-utf8@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - -isarray@1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - dependencies: - isarray "1.0.0" - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - -istanbul-api@^1.1.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.2.1.tgz#0c60a0515eb11c7d65c6b50bba2c6e999acd8620" - dependencies: - async "^2.1.4" - fileset "^2.0.2" - istanbul-lib-coverage "^1.1.1" - istanbul-lib-hook "^1.1.0" - istanbul-lib-instrument "^1.9.1" - istanbul-lib-report "^1.1.2" - istanbul-lib-source-maps "^1.2.2" - istanbul-reports "^1.1.3" - js-yaml "^3.7.0" - mkdirp "^0.5.1" - once "^1.4.0" - -istanbul-lib-coverage@^1.0.1, istanbul-lib-coverage@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" - -istanbul-lib-hook@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.1.0.tgz#8538d970372cb3716d53e55523dd54b557a8d89b" - dependencies: - append-transform "^0.4.0" - -istanbul-lib-instrument@^1.4.2, istanbul-lib-instrument@^1.7.5, istanbul-lib-instrument@^1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz#250b30b3531e5d3251299fdd64b0b2c9db6b558e" - dependencies: - babel-generator "^6.18.0" - babel-template "^6.16.0" - babel-traverse "^6.18.0" - babel-types "^6.18.0" - babylon "^6.18.0" - istanbul-lib-coverage "^1.1.1" - semver "^5.3.0" - -istanbul-lib-report@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.2.tgz#922be27c13b9511b979bd1587359f69798c1d425" - dependencies: - istanbul-lib-coverage "^1.1.1" - mkdirp "^0.5.1" - path-parse "^1.0.5" - supports-color "^3.1.2" - -istanbul-lib-source-maps@^1.1.0, istanbul-lib-source-maps@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.2.tgz#750578602435f28a0c04ee6d7d9e0f2960e62c1c" - dependencies: - debug "^3.1.0" - istanbul-lib-coverage "^1.1.1" - mkdirp "^0.5.1" - rimraf "^2.6.1" - source-map "^0.5.3" - -istanbul-reports@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.1.3.tgz#3b9e1e8defb6d18b1d425da8e8b32c5a163f2d10" - dependencies: - handlebars "^4.0.3" - -jest-changed-files@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-21.2.0.tgz#5dbeecad42f5d88b482334902ce1cba6d9798d29" - dependencies: - throat "^4.0.0" - -jest-cli@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-21.2.1.tgz#9c528b6629d651911138d228bdb033c157ec8c00" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.1" - glob "^7.1.2" - graceful-fs "^4.1.11" - is-ci "^1.0.10" - istanbul-api "^1.1.1" - istanbul-lib-coverage "^1.0.1" - istanbul-lib-instrument "^1.4.2" - istanbul-lib-source-maps "^1.1.0" - jest-changed-files "^21.2.0" - jest-config "^21.2.1" - jest-environment-jsdom "^21.2.1" - jest-haste-map "^21.2.0" - jest-message-util "^21.2.1" - jest-regex-util "^21.2.0" - jest-resolve-dependencies "^21.2.0" - jest-runner "^21.2.1" - jest-runtime "^21.2.1" - jest-snapshot "^21.2.1" - jest-util "^21.2.1" - micromatch "^2.3.11" - node-notifier "^5.0.2" - pify "^3.0.0" - slash "^1.0.0" - string-length "^2.0.0" - strip-ansi "^4.0.0" - which "^1.2.12" - worker-farm "^1.3.1" - yargs "^9.0.0" - -jest-config@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-21.2.1.tgz#c7586c79ead0bcc1f38c401e55f964f13bf2a480" - dependencies: - chalk "^2.0.1" - glob "^7.1.1" - jest-environment-jsdom "^21.2.1" - jest-environment-node "^21.2.1" - jest-get-type "^21.2.0" - jest-jasmine2 "^21.2.1" - jest-regex-util "^21.2.0" - jest-resolve "^21.2.0" - jest-util "^21.2.1" - jest-validate "^21.2.1" - pretty-format "^21.2.1" - -jest-diff@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-21.2.1.tgz#46cccb6cab2d02ce98bc314011764bb95b065b4f" - dependencies: - chalk "^2.0.1" - diff "^3.2.0" - jest-get-type "^21.2.0" - pretty-format "^21.2.1" - -jest-docblock@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" - -jest-environment-jsdom@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz#38d9980c8259b2a608ec232deee6289a60d9d5b4" - dependencies: - jest-mock "^21.2.0" - jest-util "^21.2.1" - jsdom "^9.12.0" - -jest-environment-node@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-21.2.1.tgz#98c67df5663c7fbe20f6e792ac2272c740d3b8c8" - dependencies: - jest-mock "^21.2.0" - jest-util "^21.2.1" - -jest-get-type@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.2.0.tgz#f6376ab9db4b60d81e39f30749c6c466f40d4a23" - -jest-haste-map@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-21.2.0.tgz#1363f0a8bb4338f24f001806571eff7a4b2ff3d8" - dependencies: - fb-watchman "^2.0.0" - graceful-fs "^4.1.11" - jest-docblock "^21.2.0" - micromatch "^2.3.11" - sane "^2.0.0" - worker-farm "^1.3.1" - -jest-jasmine2@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz#9cc6fc108accfa97efebce10c4308548a4ea7592" - dependencies: - chalk "^2.0.1" - expect "^21.2.1" - graceful-fs "^4.1.11" - jest-diff "^21.2.1" - jest-matcher-utils "^21.2.1" - jest-message-util "^21.2.1" - jest-snapshot "^21.2.1" - p-cancelable "^0.3.0" - -jest-matcher-utils@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz#72c826eaba41a093ac2b4565f865eb8475de0f64" - dependencies: - chalk "^2.0.1" - jest-get-type "^21.2.0" - pretty-format "^21.2.1" - -jest-message-util@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-21.2.1.tgz#bfe5d4692c84c827d1dcf41823795558f0a1acbe" - dependencies: - chalk "^2.0.1" - micromatch "^2.3.11" - slash "^1.0.0" - -jest-mock@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-21.2.0.tgz#7eb0770e7317968165f61ea2a7281131534b3c0f" - -jest-regex-util@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-21.2.0.tgz#1b1e33e63143babc3e0f2e6c9b5ba1eb34b2d530" - -jest-resolve-dependencies@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz#9e231e371e1a736a1ad4e4b9a843bc72bfe03d09" - dependencies: - jest-regex-util "^21.2.0" - -jest-resolve@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-21.2.0.tgz#068913ad2ba6a20218e5fd32471f3874005de3a6" - dependencies: - browser-resolve "^1.11.2" - chalk "^2.0.1" - is-builtin-module "^1.0.0" - -jest-runner@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-21.2.1.tgz#194732e3e518bfb3d7cbfc0fd5871246c7e1a467" - dependencies: - jest-config "^21.2.1" - jest-docblock "^21.2.0" - jest-haste-map "^21.2.0" - jest-jasmine2 "^21.2.1" - jest-message-util "^21.2.1" - jest-runtime "^21.2.1" - jest-util "^21.2.1" - pify "^3.0.0" - throat "^4.0.0" - worker-farm "^1.3.1" - -jest-runtime@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-21.2.1.tgz#99dce15309c670442eee2ebe1ff53a3cbdbbb73e" - dependencies: - babel-core "^6.0.0" - babel-jest "^21.2.0" - babel-plugin-istanbul "^4.0.0" - chalk "^2.0.1" - convert-source-map "^1.4.0" - graceful-fs "^4.1.11" - jest-config "^21.2.1" - jest-haste-map "^21.2.0" - jest-regex-util "^21.2.0" - jest-resolve "^21.2.0" - jest-util "^21.2.1" - json-stable-stringify "^1.0.1" - micromatch "^2.3.11" - slash "^1.0.0" - strip-bom "3.0.0" - write-file-atomic "^2.1.0" - yargs "^9.0.0" - -jest-snapshot@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-21.2.1.tgz#29e49f16202416e47343e757e5eff948c07fd7b0" - dependencies: - chalk "^2.0.1" - jest-diff "^21.2.1" - jest-matcher-utils "^21.2.1" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - pretty-format "^21.2.1" - -jest-util@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-21.2.1.tgz#a274b2f726b0897494d694a6c3d6a61ab819bb78" - dependencies: - callsites "^2.0.0" - chalk "^2.0.1" - graceful-fs "^4.1.11" - jest-message-util "^21.2.1" - jest-mock "^21.2.0" - jest-validate "^21.2.1" - mkdirp "^0.5.1" - -jest-validate@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-21.2.1.tgz#cc0cbca653cd54937ba4f2a111796774530dd3c7" - dependencies: - chalk "^2.0.1" - jest-get-type "^21.2.0" - leven "^2.1.0" - pretty-format "^21.2.1" - -jest@21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-21.2.1.tgz#c964e0b47383768a1438e3ccf3c3d470327604e1" - dependencies: - jest-cli "^21.2.1" - -js-base64@^2.1.9: - version "2.4.0" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.0.tgz#9e566fee624751a1d720c966cd6226d29d4025aa" - -js-tokens@^3.0.0, js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -js-yaml@^3.5.1, js-yaml@^3.7.0, js-yaml@^3.9.1: - version "3.10.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - -jsdom@^9.12.0: - version "9.12.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" - dependencies: - abab "^1.0.3" - acorn "^4.0.4" - acorn-globals "^3.1.0" - array-equal "^1.0.0" - content-type-parser "^1.0.1" - cssom ">= 0.3.2 < 0.4.0" - cssstyle ">= 0.2.37 < 0.3.0" - escodegen "^1.6.1" - html-encoding-sniffer "^1.0.1" - nwmatcher ">= 1.3.9 < 2.0.0" - parse5 "^1.5.1" - request "^2.79.0" - sax "^1.2.1" - symbol-tree "^3.2.1" - tough-cookie "^2.3.2" - webidl-conversions "^4.0.0" - whatwg-encoding "^1.0.1" - whatwg-url "^4.3.0" - xml-name-validator "^2.0.1" - -jsesc@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" - -json-parse-better-errors@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz#50183cd1b2d25275de069e9e71b467ac9eab973a" - -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - -json-stable-stringify-without-jsonify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - -json-stable-stringify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - dependencies: - jsonify "~0.0.0" - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - -json5@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" - -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -kind-of@^3.0.2: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - dependencies: - is-buffer "^1.1.5" - -kind-of@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - dependencies: - is-buffer "^1.1.5" - -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" - -lcid@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" - dependencies: - invert-kv "^1.0.0" - -leven@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" - -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -linefix@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/linefix/-/linefix-0.1.1.tgz#581f54b2935ffbe9df255770f0aa3b0341382393" - -load-json-file@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" - -load-json-file@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - strip-bom "^3.0.0" - -locate-path@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" - dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" - -lodash.isplainobject@4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" - -lodash.unescape@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" - -lodash@^4.14.0, lodash@^4.17.4, lodash@^4.3.0: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" - -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - -loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" - dependencies: - js-tokens "^3.0.0" - -loud-rejection@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" - dependencies: - currently-unhandled "^0.4.1" - signal-exit "^3.0.0" - -lru-cache@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" - -makeerror@1.0.x: - version "1.0.11" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" - dependencies: - tmpl "1.0.x" - -map-obj@^1.0.0, map-obj@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" - -mem@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" - dependencies: - mimic-fn "^1.0.0" - -meow@^3.3.0: - version "3.7.0" - resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" - dependencies: - camelcase-keys "^2.0.0" - decamelize "^1.1.2" - loud-rejection "^1.0.0" - map-obj "^1.0.1" - minimist "^1.1.3" - normalize-package-data "^2.3.4" - object-assign "^4.0.1" - read-pkg-up "^1.0.1" - redent "^1.0.0" - trim-newlines "^1.0.0" - -merge@^1.1.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" - -micromatch@^2.1.5, micromatch@^2.3.11: - version "2.3.11" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" - dependencies: - arr-diff "^2.0.0" - array-unique "^0.2.1" - braces "^1.8.2" - expand-brackets "^0.1.4" - extglob "^0.3.1" - filename-regex "^2.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.1" - kind-of "^3.0.2" - normalize-path "^2.0.1" - object.omit "^2.0.0" - parse-glob "^3.0.4" - regex-cache "^0.4.2" - -mime-db@~1.30.0: - version "1.30.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" - -mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.7: - version "2.1.17" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" - dependencies: - mime-db "~1.30.0" - -mimic-fn@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" - -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" - -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - -"mkdirp@>=0.5 0", mkdirp@^0.5.1, mkdirp@~0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - -nan@^2.3.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a" - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - -node-notifier@^5.0.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.1.2.tgz#2fa9e12605fa10009d44549d6fcd8a63dde0e4ff" - dependencies: - growly "^1.3.0" - semver "^5.3.0" - shellwords "^0.1.0" - which "^1.2.12" - -node-pre-gyp@^0.6.39: - version "0.6.39" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649" - dependencies: - detect-libc "^1.0.2" - hawk "3.1.3" - mkdirp "^0.5.1" - nopt "^4.0.1" - npmlog "^4.0.2" - rc "^1.1.7" - request "2.81.0" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^2.2.1" - tar-pack "^3.4.0" - -nopt-usage@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/nopt-usage/-/nopt-usage-0.1.0.tgz#b18b8c183e181047ca9e63b7cde7cfc702cca579" - -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" - dependencies: - abbrev "1" - osenv "^0.1.4" - -nopt@~3.0.1: - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - dependencies: - abbrev "1" - -normalize-package-data@^2.0.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: - version "2.4.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" - dependencies: - hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - -normalize-path@^2.0.0, normalize-path@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - dependencies: - remove-trailing-separator "^1.0.1" - -npm-license@0.3.3, npm-license@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/npm-license/-/npm-license-0.3.3.tgz#f67f4bc23c863f6e062cde639414e05116dcdb82" - dependencies: - mkdirp "~0.5.0" - nopt "~3.0.1" - nopt-usage "^0.1.0" - package-license "~0.1.1" - pkginfo "^0.3.0" - read-installed "~4.0.3" - treeify "~1.0.1" - underscore "~1.4.4" - -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - dependencies: - path-key "^2.0.0" - -npmlog@^4.0.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - -"nwmatcher@>= 1.3.9 < 2.0.0": - version "1.4.3" - resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.3.tgz#64348e3b3d80f035b40ac11563d278f8b72db89c" - -oauth-sign@~0.8.1, oauth-sign@~0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" - -object-assign@^4.0.1, object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -object.omit@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" - dependencies: - for-own "^0.1.4" - is-extendable "^0.1.1" - -once@^1.3.0, once@^1.3.3, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -onetime@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - dependencies: - mimic-fn "^1.0.0" - -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - -optionator@^0.8.1, optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - -os-locale@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" - dependencies: - execa "^0.7.0" - lcid "^1.0.0" - mem "^1.1.0" - -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -osenv@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.4.tgz#42fe6d5953df06c8064be6f176c3d05aaaa34644" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" - -p-cancelable@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" - -p-finally@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - -p-limit@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" - -p-locate@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" - dependencies: - p-limit "^1.1.0" - -package-license@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/package-license/-/package-license-0.1.2.tgz#f5c449a7a50fadf4a22341e2949099f91a42028b" - -parse-glob@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" - dependencies: - glob-base "^0.3.0" - is-dotfile "^1.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.0" - -parse-json@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" - dependencies: - error-ex "^1.2.0" - -parse5@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" - -path-exists@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" - dependencies: - pinkie-promise "^2.0.0" - -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - -path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - -path-is-inside@^1.0.1, path-is-inside@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - -path-key@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" - -path-type@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" - dependencies: - graceful-fs "^4.1.2" - pify "^2.0.0" - pinkie-promise "^2.0.0" - -path-type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" - dependencies: - pify "^2.0.0" - -performance-now@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - -pify@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - dependencies: - pinkie "^2.0.0" - -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - -pkginfo@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.3.1.tgz#5b29f6a81f70717142e09e765bbeab97b4f81e21" - -pluralize@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - -preserve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" - -pretty-format@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36" - dependencies: - ansi-regex "^3.0.0" - ansi-styles "^3.2.0" - -private@^0.1.7: - version "0.1.8" - resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" - -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" - -progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" - -prr@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" - -punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - -qs@~6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" - -qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" - -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" - dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" - -rc@^1.1.7: - version "1.2.2" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -read-installed@~4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/read-installed/-/read-installed-4.0.3.tgz#ff9b8b67f187d1e4c29b9feb31f6b223acd19067" - dependencies: - debuglog "^1.0.1" - read-package-json "^2.0.0" - readdir-scoped-modules "^1.0.0" - semver "2 || 3 || 4 || 5" - slide "~1.1.3" - util-extend "^1.0.1" - optionalDependencies: - graceful-fs "^4.1.2" - -read-package-json@^2.0.0: - version "2.0.12" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.0.12.tgz#68ea45f98b3741cb6e10ae3bbd42a605026a6951" - dependencies: - glob "^7.1.1" - json-parse-better-errors "^1.0.0" - normalize-package-data "^2.0.0" - slash "^1.0.0" - optionalDependencies: - graceful-fs "^4.1.2" - -read-pkg-up@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" - dependencies: - find-up "^1.0.0" - read-pkg "^1.0.0" - -read-pkg-up@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" - dependencies: - find-up "^2.0.0" - read-pkg "^2.0.0" - -read-pkg@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" - dependencies: - load-json-file "^1.0.0" - normalize-package-data "^2.3.2" - path-type "^1.0.0" - -read-pkg@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" - dependencies: - load-json-file "^2.0.0" - normalize-package-data "^2.3.2" - path-type "^2.0.0" - -readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - safe-buffer "~5.1.1" - string_decoder "~1.0.3" - util-deprecate "~1.0.1" - -readdir-scoped-modules@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" - dependencies: - debuglog "^1.0.1" - dezalgo "^1.0.0" - graceful-fs "^4.1.2" - once "^1.3.0" - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - dependencies: - resolve "^1.1.6" - -redent@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" - dependencies: - indent-string "^2.1.0" - strip-indent "^1.0.1" - -regenerator-runtime@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" - -regex-cache@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" - dependencies: - is-equal-shallow "^0.1.3" - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - -repeat-element@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" - -repeat-string@^1.5.2: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" - dependencies: - is-finite "^1.0.0" - -request@2.81.0: - version "2.81.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~4.2.1" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - performance-now "^0.2.0" - qs "~6.4.0" - safe-buffer "^5.0.1" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "^0.6.0" - uuid "^3.0.0" - -request@^2.79.0: - version "2.83.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.6.0" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.1" - forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" - performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" - tunnel-agent "^0.6.0" - uuid "^3.1.0" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - -resolve@1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" - -resolve@^1.1.6, resolve@^1.3.3: - version "1.5.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" - dependencies: - path-parse "^1.0.5" - -restore-cursor@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - dependencies: - onetime "^2.0.0" - signal-exit "^3.0.2" - -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" - dependencies: - align-text "^0.1.1" - -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" - dependencies: - glob "^7.0.5" - -run-async@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" - dependencies: - is-promise "^2.1.0" - -rx-lite-aggregates@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" - dependencies: - rx-lite "*" - -rx-lite@*, rx-lite@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" - -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" - -sane@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-2.2.0.tgz#d6d2e2fcab00e3d283c93b912b7c3a20846f1d56" - dependencies: - anymatch "^1.3.0" - exec-sh "^0.2.0" - fb-watchman "^2.0.0" - minimatch "^3.0.2" - minimist "^1.1.1" - walker "~1.0.5" - watch "~0.18.0" - optionalDependencies: - fsevents "^1.1.1" - -sax@^1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - -"semver@2 || 3 || 4 || 5", semver@5.4.1, semver@^5.1.0, semver@^5.3.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" - -semver@5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - -set-blocking@^2.0.0, set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - dependencies: - shebang-regex "^1.0.0" - -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - -shelljs-nodecli@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/shelljs-nodecli/-/shelljs-nodecli-0.1.1.tgz#f1beb5563754c475d06f7d0833e0f6075e462d3b" - dependencies: - shelljs "~0.2" - -shelljs@0.7.8: - version "0.7.8" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -shelljs@^0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.5.3.tgz#c54982b996c76ef0c1e6b59fbdc5825f5b713113" - -shelljs@~0.2: - version "0.2.6" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.2.6.tgz#90492d72ffcc8159976baba62fb0f6884f0c3378" - -shellwords@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" - -signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -slash@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" - -slice-ansi@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" - dependencies: - is-fullwidth-code-point "^2.0.0" - -slide@~1.1.3: - version "1.1.6" - resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" - -sntp@1.x.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" - dependencies: - hoek "2.x.x" - -sntp@2.x.x: - version "2.1.0" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" - dependencies: - hoek "4.x.x" - -source-map-support@^0.4.15: - version "0.4.18" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" - dependencies: - source-map "^0.5.6" - -source-map@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - dependencies: - amdefine ">=0.0.4" - -source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.6: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - -spdx-correct@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" - dependencies: - spdx-license-ids "^1.0.2" - -spdx-expression-parse@~1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" - -spdx-license-ids@^1.0.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - -sshpk@^1.7.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: - bcrypt-pbkdf "^1.0.0" - ecc-jsbn "~0.1.1" - jsbn "~0.1.0" - tweetnacl "~0.14.0" - -stream-consume@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/stream-consume/-/stream-consume-0.1.0.tgz#a41ead1a6d6081ceb79f65b061901b6d8f3d1d0f" - -string-length@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" - dependencies: - astral-regex "^1.0.0" - strip-ansi "^4.0.0" - -string-width@^1.0.1, string-width@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string_decoder@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" - dependencies: - safe-buffer "~5.1.0" - -stringstream@~0.0.4, stringstream@~0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - dependencies: - ansi-regex "^3.0.0" - -strip-bom@3.0.0, strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - -strip-bom@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" - dependencies: - is-utf8 "^0.2.0" - -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - -strip-indent@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" - dependencies: - get-stdin "^4.0.1" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -supports-color@^3.1.2: - version "3.2.3" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" - dependencies: - has-flag "^1.0.0" - -supports-color@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" - dependencies: - has-flag "^2.0.0" - -symbol-tree@^3.2.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" - -table@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" - dependencies: - ajv "^5.2.3" - ajv-keywords "^2.1.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" - -tar-pack@^3.4.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" - dependencies: - debug "^2.2.0" - fstream "^1.0.10" - fstream-ignore "^1.0.5" - once "^1.3.3" - readable-stream "^2.1.4" - rimraf "^2.5.1" - tar "^2.2.1" - uid-number "^0.0.6" - -tar@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" - dependencies: - block-stream "*" - fstream "^1.0.2" - inherits "2" - -test-exclude@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" - dependencies: - arrify "^1.0.1" - micromatch "^2.3.11" - object-assign "^4.1.0" - read-pkg-up "^1.0.1" - require-main-filename "^1.0.1" - -text-table@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - -throat@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" - -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - dependencies: - os-tmpdir "~1.0.2" - -tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - -to-fast-properties@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" - -tough-cookie@^2.3.2, tough-cookie@~2.3.0, tough-cookie@~2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" - dependencies: - punycode "^1.4.1" - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - -treeify@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/treeify/-/treeify-1.0.1.tgz#69b3cd022022a168424e7cfa1ced44c939d3eb2f" - -trim-newlines@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" - -trim-right@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" - -tryit@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - dependencies: - prelude-ls "~1.1.2" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - -typescript@~2.6.1: - version "2.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" - -uglify-js@^2.6: - version "2.8.29" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" - dependencies: - source-map "~0.5.1" - yargs "~3.10.0" - optionalDependencies: - uglify-to-browserify "~1.0.0" - -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" - -uid-number@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" - -underscore@~1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.4.4.tgz#61a6a32010622afa07963bf325203cf12239d604" - -utf8@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/utf8/-/utf8-2.1.2.tgz#1fa0d9270e9be850d9b05027f63519bf46457d96" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -util-extend@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/util-extend/-/util-extend-1.0.3.tgz#a7c216d267545169637b3b6edc6ca9119e2ff93f" - -uuid@^3.0.0, uuid@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" - -validate-npm-package-license@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" - dependencies: - spdx-correct "~1.0.0" - spdx-expression-parse "~1.0.0" - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -walker@~1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" - dependencies: - makeerror "1.0.x" - -watch@~0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" - dependencies: - exec-sh "^0.2.0" - minimist "^1.2.0" - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - -webidl-conversions@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" - -whatwg-encoding@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz#57c235bc8657e914d24e1a397d3c82daee0a6ba3" - dependencies: - iconv-lite "0.4.19" - -whatwg-url@^4.3.0: - version "4.8.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - -which@^1.2.12, which@^1.2.9: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" - dependencies: - isexe "^2.0.0" - -wide-align@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" - dependencies: - string-width "^1.0.2" - -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" - -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - -worker-farm@^1.3.1: - version "1.5.2" - resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.5.2.tgz#32b312e5dc3d5d45d79ef44acc2587491cd729ae" - dependencies: - errno "^0.1.4" - xtend "^4.0.1" - -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -write-file-atomic@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab" - dependencies: - graceful-fs "^4.1.11" - imurmurhash "^0.1.4" - signal-exit "^3.0.2" - -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - dependencies: - mkdirp "^0.5.1" - -xml-name-validator@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" - -xtend@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - -y18n@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" - -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" - -yargs-parser@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" - dependencies: - camelcase "^4.1.0" - -yargs@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" - dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - read-pkg-up "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" - -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" From 2806a5a60fb1496f8fcd7ff42793e7d051ab9eec Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 13 Dec 2017 11:29:56 +0000 Subject: [PATCH 232/326] Breaking: No prefix on FnDec within namespace (fixes #127) (#413) --- .../typescript-eslint-parser/lib/convert.js | 7 ---- .../tests/ast-alignment/fixtures-to-test.js | 9 ++--- .../tests/integration/typescript.spec.js | 34 +++++++++---------- .../lib/__snapshots__/typescript.js.snap | 18 +++++----- .../tools/test-utils.js | 2 +- 5 files changed, 29 insertions(+), 41 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index db823d772d60..00eb207e7200 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -622,13 +622,6 @@ module.exports = function convert(config) { } } - /** - * Prefix FunctionDeclarations within TypeScript namespaces with "TS" - */ - if (node.parent && node.parent.kind === SyntaxKind.ModuleBlock) { - functionDeclarationType = AST_NODE_TYPES.TSNamespaceFunctionDeclaration; - } - Object.assign(result, { type: functionDeclarationType, id: convertChild(node.name), diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index f2d19f6d14cd..e368c9443df8 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -40,7 +40,7 @@ let fixturesRequiringSourceTypeModule = []; /** * Utility to generate a FixturePatternConfig object containing the glob pattern for specific subsections of the fixtures/ directory, * including the capability to ignore specific nested patterns. - * + * * @param {string} fixturesSubPath the sub-path within the fixtures/ directory * @param {Object?} config an optional configuration object with optional sub-paths to ignore and/or parse with sourceType: module * @returns {FixturePatternConfig} an object containing the glob pattern and optional additional config @@ -466,12 +466,7 @@ let fixturePatternConfigsToTest = [ * Babylon: TSDeclareFunction * tsep: TSNamespaceFunctionDeclaration */ - "declare-namespace-with-exported-function", - /** - * Babylon: FunctionDeclaration - * tsep: TSNamespaceFunctionDeclaration - */ - "module-with-default-exports" + "declare-namespace-with-exported-function" ] }) ]; diff --git a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js index aa1e04111667..6a83a138c8e6 100644 --- a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js +++ b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js @@ -157,6 +157,23 @@ describe("TypeScript", () => { ); }); + it("should correctly apply no-unreachable on TS-constructs (#127)", () => { + verifyAndAssertMessages( + unpad(` + export namespace foo { + export function bar() { + return; + } + } + export type Qux = true; + `), + { + "no-unreachable": 2 + }, + [] + ); + }); + // it("should not produce a false positive for no-restricted-globals rule (#350)", () => { // verifyAndAssertMessages( // unpad(` @@ -171,23 +188,6 @@ describe("TypeScript", () => { // ); // }); - // it("should correctly apply no-unreachable on TS-constructs (#127)", () => { - // verifyAndAssertMessages( - // unpad(` - // export namespace foo { - // export function bar() { - // return; - // } - // } - // export type Qux = true; - // `), - // { - // "no-unreachable": 2 - // }, - // [] - // ); - // }); - // it("should not throw a TypeError in the indent rule for invalid code (#309)", () => { // verifyAndAssertMessages( // unpad(` diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 2ee0cc0ed582..d4f07b2d0aea 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -1179,7 +1179,7 @@ Object { }, }, }, - "type": "FunctionExpression", + "type": "TSEmptyBodyFunctionExpression", }, }, ], @@ -2478,7 +2478,7 @@ Object { }, }, }, - "type": "FunctionExpression", + "type": "TSEmptyBodyFunctionExpression", }, }, ], @@ -12300,7 +12300,7 @@ Object { 18, 21, ], - "type": "FunctionExpression", + "type": "TSEmptyBodyFunctionExpression", }, }, Object { @@ -12396,7 +12396,7 @@ Object { "type": "TSStringKeyword", }, }, - "type": "FunctionExpression", + "type": "TSEmptyBodyFunctionExpression", }, }, Object { @@ -12493,7 +12493,7 @@ Object { "type": "TSStringKeyword", }, }, - "type": "FunctionExpression", + "type": "TSEmptyBodyFunctionExpression", }, }, ], @@ -19988,7 +19988,7 @@ Object { "type": "TSAnyKeyword", }, }, - "type": "FunctionExpression", + "type": "TSEmptyBodyFunctionExpression", }, }, ], @@ -20409,7 +20409,7 @@ Object { "type": "TSStringKeyword", }, }, - "type": "DeclareFunction", + "type": "TSEmptyBodyDeclareFunction", }, ], "loc": Object { @@ -62800,7 +62800,7 @@ Object { }, }, }, - "type": "TSNamespaceFunctionDeclaration", + "type": "TSEmptyBodyFunctionDeclaration", }, "loc": Object { "end": Object { @@ -63500,7 +63500,7 @@ Object { 93, 110, ], - "type": "TSNamespaceFunctionDeclaration", + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { diff --git a/packages/typescript-eslint-parser/tools/test-utils.js b/packages/typescript-eslint-parser/tools/test-utils.js index 1321d98c1a3d..a00575082981 100644 --- a/packages/typescript-eslint-parser/tools/test-utils.js +++ b/packages/typescript-eslint-parser/tools/test-utils.js @@ -47,7 +47,7 @@ function createSnapshotTestBlock(code, config) { * @returns {Object} the AST object */ function parse() { - const ast = parser.parse(code, config); + const ast = parser.parseForESLint(code, config).ast; return getRaw(ast); } From 069e7112a12dda1fd43a88890e343cb603b7e179 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 13 Dec 2017 06:32:02 -0500 Subject: [PATCH 233/326] Build: changelog update for 11.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 9e96e820b6b9..90a172efd42e 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v11.0.0 - December 13, 2017 + +* 6698042 Breaking: No prefix on FnDec within namespace (fixes #127) (#413) (James Henry) +* aec31cb Breaking: Implement parseForESLint() function (#412) (James Henry) + v10.0.0 - December 11, 2017 * 59a37f4 Breaking: Updates to AST node types of some TSNodes (fixes #386) (#388) (James Henry) From d2c659f15335574852da3f447c36e407b0b4be65 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 13 Dec 2017 06:32:03 -0500 Subject: [PATCH 234/326] 11.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 503ed9f84e0c..d6d8a69f130c 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "10.0.0", + "version": "11.0.0", "files": [ "lib", "parser.js" From 8b068c62fe0275e07c9c2a8bb92dcb4f3ad424f5 Mon Sep 17 00:00:00 2001 From: Marius Schulz Date: Thu, 21 Dec 2017 13:11:07 +0100 Subject: [PATCH 235/326] Docs: Sets default code block language in issue template to "ts" (#421) --- packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md b/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md index efbde91f9eb5..7271d0acc824 100644 --- a/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md +++ b/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md @@ -6,8 +6,8 @@ **What code were you trying to parse?** -``` - +```ts +// Put your code here ``` **What did you expect to happen?** From 7d12e001247703caf6539c1f318783c432a8416e Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 12 Jan 2018 09:45:57 -0500 Subject: [PATCH 236/326] Breaking: Properly categorize constructors with no body (#427) --- packages/typescript-eslint-parser/lib/convert.js | 2 ++ .../tests/lib/__snapshots__/typescript.js.snap | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 00eb207e7200..d8f82152dbe3 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1050,6 +1050,8 @@ module.exports = function convert(config) { result.accessibility = accessibility; } + namespaceEmptyBodyFunctionForESLint(result.value); + break; } diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index d4f07b2d0aea..6eeed6c96e27 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -733,7 +733,7 @@ Object { 63, 66, ], - "type": "FunctionExpression", + "type": "TSEmptyBodyFunctionExpression", }, }, ], From 6a2f843c1bdf6cffde8057e631020b392dacb88b Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 16 Jan 2018 01:13:51 -0500 Subject: [PATCH 237/326] Build: changelog update for 12.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 90a172efd42e..1b690b51dff8 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v12.0.0 - January 16, 2018 + +* 6ce4cd8 Breaking: Properly categorize constructors with no body (#427) (Jed Fox) +* e94ede3 Docs: Sets default code block language in issue template to "ts" (#421) (Marius Schulz) + v11.0.0 - December 13, 2017 * 6698042 Breaking: No prefix on FnDec within namespace (fixes #127) (#413) (James Henry) From ffe3ca23df0f8e341bc3c4c6cfcca6501ba64d57 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 16 Jan 2018 01:13:51 -0500 Subject: [PATCH 238/326] 12.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index d6d8a69f130c..cb24a590dd34 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "11.0.0", + "version": "12.0.0", "files": [ "lib", "parser.js" From cce15a2798aa3bee742e0ee82d22efc4234691b5 Mon Sep 17 00:00:00 2001 From: Kepler Sticka-Jones Date: Fri, 9 Feb 2018 07:36:02 -0700 Subject: [PATCH 239/326] Docs: Update Known Issues section of README (#440) --- packages/typescript-eslint-parser/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 85a933197286..4cdb249420b0 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -17,9 +17,7 @@ If you use a non-supported version of TypeScript, the parser will log a warning ## Known Issues The following ESLint rules will fail on acceptable code: - - no-undef [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) - - no-unused-vars [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) - - no-useless-constructor [#77](https://github.com/eslint/typescript-eslint-parser/issues/77) + - no-undef [#416](https://github.com/eslint/typescript-eslint-parser/issues/416) The follow ESLint plugins have issues when used with this parser: - eslint-plugin-import From 482f9313d49cdc6d7833b51a0b2a82ae6a975a41 Mon Sep 17 00:00:00 2001 From: James Henry Date: Fri, 9 Feb 2018 15:18:34 +0000 Subject: [PATCH 240/326] Breaking: Support TypeScript 2.7 (fixes #442,#426) (#447) --- packages/typescript-eslint-parser/.travis.yml | 2 - packages/typescript-eslint-parser/README.md | 2 +- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 8 + .../lib/node-utils.js | 2 + .../typescript-eslint-parser/package.json | 14 +- .../tests/ast-alignment/fixtures-to-test.js | 2 + .../typescript/basics/keyof-operator.src.ts | 1 + .../typescript/basics/unique-symbol.src.ts | 1 + .../lib/__snapshots__/typescript.js.snap | 464 ++++++++++++++++++ 10 files changed, 487 insertions(+), 10 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/keyof-operator.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/unique-symbol.src.ts diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index 44a75f7ebf78..cd7025cc7ab2 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -1,8 +1,6 @@ language: node_js sudo: false node_js: - - "4" - - "5" - "6" - "7" - "8" diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 4cdb249420b0..cf903fdbc573 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -8,7 +8,7 @@ A parser that converts TypeScript source code into an [ESTree](https://github.co We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.6.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~2.7.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 42884d45750b..809404d76f67 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -141,6 +141,7 @@ module.exports = { TSSymbolKeyword: "TSSymbolKeyword", TSTypeAnnotation: "TSTypeAnnotation", TSTypeLiteral: "TSTypeLiteral", + TSTypeOperator: "TSTypeOperator", TSTypeParameter: "TSTypeParameter", TSTypeParameterDeclaration: "TSTypeParameterDeclaration", TSTypeParameterInstantiation: "TSTypeParameterInstantiation", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index d8f82152dbe3..3dcb3f90dec2 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1573,6 +1573,14 @@ module.exports = function convert(config) { }); break; + case SyntaxKind.TypeOperator: + Object.assign(result, { + type: AST_NODE_TYPES.TSTypeOperator, + operator: nodeUtils.getTextForTokenKind(node.operator), + typeAnnotation: convertChild(node.type) + }); + break; + // Binary Operations case SyntaxKind.BinaryExpression: diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 928ff14b25b5..957daeda2e1f 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -97,6 +97,8 @@ TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|="; TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^="; TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; +TOKEN_TO_TEXT[SyntaxKind.UniqueKeyword] = "unique"; +TOKEN_TO_TEXT[SyntaxKind.KeyOfKeyword] = "keyof"; /** * Find the first matching child based on the given sourceFile and predicate function. diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index cb24a590dd34..82af8e101a33 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -19,19 +19,19 @@ "license": "BSD-2-Clause", "devDependencies": { "babel-code-frame": "6.26.0", - "babylon": "7.0.0-beta.34", + "babylon": "7.0.0-beta.39", "dedent": "0.7.0", - "eslint": "4.13.1", + "eslint": "4.17.0", "eslint-config-eslint": "4.0.0", - "eslint-plugin-node": "5.2.1", + "eslint-plugin-node": "6.0.0", "eslint-release": "0.10.3", "glob": "7.1.2", - "jest": "21.2.1", + "jest": "22.2.1", "lodash.isplainobject": "4.0.6", "npm-license": "0.3.3", - "shelljs": "0.7.8", + "shelljs": "0.8.1", "shelljs-nodecli": "0.1.1", - "typescript": "~2.6.1" + "typescript": "~2.7.1" }, "keywords": [ "ast", @@ -56,7 +56,7 @@ }, "dependencies": { "lodash.unescape": "4.0.1", - "semver": "5.4.1" + "semver": "5.5.0" }, "peerDependencies": { "typescript": "*" diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index e368c9443df8..944f62151b10 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -399,6 +399,8 @@ let fixturePatternConfigsToTest = [ "export-type-class-declaration", "abstract-interface", "export-type-alias-declaration", + "unique-symbol", + "keyof-operator", /** * tsep bug - Program.body[0].expression.left.properties[0].value.right is currently showing up * as `ArrayPattern`, babylon, acorn and espree say it should be `ArrayExpression` diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/keyof-operator.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/keyof-operator.src.ts new file mode 100644 index 000000000000..d4cf1df7a5f0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/keyof-operator.src.ts @@ -0,0 +1 @@ +type x = keyof foo; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/unique-symbol.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/unique-symbol.src.ts new file mode 100644 index 000000000000..6d1be9873bdb --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/unique-symbol.src.ts @@ -0,0 +1 @@ +type A = unique symbol; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 6eeed6c96e27..f2ac97ebde98 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -34908,6 +34908,247 @@ Object { } `; +exports[`typescript fixtures/basics/keyof-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "keyof", + "range": Array [ + 9, + 18, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 19, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/nested-type-arguments.src 1`] = ` Object { "body": Array [ @@ -42862,6 +43103,229 @@ Object { } `; +exports[`typescript fixtures/basics/unique-symbol.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "unique", + "range": Array [ + 9, + 22, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSSymbolKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` Object { "body": Array [ From 74695dc333b91ea8ff4d6bb3908917cdbfb93c72 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 9 Feb 2018 10:23:44 -0500 Subject: [PATCH 241/326] Build: changelog update for 13.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 1b690b51dff8..a88fffc6e3ce 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v13.0.0 - February 9, 2018 + +* fb5e4c4 Breaking: Support TypeScript 2.7 (fixes #442,#426) (#447) (James Henry) +* bd9c12f Docs: Update Known Issues section of README (#440) (Kepler Sticka-Jones) + v12.0.0 - January 16, 2018 * 6ce4cd8 Breaking: Properly categorize constructors with no body (#427) (Jed Fox) From 3dedcc53f440bf260120bd43d2699adf9ea4bf0e Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Fri, 9 Feb 2018 10:23:44 -0500 Subject: [PATCH 242/326] 13.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 82af8e101a33..b8b6c15746ed 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "12.0.0", + "version": "13.0.0", "files": [ "lib", "parser.js" From 1f499c7320994a37aa3d0cbf7da68b35c706cbdd Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Sat, 17 Feb 2018 10:15:49 -0500 Subject: [PATCH 243/326] Breaking: Remove all tokens inside comments from tokens array (fixes #422) (#423) --- .../lib/node-utils.js | 29 +- .../fixtures/comments/jsdoc-comment.src.js | 8 + .../external-fixtures/jsdoc-indent.js | 11 +- .../tests/integration/typescript.spec.js | 2 +- .../tests/lib/__snapshots__/comments.js.snap | 341 ++++++++++++++++++ 5 files changed, 387 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/comments/jsdoc-comment.src.js diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 957daeda2e1f..677ff505e2bc 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -187,7 +187,9 @@ module.exports = { convertTokens, getNodeContainer, isWithinTypeAnnotation, - isTypeKeyword + isTypeKeyword, + isComment, + isJSDocComment }; /* eslint-enable no-use-before-define */ @@ -246,6 +248,24 @@ function isComma(token) { return token.kind === SyntaxKind.CommaToken; } +/** + * Returns true if the given TSNode is a comment + * @param {TSNode} node the TypeScript node + * @returns {boolean} is commment + */ +function isComment(node) { + return node.kind === SyntaxKind.SingleLineCommentTrivia || node.kind === SyntaxKind.MultiLineCommentTrivia; +} + +/** + * Returns true if the given TSNode is a JSDoc comment + * @param {TSNode} node the TypeScript node + * @returns {boolean} is JSDoc comment + */ +function isJSDocComment(node) { + return node.kind === SyntaxKind.JSDocComment; +} + /** * Returns the binary expression type of the given TSToken * @param {TSToken} operator the operator token @@ -258,7 +278,6 @@ function getBinaryExpressionType(operator) { return "LogicalExpression"; } return "BinaryExpression"; - } /** @@ -695,6 +714,12 @@ function convertTokens(ast) { * @returns {undefined} */ function walk(node) { + // TypeScript generates tokens for types in JSDoc blocks. Comment tokens + // and their children should not be walked or added to the resulting tokens list. + if (isComment(node) || isJSDocComment(node)) { + return; + } + if (isToken(node) && node.kind !== SyntaxKind.EndOfFileToken) { const converted = convertToken(node, ast); diff --git a/packages/typescript-eslint-parser/tests/fixtures/comments/jsdoc-comment.src.js b/packages/typescript-eslint-parser/tests/fixtures/comments/jsdoc-comment.src.js new file mode 100644 index 000000000000..29298a12b52f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/comments/jsdoc-comment.src.js @@ -0,0 +1,8 @@ +/** + * This is a function. + * @param {String} bar some string + * @returns {String} returns bar + */ +function foo(bar) { + return bar; +} diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js b/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js index 25641d508252..c402637e21e1 100644 --- a/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js +++ b/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js @@ -9,4 +9,13 @@ foo; /** * a */ -foo; \ No newline at end of file +foo; + +/** + * This is a function. + * @param {String} bar some string + * @returns {String} returns bar + */ +function foo(bar) { + return bar; +} diff --git a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js index 6a83a138c8e6..c2a6f8043877 100644 --- a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js +++ b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js @@ -80,7 +80,7 @@ describe("TypeScript", () => { ); }); - it("should not produce any lint errors on valid JSDoc indentation (#344)", () => { + it("should not produce any lint errors on valid JSDoc indentation (#344 & #422)", () => { verifyAndAssertMessages( loadExternalFixture("jsdoc-indent"), { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap index 72ee0ac2ef3b..41309c3f7edc 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap @@ -830,6 +830,347 @@ Object { } `; +exports[`Comments fixtures/jsdoc-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 123, + 134, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 117, + 136, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 112, + 115, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 99, + 136, + ], + "type": "FunctionDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 98, + ], + "type": "Block", + "value": "* + * This is a function. + * @param {String} bar some string + * @returns {String} returns bar + ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 99, + 137, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 99, + 107, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 112, + 115, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 123, + 129, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`Comments fixtures/jsx-block-comment.src 1`] = ` Object { "body": Array [ From 28ab9aaca6cad0cd9cf580738280f75c7b99e17d Mon Sep 17 00:00:00 2001 From: Lucas Azzola Date: Thu, 22 Feb 2018 00:21:18 +1100 Subject: [PATCH 244/326] New: Support Definite Assignment (fixes #424) (#432) --- .../typescript-eslint-parser/lib/convert.js | 8 + .../tests/ast-alignment/fixtures-to-test.js | 2 + .../class-with-definite-assignment.src.ts | 3 + .../var-with-definite-assignment.src.ts | 3 + .../lib/__snapshots__/typescript.js.snap | 937 ++++++++++++++++++ 5 files changed, 953 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-definite-assignment.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-definite-assignment.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 3dcb3f90dec2..225ae37c1b8d 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -658,6 +658,10 @@ module.exports = function convert(config) { init: convertChild(node.initializer) }); + if (node.exclamationToken) { + result.definite = true; + } + if (node.type) { result.id.typeAnnotation = convertTypeAnnotation(node.type); fixTypeAnnotationParentLocation(result.id); @@ -859,6 +863,10 @@ module.exports = function convert(config) { result.key.optional = true; } + if (node.exclamationToken) { + result.definite = true; + } + if (result.key.type === AST_NODE_TYPES.Literal && node.questionToken) { result.optional = true; } diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index 944f62151b10..a1554d3651fa 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -349,6 +349,8 @@ let fixturePatternConfigsToTest = [ "interface-with-all-property-types", // babylon parse errors "interface-with-construct-signature-with-parameter-accessibility", // babylon parse errors "class-with-implements-and-extends", // babylon parse errors + "var-with-definite-assignment", // babylon parse errors + "class-with-definite-assignment", // babylon parse errors /** * typescript-eslint-parser erroring, but babylon not. */ diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-definite-assignment.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-definite-assignment.src.ts new file mode 100644 index 000000000000..b1882b9f280d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/class-with-definite-assignment.src.ts @@ -0,0 +1,3 @@ +class X { + a!: string; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-definite-assignment.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-definite-assignment.src.ts new file mode 100644 index 000000000000..60906317fcad --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/var-with-definite-assignment.src.ts @@ -0,0 +1,3 @@ +const x!: string; +var y!: number; +let z!: object; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index f2ac97ebde98..c6ddec7cdea8 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -6021,6 +6021,321 @@ Object { } `; +exports[`typescript fixtures/basics/class-with-definite-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "definite": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 23, + ], + "static": false, + "type": "ClassProperty", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/class-with-export-parameter-properties.src 1`] = ` Object { "body": Array [ @@ -43326,6 +43641,628 @@ Object { } `; +exports[`typescript fixtures/basics/var-with-definite-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "range": Array [ + 22, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 32, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 18, + 33, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "z", + "range": Array [ + 38, + 48, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSObjectKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 49, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/var-with-dotted-type.src 1`] = ` Object { "body": Array [ From 1836e87d745cb1a65088b320500fdea8abd18f63 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 21 Feb 2018 08:23:22 -0500 Subject: [PATCH 245/326] Build: changelog update for 14.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index a88fffc6e3ce..29cb6760c615 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v14.0.0 - February 21, 2018 + +* 439ea24 New: Support Definite Assignment (fixes #424) (#432) (Lucas Azzola) +* adc0b1b Breaking: Remove all tokens inside comments from tokens array (fixes #422) (#423) (Kai Cataldo) + v13.0.0 - February 9, 2018 * fb5e4c4 Breaking: Support TypeScript 2.7 (fixes #442,#426) (#447) (James Henry) From 8d715620b760849675879e21f0bcded2902376ec Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 21 Feb 2018 08:23:22 -0500 Subject: [PATCH 246/326] 14.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index b8b6c15746ed..c33fe97f9248 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "13.0.0", + "version": "14.0.0", "files": [ "lib", "parser.js" From e9e7e22396f805d611cbb0dbead2532b26953979 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 17 Apr 2018 13:18:45 -0400 Subject: [PATCH 247/326] Breaking: Support TypeScript 2.8 (fixes #453) (#454) --- packages/typescript-eslint-parser/README.md | 2 +- packages/typescript-eslint-parser/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index cf903fdbc573..201473273196 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -8,7 +8,7 @@ A parser that converts TypeScript source code into an [ESTree](https://github.co We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.7.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~2.8.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index c33fe97f9248..406e1d9ce7dc 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -31,7 +31,7 @@ "npm-license": "0.3.3", "shelljs": "0.8.1", "shelljs-nodecli": "0.1.1", - "typescript": "~2.7.1" + "typescript": "~2.8.1" }, "keywords": [ "ast", From 886743b161c602cf3b9a062b0fe659224913ba90 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 17 Apr 2018 13:23:51 -0400 Subject: [PATCH 248/326] Build: changelog update for 15.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 29cb6760c615..387a7791fd54 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v15.0.0 - April 17, 2018 + +* e572416 Breaking: Support TypeScript 2.8 (fixes #453) (#454) (James Henry) + v14.0.0 - February 21, 2018 * 439ea24 New: Support Definite Assignment (fixes #424) (#432) (Lucas Azzola) From e1753d6b2a03c060cde61475989df839193a2334 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 17 Apr 2018 13:23:51 -0400 Subject: [PATCH 249/326] 15.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 406e1d9ce7dc..14f3320f4404 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "14.0.0", + "version": "15.0.0", "files": [ "lib", "parser.js" From 98c92f1c35b0c97a246c8d6e5bda7359f4dcf6b6 Mon Sep 17 00:00:00 2001 From: Muhanad Rabie Date: Sun, 3 Jun 2018 18:42:15 -0700 Subject: [PATCH 250/326] Fix: decorators removed on interface declarations (fixes #478) (#479) --- .../typescript-eslint-parser/lib/convert.js | 9 +- .../tests/ast-alignment/fixtures-to-test.js | 1 + .../decorator-on-interface-declaration.src.ts | 2 + .../lib/__snapshots__/typescript.js.snap | 279 ++++++++++++++++++ 4 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 225ae37c1b8d..ac0249fff2c2 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -2101,7 +2101,14 @@ module.exports = function convert(config) { id: convertChild(node.name), heritage: hasImplementsClause ? interfaceHeritageClauses[0].types.map(convertInterfaceHeritageClause) : [] }); - + /** + * Semantically, decorators are not allowed on interface declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + result.decorators = convertDecorators(node.decorators); + } // check for exports result = nodeUtils.fixExports(node, result, ast); diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index a1554d3651fa..415075bc4415 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -454,6 +454,7 @@ let fixturePatternConfigsToTest = [ "class-empty-extends-implements", // babylon parse errors "class-empty-extends", // babylon parse errors "decorator-on-enum-declaration", // babylon parse errors + "decorator-on-interface-declaration", // babylon parse errors "interface-property-modifiers", // babylon parse errors "enum-with-keywords" // babylon parse errors ] diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts new file mode 100644 index 000000000000..adb33f8e53bd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/errorRecovery/decorator-on-interface-declaration.src.ts @@ -0,0 +1,2 @@ +@deco() +interface M {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index c6ddec7cdea8..08fef27eb8be 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -57236,6 +57236,285 @@ Object { } `; +exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "TSInterfaceBody", + }, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "deco", + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 7, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "heritage": Array [], + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "M", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "TSInterfaceDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "value": "deco", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 17, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/errorRecovery/empty-type-arguments.src 1`] = ` Object { "body": Array [ From a18a4fd66defb52251b5b9d9672dd0869c4c2728 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 3 Jun 2018 21:41:56 -0400 Subject: [PATCH 251/326] Build: changelog update for 15.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 387a7791fd54..35b7c5ecf433 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v15.0.1 - June 3, 2018 + +* 891cee9 Fix: decorators removed on interface declarations (fixes #478) (#479) (Muhanad Rabie) + v15.0.0 - April 17, 2018 * e572416 Breaking: Support TypeScript 2.8 (fixes #453) (#454) (James Henry) From b380cc3be155035a6d05953207d04d437e4afbeb Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 3 Jun 2018 21:41:56 -0400 Subject: [PATCH 252/326] 15.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 14f3320f4404..56164a7c7140 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "15.0.0", + "version": "15.0.1", "files": [ "lib", "parser.js" From f58aa6715c00cdf9357cb7d77b5617bfbab3846d Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 3 Jun 2018 22:09:07 -0400 Subject: [PATCH 253/326] Breaking: Support TypeScript 2.9 (#480) * New: support TaggedTemplateExpression typeArguments (#469) * New: support generic JSX element (fixes #462) (#461) * Chore: Set latest TS version --- packages/typescript-eslint-parser/README.md | 2 +- .../typescript-eslint-parser/lib/convert.js | 6 + .../typescript-eslint-parser/package.json | 2 +- .../tests/ast-alignment/fixtures-to-test.js | 16 +- .../fixtures/tsx/generic-jsx-element.src.tsx | 1 + ...-template-expression-type-arguments.src.ts | 1 + .../tests/lib/__snapshots__/tsx.js.snap | 422 ++++++++++++++++++ .../lib/__snapshots__/typescript.js.snap | 281 ++++++++++++ 8 files changed, 727 insertions(+), 4 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/tsx/generic-jsx-element.src.tsx create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 201473273196..484da02c3caf 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -8,7 +8,7 @@ A parser that converts TypeScript source code into an [ESTree](https://github.co We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.8.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~2.9.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index ac0249fff2c2..18d52cddaf1d 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1237,6 +1237,9 @@ module.exports = function convert(config) { case SyntaxKind.TaggedTemplateExpression: Object.assign(result, { type: AST_NODE_TYPES.TaggedTemplateExpression, + typeParameters: (node.typeArguments) + ? convertTypeArgumentsToTypeParameters(node.typeArguments) + : undefined, tag: convertChild(node.tag), quasi: convertChild(node.template) }); @@ -1856,6 +1859,9 @@ module.exports = function convert(config) { case SyntaxKind.JsxOpeningElement: Object.assign(result, { type: AST_NODE_TYPES.JSXOpeningElement, + typeParameters: (node.typeArguments) + ? convertTypeArgumentsToTypeParameters(node.typeArguments) + : undefined, selfClosing: false, name: convertTypeScriptJSXTagNameToESTreeName(node.tagName), attributes: node.attributes.properties.map(convertChild) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 56164a7c7140..111f40d07216 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -31,7 +31,7 @@ "npm-license": "0.3.3", "shelljs": "0.8.1", "shelljs-nodecli": "0.1.1", - "typescript": "~2.8.1" + "typescript": "~2.9.1" }, "keywords": [ "ast", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index 415075bc4415..c4ba689343d4 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -324,7 +324,11 @@ let fixturePatternConfigsToTest = [ /** * AST difference */ - "react-typed-props" + "react-typed-props", + /** + * currently babylon not supported + */ + "generic-jsx-element" ] }), @@ -439,7 +443,15 @@ let fixturePatternConfigsToTest = [ createFixturePatternConfigFor("typescript/decorators/parameter-decorators", { fileType: "ts" }), createFixturePatternConfigFor("typescript/decorators/property-decorators", { fileType: "ts" }), - createFixturePatternConfigFor("typescript/expressions", { fileType: "ts" }), + createFixturePatternConfigFor("typescript/expressions", { + fileType: "ts", + ignore: [ + /** + * currently babylon not supported + */ + "tagged-template-expression-type-arguments" + ] + }), createFixturePatternConfigFor("typescript/errorRecovery", { fileType: "ts", diff --git a/packages/typescript-eslint-parser/tests/fixtures/tsx/generic-jsx-element.src.tsx b/packages/typescript-eslint-parser/tests/fixtures/tsx/generic-jsx-element.src.tsx new file mode 100644 index 000000000000..7a620161439c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/tsx/generic-jsx-element.src.tsx @@ -0,0 +1 @@ + data={12} /> diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts new file mode 100644 index 000000000000..aff1105de138 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/expressions/tagged-template-expression-type-arguments.src.ts @@ -0,0 +1 @@ +foo`baz`; \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap index a18c507de333..d78b679e7e0f 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap @@ -1,5 +1,427 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`TSX fixtures/generic-jsx-element.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "data", + "range": Array [ + 21, + 25, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 21, + 30, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "raw": "12", + "type": "Literal", + "value": 12, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "JSXExpressionContainer", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "MyComponent", + "range": Array [ + 1, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 33, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 12, + ], + "type": "JSXIdentifier", + "value": "MyComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "JSXIdentifier", + "value": "data", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "Numeric", + "value": "12", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + exports[`TSX fixtures/react-typed-props.src 1`] = ` Object { "body": Array [ diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 08fef27eb8be..176b601c54fd 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -63960,6 +63960,287 @@ Object { } `; +exports[`typescript fixtures/expressions/tagged-template-expression-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasi": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "baz", + "raw": "baz", + }, + }, + ], + "range": Array [ + 8, + 13, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 0, + 13, + ], + "tag": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + }, + "type": "TaggedTemplateExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 3, + 8, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Template", + "value": "\`baz\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/namespaces-and-modules/ambient-module-declaration-with-import.src 1`] = ` Object { "body": Array [ From b99e919cfb956d9ada6aab750222bf2befbd6d01 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 3 Jun 2018 22:27:58 -0400 Subject: [PATCH 254/326] Breaking: Set minimum node version to 6 (#481) --- packages/typescript-eslint-parser/.travis.yml | 1 - .../typescript-eslint-parser/package.json | 12 +- .../lib/__snapshots__/ecma-features.js.snap | 8177 ++++++++--------- .../tests/lib/ecma-features.js | 48 +- 4 files changed, 3803 insertions(+), 4435 deletions(-) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index cd7025cc7ab2..4a6efadd3d83 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -2,7 +2,6 @@ language: node_js sudo: false node_js: - "6" - - "7" - "8" - "9" after_success: diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 111f40d07216..1c253a41b9b9 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -10,7 +10,7 @@ "parser.js" ], "engines": { - "node": ">=4" + "node": "^6.14.0 || ^8.10.0 || >=9.10.0" }, "repository": "eslint/typescript-eslint-parser", "bugs": { @@ -21,15 +21,15 @@ "babel-code-frame": "6.26.0", "babylon": "7.0.0-beta.39", "dedent": "0.7.0", - "eslint": "4.17.0", + "eslint": "4.19.1", "eslint-config-eslint": "4.0.0", - "eslint-plugin-node": "6.0.0", - "eslint-release": "0.10.3", + "eslint-plugin-node": "6.0.1", + "eslint-release": "0.11.1", "glob": "7.1.2", - "jest": "22.2.1", + "jest": "23.1.0", "lodash.isplainobject": "4.0.6", "npm-license": "0.3.3", - "shelljs": "0.8.1", + "shelljs": "0.8.2", "shelljs-nodecli": "0.1.1", "typescript": "~2.9.1" }, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 0f57b862c3c2..2436e0da8655 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -1,73 +1,89 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`ecmaFeatures REGEXP FLAG - NODE VERSION <6: fixtures/regexUFlag/regex-u-extended-escape.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/as-param.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, + "expression": Object { + "arguments": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, }, + "range": Array [ + 10, + 12, + ], + "type": "BlockStatement", }, - "name": "x", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - "init": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 40, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 4, "line": 1, }, }, + "params": Array [], "range": Array [ - 8, - 40, + 4, + 12, ], - "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", - "regex": Object { - "flags": "u", - "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", - }, - "type": "Literal", - "value": null, + "type": "ArrowFunctionExpression", }, + ], + "callee": Object { "loc": Object { "end": Object { - "column": 40, + "column": 3, "line": 1, }, "start": Object { - "column": 4, + "column": 0, "line": 1, }, }, + "name": "foo", "range": Array [ - 4, - 40, + 0, + 3, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + }, "loc": Object { "end": Object { - "column": 41, + "column": 14, "line": 1, }, "start": Object { @@ -77,15 +93,15 @@ Object { }, "range": Array [ 0, - 41, + 14, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { "column": 0, @@ -94,7 +110,7 @@ Object { }, "range": Array [ 0, - 42, + 14, ], "sourceType": "script", "tokens": Array [ @@ -113,278 +129,149 @@ Object { 0, 3, ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 3, "line": 1, }, }, "range": Array [ - 6, - 7, + 3, + 4, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 40, - ], - "regex": Object { - "flags": "u", - "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", - }, - "type": "RegularExpression", - "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 5, "line": 1, }, "start": Object { - "column": 40, + "column": 4, "line": 1, }, }, "range": Array [ - 40, - 41, + 4, + 5, ], "type": "Punctuator", - "value": ";", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures REGEXP FLAG - NODE VERSION <6: fixtures/regexUFlag/regex-u-simple.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 16, - ], - "raw": "/foo/u", - "regex": Object { - "flags": "u", - "pattern": "foo", - }, - "type": "Literal", - "value": null, - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 16, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 17, + "column": 6, "line": 1, }, "start": Object { - "column": 0, + "column": 5, "line": 1, }, }, "range": Array [ - 0, - 17, + 5, + 6, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 9, "line": 1, }, "start": Object { - "column": 0, + "column": 7, "line": 1, }, }, "range": Array [ - 0, - 3, + 7, + 9, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 4, + "column": 10, "line": 1, }, }, "range": Array [ - 4, - 7, + 10, + 11, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, "range": Array [ - 8, - 9, + 11, + 12, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 16, + 12, + 13, ], - "regex": Object { - "flags": "u", - "pattern": "foo", - }, - "type": "RegularExpression", - "value": "/foo/u", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 14, "line": 1, }, "start": Object { - "column": 16, + "column": 13, "line": 1, }, }, "range": Array [ - 16, - 17, + 13, + 14, ], "type": "Punctuator", "value": ";", @@ -394,74 +281,127 @@ Object { } `; -exports[`ecmaFeatures REGEXP FLAG - NODE VERSION <6: fixtures/regexYFlag/regexp-y-simple.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/as-param-with-params.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, + "expression": Object { + "arguments": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { "column": 16, "line": 1, }, "start": Object { - "column": 10, + "column": 4, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + ], "range": Array [ - 10, + 4, 16, ], - "raw": "/foo/y", - "regex": Object { - "flags": "y", - "pattern": "foo", - }, - "type": "Literal", - "value": null, + "type": "ArrowFunctionExpression", }, + ], + "callee": Object { "loc": Object { "end": Object { - "column": 16, + "column": 3, "line": 1, }, "start": Object { - "column": 4, + "column": 0, "line": 1, }, }, + "name": "foo", "range": Array [ - 4, - 16, + 0, + 3, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "CallExpression", + }, "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -471,15 +411,15 @@ Object { }, "range": Array [ 0, - 17, + 18, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { "column": 0, @@ -507,278 +447,203 @@ Object { 0, 3, ], - "type": "Keyword", - "value": "var", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 4, + "column": 3, "line": 1, }, }, "range": Array [ + 3, 4, - 7, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { - "column": 8, + "column": 4, "line": 1, }, }, "range": Array [ - 8, - 9, + 4, + 5, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 6, "line": 1, }, "start": Object { - "column": 10, + "column": 5, "line": 1, }, }, "range": Array [ - 10, - 16, + 5, + 6, ], - "regex": Object { - "flags": "y", - "pattern": "foo", - }, - "type": "RegularExpression", - "value": "/foo/y", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 7, "line": 1, }, "start": Object { - "column": 16, + "column": 6, "line": 1, }, }, "range": Array [ - 16, - 17, + 6, + 7, ], "type": "Punctuator", - "value": ";", + "value": ",", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures REGEXP FLAG - NODE VERSION >=6: fixtures/regexUFlag/regex-u-extended-escape.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 40, - ], - "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", - "regex": Object { - "flags": "u", - "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", - }, - "type": "Literal", - "value": Object {}, - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 40, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, }, + }, + "range": Array [ + 8, + 9, ], - "kind": "var", + "type": "Identifier", + "value": "y", + }, + Object { "loc": Object { "end": Object { - "column": 41, + "column": 10, "line": 1, }, "start": Object { - "column": 0, + "column": 9, "line": 1, }, }, "range": Array [ - 0, - 41, + 9, + 10, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ")", }, - }, - "range": Array [ - 0, - 42, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 13, "line": 1, }, "start": Object { - "column": 0, + "column": 11, "line": 1, }, }, "range": Array [ - 0, - 3, + 11, + 13, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 15, "line": 1, }, "start": Object { - "column": 4, + "column": 14, "line": 1, }, }, "range": Array [ - 4, - 5, + 14, + 15, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 16, "line": 1, }, "start": Object { - "column": 6, + "column": 15, "line": 1, }, }, "range": Array [ - 6, - 7, + 15, + 16, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 17, "line": 1, }, "start": Object { - "column": 8, + "column": 16, "line": 1, }, }, "range": Array [ - 8, - 40, + 16, + 17, ], - "regex": Object { - "flags": "u", - "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", - }, - "type": "RegularExpression", - "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 18, "line": 1, }, "start": Object { - "column": 40, + "column": 17, "line": 1, }, }, "range": Array [ - 40, - 41, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -788,74 +653,54 @@ Object { } `; -exports[`ecmaFeatures REGEXP FLAG - NODE VERSION >=6: fixtures/regexUFlag/regex-u-simple.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/basic.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 16, - ], - "raw": "/foo/u", - "regex": Object { - "flags": "u", - "pattern": "foo", - }, - "type": "Literal", - "value": Object {}, - }, + "expression": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 16, + 6, + 12, ], - "type": "VariableDeclarator", + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", }, - ], - "kind": "var", + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 12, + ], + "type": "ArrowFunctionExpression", + }, "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 1, }, "start": Object { @@ -865,15 +710,15 @@ Object { }, "range": Array [ 0, - 17, + 13, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { "column": 0, @@ -882,14 +727,14 @@ Object { }, "range": Array [ 0, - 18, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -899,83 +744,79 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 2, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 7, + 1, + 2, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { - "column": 8, + "column": 3, "line": 1, }, }, "range": Array [ - 8, - 9, + 3, + 5, ], "type": "Punctuator", - "value": "=", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "range": Array [ - 10, - 16, + 6, + 12, ], - "regex": Object { - "flags": "u", - "pattern": "foo", - }, - "type": "RegularExpression", - "value": "/foo/u", + "type": "String", + "value": "\\"test\\"", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 13, "line": 1, }, "start": Object { - "column": 16, + "column": 12, "line": 1, }, }, "range": Array [ - 16, - 17, + 12, + 13, ], "type": "Punctuator", "value": ";", @@ -985,108 +826,109 @@ Object { } `; -exports[`ecmaFeatures REGEXP FLAG - NODE VERSION >=6: fixtures/regexYFlag/regexp-y-simple.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/basic-in-binary-expression.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "expression": Object { + "left": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, - "name": "foo", + "properties": Array [], "range": Array [ - 4, 7, + 9, ], - "type": "Identifier", + "type": "ObjectExpression", }, - "init": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 10, - 16, - ], - "raw": "/foo/y", - "regex": Object { - "flags": "y", - "pattern": "foo", + "start": Object { + "column": 1, + "line": 1, }, - "type": "Literal", - "value": Object {}, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 1, + 10, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 0, + 15, + ], + "right": Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { - "column": 4, + "column": 14, "line": 1, }, }, "range": Array [ - 4, - 16, + 14, + 15, ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "raw": "1", + "type": "Literal", + "value": 1, }, + "type": "BinaryExpression", }, - "range": Array [ - 0, - 17, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ - Object { "loc": Object { "end": Object { - "column": 3, + "column": 16, "line": 1, }, "start": Object { @@ -1096,194 +938,128 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, 16, ], - "regex": Object { - "flags": "y", - "pattern": "foo", - }, - "type": "RegularExpression", - "value": "/foo/y", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/arrowFunctions/as-param.src 1`] = ` -Object { - "body": Array [ Object { "expression": Object { - "arguments": Array [ - Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 12, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "left": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 4, - "line": 1, + "column": 8, + "line": 2, }, }, - "params": Array [], + "properties": Array [], "range": Array [ - 4, - 12, + 25, + 27, ], - "type": "ArrowFunctionExpression", + "type": "ObjectExpression", }, - ], - "callee": Object { + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 2, }, }, - "name": "foo", + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + ], "range": Array [ - 0, - 3, + 19, + 28, ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 1, + "line": 2, }, }, + "operator": "+", "range": Array [ - 0, - 13, + 18, + 33, ], - "type": "CallExpression", + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 14, + 17, + 35, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 3, }, "start": Object { "column": 0, @@ -1292,14 +1068,14 @@ Object { }, "range": Array [ 0, - 14, + 36, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -1309,15 +1085,33 @@ Object { }, "range": Array [ 0, - 3, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, ], "type": "Identifier", - "value": "foo", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 5, "line": 1, }, "start": Object { @@ -1327,25 +1121,25 @@ Object { }, "range": Array [ 3, - 4, + 5, ], "type": "Punctuator", - "value": "(", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 5, + 6, + 7, ], "type": "Punctuator", "value": "(", @@ -1353,20 +1147,20 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { - "column": 5, + "column": 7, "line": 1, }, }, "range": Array [ - 5, - 6, + 7, + 8, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { @@ -1375,52 +1169,52 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, + 8, 9, ], "type": "Punctuator", - "value": "=>", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 11, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 1, }, "start": Object { - "column": 11, + "column": 10, "line": 1, }, }, "range": Array [ + 10, 11, - 12, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { @@ -1438,214 +1232,76 @@ Object { 13, ], "type": "Punctuator", - "value": ")", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], - "type": "Punctuator", - "value": ";", + "type": "Numeric", + "value": "1", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/arrowFunctions/as-param-with-params.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "arguments": Array [ - Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 16, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 4, - 16, - ], - "type": "ArrowFunctionExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 0, - 3, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "type": "CallExpression", - }, "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, "range": Array [ - 0, - 18, + 15, + 16, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ";", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 1, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 3, + 17, + 18, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 2, + "line": 2, }, "start": Object { - "column": 3, - "line": 1, + "column": 1, + "line": 2, }, }, "range": Array [ - 3, - 4, + 18, + 19, ], "type": "Punctuator", "value": "(", @@ -1653,161 +1309,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 4, - "line": 1, + "column": 2, + "line": 2, }, }, "range": Array [ - 4, - 5, + 19, + 20, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { "column": 6, - "line": 1, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 5, - 6, + 21, + 23, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 6, - 7, + 24, + 25, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 1, + "line": 2, }, "start": Object { "column": 8, - "line": 1, + "line": 2, }, }, "range": Array [ - 8, - 9, + 25, + 26, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 10, - "line": 1, + "line": 2, }, "start": Object { "column": 9, - "line": 1, + "line": 2, }, }, "range": Array [ - 9, - 10, + 26, + 27, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 11, - 13, + 27, + 28, ], "type": "Punctuator", - "value": "=>", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 14, - 15, + 28, + 29, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 13, + "line": 2, }, }, "range": Array [ - 15, - 16, + 30, + 31, ], "type": "Punctuator", - "value": "}", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { "column": 17, - "line": 1, + "line": 2, }, "start": Object { "column": 16, - "line": 1, + "line": 2, }, }, "range": Array [ - 16, - 17, + 33, + 34, ], "type": "Punctuator", "value": ")", @@ -1816,16 +1490,16 @@ Object { "loc": Object { "end": Object { "column": 18, - "line": 1, + "line": 2, }, "start": Object { "column": 17, - "line": 1, + "line": 2, }, }, "range": Array [ - 17, - 18, + 34, + 35, ], "type": "Punctuator", "value": ";", @@ -1835,32 +1509,68 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/basic.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/block-body.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "ExpressionStatement", + }, + ], "loc": Object { "end": Object { "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ - 6, + 5, 12, ], - "raw": "\\"test\\"", - "type": "Literal", - "value": "test", + "type": "BlockStatement", }, - "expression": true, + "expression": false, "generator": false, "id": null, "loc": Object { @@ -1873,7 +1583,26 @@ Object { "line": 1, }, }, - "params": Array [], + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + ], "range": Array [ 0, 12, @@ -1928,44 +1657,80 @@ Object { 0, 1, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 4, "line": 1, }, "start": Object { - "column": 1, + "column": 2, "line": 1, }, }, "range": Array [ - 1, 2, + 4, ], "type": "Punctuator", - "value": ")", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { - "column": 3, + "column": 5, "line": 1, }, }, "range": Array [ - 3, 5, + 6, ], "type": "Punctuator", - "value": "=>", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { @@ -1974,16 +1739,16 @@ Object { "line": 1, }, "start": Object { - "column": 6, + "column": 11, "line": 1, }, }, "range": Array [ - 6, + 11, 12, ], - "type": "String", - "value": "\\"test\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -2008,240 +1773,162 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/basic-in-binary-expression.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/block-body-not-object.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "left": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, + "async": false, + "body": Object { + "body": Array [ + Object { + "body": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "ExpressionStatement", }, - "start": Object { - "column": 7, - "line": 1, + "label": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "label", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", }, - }, - "properties": Array [], - "range": Array [ - 7, - 9, - ], - "type": "ObjectExpression", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "params": Array [ - Object { "loc": Object { "end": Object { - "column": 2, + "column": 16, "line": 1, }, "start": Object { - "column": 1, + "column": 7, "line": 1, }, }, - "name": "a", "range": Array [ - 1, - 2, + 7, + 16, ], - "type": "Identifier", + "type": "LabeledStatement", }, ], - "range": Array [ - 1, - 10, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "operator": "+", - "range": Array [ - 0, - 15, - ], - "right": Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 5, "line": 1, }, }, "range": Array [ - 14, - 15, + 5, + 18, ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, + "type": "BlockStatement", }, - "start": Object { - "column": 0, - "line": 1, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, - }, - "range": Array [ - 0, - 16, - ], - "type": "ExpressionStatement", - }, - Object { - "expression": Object { - "left": Object { - "async": false, - "body": Object { + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 1, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 0, + "line": 1, }, }, - "properties": Array [], + "name": "e", "range": Array [ - 25, - 27, + 0, + 1, ], - "type": "ObjectExpression", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "name": "a", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 19, - 28, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 1, - "line": 2, + "type": "Identifier", }, - }, - "operator": "+", + ], "range": Array [ + 0, 18, - 33, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 32, - 33, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "BinaryExpression", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 17, - 35, + 0, + 19, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 3, + "column": 19, + "line": 1, }, "start": Object { "column": 0, @@ -2250,7 +1937,7 @@ Object { }, "range": Array [ 0, - 36, + 19, ], "sourceType": "script", "tokens": Array [ @@ -2269,203 +1956,250 @@ Object { 0, 1, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 4, "line": 1, }, "start": Object { - "column": 1, + "column": 2, "line": 1, }, }, "range": Array [ - 1, 2, + 4, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { - "column": 3, + "column": 5, "line": 1, }, }, "range": Array [ - 3, 5, + 6, ], "type": "Punctuator", - "value": "=>", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, 7, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "label", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 1, }, "start": Object { - "column": 7, + "column": 12, "line": 1, }, }, "range": Array [ - 7, - 8, + 12, + 13, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 9, + 14, + 16, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 18, "line": 1, }, "start": Object { - "column": 9, + "column": 17, "line": 1, }, }, "range": Array [ - 9, - 10, + 17, + 18, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 19, "line": 1, }, "start": Object { - "column": 10, + "column": 18, "line": 1, }, }, "range": Array [ - 10, - 11, + 18, + 19, ], "type": "Punctuator", - "value": ")", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/expression.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, - "start": Object { - "column": 12, - "line": 1, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 1, + 7, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "+", - }, - Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 9, ], - "type": "Numeric", - "value": "1", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": ";", + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 1, - "line": 2, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 17, - 18, + 0, + 1, ], "type": "Punctuator", "value": "(", @@ -2474,52 +2208,34 @@ Object { "loc": Object { "end": Object { "column": 2, - "line": 2, + "line": 1, }, "start": Object { "column": 1, - "line": 2, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, + "line": 1, }, }, "range": Array [ - 19, - 20, + 1, + 2, ], "type": "Identifier", - "value": "a", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 3, + "line": 1, }, }, "range": Array [ - 21, - 23, + 3, + 5, ], "type": "Punctuator", "value": "=>", @@ -2527,143 +2243,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { "column": 7, - "line": 2, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 10, - "line": 2, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 32, - 33, + 6, + 7, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 33, - 34, + 7, + 8, ], "type": "Punctuator", "value": ")", @@ -2671,17 +2279,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 34, - 35, + 8, + 9, ], "type": "Punctuator", "value": ";", @@ -2691,73 +2299,95 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/block-body.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/iife.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { - "body": Array [ + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "properties": Array [ Object { - "expression": Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, + "name": "property", "range": Array [ - 7, - 9, + 8, + 16, ], - "raw": "42", - "type": "Literal", - "value": 42, + "type": "Identifier", }, + "kind": "init", "loc": Object { "end": Object { - "column": 10, + "column": 20, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, + "method": false, "range": Array [ - 7, - 10, + 8, + 20, ], - "type": "ExpressionStatement", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, }, ], - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, "range": Array [ - 5, - 12, + 6, + 22, ], - "type": "BlockStatement", + "type": "ObjectExpression", }, - "expression": false, + "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 1, }, "start": Object { @@ -2787,13 +2417,13 @@ Object { ], "range": Array [ 0, - 12, + 23, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 13, + "column": 24, "line": 1, }, "start": Object { @@ -2803,14 +2433,14 @@ Object { }, "range": Array [ 0, - 13, + 24, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 13, + "column": 24, "line": 1, }, "start": Object { @@ -2820,7 +2450,7 @@ Object { }, "range": Array [ 0, - 13, + 24, ], "sourceType": "script", "tokens": Array [ @@ -2876,58 +2506,94 @@ Object { 6, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { - "column": 7, + "column": 6, "line": 1, }, }, "range": Array [ + 6, 7, - 9, ], - "type": "Numeric", - "value": "42", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 9, + "column": 8, "line": 1, }, }, "range": Array [ - 9, - 10, + 8, + 16, + ], + "type": "Identifier", + "value": "property", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 18, "line": 1, }, }, "range": Array [ - 11, - 12, + 18, + 20, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, ], "type": "Punctuator", "value": "}", @@ -2935,128 +2601,75 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 23, "line": 1, }, "start": Object { - "column": 12, + "column": 22, "line": 1, }, }, "range": Array [ - 12, - 13, + 22, + 23, ], "type": "Punctuator", - "value": ";", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/arrowFunctions/block-body-not-object.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "body": Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 16, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 16, - ], - "type": "ExpressionStatement", - }, - "label": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "label", - "range": Array [ - 7, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 16, - ], - "type": "LabeledStatement", - }, - ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/multiple-params.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 18, + 10, + 16, ], - "type": "BlockStatement", + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", }, - "expression": false, + "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { @@ -3068,31 +2681,49 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 2, "line": 1, }, "start": Object { - "column": 0, + "column": 1, "line": 1, }, }, - "name": "e", + "name": "a", "range": Array [ - 0, 1, + 2, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, ], "type": "Identifier", }, ], "range": Array [ 0, - 18, + 16, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 19, + "column": 17, "line": 1, }, "start": Object { @@ -3102,14 +2733,14 @@ Object { }, "range": Array [ 0, - 19, + 17, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 19, + "column": 17, "line": 1, }, "start": Object { @@ -3119,7 +2750,7 @@ Object { }, "range": Array [ 0, - 19, + 17, ], "sourceType": "script", "tokens": Array [ @@ -3138,131 +2769,131 @@ Object { 0, 1, ], - "type": "Identifier", - "value": "e", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 2, "line": 1, }, "start": Object { - "column": 2, + "column": 1, "line": 1, }, }, "range": Array [ + 1, 2, - 4, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 1, }, "start": Object { - "column": 5, + "column": 2, "line": 1, }, }, "range": Array [ - 5, - 6, + 2, + 3, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 5, "line": 1, }, "start": Object { - "column": 7, + "column": 4, "line": 1, }, }, "range": Array [ - 7, - 12, + 4, + 5, ], "type": "Identifier", - "value": "label", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 6, "line": 1, }, "start": Object { - "column": 12, + "column": 5, "line": 1, }, }, "range": Array [ - 12, - 13, + 5, + 6, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 9, "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, - 16, + 7, + 9, ], - "type": "Numeric", - "value": "42", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 17, + "column": 10, "line": 1, }, }, "range": Array [ - 17, - 18, + 10, + 16, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"test\\"", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 17, "line": 1, }, "start": Object { - "column": 18, + "column": 16, "line": 1, }, }, "range": Array [ - 18, - 19, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -3272,40 +2903,77 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/expression.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/no-auto-return.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "ExpressionStatement", + }, + ], "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, - "name": "x", "range": Array [ - 6, - 7, + 10, + 17, ], - "type": "Identifier", + "type": "BlockStatement", }, - "expression": true, + "expression": false, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, @@ -3321,23 +2989,41 @@ Object { "line": 1, }, }, - "name": "x", + "name": "a", "range": Array [ 1, 2, ], "type": "Identifier", }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, ], "range": Array [ - 1, - 7, + 0, + 17, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 1, }, "start": Object { @@ -3347,14 +3033,14 @@ Object { }, "range": Array [ 0, - 9, + 18, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 1, }, "start": Object { @@ -3364,7 +3050,7 @@ Object { }, "range": Array [ 0, - 9, + 18, ], "sourceType": "script", "tokens": Array [ @@ -3402,58 +3088,58 @@ Object { 2, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { - "column": 3, + "column": 2, "line": 1, }, }, "range": Array [ + 2, 3, - 5, ], "type": "Punctuator", - "value": "=>", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 7, + 4, + 5, ], "type": "Identifier", - "value": "x", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, - 8, + 5, + 6, ], "type": "Punctuator", "value": ")", @@ -3465,353 +3151,277 @@ Object { "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ - 8, + 7, 9, ], "type": "Punctuator", - "value": ";", + "value": "=>", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/arrowFunctions/iife.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "property", - "range": Array [ - 8, - 16, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 8, - 20, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - }, - ], - "range": Array [ - 6, - 22, - ], - "type": "ObjectExpression", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "e", - "range": Array [ - 0, - 1, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 0, - 23, - ], - "type": "ArrowFunctionExpression", - }, "loc": Object { "end": Object { - "column": 24, + "column": 11, "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 24, + 10, + 11, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 14, "line": 1, }, "start": Object { - "column": 0, + "column": 12, "line": 1, }, }, "range": Array [ - 0, - 1, - ], - "type": "Identifier", - "value": "e", + 12, + 14, + ], + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 14, "line": 1, }, }, "range": Array [ - 2, - 4, + 14, + 15, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 17, "line": 1, }, "start": Object { - "column": 5, + "column": 16, "line": 1, }, }, "range": Array [ - 5, - 6, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 18, "line": 1, }, "start": Object { - "column": 6, + "column": 17, "line": 1, }, }, "range": Array [ - 6, - 7, + 17, + 18, ], "type": "Punctuator", - "value": "{", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-arguments.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "42", + "type": "Literal", + "value": 42, }, - "start": Object { - "column": 8, - "line": 1, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "arguments", + "range": Array [ + 0, + 9, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 8, - 16, - ], - "type": "Identifier", - "value": "property", - }, - Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 0, "line": 1, }, }, "range": Array [ + 0, 16, - 17, ], - "type": "Punctuator", - "value": ":", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 20, + "column": 9, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 20, + 0, + 9, ], - "type": "Numeric", - "value": "42", + "type": "Identifier", + "value": "arguments", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 12, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, "range": Array [ - 21, - 22, + 10, + 12, ], "type": "Punctuator", - "value": "}", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 15, "line": 1, }, "start": Object { - "column": 22, + "column": 13, "line": 1, }, }, "range": Array [ - 22, - 23, + 13, + 15, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 16, "line": 1, }, "start": Object { - "column": 23, + "column": 15, "line": 1, }, }, "range": Array [ - 23, - 24, + 15, + 16, ], "type": "Punctuator", "value": ";", @@ -3821,7 +3431,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/multiple-params.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval.src 1`] = ` Object { "body": Array [ Object { @@ -3830,28 +3440,28 @@ Object { "body": Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ + 8, 10, - 16, ], - "raw": "\\"test\\"", + "raw": "42", "type": "Literal", - "value": "test", + "value": 42, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { @@ -3863,49 +3473,31 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, + "column": 4, "line": 1, }, "start": Object { - "column": 4, + "column": 0, "line": 1, }, }, - "name": "b", + "name": "eval", "range": Array [ + 0, 4, - 5, ], "type": "Identifier", }, ], "range": Array [ 0, - 16, + 10, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { @@ -3915,14 +3507,14 @@ Object { }, "range": Array [ 0, - 17, + 11, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { @@ -3932,14 +3524,14 @@ Object { }, "range": Array [ 0, - 17, + 11, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 4, "line": 1, }, "start": Object { @@ -3949,69 +3541,15 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 2, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 3, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ 4, - 5, ], "type": "Identifier", - "value": "b", + "value": "eval", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 1, }, "start": Object { @@ -4021,25 +3559,7 @@ Object { }, "range": Array [ 5, - 6, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ 7, - 9, ], "type": "Punctuator", "value": "=>", @@ -4047,35 +3567,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ + 8, 10, - 16, ], - "type": "String", - "value": "\\"test\\"", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 11, ], "type": "Punctuator", "value": ";", @@ -4085,73 +3605,37 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/no-auto-return.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval-params.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 14, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 15, - ], - "type": "ExpressionStatement", - }, - ], "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { - "column": 10, + "column": 13, "line": 1, }, }, "range": Array [ - 10, - 17, + 13, + 15, ], - "type": "BlockStatement", + "raw": "42", + "type": "Literal", + "value": 42, }, - "expression": false, + "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { @@ -4163,7 +3647,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 5, "line": 1, }, "start": Object { @@ -4171,41 +3655,41 @@ Object { "line": 1, }, }, - "name": "a", + "name": "eval", "range": Array [ 1, - 2, + 5, ], "type": "Identifier", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, - "name": "b", + "name": "a", "range": Array [ - 4, - 5, + 7, + 8, ], "type": "Identifier", }, ], "range": Array [ 0, - 17, + 15, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { @@ -4215,14 +3699,14 @@ Object { }, "range": Array [ 0, - 18, + 16, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { @@ -4232,7 +3716,7 @@ Object { }, "range": Array [ 0, - 18, + 16, ], "sourceType": "script", "tokens": Array [ @@ -4257,7 +3741,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 5, "line": 1, }, "start": Object { @@ -4267,46 +3751,10 @@ Object { }, "range": Array [ 1, - 2, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 3, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, 5, ], "type": "Identifier", - "value": "b", + "value": "eval", }, Object { "loc": Object { @@ -4324,12 +3772,12 @@ Object { 6, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 8, "line": 1, }, "start": Object { @@ -4339,46 +3787,46 @@ Object { }, "range": Array [ 7, - 9, + 8, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 11, + 8, + 9, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 1, }, "start": Object { - "column": 12, + "column": 10, "line": 1, }, }, "range": Array [ + 10, 12, - 14, ], - "type": "Numeric", - "value": "42", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { @@ -4387,89 +3835,71 @@ Object { "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, "range": Array [ - 14, + 13, 15, ], - "type": "Punctuator", - "value": ";", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 17, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-arguments.src 1`] = ` -Object { - "body": Array [ + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-octal.src 1`] = ` +Object { + "body": Array [ Object { "expression": Object { "async": false, "body": Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 7, "line": 1, }, }, "range": Array [ - 13, - 15, + 7, + 9, ], - "raw": "42", + "raw": "00", "type": "Literal", - "value": 42, + "value": 0, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { @@ -4481,31 +3911,31 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 2, "line": 1, }, "start": Object { - "column": 0, + "column": 1, "line": 1, }, }, - "name": "arguments", + "name": "a", "range": Array [ - 0, - 9, + 1, + 2, ], "type": "Identifier", }, ], "range": Array [ 0, - 15, + 9, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { @@ -4515,14 +3945,14 @@ Object { }, "range": Array [ 0, - 16, + 10, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { @@ -4532,14 +3962,14 @@ Object { }, "range": Array [ 0, - 16, + 10, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 1, "line": 1, }, "start": Object { @@ -4549,25 +3979,61 @@ Object { }, "range": Array [ 0, - 9, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, ], "type": "Identifier", - "value": "arguments", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 3, "line": 1, }, "start": Object { - "column": 10, + "column": 2, "line": 1, }, }, "range": Array [ - 10, - 12, + 2, + 3, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, ], "type": "Punctuator", "value": "=>", @@ -4575,35 +4041,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 7, "line": 1, }, }, "range": Array [ - 13, - 15, + 7, + 9, ], "type": "Numeric", - "value": "42", + "value": "00", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 16, + 9, + 10, ], "type": "Punctuator", "value": ";", @@ -4613,37 +4079,78 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/return-arrow-function.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 5, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + ], "range": Array [ - 8, - 10, + 5, + 12, ], - "raw": "42", - "type": "Literal", - "value": 42, + "type": "ArrowFunctionExpression", }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { @@ -4655,7 +4162,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, + "column": 1, "line": 1, }, "start": Object { @@ -4663,23 +4170,23 @@ Object { "line": 1, }, }, - "name": "eval", + "name": "x", "range": Array [ 0, - 4, + 1, ], "type": "Identifier", }, ], "range": Array [ 0, - 10, + 12, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { @@ -4689,14 +4196,14 @@ Object { }, "range": Array [ 0, - 11, + 13, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { @@ -4706,14 +4213,14 @@ Object { }, "range": Array [ 0, - 11, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 1, "line": 1, }, "start": Object { @@ -4723,15 +4230,33 @@ Object { }, "range": Array [ 0, - 4, + 1, ], "type": "Identifier", - "value": "eval", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, "line": 1, }, "start": Object { @@ -4741,7 +4266,25 @@ Object { }, "range": Array [ 5, + 6, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ 7, + 9, ], "type": "Punctuator", "value": "=>", @@ -4749,17 +4292,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, 10, + 12, ], "type": "Numeric", "value": "42", @@ -4767,17 +4310,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 11, + 12, + 13, ], "type": "Punctuator", "value": ";", @@ -4787,37 +4330,150 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval-params.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/return-sequence.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { + "async": false, + "body": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "SequenceExpression", + }, + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 15, + "column": 27, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], "range": Array [ - 13, - 15, + 8, + 27, ], - "raw": "42", - "type": "Literal", - "value": 42, + "type": "ArrowFunctionExpression", }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 15, + "column": 28, "line": 1, }, "start": Object { @@ -4829,7 +4485,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 2, "line": 1, }, "start": Object { @@ -4837,41 +4493,23 @@ Object { "line": 1, }, }, - "name": "eval", + "name": "x", "range": Array [ 1, - 5, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 7, - 8, + 2, ], "type": "Identifier", }, ], "range": Array [ 0, - 15, + 28, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 29, "line": 1, }, "start": Object { @@ -4881,14 +4519,14 @@ Object { }, "range": Array [ 0, - 16, + 29, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 16, + "column": 29, "line": 1, }, "start": Object { @@ -4898,7 +4536,7 @@ Object { }, "range": Array [ 0, - 16, + 29, ], "sourceType": "script", "tokens": Array [ @@ -4923,7 +4561,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 2, "line": 1, }, "start": Object { @@ -4933,10 +4571,28 @@ Object { }, "range": Array [ 1, - 5, + 2, ], "type": "Identifier", - "value": "eval", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -4945,16 +4601,16 @@ Object { "line": 1, }, "start": Object { - "column": 5, + "column": 4, "line": 1, }, }, "range": Array [ - 5, + 4, 6, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { @@ -4971,8 +4627,8 @@ Object { 7, 8, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -4990,12 +4646,30 @@ Object { 9, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, "line": 1, }, "start": Object { @@ -5005,15 +4679,33 @@ Object { }, "range": Array [ 10, - 12, + 11, ], "type": "Punctuator", - "value": "=>", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, "line": 1, }, "start": Object { @@ -5023,15 +4715,15 @@ Object { }, "range": Array [ 13, - 15, + 14, ], - "type": "Numeric", - "value": "42", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { @@ -5041,217 +4733,169 @@ Object { }, "range": Array [ 15, - 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": "=>", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-octal.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 9, - ], - "raw": "00", - "type": "Literal", - "value": 0, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "start": Object { + "column": 18, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 0, - 9, - ], - "type": "ArrowFunctionExpression", }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 10, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 19, "line": 1, }, }, "range": Array [ - 0, - 10, + 19, + 20, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "x", }, - }, - "range": Array [ - 0, - 10, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 21, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 1, + 20, + 21, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 23, "line": 1, }, "start": Object { - "column": 1, + "column": 22, "line": 1, }, }, "range": Array [ - 1, - 2, + 22, + 23, ], "type": "Identifier", - "value": "a", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 24, "line": 1, }, "start": Object { - "column": 2, + "column": 23, "line": 1, }, }, "range": Array [ - 2, - 3, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 26, "line": 1, }, "start": Object { - "column": 4, + "column": 25, "line": 1, }, }, "range": Array [ - 4, - 6, + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, ], "type": "Punctuator", - "value": "=>", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 28, "line": 1, }, "start": Object { - "column": 7, + "column": 27, "line": 1, }, }, "range": Array [ - 7, - 9, + 27, + 28, ], - "type": "Numeric", - "value": "00", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 29, "line": 1, }, "start": Object { - "column": 9, + "column": 28, "line": 1, }, }, "range": Array [ - 9, - 10, + 28, + 29, ], "type": "Punctuator", "value": ";", @@ -5261,39 +4905,16 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/return-arrow-function.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/single-param.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 12, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "expression": true, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 1, }, "start": Object { @@ -5301,38 +4922,20 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - ], "range": Array [ 5, - 12, + 11, ], - "type": "ArrowFunctionExpression", + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 1, }, "start": Object { @@ -5352,7 +4955,7 @@ Object { "line": 1, }, }, - "name": "x", + "name": "e", "range": Array [ 0, 1, @@ -5362,13 +4965,13 @@ Object { ], "range": Array [ 0, - 12, + 11, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { @@ -5378,14 +4981,14 @@ Object { }, "range": Array [ 0, - 13, + 12, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { @@ -5395,7 +4998,7 @@ Object { }, "range": Array [ 0, - 13, + 12, ], "sourceType": "script", "tokens": Array [ @@ -5415,7 +5018,7 @@ Object { 1, ], "type": "Identifier", - "value": "x", + "value": "e", }, Object { "loc": Object { @@ -5438,7 +5041,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { @@ -5448,28 +5051,10 @@ Object { }, "range": Array [ 5, - 6, - ], - "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 9, + 11, ], - "type": "Punctuator", - "value": "=>", + "type": "String", + "value": "\\"test\\"", }, Object { "loc": Object { @@ -5478,31 +5063,13 @@ Object { "line": 1, }, "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 12, - ], - "type": "Numeric", - "value": "42", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 12, - 13, ], "type": "Punctuator", "value": ";", @@ -5512,150 +5079,37 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/return-sequence.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/single-param-parens.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { - "async": false, - "body": Object { - "expressions": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 26, - ], - "type": "SequenceExpression", - }, - "expression": true, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 27, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - ], "range": Array [ - 8, - 27, + 7, + 13, ], - "type": "ArrowFunctionExpression", + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 28, + "column": 13, "line": 1, }, "start": Object { @@ -5675,7 +5129,7 @@ Object { "line": 1, }, }, - "name": "x", + "name": "e", "range": Array [ 1, 2, @@ -5685,13 +5139,13 @@ Object { ], "range": Array [ 0, - 28, + 13, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 29, + "column": 14, "line": 1, }, "start": Object { @@ -5701,14 +5155,14 @@ Object { }, "range": Array [ 0, - 29, + 14, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 29, + "column": 14, "line": 1, }, "start": Object { @@ -5718,7 +5172,7 @@ Object { }, "range": Array [ 0, - 29, + 14, ], "sourceType": "script", "tokens": Array [ @@ -5756,7 +5210,7 @@ Object { 2, ], "type": "Identifier", - "value": "x", + "value": "e", }, Object { "loc": Object { @@ -5797,7 +5251,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 1, }, "start": Object { @@ -5807,277 +5261,333 @@ Object { }, "range": Array [ 7, - 8, + 13, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"test\\"", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { - "column": 8, + "column": 13, "line": 1, }, }, "range": Array [ - 8, - 9, + 13, + 14, ], "type": "Punctuator", - "value": "(", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/single-param-return-identifier.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "earth", + "range": Array [ + 9, + 14, + ], + "type": "Identifier", }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sun", + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 14, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": ",", - }, - Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 0, "line": 1, }, }, "range": Array [ - 12, - 13, + 0, + 15, ], - "type": "Identifier", - "value": "z", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": ")", + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, + "column": 1, "line": 1, }, "start": Object { - "column": 15, + "column": 0, "line": 1, }, }, "range": Array [ - 15, - 17, + 0, + 1, ], "type": "Punctuator", - "value": "=>", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 4, "line": 1, }, "start": Object { - "column": 18, + "column": 1, "line": 1, }, }, "range": Array [ - 18, - 19, + 1, + 4, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "sun", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 5, "line": 1, }, "start": Object { - "column": 19, + "column": 4, "line": 1, }, }, "range": Array [ - 19, - 20, + 4, + 5, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 20, + "column": 6, "line": 1, }, }, "range": Array [ - 20, - 21, + 6, + 8, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 1, }, "start": Object { - "column": 22, + "column": 9, "line": 1, }, }, "range": Array [ - 22, - 23, + 9, + 14, ], "type": "Identifier", - "value": "y", + "value": "earth", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 1, }, "start": Object { - "column": 23, + "column": 14, "line": 1, }, }, "range": Array [ - 23, - 24, + 14, + 15, ], "type": "Punctuator", - "value": ",", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/binaryLiterals/invalid.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/binaryLiterals/lowercase.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 5, + ], + "raw": "0b101", + "type": "Literal", + "value": 5, }, - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - "value": "z", - }, - Object { "loc": Object { "end": Object { - "column": 27, + "column": 6, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 6, ], - "type": "Punctuator", - "value": ")", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 28, + "column": 5, "line": 1, }, "start": Object { - "column": 27, + "column": 0, "line": 1, }, }, "range": Array [ - 27, - 28, + 0, + 5, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "0b101", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 6, "line": 1, }, "start": Object { - "column": 28, + "column": 5, "line": 1, }, }, "range": Array [ - 28, - 29, + 5, + 6, ], "type": "Punctuator", "value": ";", @@ -6087,37 +5597,14 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/single-param.src 1`] = ` +exports[`ecmaFeatures fixtures/binaryLiterals/uppercase.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "raw": "\\"test\\"", - "type": "Literal", - "value": "test", - }, - "expression": true, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 11, + "column": 5, "line": 1, }, "start": Object { @@ -6125,35 +5612,17 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "e", - "range": Array [ - 0, - 1, - ], - "type": "Identifier", - }, - ], "range": Array [ 0, - 11, + 5, ], - "type": "ArrowFunctionExpression", + "raw": "0B101", + "type": "Literal", + "value": 5, }, "loc": Object { "end": Object { - "column": 12, + "column": 6, "line": 1, }, "start": Object { @@ -6163,15 +5632,15 @@ Object { }, "range": Array [ 0, - 12, + 6, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -6180,14 +5649,14 @@ Object { }, "range": Array [ 0, - 12, + 7, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -6197,33 +5666,15 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Identifier", - "value": "e", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 4, + 5, ], - "type": "Punctuator", - "value": "=>", + "type": "Numeric", + "value": "0B101", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 6, "line": 1, }, "start": Object { @@ -6233,25 +5684,7 @@ Object { }, "range": Array [ 5, - 11, - ], - "type": "String", - "value": "\\"test\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, + 6, ], "type": "Punctuator", "value": ";", @@ -6261,73 +5694,69 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/single-param-parens.src 1`] = ` +exports[`ecmaFeatures fixtures/blockBindings/const.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", }, - "range": Array [ - 7, - 13, - ], - "raw": "\\"test\\"", - "type": "Literal", - "value": "test", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { + "init": Object { "loc": Object { "end": Object { - "column": 2, + "column": 15, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, - "name": "e", + "name": "bar", "range": Array [ - 1, - 2, + 12, + 15, ], "type": "Identifier", }, - ], - "range": Array [ - 0, - 13, - ], - "type": "ArrowFunctionExpression", - }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { @@ -6337,15 +5766,15 @@ Object { }, "range": Array [ 0, - 14, + 16, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -6354,14 +5783,14 @@ Object { }, "range": Array [ 0, - 14, + 17, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -6371,97 +5800,79 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 9, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 2, + 6, + 9, ], "type": "Identifier", - "value": "e", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 11, "line": 1, }, "start": Object { - "column": 2, + "column": 10, "line": 1, }, }, "range": Array [ - 2, - 3, + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 15, "line": 1, }, "start": Object { - "column": 4, + "column": 12, "line": 1, }, }, "range": Array [ - 4, - 6, + 12, + 15, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 15, "line": 1, }, }, "range": Array [ - 7, - 13, - ], - "type": "String", - "value": "\\"test\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, + 15, + 16, ], "type": "Punctuator", "value": ";", @@ -6471,72 +5882,69 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/single-param-return-identifier.src 1`] = ` +exports[`ecmaFeatures fixtures/blockBindings/let.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", }, - "name": "earth", - "range": Array [ - 9, - 14, - ], - "type": "Identifier", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { + "init": Object { "loc": Object { "end": Object { - "column": 4, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 10, "line": 1, }, }, - "name": "sun", + "name": "bar", "range": Array [ - 1, - 4, + 10, + 13, ], "type": "Identifier", }, - ], - "range": Array [ - 0, - 14, - ], - "type": "ArrowFunctionExpression", - }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { @@ -6546,15 +5954,15 @@ Object { }, "range": Array [ 0, - 15, + 14, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -6570,7 +5978,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -6580,97 +5988,79 @@ Object { }, "range": Array [ 0, - 1, + 3, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 4, "line": 1, }, }, "range": Array [ - 1, 4, + 7, ], "type": "Identifier", - "value": "sun", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { "column": 8, "line": 1, }, - "start": Object { - "column": 6, - "line": 1, - }, }, "range": Array [ - 6, 8, + 9, ], "type": "Punctuator", - "value": "=>", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, - 14, + 10, + 13, ], "type": "Identifier", - "value": "earth", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, "range": Array [ + 13, 14, - 15, ], "type": "Punctuator", "value": ";", @@ -6680,34 +6070,163 @@ Object { } `; -exports[`ecmaFeatures fixtures/binaryLiterals/invalid.src 1`] = `"';' expected."`; - -exports[`ecmaFeatures fixtures/binaryLiterals/lowercase.src 1`] = ` +exports[`ecmaFeatures fixtures/blockBindings/let-in-switchcase.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "t", + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 38, + ], + "type": "VariableDeclaration", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 45, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { "loc": Object { "end": Object { - "column": 5, + "column": 14, "line": 1, }, "start": Object { - "column": 0, + "column": 8, "line": 1, }, }, + "name": "answer", "range": Array [ - 0, - 5, + 8, + 14, ], - "raw": "0b101", - "type": "Literal", - "value": 5, + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 6, + "column": 47, "line": 1, }, "start": Object { @@ -6717,9 +6236,9 @@ Object { }, "range": Array [ 0, - 6, + 47, ], - "type": "ExpressionStatement", + "type": "SwitchStatement", }, ], "loc": Object { @@ -6734,14 +6253,14 @@ Object { }, "range": Array [ 0, - 7, + 48, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { @@ -6751,647 +6270,471 @@ Object { }, "range": Array [ 0, - 5, + 6, ], - "type": "Numeric", - "value": "0b101", + "type": "Keyword", + "value": "switch", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { - "column": 5, + "column": 7, "line": 1, }, }, "range": Array [ - 5, - 6, + 7, + 8, ], "type": "Punctuator", - "value": ";", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/binaryLiterals/uppercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "raw": "0B101", - "type": "Literal", - "value": 5, - }, "loc": Object { "end": Object { - "column": 6, + "column": 14, "line": 1, }, "start": Object { - "column": 0, + "column": 8, "line": 1, }, }, "range": Array [ - 0, - 6, + 8, + 14, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "answer", }, - }, - "range": Array [ - 0, - 7, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 15, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 5, + 14, + 15, ], - "type": "Numeric", - "value": "0B101", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 17, "line": 1, }, "start": Object { - "column": 5, + "column": 16, "line": 1, }, }, "range": Array [ - 5, - 6, + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/blockBindings/const.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 15, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 16, + "column": 22, "line": 1, }, "start": Object { - "column": 0, + "column": 18, "line": 1, }, }, "range": Array [ - 0, - 16, + 18, + 22, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "case", }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 25, "line": 1, }, "start": Object { - "column": 0, + "column": 23, "line": 1, }, }, "range": Array [ - 0, - 5, + 23, + 25, ], - "type": "Keyword", - "value": "const", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 26, "line": 1, }, "start": Object { - "column": 6, + "column": 25, "line": 1, }, }, "range": Array [ - 6, - 9, + 25, + 26, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 30, "line": 1, }, "start": Object { - "column": 10, + "column": 27, "line": 1, }, }, "range": Array [ - 10, - 11, + 27, + 30, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 32, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 15, + 31, + 32, ], "type": "Identifier", - "value": "bar", + "value": "t", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 34, "line": 1, }, "start": Object { - "column": 15, + "column": 33, "line": 1, }, }, "range": Array [ - 15, - 16, + 33, + 34, ], "type": "Punctuator", - "value": ";", + "value": "=", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/blockBindings/let.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 13, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", "loc": Object { "end": Object { - "column": 14, + "column": 37, "line": 1, }, "start": Object { - "column": 0, + "column": 35, "line": 1, }, }, "range": Array [ - 0, - 14, + 35, + 37, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Numeric", + "value": "42", }, - }, - "range": Array [ - 0, - 15, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 38, "line": 1, }, "start": Object { - "column": 0, + "column": 37, "line": 1, }, }, "range": Array [ - 0, - 3, + 37, + 38, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 44, "line": 1, }, "start": Object { - "column": 4, + "column": 39, "line": 1, }, }, "range": Array [ - 4, - 7, + 39, + 44, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "break", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 45, "line": 1, }, "start": Object { - "column": 8, + "column": 44, "line": 1, }, }, "range": Array [ - 8, - 9, + 44, + 45, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - "value": "bar", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 47, "line": 1, }, "start": Object { - "column": 13, + "column": 46, "line": 1, }, }, "range": Array [ - 13, - 14, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/blockBindings/let-in-switchcase.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-accessor-properties.src 1`] = ` Object { "body": Array [ Object { - "cases": Array [ - Object { - "consequent": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "name": "t", - "range": Array [ - 31, - 32, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 37, - ], - "raw": "42", - "type": "Literal", - "value": 42, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, + "start": Object { + "column": 16, + "line": 1, }, - "range": Array [ - 31, - 37, - ], - "type": "VariableDeclarator", }, - ], - "kind": "let", + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 38, + "column": 18, "line": 1, }, "start": Object { - "column": 27, + "column": 14, "line": 1, }, }, + "params": Array [], "range": Array [ - 27, - 38, + 14, + 18, ], - "type": "VariableDeclaration", + "type": "FunctionExpression", }, - Object { - "label": null, + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 45, + "column": 24, "line": 1, }, "start": Object { - "column": 39, + "column": 23, "line": 1, }, }, + "name": "b", "range": Array [ - 39, - 45, + 23, + 24, ], - "type": "BreakStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 18, - 45, - ], - "test": Object { + "kind": "set", "loc": Object { "end": Object { - "column": 25, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 19, "line": 1, }, }, "range": Array [ - 23, - 25, + 19, + 29, ], - "raw": "42", - "type": "Literal", - "value": 42, + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 24, + 29, + ], + "type": "FunctionExpression", + }, }, - "type": "SwitchCase", - }, - ], - "discriminant": Object { + ], "loc": Object { "end": Object { - "column": 14, + "column": 31, "line": 1, }, "start": Object { @@ -7399,16 +6742,33 @@ Object { "line": 1, }, }, - "name": "answer", "range": Array [ 8, - 14, + 31, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 47, + "column": 31, "line": 1, }, "start": Object { @@ -7418,15 +6778,33 @@ Object { }, "range": Array [ 0, - 47, + 31, ], - "type": "SwitchStatement", + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 32, + "line": 1, }, "start": Object { "column": 0, @@ -7435,14 +6813,14 @@ Object { }, "range": Array [ 0, - 48, + 32, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 5, "line": 1, }, "start": Object { @@ -7452,28 +6830,64 @@ Object { }, "range": Array [ 0, - 6, + 5, ], "type": "Keyword", - "value": "switch", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 1, }, "start": Object { - "column": 7, + "column": 6, "line": 1, }, }, "range": Array [ + 6, 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "get", }, Object { "loc": Object { @@ -7482,16 +6896,16 @@ Object { "line": 1, }, "start": Object { - "column": 8, + "column": 13, "line": 1, }, }, "range": Array [ - 8, + 13, 14, ], "type": "Identifier", - "value": "answer", + "value": "a", }, Object { "loc": Object { @@ -7509,6 +6923,24 @@ Object { 15, ], "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", "value": ")", }, Object { @@ -7532,236 +6964,236 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 18, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 18, - 22, ], - "type": "Keyword", - "value": "case", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 22, "line": 1, }, "start": Object { - "column": 23, + "column": 19, "line": 1, }, }, "range": Array [ - 23, - 25, + 19, + 22, ], - "type": "Numeric", - "value": "42", + "type": "Identifier", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 24, "line": 1, }, "start": Object { - "column": 25, + "column": 23, "line": 1, }, }, "range": Array [ - 25, - 26, + 23, + 24, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 25, "line": 1, }, "start": Object { - "column": 27, + "column": 24, "line": 1, }, }, "range": Array [ - 27, - 30, + 24, + 25, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { - "column": 31, + "column": 25, "line": 1, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "Identifier", - "value": "t", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 27, "line": 1, }, "start": Object { - "column": 33, + "column": 26, "line": 1, }, }, "range": Array [ - 33, - 34, + 26, + 27, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 28, "line": 1, }, "start": Object { - "column": 35, + "column": 27, "line": 1, }, }, "range": Array [ - 35, - 37, + 27, + 28, ], - "type": "Numeric", - "value": "42", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 29, "line": 1, }, "start": Object { - "column": 37, + "column": 28, "line": 1, }, }, "range": Array [ - 37, - 38, + 28, + 29, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 30, "line": 1, }, "start": Object { - "column": 39, + "column": 29, "line": 1, }, }, "range": Array [ - 39, - 44, + 29, + 30, ], - "type": "Keyword", - "value": "break", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 31, "line": 1, }, "start": Object { - "column": 44, + "column": 30, "line": 1, }, }, "range": Array [ - 44, - 45, + 30, + 31, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 32, "line": 1, }, "start": Object { - "column": 46, + "column": 31, "line": 1, }, }, "range": Array [ - 46, - 47, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/classes/class-accessor-properties.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-computed-static-method.src 1`] = ` Object { "body": Array [ Object { "body": Object { "body": Array [ Object { - "computed": false, + "computed": true, "key": Object { "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 1, }, "start": Object { - "column": 13, + "column": 17, "line": 1, }, }, "name": "a", "range": Array [ - 13, - 14, + 17, + 18, ], "type": "Identifier", }, - "kind": "get", + "kind": "method", "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { @@ -7771,9 +7203,9 @@ Object { }, "range": Array [ 9, - 18, + 23, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -7781,17 +7213,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 18, + 21, + 23, ], "type": "BlockStatement", }, @@ -7800,115 +7232,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { - "column": 14, + "column": 19, "line": 1, }, }, "params": Array [], "range": Array [ - 14, - 18, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "b", - "range": Array [ + 19, 23, - 24, - ], - "type": "Identifier", - }, - "kind": "set", - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 29, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 29, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 24, - 29, ], "type": "FunctionExpression", }, @@ -7916,7 +7251,7 @@ Object { ], "loc": Object { "end": Object { - "column": 31, + "column": 25, "line": 1, }, "start": Object { @@ -7926,7 +7261,7 @@ Object { }, "range": Array [ 8, - 31, + 25, ], "type": "ClassBody", }, @@ -7950,7 +7285,7 @@ Object { }, "loc": Object { "end": Object { - "column": 31, + "column": 25, "line": 1, }, "start": Object { @@ -7960,7 +7295,7 @@ Object { }, "range": Array [ 0, - 31, + 25, ], "superClass": null, "type": "ClassDeclaration", @@ -7968,24 +7303,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { - "column": 31, + "column": 25, "line": 1, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { @@ -7995,7 +7330,7 @@ Object { }, "range": Array [ 0, - 32, + 26, ], "sourceType": "script", "tokens": Array [ @@ -8056,7 +7391,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 15, "line": 1, }, "start": Object { @@ -8066,64 +7401,10 @@ Object { }, "range": Array [ 9, - 12, - ], - "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ 15, - 16, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { @@ -8141,7 +7422,7 @@ Object { 17, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { @@ -8158,59 +7439,41 @@ Object { 17, 18, ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 22, - ], "type": "Identifier", - "value": "set", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 19, "line": 1, }, "start": Object { - "column": 23, + "column": 18, "line": 1, }, }, "range": Array [ - 23, - 24, + 18, + 19, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 20, "line": 1, }, "start": Object { - "column": 24, + "column": 19, "line": 1, }, }, "range": Array [ - 24, - 25, + 19, + 20, ], "type": "Punctuator", "value": "(", @@ -8218,35 +7481,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - "value": "c", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, + "column": 21, "line": 1, }, "start": Object { - "column": 26, + "column": 20, "line": 1, }, }, "range": Array [ - 26, - 27, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -8254,17 +7499,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 22, "line": 1, }, "start": Object { - "column": 27, + "column": 21, "line": 1, }, }, "range": Array [ - 27, - 28, + 21, + 22, ], "type": "Punctuator", "value": "{", @@ -8272,17 +7517,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 28, + "column": 22, "line": 1, }, }, "range": Array [ - 28, - 29, + 22, + 23, ], "type": "Punctuator", "value": "}", @@ -8290,17 +7535,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 24, "line": 1, }, "start": Object { - "column": 29, + "column": 23, "line": 1, }, }, "range": Array [ - 29, - 30, + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -8308,17 +7553,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 25, "line": 1, }, "start": Object { - "column": 30, + "column": 24, "line": 1, }, }, "range": Array [ - 30, - 31, + 24, + 25, ], "type": "Punctuator", "value": "}", @@ -8326,17 +7571,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 26, "line": 1, }, "start": Object { - "column": 31, + "column": 25, "line": 1, }, }, "range": Array [ - 31, - 32, + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -8346,434 +7591,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-computed-static-method.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 23, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 23, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 19, - 23, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 25, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 25, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "EmptyStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - "value": "A", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 15, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/class-expression.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-expression.src 1`] = ` Object { "body": Array [ Object { @@ -88770,107 +87588,669 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/octalLiterals/invalid.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/octalLiterals/lowercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0o717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0o717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/octalLiterals/strict-uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "0O717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Numeric", + "value": "0O717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/octalLiterals/uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0O717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0O717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/regex/regexp-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo./", + "regex": Object { + "flags": "", + "pattern": "foo.", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, }, "start": Object { - "column": 7, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 45, - 46, + 0, + 3, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 7, + "line": 1, }, "start": Object { "column": 4, - "line": 7, + "line": 1, }, }, "range": Array [ - 51, - 54, + 4, + 7, ], "type": "Identifier", - "value": "get", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 9, + "line": 1, }, "start": Object { - "column": 7, - "line": 7, + "column": 8, + "line": 1, }, }, "range": Array [ - 54, - 55, + 8, + 9, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 16, + "line": 1, }, "start": Object { - "column": 4, - "line": 8, + "column": 10, + "line": 1, }, }, "range": Array [ - 60, - 63, + 10, + 16, ], - "type": "Identifier", - "value": "set", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 9, - }, + "regex": Object { + "flags": "", + "pattern": "foo.", }, - "range": Array [ - 64, - 65, - ], - "type": "Punctuator", - "value": "}", + "type": "RegularExpression", + "value": "/foo./", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 17, + "line": 1, }, "start": Object { - "column": 1, - "line": 9, + "column": 16, + "line": 1, }, }, "range": Array [ - 65, - 66, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -88880,34 +88260,74 @@ Object { } `; -exports[`ecmaFeatures fixtures/octalLiterals/invalid.src 1`] = `"';' expected."`; - -exports[`ecmaFeatures fixtures/octalLiterals/lowercase.src 1`] = ` +exports[`ecmaFeatures fixtures/regexUFlag/regex-u-extended-escape.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", }, - "start": Object { - "column": 0, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 40, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 0, - 5, - ], - "raw": "0o717", - "type": "Literal", - "value": 463, - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 6, + "column": 41, "line": 1, }, "start": Object { @@ -88917,9 +88337,9 @@ Object { }, "range": Array [ 0, - 6, + 41, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { @@ -88934,14 +88354,14 @@ Object { }, "range": Array [ 0, - 7, + 42, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -88951,114 +88371,178 @@ Object { }, "range": Array [ 0, - 5, + 3, ], - "type": "Numeric", - "value": "0o717", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 5, "line": 1, }, "start": Object { - "column": 5, + "column": 4, "line": 1, }, }, "range": Array [ + 4, 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ 6, + 7, ], "type": "Punctuator", - "value": ";", + "value": "=", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/octalLiterals/strict-uppercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, }, - "range": Array [ - 0, - 12, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", }, + "type": "RegularExpression", + "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + }, + Object { "loc": Object { "end": Object { - "column": 13, + "column": 41, "line": 1, }, "start": Object { - "column": 0, + "column": 40, "line": 1, }, }, "range": Array [ - 0, - 13, + 40, + 41, ], - "type": "ExpressionStatement", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/regexUFlag/regex-u-simple.src 1`] = ` +Object { + "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", }, - "start": Object { - "column": 0, - "line": 2, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo/u", + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 14, - 19, - ], - "raw": "0O717", - "type": "Literal", - "value": 463, - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 14, - 20, + 0, + 17, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 2, }, "start": Object { "column": 0, @@ -89067,14 +88551,14 @@ Object { }, "range": Array [ 0, - 21, + 18, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 12, + "column": 3, "line": 1, }, "start": Object { @@ -89084,158 +88568,83 @@ Object { }, "range": Array [ 0, - 12, + 3, ], - "type": "String", - "value": "\\"use strict\\"", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 12, + "column": 4, "line": 1, }, }, "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 14, - 19, - ], - "type": "Numeric", - "value": "0O717", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 19, - 20, + 4, + 7, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "foo", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/octalLiterals/uppercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "raw": "0O717", - "type": "Literal", - "value": 463, - }, "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { - "column": 0, + "column": 8, "line": 1, }, }, "range": Array [ - 0, - 6, + 8, + 9, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "=", }, - }, - "range": Array [ - 0, - 7, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 16, "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 5, + 10, + 16, ], - "type": "Numeric", - "value": "0O717", + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "RegularExpression", + "value": "/foo/u", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 17, "line": 1, }, "start": Object { - "column": 5, + "column": 16, "line": 1, }, }, "range": Array [ - 5, - 6, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -89245,7 +88654,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/regex/regexp-simple.src 1`] = ` +exports[`ecmaFeatures fixtures/regexYFlag/regexp-y-simple.src 1`] = ` Object { "body": Array [ Object { @@ -89284,10 +88693,10 @@ Object { 10, 16, ], - "raw": "/foo./", + "raw": "/foo/y", "regex": Object { - "flags": "", - "pattern": "foo.", + "flags": "y", + "pattern": "foo", }, "type": "Literal", "value": Object {}, @@ -89413,11 +88822,11 @@ Object { 16, ], "regex": Object { - "flags": "", - "pattern": "foo.", + "flags": "y", + "pattern": "foo", }, "type": "RegularExpression", - "value": "/foo./", + "value": "/foo/y", }, Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 8e417179fe4a..8b128845fa7d 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -28,12 +28,6 @@ const testFiles = shelljs.find(FIXTURES_DIR) .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)) .filter(filename => !(/error-|invalid-|globalReturn/.test(filename))); -const regexFilenames = [ - "regexYFlag/regexp-y-simple", - "regexUFlag/regex-u-simple", - "regexUFlag/regex-u-extended-escape" -]; - //------------------------------------------------------------------------------ // Tests //------------------------------------------------------------------------------ @@ -54,43 +48,9 @@ describe("ecmaFeatures", () => { errorOnUnknownASTType: true }; - if (regexFilenames.indexOf(filename) === -1) { - test(`fixtures/${filename}.src`, () => { - config.ecmaFeatures[feature] = true; - testUtils.createSnapshotTestBlock(code, config)(); - }); - return; - } - - /** - * Some regexp flags have different ASTs depending on the current node version, - * so we need to account for this in our test cases. - * - * NOTE: When running the tests for node v5, for example, the snapshots for node v6 - * are irrelevant. Therefore, in order to prevent Jest from marking them as obsolete - * (which would cause the tests to exit with code 1), we make use of `test.skip`. - */ - const nodeVersions = process.versions; - const nodeVersionParts = nodeVersions.node.split("."); - const nodeMajorVersion = parseInt(nodeVersionParts[0], 10); - const NODE_6_AND_ABOVE = `REGEXP FLAG - NODE VERSION >=6: fixtures/${filename}.src`; - const NODE_PRE_6 = `REGEXP FLAG - NODE VERSION <6: fixtures/${filename}.src`; - - if (nodeMajorVersion >= 6) { - test.skip(NODE_PRE_6); - test(NODE_6_AND_ABOVE, () => { - config.ecmaFeatures[feature] = true; - testUtils.createSnapshotTestBlock(code, config)(); - }); - } else { - test.skip(NODE_6_AND_ABOVE); - test(NODE_PRE_6, () => { - config.ecmaFeatures[feature] = true; - testUtils.createSnapshotTestBlock(code, config)(); - }); - } - + test(`fixtures/${filename}.src`, () => { + config.ecmaFeatures[feature] = true; + testUtils.createSnapshotTestBlock(code, config)(); + }); }); - - }); From 853a06f6791c7a64ea48775461a4de69cdbf12cc Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 3 Jun 2018 22:27:17 -0400 Subject: [PATCH 255/326] Build: changelog update for 16.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 35b7c5ecf433..3d2dea0989b8 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v16.0.0 - June 3, 2018 + +* 009336d Breaking: Set minimum node version to 6 (#481) (James Henry) +* 9316b23 Breaking: Support TypeScript 2.9 (#480) (James Henry) + v15.0.1 - June 3, 2018 * 891cee9 Fix: decorators removed on interface declarations (fixes #478) (#479) (Muhanad Rabie) From 2ba5dcc30440d177288a2fbf73ae137c1e8ff026 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sun, 3 Jun 2018 22:27:17 -0400 Subject: [PATCH 256/326] 16.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 1c253a41b9b9..85649eee6474 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "15.0.1", + "version": "16.0.0", "files": [ "lib", "parser.js" From 86a60f1700e18c339a0e213bb94f0d00670a9939 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 10 Jun 2018 19:05:31 -0400 Subject: [PATCH 257/326] Chore: Powerful integration tests and improved README (#483) --- .../typescript-eslint-parser/.eslintignore | 1 + packages/typescript-eslint-parser/.travis.yml | 9 +- packages/typescript-eslint-parser/README.md | 75 +- .../typescript-eslint-parser/package.json | 4 +- .../tests/integration/.eslintrc.yml | 2 - .../.eslintrc.yml | 6 + .../Dockerfile | 22 + .../expected-lint-output.json | 214 ++++++ .../index.ts} | 0 .../package.json | 13 + .../tests/integration/docker-compose.yml | 52 ++ .../integration/from-babel-eslint.spec.js | 710 ------------------ .../tests/integration/jest.config.js | 5 - .../jsdoc-indent-issues-344-422/.eslintrc.yml | 7 + .../jsdoc-indent-issues-344-422/Dockerfile | 22 + .../expected-lint-output.json | 1 + .../index.ts} | 0 .../jsdoc-indent-issues-344-422/package.json | 13 + .../method-overloads-issue-389/.eslintrc.yml | 11 + .../method-overloads-issue-389/Dockerfile | 22 + .../expected-lint-output.json | 1 + .../method-overloads-issue-389/index.ts | 7 + .../method-overloads-issue-389/package.json | 13 + .../.eslintrc.yml | 7 + .../Dockerfile | 22 + .../expected-lint-output.json | 1 + .../index.ts} | 0 .../package.json | 13 + .../.eslintrc.yml | 7 + .../range-error-indent-issue-333/Dockerfile | 22 + .../expected-lint-output.json | 1 + .../index.ts} | 0 .../range-error-indent-issue-333/package.json | 13 + .../tests/integration/typescript.spec.js | 210 ------ .../tests/integration/utils.js | 104 --- 35 files changed, 555 insertions(+), 1055 deletions(-) create mode 100644 packages/typescript-eslint-parser/.eslintignore delete mode 100644 packages/typescript-eslint-parser/tests/integration/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/Dockerfile create mode 100644 packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/expected-lint-output.json rename packages/typescript-eslint-parser/tests/integration/{external-fixtures/declared-empty-body-functions.js => declared-empty-body-functions-issue-162/index.ts} (100%) create mode 100644 packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json create mode 100644 packages/typescript-eslint-parser/tests/integration/docker-compose.yml delete mode 100644 packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js delete mode 100644 packages/typescript-eslint-parser/tests/integration/jest.config.js create mode 100644 packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/Dockerfile create mode 100644 packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/expected-lint-output.json rename packages/typescript-eslint-parser/tests/integration/{external-fixtures/jsdoc-indent.js => jsdoc-indent-issues-344-422/index.ts} (100%) create mode 100644 packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json create mode 100644 packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/Dockerfile create mode 100644 packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/expected-lint-output.json create mode 100644 packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/index.ts create mode 100644 packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json create mode 100644 packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/Dockerfile create mode 100644 packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/expected-lint-output.json rename packages/typescript-eslint-parser/tests/integration/{external-fixtures/no-redeclare-overloaded-functions.js => no-redeclare-overloaded-functions-issue-402/index.ts} (100%) create mode 100644 packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json create mode 100644 packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/.eslintrc.yml create mode 100644 packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/Dockerfile create mode 100644 packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/expected-lint-output.json rename packages/typescript-eslint-parser/tests/integration/{external-fixtures/range-error-indent.js => range-error-indent-issue-333/index.ts} (100%) create mode 100644 packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json delete mode 100644 packages/typescript-eslint-parser/tests/integration/typescript.spec.js delete mode 100644 packages/typescript-eslint-parser/tests/integration/utils.js diff --git a/packages/typescript-eslint-parser/.eslintignore b/packages/typescript-eslint-parser/.eslintignore new file mode 100644 index 000000000000..da86dd0097ea --- /dev/null +++ b/packages/typescript-eslint-parser/.eslintignore @@ -0,0 +1 @@ +tests/integration/* \ No newline at end of file diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index 4a6efadd3d83..c3bda60d54e6 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -1,8 +1,15 @@ +sudo: required + +services: + - docker + language: node_js -sudo: false + node_js: - "6" - "8" - "9" + - "10" + after_success: - npm run coveralls diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 484da02c3caf..e4dce3c3a704 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -2,54 +2,87 @@ A parser that converts TypeScript source code into an [ESTree](https://github.com/estree/estree)-compatible form. -**Important:** This parser is not fully compatible with all ESLint rules and plugins. Some rules will improperly mark source code as failing or not find problems where it should. +## Usage -## Supported TypeScript Version +This parser is actually somewhat generic and robust - it could be used to power any use-case which requires taking TypeScript source code and producing an ESTree-compatiable AST. -We will always endeavor to support the latest stable version of TypeScript. +In fact, that is exactly what it is used for in the popular open-source code formatter, [Prettier](https://prettier.io), to power its TypeScript support. -The version of TypeScript currently supported by this parser is `~2.9.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +Nevertheless, the parser does have a special appreciation for ESLint-specific use-cases built in, and can even produce a slightly different AST for ESLint if needed (using the special `parseForESLint()` method). -If you use a non-supported version of TypeScript, the parser will log a warning to the console. +The majority of users of this parser use it to enable them to use ESLint on their TypeScript source files, so they will not actually be interacting with the parser directly. Instead they will configure ESLint to use it instead of its default parser, [espree](https://github.com/eslint/espree), which does not understand TypeScript. -**Please ensure that you are using a supported version before submitting any issues/bug reports.** +## Usage with ESLint -## Known Issues +There is sometimes an incorrect assumption that the parser itself is what does everything necessary to facilitate the use of ESLint with TypeScript. In actuality, it is the combination of the parser _and_ one or more plugins which allow you to maximize your usage of ESLint with TypeScript. -The following ESLint rules will fail on acceptable code: - - no-undef [#416](https://github.com/eslint/typescript-eslint-parser/issues/416) - -The follow ESLint plugins have issues when used with this parser: - - eslint-plugin-import - - prefer-default-export - Will fail exports inside of Namespaces or Modules +For example, once this parser successfully produces an AST for the TypeScript source code, it might well contain some information which simply does not exist in a standard JavaScript context, such as the data for a TypeScript-specific construct, like an `interface`. -## Usage +The core rules built into ESLint, such as `indent` have no knowledge of such constructs, so it is impossible to expect them to work out of the box with them. + +Instead, you also need to make use of one more plugins which will add or extend rules with TypeScript-specific features. + +By far the most common case will be installing the [eslint-plugin-typescript](https://github.com/nzakas/eslint-plugin-typescript) plugin, but there are also other relevant options available such a [eslint-plugin-tslint](https://github.com/JamesHenry/eslint-plugin-tslint). Install: -``` -npm i typescript-eslint-parser --save-dev +```sh +npm install --save-dev typescript-eslint-parser ``` And in your ESLint configuration file: -``` +```json "parser": "typescript-eslint-parser" ``` +## Supported TypeScript Version + +We will always endeavor to support the latest stable version of TypeScript. + +The version of TypeScript currently supported by this parser is `~2.9.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. + +If you use a non-supported version of TypeScript, the parser will log a warning to the console. + +**Please ensure that you are using a supported version before submitting any issues/bug reports.** + ## Help Wanted! If you're familiar with TypeScript and ESLint, and you'd like to see this project progress, please consider contributing. We need people with a good knowledge of TypeScript to ensure this parser is useful. -## Reporting Bugs +## Reporting Issues -Please check the current list of open and known issues and ensure the bug has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes: +The vast majority of issues which are submitted here are not actually parsing bugs at all. They are integration issues with the ESLint ecosystem. + +This is not ideal, but users need a place to be able to report those things, so it has become accepted that that will also be done in this repo. + +Please check the current list of open and known issues and ensure the issue has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes: - ESLint Version - TypeScript version - - TypeScript parser version + - The `typescript-eslint-parser` version - ESLint config or rules and plugins currently enabled -As well include a small code sample that can be used to reproduce the issue. +## Integration Tests + +We have a very flexible way of running integration tests which connects all of the moving parts of the usage of this parser in the ESLint ecosystem. + +We run each test within its own docker container, and so each one has complete autonomy over what dependencies/plugins are installed and what versions are used. This also has the benefit of not bloating the `package.json` and `node_modules` of the parser project itself. + +> If you are going to submit an issue related to the usage of this parser with ESLint, please consider creating a failing integration which clearly demonstrates the behavior. It's honestly super quick! + +You just need to duplicate on of the existing test sub-directories found in `tests/integration/`, tweak the dependencies and ESLint config to match what you need, and add a new entry to the docker-compose.yml file which matches the format of the existing ones. + +Then run: + +```sh +npm run integration-tests +``` + +If you ever need to change what gets installed when the docker images are built by docker-compose, you will first need to kill the existing containers by running: + +```sh +npm run kill-integration-test-containers +``` ## Contributing diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 85649eee6474..999e8e7d456e 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -20,7 +20,6 @@ "devDependencies": { "babel-code-frame": "6.26.0", "babylon": "7.0.0-beta.39", - "dedent": "0.7.0", "eslint": "4.19.1", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "6.0.1", @@ -46,7 +45,8 @@ "test": "node Makefile.js test && npm run integration-tests && npm run ast-alignment-tests", "jest": "jest", "ast-alignment-tests": "jest --config=./tests/ast-alignment/jest.config.js", - "integration-tests": "jest --config=./tests/integration/jest.config.js", + "integration-tests": "docker-compose -f tests/integration/docker-compose.yml up", + "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", "lint": "node Makefile.js lint", "release": "eslint-release", "ci-release": "eslint-ci-release", diff --git a/packages/typescript-eslint-parser/tests/integration/.eslintrc.yml b/packages/typescript-eslint-parser/tests/integration/.eslintrc.yml deleted file mode 100644 index e19b2cfa824a..000000000000 --- a/packages/typescript-eslint-parser/tests/integration/.eslintrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -env: - jest: true diff --git a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/.eslintrc.yml b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/.eslintrc.yml new file mode 100644 index 000000000000..55c93368bf5d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/.eslintrc.yml @@ -0,0 +1,6 @@ +root: true + +# typescript-eslint-parser +parser: /usr/parser/parser.js + +extends: eslint:all diff --git a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/Dockerfile b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/Dockerfile new file mode 100644 index 000000000000..37142ae38ab6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/Dockerfile @@ -0,0 +1,22 @@ +FROM node:carbon + +# Copy the package.json into the container so that we can +# run the install. Every other file will be linked, rather +# than copied to allow for changes without rebuilds +WORKDIR /usr +COPY ./package.json /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const expectedLintOutput = require('./linked/expected-lint-output.json');\n" \ + "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toEqual(expectedLintOutput);\n" \ + "});\n" > test.js + +# Install dependencies +RUN npm install + +# Run ESLint and assert that the output matches our expectations +CMD [ "npm", "start" ] diff --git a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/expected-lint-output.json b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/expected-lint-output.json new file mode 100644 index 000000000000..39dd864369e0 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/expected-lint-output.json @@ -0,0 +1,214 @@ +[{ + "filePath": "/usr/linked/index.ts", + "messages": [{ + "ruleId": "strict", + "severity": 2, + "message": "Use the function form of 'use strict'.", + "line": 1, + "column": 1, + "nodeType": "ExpressionStatement", + "source": "\"use strict\";", + "endLine": 1, + "endColumn": 14 + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'FF' is not defined.", + "line": 3, + "column": 19, + "nodeType": "Identifier", + "source": "declare namespace FF {", + "endLine": 3, + "endColumn": 21 + }, { + "ruleId": "no-unused-vars", + "severity": 2, + "message": "'Foo' is defined but never used.", + "line": 4, + "column": 11, + "nodeType": "Identifier", + "source": " class Foo extends Bar.Baz {", + "endLine": 4, + "endColumn": 14 + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'Bar' is not defined.", + "line": 4, + "column": 23, + "nodeType": "Identifier", + "source": " class Foo extends Bar.Baz {", + "endLine": 4, + "endColumn": 26 + }, { + "ruleId": "padded-blocks", + "severity": 2, + "message": "Block must be padded by blank lines.", + "line": 4, + "column": 31, + "nodeType": "ClassBody", + "source": " class Foo extends Bar.Baz {", + "fix": { + "range": [69, 69], + "text": "\n" + } + }, { + "ruleId": "padded-blocks", + "severity": 2, + "message": "Block must be padded by blank lines.", + "line": 6, + "column": 5, + "nodeType": "ClassBody", + "source": " }", + "fix": { + "range": [94, 94], + "text": "\n" + } + }, { + "ruleId": "no-redeclare", + "severity": 2, + "message": "'Foo' is already defined.", + "line": 10, + "column": 11, + "nodeType": "Identifier", + "source": " class Foo extends Bar.Baz {", + "endLine": 10, + "endColumn": 14 + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'Bar' is not defined.", + "line": 10, + "column": 23, + "nodeType": "Identifier", + "source": " class Foo extends Bar.Baz {", + "endLine": 10, + "endColumn": 26 + }, { + "ruleId": "padded-blocks", + "severity": 2, + "message": "Block must be padded by blank lines.", + "line": 10, + "column": 31, + "nodeType": "ClassBody", + "source": " class Foo extends Bar.Baz {", + "fix": { + "range": [152, 152], + "text": "\n" + } + }, { + "ruleId": "padded-blocks", + "severity": 2, + "message": "Block must be padded by blank lines.", + "line": 12, + "column": 5, + "nodeType": "ClassBody", + "source": " }", + "fix": { + "range": [177, 177], + "text": "\n" + } + }, { + "ruleId": "no-redeclare", + "severity": 2, + "message": "'Foo' is already defined.", + "line": 15, + "column": 15, + "nodeType": "Identifier", + "source": "declare class Foo extends Bar.Baz {", + "endLine": 15, + "endColumn": 18 + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'Bar' is not defined.", + "line": 15, + "column": 27, + "nodeType": "Identifier", + "source": "declare class Foo extends Bar.Baz {", + "endLine": 15, + "endColumn": 30 + }, { + "ruleId": "padded-blocks", + "severity": 2, + "message": "Block must be padded by blank lines.", + "line": 15, + "column": 35, + "nodeType": "ClassBody", + "source": "declare class Foo extends Bar.Baz {", + "fix": { + "range": [217, 217], + "text": "\n" + } + }, { + "ruleId": "padded-blocks", + "severity": 2, + "message": "Block must be padded by blank lines.", + "line": 17, + "column": 1, + "nodeType": "ClassBody", + "source": "}", + "fix": { + "range": [234, 234], + "text": "\n" + } + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'d3' is not defined.", + "line": 19, + "column": 19, + "nodeType": "Identifier", + "source": "declare namespace d3 {", + "endLine": 19, + "endColumn": 21 + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'select' is not defined.", + "line": 20, + "column": 21, + "nodeType": "Identifier", + "source": " export function select(selector: string): Selection;", + "endLine": 20, + "endColumn": 27 + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'selector' is not defined.", + "line": 20, + "column": 28, + "nodeType": "Identifier", + "source": " export function select(selector: string): Selection;", + "endLine": 20, + "endColumn": 44 + }, { + "ruleId": "no-undef", + "severity": 2, + "message": "'Selection' is not defined.", + "line": 20, + "column": 47, + "nodeType": "Identifier", + "source": " export function select(selector: string): Selection;", + "endLine": 20, + "endColumn": 56 + }, { + "ruleId": "eol-last", + "severity": 2, + "message": "Newline required at end of file but not found.", + "line": 21, + "column": 2, + "nodeType": "Program", + "source": "}", + "messageId": "missing", + "fix": { + "range": [323, 323], + "text": "\n" + } + }], + "errorCount": 19, + "warningCount": 0, + "fixableErrorCount": 7, + "fixableWarningCount": 0, + "source": "\"use strict\";\n\ndeclare namespace FF {\n class Foo extends Bar.Baz {\n far(): any;\n }\n}\n\ndeclare module \"FF\" {\n class Foo extends Bar.Baz {\n far(): any;\n }\n}\n\ndeclare class Foo extends Bar.Baz {\n far(): any;\n}\n\ndeclare namespace d3 {\n export function select(selector: string): Selection;\n}" +}] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/declared-empty-body-functions.js b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/index.ts similarity index 100% rename from packages/typescript-eslint-parser/tests/integration/external-fixtures/declared-empty-body-functions.js rename to packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/index.ts diff --git a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json new file mode 100644 index 000000000000..6881c7361e35 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json @@ -0,0 +1,13 @@ +{ + "private": true, + "scripts": { + "start": "npm run lint && npm run test", + "lint": "eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.ts || true", + "test": "jest ./test.js" + }, + "devDependencies": { + "eslint": "4.19.1", + "jest": "23.1.0", + "typescript": "~2.9.1" + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/docker-compose.yml b/packages/typescript-eslint-parser/tests/integration/docker-compose.yml new file mode 100644 index 000000000000..e987e756869a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/docker-compose.yml @@ -0,0 +1,52 @@ +version: '3' + +services: + range-error-indent-issue-333: + build: ./range-error-indent-issue-333 + container_name: "range-error-indent-issue-333" + volumes: + # link to all the integration test files, so that updates don't require a rebuild + - ./range-error-indent-issue-333:/usr/linked + # link to parser source, but "ignore" tests (by overriding it with an empty dir) + - ../../:/usr/parser + - /usr/parser/tests + + no-redeclare-overloaded-functions-issue-402: + build: ./no-redeclare-overloaded-functions-issue-402 + container_name: "no-redeclare-overloaded-functions-issue-402" + volumes: + # link to all the integration test files, so that updates don't require a rebuild + - ./no-redeclare-overloaded-functions-issue-402:/usr/linked + # link to parser source, but "ignore" tests (by overriding it with an empty dir) + - ../../:/usr/parser + - /usr/parser/tests + + declared-empty-body-functions-issue-162: + build: ./declared-empty-body-functions-issue-162 + container_name: "declared-empty-body-functions-issue-162" + volumes: + # link to all the integration test files, so that updates don't require a rebuild + - ./declared-empty-body-functions-issue-162:/usr/linked + # link to parser source, but "ignore" tests (by overriding it with an empty dir) + - ../../:/usr/parser + - /usr/parser/tests + + jsdoc-indent-issues-344-422: + build: ./jsdoc-indent-issues-344-422 + container_name: "jsdoc-indent-issues-344-422" + volumes: + # link to all the integration test files, so that updates don't require a rebuild + - ./jsdoc-indent-issues-344-422:/usr/linked + # link to parser source, but "ignore" tests (by overriding it with an empty dir) + - ../../:/usr/parser + - /usr/parser/tests + + method-overloads-issue-389: + build: ./method-overloads-issue-389 + container_name: "method-overloads-issue-389" + volumes: + # link to all the integration test files, so that updates don't require a rebuild + - ./method-overloads-issue-389:/usr/linked + # link to parser source, but "ignore" tests (by overriding it with an empty dir) + - ../../:/usr/parser + - /usr/parser/tests diff --git a/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js b/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js deleted file mode 100644 index 51449facfe8c..000000000000 --- a/packages/typescript-eslint-parser/tests/integration/from-babel-eslint.spec.js +++ /dev/null @@ -1,710 +0,0 @@ -/** - * LICENCE from babel-eslint - */ -// Copyright (c) 2014-2016 Sebastian McKenzie - -// MIT License - -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: - -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -"use strict"; - -const unpad = require("dedent"); - -const utils = require("./utils"); -const verifyAndAssertMessages = utils.verifyAndAssertMessages; - -describe("Non-regression tests from babel-eslint", () => { - it("arrow function support", () => { - verifyAndAssertMessages("describe('stuff', () => {});", {}, []); - }); - - it("EOL validation", () => { - verifyAndAssertMessages( - "module.exports = \"something\";", - { "eol-last": 1, semi: 1 }, - ["1:30 Newline required at end of file but not found. eol-last"] - ); - }); - - it("Modules support", () => { - verifyAndAssertMessages( - unpad(` - import Foo from 'foo'; - export default Foo; - export const c = 'c'; - export class Store {} - `), - {}, - [], - "module" - ); - }); - - it("Rest parameters", () => { - verifyAndAssertMessages( - "function foo(...args) { return args; }", - { "no-undef": 1 }, - [] - ); - }); - - it("Exported classes should be used", () => { - verifyAndAssertMessages( - "class Foo {} module.exports = Foo;", - { "no-unused-vars": 1 }, - [] - ); - }); - - it("super keyword in class", () => { - verifyAndAssertMessages( - "class Foo { constructor() { super() } }", - { "no-undef": 1 }, - [] - ); - }); - - it("Rest parameter in destructuring assignment", () => { - verifyAndAssertMessages( - "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", - { "no-undef": 1 }, - [], - "script", - { - envs: ["node"] - } - ); - }); - - it("JSX attribute names marked as variables", () => { - verifyAndAssertMessages( - "module.exports =
", - { "no-undef": 1 }, - [], - "script", - { - envs: ["node"] - } - ); - }); - - it("Multiple destructured assignment with compound properties", () => { - verifyAndAssertMessages( - "module.exports = { ...a.a, ...a.b };", - { "no-dupe-keys": 1 }, - [] - ); - }); - - it("Arrow function with non-block bodies", () => { - verifyAndAssertMessages( - "\"use strict\"; () => 1", - { strict: [1, "global"] }, - [], - "script" - ); - }); - - it("babel/babel-eslint#242", () => { - verifyAndAssertMessages( - "\"use strict\"; asdf;", - { "no-irregular-whitespace": 1 }, - [], - {} - ); - }); - - it("await keyword", () => { - verifyAndAssertMessages( - "async function foo() { await bar(); }", - { "no-unused-expressions": 1 }, - [] - ); - }); - - it("arrow functions", () => { - verifyAndAssertMessages( - "[1, 2, 3].map(i => i * 2);", - { "func-names": 1, "space-before-blocks": 1 }, - [] - ); - }); - - it("comment with padded-blocks", () => { - verifyAndAssertMessages( - unpad(` - if (a) { - // i'm a comment! - let b = c - } - `), - { "padded-blocks": [1, "never"] }, - [] - ); - }); - - it("class usage", () => { - verifyAndAssertMessages( - "class Lol {} module.exports = Lol;", - { "no-unused-vars": 1 }, - [] - ); - }); - - it("class definition: gaearon/redux#24", () => { - verifyAndAssertMessages( - unpad(` - export default function root(stores) { - return DecoratedComponent => class ReduxRootDecorator { - a() { DecoratedComponent; stores; } - }; - } - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] - ); - }); - - it("template strings", () => { - verifyAndAssertMessages( - "console.log(`${a}, b`);", - { "comma-spacing": 1 }, - [] - ); - }); - - it("template with destructuring", () => { - verifyAndAssertMessages( - unpad(` - module.exports = { - render() { - var {name} = this.props; - return Math.max(null, \`Name: \${name}, Name: \${name}\`); - } - }; - `), - { "comma-spacing": 1 }, - [] - ); - }); - - describe("decorators", () => { - // it("class declaration", () => { - // verifyAndAssertMessages( - // unpad(` - // import classDeclaration from 'decorator'; - // import decoratorParameter from 'decorator'; - // @classDeclaration((parameter) => parameter) - // @classDeclaration(decoratorParameter) - // @classDeclaration - // export class TextareaAutosize {} - // `), - // { "no-unused-vars": 1 }, - // [], - // "module" - // ); - // }); - - // it("method definition", () => { - // verifyAndAssertMessages( - // unpad(` - // import classMethodDeclarationA from 'decorator'; - // import decoratorParameter from 'decorator'; - // export class TextareaAutosize { - // @classMethodDeclarationA((parameter) => parameter) - // @classMethodDeclarationA(decoratorParameter) - // @classMethodDeclarationA - // methodDeclaration(e) { - // e(); - // } - // } - // `), - // { "no-unused-vars": 1 }, - // [] - // ); - // }); - - // it("method definition get/set", () => { - // verifyAndAssertMessages( - // unpad(` - // import classMethodDeclarationA from 'decorator'; - // import decoratorParameter from 'decorator'; - // export class TextareaAutosize { - // @classMethodDeclarationA((parameter) => parameter) - // @classMethodDeclarationA(decoratorParameter) - // @classMethodDeclarationA - // get bar() { } - // @classMethodDeclarationA((parameter) => parameter) - // @classMethodDeclarationA(decoratorParameter) - // @classMethodDeclarationA - // set bar(val) { val; } - // } - // `), - // { "no-unused-vars": 1 }, - // [] - // ); - // }); - - // it("object property", () => { - // verifyAndAssertMessages( - // unpad(` - // import classMethodDeclarationA from 'decorator'; - // import decoratorParameter from 'decorator'; - // var obj = { - // @classMethodDeclarationA((parameter) => parameter) - // @classMethodDeclarationA(decoratorParameter) - // @classMethodDeclarationA - // methodDeclaration(e) { - // e(); - // } - // }; - // obj; - // `), - // { "no-unused-vars": 1 }, - // [] - // ); - // }); - - // it("object property get/set", () => { - // verifyAndAssertMessages( - // unpad(` - // import classMethodDeclarationA from 'decorator'; - // import decoratorParameter from 'decorator'; - // var obj = { - // @classMethodDeclarationA((parameter) => parameter) - // @classMethodDeclarationA(decoratorParameter) - // @classMethodDeclarationA - // get bar() { }, - // @classMethodDeclarationA((parameter) => parameter) - // @classMethodDeclarationA(decoratorParameter) - // @classMethodDeclarationA - // set bar(val) { val; } - // }; - // obj; - // `), - // { "no-unused-vars": 1 }, - // [] - // ); - // }); - }); - - it("detects minimal no-unused-vars case", () => { - verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ - "1:5 'unused' is defined but never used. no-unused-vars" - ]); - }); - - // This two tests are disabled, as the feature to visit properties when - // there is a spread/rest operator has been removed as it caused problems - // with other rules - it.skip("visits excluded properties left of spread", () => { - verifyAndAssertMessages( - "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-unused-vars": 1 }, - [] - ); - }); - - it.skip("visits excluded properties left of spread", () => { - verifyAndAssertMessages( - "const props = { yo: 'yo' }; const { ...otherProps } = props;", - { "no-unused-vars": 1 }, - [] - ); - }); - - it("does not mark spread variables false-positive", () => { - verifyAndAssertMessages( - "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-undef": 1, "no-redeclare": 1 }, - [] - ); - }); - - it("does not mark spread variables false-positive", () => { - verifyAndAssertMessages( - "const props = { yo: 'yo' }; const { ...otherProps } = props;", - { "no-undef": 1, "no-redeclare": 1 }, - [] - ); - }); - - it("does not mark spread variables as use-before-define", () => { - verifyAndAssertMessages( - "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-use-before-define": 1 }, - [] - ); - }); - - it("detects no-unused-vars with object destructuring", () => { - verifyAndAssertMessages( - "const {Bacona} = require('baconjs')", - { "no-undef": 1, "no-unused-vars": 1 }, - ["1:8 'Bacona' is assigned a value but never used. no-unused-vars"], - "script", - { - envs: ["node"] - } - ); - }); - - it("don't warn no-unused-vars with spread", () => { - verifyAndAssertMessages( - unpad(` - export default function test(data) { - return { - foo: 'bar', - ...data - }; - } - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] - ); - }); - - it("excludes comment tokens", () => { - verifyAndAssertMessages( - unpad(` - var a = [ - 1, - 2, // a trailing comment makes this line fail comma-dangle (always-multiline) - ]; - `), - { "comma-dangle": [2, "always-multiline"] }, - [] - ); - - verifyAndAssertMessages( - unpad(` - switch (a) { - // A comment here makes the above line fail brace-style - case 1: - console.log(a); - } - `), - { "brace-style": 2 }, - [] - ); - }); - - it("ternary and parens", () => { - verifyAndAssertMessages( - "true ? (true) : false;", - { "space-infix-ops": 1 }, - [] - ); - }); - - it("line comment space-in-parens", () => { - verifyAndAssertMessages( - unpad(` - React.createClass({ - render() { - // return ( - //
- // ); // <-- this is the line that is reported - } - }); - `), - { "space-in-parens": 1 }, - [] - ); - }); - - it("block comment space-in-parens", () => { - verifyAndAssertMessages( - unpad(` - React.createClass({ - render() { - /* - return ( -
- ); // <-- this is the line that is reported - */ - } - }); - `), - { "space-in-parens": 1 }, - [] - ); - }); - - it("no no-undef error with rest", () => { - verifyAndAssertMessages( - "const [a, ...rest] = ['1', '2', '3']; a; rest;", - { "no-undef": 1, "no-unused-vars": 1 }, - [] - ); - }); - - it("async function with space-before-function-paren", () => { - verifyAndAssertMessages( - "it('handles updates', async function() {});", - { "space-before-function-paren": [1, "never"] }, - [] - ); - }); - - it("no-use-before-define", () => { - verifyAndAssertMessages( - unpad(` - console.log(x); - var x = 1; - `), - { "no-use-before-define": 1 }, - ["1:13 'x' was used before it was defined. no-use-before-define"] - ); - }); - - it("jsx and stringliteral", () => { - verifyAndAssertMessages("
", {}, []); - }); - - it("getter/setter", () => { - verifyAndAssertMessages( - unpad(` - class Person { - set a (v) { } - } - `), - { - "space-before-function-paren": 1, - "keyword-spacing": [1, { before: true }], - indent: 1 - }, - [] - ); - }); - - it("getter/setter", () => { - verifyAndAssertMessages( - unpad(` - var B = { - get x () { - return this.ecks; - }, - set x (ecks) { - this.ecks = ecks; - } - }; - `), - { "no-dupe-keys": 1 }, - [] - ); - }); - - it("correctly detects redeclares if in script mode", () => { - verifyAndAssertMessages( - unpad(` - var a = 321; - var a = 123; - `), - { "no-redeclare": 1 }, - ["2:5 'a' is already defined. no-redeclare"], - "script" - ); - }); - - // it("correctly detects redeclares if in module mode", () => { - // verifyAndAssertMessages( - // unpad(` - // var a = 321; - // var a = 123; - // `), - // { "no-redeclare": 1 }, - // ["2:5 'a' is already defined. no-redeclare"], - // "module" - // ); - // }); - - it("no-implicit-globals in script", () => { - verifyAndAssertMessages( - "var leakedGlobal = 1;", - { "no-implicit-globals": 1 }, - [ - "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" - ], - "script", - { - env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "script" } - } - ); - }); - - // it("no-implicit-globals in module", () => { - // verifyAndAssertMessages( - // "var leakedGlobal = 1;", - // { "no-implicit-globals": 1 }, - // [], - // "module", - // { - // env: {}, - // parserOptions: { ecmaVersion: 6, sourceType: "module" } - // } - // ); - // }); - - // it("no-implicit-globals in default", () => { - // verifyAndAssertMessages( - // "var leakedGlobal = 1;", - // { "no-implicit-globals": 1 }, - // [], - // null, - // { - // env: {}, - // parserOptions: { ecmaVersion: 6 } - // } - // ); - // }); - - it("with does not crash parsing in script mode (strict off)", () => { - verifyAndAssertMessages("with (arguments) { length; }", {}, [], "script"); - }); - - // it("with does crash parsing in module mode (strict on)", () => { - // verifyAndAssertMessages("with (arguments) { length; }", {}, [ - // "1:1 Parsing error: 'with' in strict mode" - // ]); - // }); - - it("new.target is not reported as undef", () => { - verifyAndAssertMessages( - "function foo () { return new.target }", - { "no-undef": 1 }, - [] - ); - }); - - // it("decorator does not create TypeError", () => { - // verifyAndAssertMessages( - // unpad(` - // class A { - // @test - // f() {} - // } - // `), - // { "no-undef": 1 }, - // ["2:4 'test' is not defined. no-undef"] - // ); - // }); - - it("newline-before-return with comments", () => { - verifyAndAssertMessages( - unpad(` - function a() { - if (b) { - /* eslint-disable no-console */ - console.log('test'); - /* eslint-enable no-console */ - } - - return hasGlobal; - } - `), - { "newline-before-return": 1 }, - [] - ); - }); - - describe("Class Property Declarations", () => { - // it("no-redeclare false positive 1", () => { - // verifyAndAssertMessages( - // unpad(` - // class Group { - // static propTypes = {}; - // } - // class TypicalForm { - // static propTypes = {}; - // } - // `), - // { "no-redeclare": 1 }, - // [] - // ); - // }); - - // it("no-redeclare false positive 2", () => { - // verifyAndAssertMessages( - // unpad(` - // function validate() {} - // class MyComponent { - // static validate = validate; - // } - // `), - // { "no-redeclare": 1 }, - // [] - // ); - // }); - - // it("check references", () => { - // verifyAndAssertMessages( - // unpad(` - // var a; - // class A { - // prop1; - // prop2 = a; - // prop3 = b; - // } - // new A - // `), - // { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, - // ["5:11 'b' is not defined. no-undef"] - // ); - // }); - }); - - it("dynamic import support", () => { - verifyAndAssertMessages("import('test-module').then(() => {})", {}, []); - }); - - it("regex with es6 unicodeCodePointEscapes", () => { - verifyAndAssertMessages( - "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", - {}, - [] - ); - }); - - it("works with dynamicImport", () => { - verifyAndAssertMessages( - unpad(` - import('a'); - `), - {}, - [] - ); - }); - - it("works with optionalCatchBinding", () => { - verifyAndAssertMessages( - unpad(` - try {} catch {} - try {} catch {} finally {} - `), - {}, - [] - ); - }); -}); - diff --git a/packages/typescript-eslint-parser/tests/integration/jest.config.js b/packages/typescript-eslint-parser/tests/integration/jest.config.js deleted file mode 100644 index 76709269eaac..000000000000 --- a/packages/typescript-eslint-parser/tests/integration/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -module.exports = { - testRegex: ".*\\.spec\\.js$" -}; diff --git a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/.eslintrc.yml b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/.eslintrc.yml new file mode 100644 index 000000000000..fdf3f24a9ff3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/.eslintrc.yml @@ -0,0 +1,7 @@ +root: true + +# typescript-eslint-parser +parser: /usr/parser/parser.js + +rules: + indent: 2 diff --git a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/Dockerfile b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/Dockerfile new file mode 100644 index 000000000000..37142ae38ab6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/Dockerfile @@ -0,0 +1,22 @@ +FROM node:carbon + +# Copy the package.json into the container so that we can +# run the install. Every other file will be linked, rather +# than copied to allow for changes without rebuilds +WORKDIR /usr +COPY ./package.json /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const expectedLintOutput = require('./linked/expected-lint-output.json');\n" \ + "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toEqual(expectedLintOutput);\n" \ + "});\n" > test.js + +# Install dependencies +RUN npm install + +# Run ESLint and assert that the output matches our expectations +CMD [ "npm", "start" ] diff --git a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/expected-lint-output.json b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/expected-lint-output.json new file mode 100644 index 000000000000..f69db47a6f38 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/expected-lint-output.json @@ -0,0 +1 @@ +[{"filePath":"/usr/linked/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/index.ts similarity index 100% rename from packages/typescript-eslint-parser/tests/integration/external-fixtures/jsdoc-indent.js rename to packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/index.ts diff --git a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json new file mode 100644 index 000000000000..6881c7361e35 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json @@ -0,0 +1,13 @@ +{ + "private": true, + "scripts": { + "start": "npm run lint && npm run test", + "lint": "eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.ts || true", + "test": "jest ./test.js" + }, + "devDependencies": { + "eslint": "4.19.1", + "jest": "23.1.0", + "typescript": "~2.9.1" + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/.eslintrc.yml b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/.eslintrc.yml new file mode 100644 index 000000000000..0c55147878a5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/.eslintrc.yml @@ -0,0 +1,11 @@ +root: true + +# typescript-eslint-parser +parser: /usr/parser/parser.js + +rules: + array-callback-return: 2 + getter-return: 2 + strict: 2 + lines-around-directive: 2 + no-empty-function: 2 diff --git a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/Dockerfile b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/Dockerfile new file mode 100644 index 000000000000..37142ae38ab6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/Dockerfile @@ -0,0 +1,22 @@ +FROM node:carbon + +# Copy the package.json into the container so that we can +# run the install. Every other file will be linked, rather +# than copied to allow for changes without rebuilds +WORKDIR /usr +COPY ./package.json /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const expectedLintOutput = require('./linked/expected-lint-output.json');\n" \ + "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toEqual(expectedLintOutput);\n" \ + "});\n" > test.js + +# Install dependencies +RUN npm install + +# Run ESLint and assert that the output matches our expectations +CMD [ "npm", "start" ] diff --git a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/expected-lint-output.json b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/expected-lint-output.json new file mode 100644 index 000000000000..f69db47a6f38 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/expected-lint-output.json @@ -0,0 +1 @@ +[{"filePath":"/usr/linked/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/index.ts b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/index.ts new file mode 100644 index 000000000000..1d23c00eb095 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/index.ts @@ -0,0 +1,7 @@ +export class Test { + public test(param1: Number): Test; + public test(param1: Test): Test; + public test(param1: any): Test { + return new Test(); + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json new file mode 100644 index 000000000000..6881c7361e35 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json @@ -0,0 +1,13 @@ +{ + "private": true, + "scripts": { + "start": "npm run lint && npm run test", + "lint": "eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.ts || true", + "test": "jest ./test.js" + }, + "devDependencies": { + "eslint": "4.19.1", + "jest": "23.1.0", + "typescript": "~2.9.1" + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/.eslintrc.yml b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/.eslintrc.yml new file mode 100644 index 000000000000..3f2483ce9a81 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/.eslintrc.yml @@ -0,0 +1,7 @@ +root: true + +# typescript-eslint-parser +parser: /usr/parser/parser.js + +rules: + no-redeclare: 2 diff --git a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/Dockerfile b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/Dockerfile new file mode 100644 index 000000000000..37142ae38ab6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/Dockerfile @@ -0,0 +1,22 @@ +FROM node:carbon + +# Copy the package.json into the container so that we can +# run the install. Every other file will be linked, rather +# than copied to allow for changes without rebuilds +WORKDIR /usr +COPY ./package.json /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const expectedLintOutput = require('./linked/expected-lint-output.json');\n" \ + "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toEqual(expectedLintOutput);\n" \ + "});\n" > test.js + +# Install dependencies +RUN npm install + +# Run ESLint and assert that the output matches our expectations +CMD [ "npm", "start" ] diff --git a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/expected-lint-output.json b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/expected-lint-output.json new file mode 100644 index 000000000000..f69db47a6f38 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/expected-lint-output.json @@ -0,0 +1 @@ +[{"filePath":"/usr/linked/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/no-redeclare-overloaded-functions.js b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/index.ts similarity index 100% rename from packages/typescript-eslint-parser/tests/integration/external-fixtures/no-redeclare-overloaded-functions.js rename to packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/index.ts diff --git a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json new file mode 100644 index 000000000000..6881c7361e35 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json @@ -0,0 +1,13 @@ +{ + "private": true, + "scripts": { + "start": "npm run lint && npm run test", + "lint": "eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.ts || true", + "test": "jest ./test.js" + }, + "devDependencies": { + "eslint": "4.19.1", + "jest": "23.1.0", + "typescript": "~2.9.1" + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/.eslintrc.yml b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/.eslintrc.yml new file mode 100644 index 000000000000..fdf3f24a9ff3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/.eslintrc.yml @@ -0,0 +1,7 @@ +root: true + +# typescript-eslint-parser +parser: /usr/parser/parser.js + +rules: + indent: 2 diff --git a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/Dockerfile b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/Dockerfile new file mode 100644 index 000000000000..37142ae38ab6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/Dockerfile @@ -0,0 +1,22 @@ +FROM node:carbon + +# Copy the package.json into the container so that we can +# run the install. Every other file will be linked, rather +# than copied to allow for changes without rebuilds +WORKDIR /usr +COPY ./package.json /usr/ + +# Create file which will be executed by jest +# to assert that the lint output is what we expect +RUN echo "const expectedLintOutput = require('./linked/expected-lint-output.json');\n" \ + "const actualLintOutput = require('./lint-output.json');\n" \ + "\n" \ + "test('it should produce the expected lint ouput', () => {\n" \ + " expect(actualLintOutput).toEqual(expectedLintOutput);\n" \ + "});\n" > test.js + +# Install dependencies +RUN npm install + +# Run ESLint and assert that the output matches our expectations +CMD [ "npm", "start" ] diff --git a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/expected-lint-output.json b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/expected-lint-output.json new file mode 100644 index 000000000000..f69db47a6f38 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/expected-lint-output.json @@ -0,0 +1 @@ +[{"filePath":"/usr/linked/index.ts","messages":[],"errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0}] \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/external-fixtures/range-error-indent.js b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/index.ts similarity index 100% rename from packages/typescript-eslint-parser/tests/integration/external-fixtures/range-error-indent.js rename to packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/index.ts diff --git a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json new file mode 100644 index 000000000000..6881c7361e35 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json @@ -0,0 +1,13 @@ +{ + "private": true, + "scripts": { + "start": "npm run lint && npm run test", + "lint": "eslint --format json --output-file /usr/lint-output.json --config /usr/linked/.eslintrc.yml /usr/linked/**/*.ts || true", + "test": "jest ./test.js" + }, + "devDependencies": { + "eslint": "4.19.1", + "jest": "23.1.0", + "typescript": "~2.9.1" + } +} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js b/packages/typescript-eslint-parser/tests/integration/typescript.spec.js deleted file mode 100644 index c2a6f8043877..000000000000 --- a/packages/typescript-eslint-parser/tests/integration/typescript.spec.js +++ /dev/null @@ -1,210 +0,0 @@ -"use strict"; - -const unpad = require("dedent"); - -const utils = require("./utils"); -const verifyAndAssertMessages = utils.verifyAndAssertMessages; -const loadExternalFixture = utils.loadExternalFixture; - -describe("TypeScript", () => { - it("should fundamentally work with `eslint:all`", () => { - verifyAndAssertMessages( - unpad(` - "use strict"; - const foo: string = "bar"; - `), - {}, - ["2:7 'foo' is assigned a value but never used. no-unused-vars"], - "script", - { - baseConfig: { - extends: ["eslint:all"], - rules: { - "eol-last": "off" - } - } - } - ); - }); - - it("should not cause a RangeError within the indent rule (#333)", () => { - verifyAndAssertMessages( - loadExternalFixture("range-error-indent"), - { - indent: "error" - }, - [] - ); - }); - - it("should not throw in any rules on method overloads (#389)", () => { - verifyAndAssertMessages( - unpad(` - export class Test { - public test(param1: Number): Test; - public test(param1: Test): Test; - public test(param1: any): Test { - return new Test(); - } - } - `), - { - "array-callback-return": "error", - "getter-return": "error", - strict: "error", - "lines-around-directive": "error", - "no-empty-function": "error" - }, - [] - ); - }); - - it("should not throw in any rules on abstract class methods (#400)", () => { - verifyAndAssertMessages( - unpad(` - export abstract class TestAbstract { - onCreated?(): Promise | any; - } - export abstract class AbstractSocket { - abstract createSocket(): Promise; - } - `), - { - "array-callback-return": "error", - "getter-return": "error", - strict: "error", - "lines-around-directive": "error", - "no-empty-function": "error" - }, - [] - ); - }); - - it("should not produce any lint errors on valid JSDoc indentation (#344 & #422)", () => { - verifyAndAssertMessages( - loadExternalFixture("jsdoc-indent"), - { - indent: "error" - }, - [] - ); - }); - - it("should not produce a parse error (#403)", () => { - verifyAndAssertMessages( - unpad(` - class X { - data() { - return { - form: { - startDate: undefined - } - }; - } - } - `), - {}, - [], - "script", - { - parserOptions: { - jsx: false - } - } - ); - }); - - it("should not produce any lint errors for no-declare on overloaded functions (#402)", () => { - verifyAndAssertMessages( - loadExternalFixture("no-redeclare-overloaded-functions"), - { - "no-redeclare": "error" - }, - [] - ); - }); - - it("should not throw any TypeErrors when parsing declared empty body functions using eslint:all (#162)", () => { - verifyAndAssertMessages( - loadExternalFixture("declared-empty-body-functions"), - {}, - [ - "3:19 'FF' is not defined. no-undef", - "4:11 'Foo' is defined but never used. no-unused-vars", - "4:23 'Bar' is not defined. no-undef", - "4:31 Block must be padded by blank lines. padded-blocks", - "6:5 Block must be padded by blank lines. padded-blocks", - "10:11 'Foo' is already defined. no-redeclare", - "10:23 'Bar' is not defined. no-undef", - "10:31 Block must be padded by blank lines. padded-blocks", - "12:5 Block must be padded by blank lines. padded-blocks", - "15:15 'Foo' is already defined. no-redeclare", - "15:27 'Bar' is not defined. no-undef", - "15:35 Block must be padded by blank lines. padded-blocks", - "17:1 Block must be padded by blank lines. padded-blocks", - "19:19 'd3' is not defined. no-undef", - "20:21 'select' is not defined. no-undef", - "20:28 'selector' is not defined. no-undef", - "20:47 'Selection' is not defined. no-undef", - "21:2 Newline required at end of file but not found. eol-last" - ], - "script", - { - baseConfig: { - extends: ["eslint:all"] - } - } - ); - }); - - it("should correctly apply no-unreachable on TS-constructs (#127)", () => { - verifyAndAssertMessages( - unpad(` - export namespace foo { - export function bar() { - return; - } - } - export type Qux = true; - `), - { - "no-unreachable": 2 - }, - [] - ); - }); - - // it("should not produce a false positive for no-restricted-globals rule (#350)", () => { - // verifyAndAssertMessages( - // unpad(` - // type foo = { - // location: any; - // }; - // `), - // { - // "no-restricted-globals": [2, "location"] - // }, - // [] - // ); - // }); - - // it("should not throw a TypeError in the indent rule for invalid code (#309)", () => { - // verifyAndAssertMessages( - // unpad(` - // const - // `), - // { - // indent: "error" - // }, - // [] - // ); - // }); - - // it("class properties and no-undef", () => { - // verifyAndAssertMessages( - // "class Lol { foo = 'bar'; }", - // { "no-undef": 1 }, - // [] - // ); - // }); -}); diff --git a/packages/typescript-eslint-parser/tests/integration/utils.js b/packages/typescript-eslint-parser/tests/integration/utils.js deleted file mode 100644 index f3cc76cf5645..000000000000 --- a/packages/typescript-eslint-parser/tests/integration/utils.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @fileoverview Utilities for running integration tests - * @author James Henry - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -const eslint = require("eslint"); -const unpad = require("dedent"); -const fs = require("fs"); -const path = require("path"); - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -/* eslint-disable no-use-before-define */ -module.exports = { - verifyAndAssertMessages, - loadExternalFixture -}; -/* eslint-enable no-use-before-define */ - -/** - * Loads an external fixture by name - * @param {string} fixtureName the name of the fixture file to load - * @returns {string} stringified file contents - */ -function loadExternalFixture(fixtureName) { - return fs.readFileSync( - path.join(__dirname, "external-fixtures", `${fixtureName}.js`) - ).toString(); -} - -/** - * A utility function to lint the given source code using typescript-eslint-parser - * and assert expectations around the linting feedback - * - * @param {string} code source code to lint - * @param {Object} rules ESLint rules configuration - * @param {string[]} expectedMessages Expected linting feedback - * @param {string} sourceType Either "module" or "script" - * @param {Obejct} overrideConfig Custom configuration options for the CLIEngine - * @returns {void} - */ -function verifyAndAssertMessages( - code, - rules, - expectedMessages, - sourceType, - overrideConfig -) { - const cliEngineConfig = { - useEslintrc: false, - parser: require.resolve("../../parser"), - rules, - parserOptions: { - ecmaVersion: 8, - ecmaFeatures: { - jsx: true, - experimentalObjectRestSpread: true, - globalReturn: true - }, - sourceType: sourceType || "script" - }, - cwd: __dirname - }; - - if (overrideConfig) { - Object.assign(cliEngineConfig, overrideConfig); - } - - const cli = new eslint.CLIEngine(cliEngineConfig); - const messages = cli.executeOnText(code, "fake-filename.js").results[0].messages; - - if (messages.length !== expectedMessages.length) { - throw new Error( - `Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify( - messages, - null, - 2 - )}` - ); - } - - messages.forEach((message, i) => { - const formatedMessage = `${message.line}:${message.column} ${message.message}${message.ruleId - ? ` ${message.ruleId}` - : ""}`; - if (formatedMessage !== expectedMessages[i]) { - throw new Error( - unpad(` - Message ${i} does not match: - Expected: ${expectedMessages[i]} - Actual: ${formatedMessage} - `) - ); - } - }); -} From deeeb73358b5f4fe9c25881f1a1ebfb0e20f8898 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 10 Jun 2018 20:34:02 -0400 Subject: [PATCH 258/326] Chore: Loosen node version requirement in package.json (fixes #482) (#484) --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 999e8e7d456e..34192bfbd7e1 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -10,7 +10,7 @@ "parser.js" ], "engines": { - "node": "^6.14.0 || ^8.10.0 || >=9.10.0" + "node": ">=6.14.0" }, "repository": "eslint/typescript-eslint-parser", "bugs": { From 0db69b3dbedf89cc134205d2aeedc81ea4fc33d2 Mon Sep 17 00:00:00 2001 From: Ika Date: Wed, 27 Jun 2018 20:57:07 +0800 Subject: [PATCH 259/326] Fix: support ImportMeta (fixes #489) (#490) --- .../typescript-eslint-parser/lib/convert.js | 2 +- .../lib/node-utils.js | 2 + .../importMeta/simple-import-meta.src.js | 1 + .../lib/__snapshots__/ecma-features.js.snap | 239 ++++++++++++++++++ 4 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/importMeta/simple-import-meta.src.js diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 18d52cddaf1d..f24a91da7484 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1729,7 +1729,7 @@ module.exports = function convert(config) { type: AST_NODE_TYPES.Identifier, range: newToken.range, loc: newToken.loc, - name: "new" + name: nodeUtils.getTextForTokenKind(node.keywordToken) }, property: convertChild(node.name) }); diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 677ff505e2bc..ac22ce44c01c 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -99,6 +99,8 @@ TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; TOKEN_TO_TEXT[SyntaxKind.UniqueKeyword] = "unique"; TOKEN_TO_TEXT[SyntaxKind.KeyOfKeyword] = "keyof"; +TOKEN_TO_TEXT[SyntaxKind.NewKeyword] = "new"; +TOKEN_TO_TEXT[SyntaxKind.ImportKeyword] = "import"; /** * Find the first matching child based on the given sourceFile and predicate function. diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/importMeta/simple-import-meta.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/importMeta/simple-import-meta.src.js new file mode 100644 index 000000000000..bd14f9431ae7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/importMeta/simple-import-meta.src.js @@ -0,0 +1 @@ +import.meta.url; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 2436e0da8655..fab54a3bfeb5 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -69303,6 +69303,245 @@ Object { } `; +exports[`ecmaFeatures fixtures/importMeta/simple-import-meta.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "import", + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "meta", + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 11, + ], + "type": "MetaProperty", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "url", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 15, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "meta", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "url", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`ecmaFeatures fixtures/modules/export-default-array.src 1`] = ` Object { "body": Array [ From 3acd7434e46bb5462bc68821b4d81daf5d35234b Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 27 Jun 2018 14:27:51 +0100 Subject: [PATCH 260/326] Fix: Snapshot all ecma-features fixtures (#495) --- .../lib/__snapshots__/ecma-features.js.snap | 90422 +++++++++------- .../tests/lib/ecma-features.js | 3 +- 2 files changed, 51353 insertions(+), 39072 deletions(-) diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index fab54a3bfeb5..599c24613eed 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -2090,7 +2090,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/expression.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-dup-params.src 1`] = ` Object { "body": Array [ Object { @@ -2099,31 +2099,32 @@ Object { "body": Object { "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, - "name": "x", "range": Array [ - 6, - 7, + 10, + 12, ], - "type": "Identifier", + "raw": "42", + "type": "Literal", + "value": 42, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, @@ -2139,23 +2140,41 @@ Object { "line": 1, }, }, - "name": "x", + "name": "a", "range": Array [ 1, 2, ], "type": "Identifier", }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, ], "range": Array [ - 1, - 7, + 0, + 12, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { @@ -2165,14 +2184,14 @@ Object { }, "range": Array [ 0, - 9, + 13, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { @@ -2182,7 +2201,7 @@ Object { }, "range": Array [ 0, - 9, + 13, ], "sourceType": "script", "tokens": Array [ @@ -2220,58 +2239,58 @@ Object { 2, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { - "column": 3, + "column": 2, "line": 1, }, }, "range": Array [ + 2, 3, - 5, ], "type": "Punctuator", - "value": "=>", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 7, + 4, + 5, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, - 8, + 5, + 6, ], "type": "Punctuator", "value": ")", @@ -2283,15 +2302,51 @@ Object { "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ - 8, + 7, 9, ], "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", "value": ";", }, ], @@ -2299,148 +2354,172 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/iife.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-missing-paren.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/arrowFunctions/error-not-arrow.src 1`] = `"Expression expected."`; + +exports[`ecmaFeatures fixtures/arrowFunctions/error-numeric-param.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/arrowFunctions/error-numeric-param-multi.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/arrowFunctions/error-reverse-arrow.src 1`] = `"Expression expected."`; + +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-default-param-eval.src 1`] = ` Object { "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, Object { "expression": Object { "async": false, "body": Object { "loc": Object { "end": Object { - "column": 22, + "column": 31, "line": 1, }, "start": Object { - "column": 6, + "column": 29, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "property", - "range": Array [ - 8, - 16, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 8, - 20, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - }, - ], "range": Array [ - 6, - 22, + 29, + 31, ], - "type": "ObjectExpression", + "raw": "42", + "type": "Literal", + "value": 42, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 23, + "column": 31, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "params": Array [ Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "eval", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 1, + "column": 24, "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, - "name": "e", "range": Array [ - 0, - 1, + 15, + 24, ], - "type": "Identifier", + "right": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", }, ], "range": Array [ - 0, - 23, + 14, + 31, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 24, + 14, + 32, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 1, }, "start": Object { @@ -2450,14 +2529,14 @@ Object { }, "range": Array [ 0, - 24, + 32, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -2467,43 +2546,43 @@ Object { }, "range": Array [ 0, - 1, + 12, ], - "type": "Identifier", - "value": "e", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 13, "line": 1, }, "start": Object { - "column": 2, + "column": 12, "line": 1, }, }, "range": Array [ - 2, - 4, + 12, + 13, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 15, "line": 1, }, "start": Object { - "column": 5, + "column": 14, "line": 1, }, }, "range": Array [ - 5, - 6, + 14, + 15, ], "type": "Punctuator", "value": "(", @@ -2511,125 +2590,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 19, "line": 1, }, "start": Object { - "column": 6, + "column": 15, "line": 1, }, }, "range": Array [ - 6, - 7, + 15, + 19, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "eval", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 20, "line": 1, }, }, "range": Array [ - 8, - 16, + 20, + 21, ], - "type": "Identifier", - "value": "property", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 24, "line": 1, }, "start": Object { - "column": 16, + "column": 22, "line": 1, }, }, "range": Array [ - 16, - 17, + 22, + 24, ], - "type": "Punctuator", - "value": ":", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 1, }, "start": Object { - "column": 18, + "column": 24, "line": 1, }, }, "range": Array [ - 18, - 20, + 24, + 25, ], - "type": "Numeric", - "value": "42", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 28, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 22, + 26, + 28, ], "type": "Punctuator", - "value": "}", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 31, "line": 1, }, "start": Object { - "column": 22, + "column": 29, "line": 1, }, }, "range": Array [ - 22, - 23, + 29, + 31, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 1, }, "start": Object { - "column": 23, + "column": 31, "line": 1, }, }, "range": Array [ - 23, - 24, + 31, + 32, ], "type": "Punctuator", "value": ";", @@ -2639,41 +2718,77 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/multiple-params.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-dup-params.src 1`] = ` Object { "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, Object { "expression": Object { "async": false, "body": Object { "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { - "column": 10, + "column": 24, "line": 1, }, }, "range": Array [ - 10, - 16, + 24, + 26, ], - "raw": "\\"test\\"", + "raw": "42", "type": "Literal", - "value": "test", + "value": 42, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, @@ -2681,66 +2796,66 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 16, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, "name": "a", "range": Array [ - 1, - 2, + 15, + 16, ], "type": "Identifier", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 19, "line": 1, }, "start": Object { - "column": 4, + "column": 18, "line": 1, }, }, - "name": "b", + "name": "a", "range": Array [ - 4, - 5, + 18, + 19, ], "type": "Identifier", }, ], "range": Array [ - 0, - 16, + 14, + 26, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 17, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 17, + 14, + 27, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 17, + "column": 27, "line": 1, }, "start": Object { @@ -2750,14 +2865,14 @@ Object { }, "range": Array [ 0, - 17, + 27, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -2767,43 +2882,79 @@ Object { }, "range": Array [ 0, - 1, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, "range": Array [ - 1, - 2, + 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 14, "line": 1, }, }, "range": Array [ - 2, - 3, + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, ], "type": "Punctuator", "value": ",", @@ -2811,35 +2962,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 19, "line": 1, }, "start": Object { - "column": 4, + "column": 18, "line": 1, }, }, "range": Array [ - 4, - 5, + 18, + 19, ], "type": "Identifier", - "value": "b", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 5, + "column": 19, "line": 1, }, }, "range": Array [ - 5, - 6, + 19, + 20, ], "type": "Punctuator", "value": ")", @@ -2847,17 +2998,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 23, "line": 1, }, "start": Object { - "column": 7, + "column": 21, "line": 1, }, }, "range": Array [ - 7, - 9, + 21, + 23, ], "type": "Punctuator", "value": "=>", @@ -2865,35 +3016,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { - "column": 10, + "column": 24, "line": 1, }, }, "range": Array [ - 10, - 16, + 24, + 26, ], - "type": "String", - "value": "\\"test\\"", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 27, "line": 1, }, "start": Object { - "column": 16, + "column": 26, "line": 1, }, }, "range": Array [ - 16, - 17, + 26, + 27, ], "type": "Punctuator", "value": ";", @@ -2903,7 +3054,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/no-auto-return.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-eval.src 1`] = ` Object { "body": Array [ Object { @@ -2915,7 +3066,7 @@ Object { "expression": Object { "loc": Object { "end": Object { - "column": 14, + "column": 24, "line": 1, }, "start": Object { @@ -2925,15 +3076,15 @@ Object { }, "range": Array [ 12, - 14, + 24, ], - "raw": "42", + "raw": "\\"use strict\\"", "type": "Literal", - "value": 42, + "value": "use strict", }, "loc": Object { "end": Object { - "column": 15, + "column": 25, "line": 1, }, "start": Object { @@ -2943,14 +3094,50 @@ Object { }, "range": Array [ 12, - 15, + 25, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 17, + "column": 30, "line": 1, }, "start": Object { @@ -2960,7 +3147,7 @@ Object { }, "range": Array [ 10, - 17, + 30, ], "type": "BlockStatement", }, @@ -2969,7 +3156,7 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 17, + "column": 30, "line": 1, }, "start": Object { @@ -2981,7 +3168,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 5, "line": 1, }, "start": Object { @@ -2989,27 +3176,9 @@ Object { "line": 1, }, }, - "name": "a", + "name": "eval", "range": Array [ 1, - 2, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 4, 5, ], "type": "Identifier", @@ -3017,13 +3186,13 @@ Object { ], "range": Array [ 0, - 17, + 30, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 1, }, "start": Object { @@ -3033,14 +3202,14 @@ Object { }, "range": Array [ 0, - 18, + 30, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 1, }, "start": Object { @@ -3050,7 +3219,7 @@ Object { }, "range": Array [ 0, - 18, + 30, ], "sourceType": "script", "tokens": Array [ @@ -3075,7 +3244,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 5, "line": 1, }, "start": Object { @@ -3085,46 +3254,10 @@ Object { }, "range": Array [ 1, - 2, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 3, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, 5, ], "type": "Identifier", - "value": "b", + "value": "eval", }, Object { "loc": Object { @@ -3183,7 +3316,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 24, "line": 1, }, "start": Object { @@ -3193,25 +3326,25 @@ Object { }, "range": Array [ 12, - 14, + 24, ], - "type": "Numeric", - "value": "42", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 25, "line": 1, }, "start": Object { - "column": 14, + "column": 24, "line": 1, }, }, "range": Array [ - 14, - 15, + 24, + 25, ], "type": "Punctuator", "value": ";", @@ -3219,64 +3352,100 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 28, "line": 1, }, "start": Object { - "column": 16, + "column": 26, "line": 1, }, }, "range": Array [ - 16, - 17, + 26, + 28, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 30, "line": 1, }, "start": Object { - "column": 17, + "column": 29, "line": 1, }, }, "range": Array [ - 17, - 18, + 29, + 30, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-arguments.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-eval-return.src 1`] = ` Object { "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, Object { "expression": Object { "async": false, "body": Object { "loc": Object { "end": Object { - "column": 15, + "column": 26, "line": 1, }, "start": Object { - "column": 13, + "column": 24, "line": 1, }, }, "range": Array [ - 13, - 15, + 24, + 26, ], "raw": "42", "type": "Literal", @@ -3287,11 +3456,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 15, + "column": 26, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, @@ -3299,48 +3468,48 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 19, "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, - "name": "arguments", + "name": "eval", "range": Array [ - 0, - 9, + 15, + 19, ], "type": "Identifier", }, ], "range": Array [ - 0, - 15, + 14, + 26, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 16, + 14, + 26, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { @@ -3350,14 +3519,14 @@ Object { }, "range": Array [ 0, - 16, + 26, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { @@ -3367,28 +3536,28 @@ Object { }, "range": Array [ 0, - 9, + 12, ], - "type": "Identifier", - "value": "arguments", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, 12, + 13, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, Object { "loc": Object { @@ -3397,21 +3566,21 @@ Object { "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, + 14, 15, ], - "type": "Numeric", - "value": "42", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 1, }, "start": Object { @@ -3421,51 +3590,141 @@ Object { }, "range": Array [ 15, - 16, + 19, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, ], "type": "Punctuator", - "value": ";", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Numeric", + "value": "42", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-octal.src 1`] = ` Object { "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, Object { "expression": Object { "async": false, "body": Object { "loc": Object { "end": Object { - "column": 10, + "column": 23, "line": 1, }, "start": Object { - "column": 8, + "column": 21, "line": 1, }, }, "range": Array [ - 8, - 10, + 21, + 23, ], - "raw": "42", + "raw": "00", "type": "Literal", - "value": 42, + "value": 0, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 23, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, @@ -3473,48 +3732,48 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, + "column": 16, "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, - "name": "eval", + "name": "a", "range": Array [ - 0, - 4, + 15, + 16, ], "type": "Identifier", }, ], "range": Array [ - 0, - 10, + 14, + 23, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 11, + "column": 24, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 11, + 14, + 24, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 11, + "column": 24, "line": 1, }, "start": Object { @@ -3524,14 +3783,14 @@ Object { }, "range": Array [ 0, - 11, + 24, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 12, "line": 1, }, "start": Object { @@ -3541,61 +3800,133 @@ Object { }, "range": Array [ 0, - 4, + 12, ], - "type": "Identifier", - "value": "eval", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { - "column": 5, + "column": 12, "line": 1, }, }, "range": Array [ - 5, - 7, + 12, + 13, ], "type": "Punctuator", - "value": "=>", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 8, + "column": 14, "line": 1, }, }, "range": Array [ - 8, - 10, - ], + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], "type": "Numeric", - "value": "42", + "value": "00", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 24, "line": 1, }, "start": Object { - "column": 10, + "column": 23, "line": 1, }, }, "range": Array [ - 10, - 11, + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -3605,26 +3936,62 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval-params.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-arguments.src 1`] = ` Object { "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, Object { "expression": Object { "async": false, "body": Object { "loc": Object { "end": Object { - "column": 15, + "column": 34, "line": 1, }, "start": Object { - "column": 13, + "column": 32, "line": 1, }, }, "range": Array [ - 13, - 15, + 32, + 34, ], "raw": "42", "type": "Literal", @@ -3635,11 +4002,11 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 15, + "column": 34, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, @@ -3647,66 +4014,66 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 24, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, - "name": "eval", + "name": "arguments", "range": Array [ - 1, - 5, + 15, + 24, ], "type": "Identifier", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 27, "line": 1, }, "start": Object { - "column": 7, + "column": 26, "line": 1, }, }, "name": "a", "range": Array [ - 7, - 8, + 26, + 27, ], "type": "Identifier", }, ], "range": Array [ - 0, - 15, + 14, + 34, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 35, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 16, + 14, + 35, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 16, + "column": 35, "line": 1, }, "start": Object { @@ -3716,14 +4083,14 @@ Object { }, "range": Array [ 0, - 16, + 35, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -3733,7 +4100,43 @@ Object { }, "range": Array [ 0, - 1, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", "value": "(", @@ -3741,35 +4144,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 24, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, "range": Array [ - 1, - 5, + 15, + 24, ], "type": "Identifier", - "value": "eval", + "value": "arguments", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 25, "line": 1, }, "start": Object { - "column": 5, + "column": 24, "line": 1, }, }, "range": Array [ - 5, - 6, + 24, + 25, ], "type": "Punctuator", "value": ",", @@ -3777,17 +4180,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 27, "line": 1, }, "start": Object { - "column": 7, + "column": 26, "line": 1, }, }, "range": Array [ - 7, - 8, + 26, + 27, ], "type": "Identifier", "value": "a", @@ -3795,17 +4198,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 28, "line": 1, }, "start": Object { - "column": 8, + "column": 27, "line": 1, }, }, "range": Array [ - 8, - 9, + 27, + 28, ], "type": "Punctuator", "value": ")", @@ -3813,17 +4216,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 31, "line": 1, }, "start": Object { - "column": 10, + "column": 29, "line": 1, }, }, "range": Array [ - 10, - 12, + 29, + 31, ], "type": "Punctuator", "value": "=>", @@ -3831,17 +4234,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 34, "line": 1, }, "start": Object { - "column": 13, + "column": 32, "line": 1, }, }, "range": Array [ - 13, - 15, + 32, + 34, ], "type": "Numeric", "value": "42", @@ -3849,17 +4252,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 35, "line": 1, }, "start": Object { - "column": 15, + "column": 34, "line": 1, }, }, "range": Array [ - 15, - 16, + 34, + 35, ], "type": "Punctuator", "value": ";", @@ -3869,41 +4272,77 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-octal.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-eval.src 1`] = ` Object { "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, Object { "expression": Object { "async": false, "body": Object { "loc": Object { "end": Object { - "column": 9, + "column": 29, "line": 1, }, "start": Object { - "column": 7, + "column": 27, "line": 1, }, }, "range": Array [ - 7, - 9, + 27, + 29, ], - "raw": "00", + "raw": "42", "type": "Literal", - "value": 0, + "value": 42, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 9, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, @@ -3911,48 +4350,66 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 19, "line": 1, }, "start": Object { - "column": 1, + "column": 15, + "line": 1, + }, + }, + "name": "eval", + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, "line": 1, }, }, "name": "a", "range": Array [ - 1, - 2, + 21, + 22, ], "type": "Identifier", }, ], "range": Array [ - 0, - 9, + 14, + 29, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 10, + "column": 30, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 10, + 14, + 30, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 10, + "column": 30, "line": 1, }, "start": Object { @@ -3962,14 +4419,14 @@ Object { }, "range": Array [ 0, - 10, + 30, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -3979,7 +4436,43 @@ Object { }, "range": Array [ 0, - 1, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", "value": "(", @@ -3987,17 +4480,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 19, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, "range": Array [ - 1, - 2, + 15, + 19, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, ], "type": "Identifier", "value": "a", @@ -4005,17 +4534,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 23, "line": 1, }, "start": Object { - "column": 2, + "column": 22, "line": 1, }, }, "range": Array [ - 2, - 3, + 22, + 23, ], "type": "Punctuator", "value": ")", @@ -4023,17 +4552,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 26, "line": 1, }, "start": Object { - "column": 4, + "column": 24, "line": 1, }, }, "range": Array [ - 4, - 6, + 24, + 26, ], "type": "Punctuator", "value": "=>", @@ -4041,35 +4570,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 29, "line": 1, }, "start": Object { - "column": 7, + "column": 27, "line": 1, }, }, "range": Array [ - 7, - 9, + 27, + 29, ], "type": "Numeric", - "value": "00", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 30, "line": 1, }, "start": Object { - "column": 9, + "column": 29, "line": 1, }, }, "range": Array [ - 9, - 10, + 29, + 30, ], "type": "Punctuator", "value": ";", @@ -4079,82 +4608,77 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/return-arrow-function.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-names.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 12, - ], - "raw": "42", - "type": "Literal", - "value": 42, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, "start": Object { - "column": 5, + "column": 27, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - ], "range": Array [ - 5, - 12, + 27, + 29, ], - "type": "ArrowFunctionExpression", + "raw": "42", + "type": "Literal", + "value": 42, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 12, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, @@ -4162,48 +4686,66 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 19, "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, - "name": "x", + "name": "eval", "range": Array [ - 0, - 1, + 15, + 19, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 21, + 22, ], "type": "Identifier", }, ], "range": Array [ - 0, - 12, + 14, + 29, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 13, + "column": 30, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 13, + 14, + 30, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 13, + "column": 30, "line": 1, }, "start": Object { @@ -4213,14 +4755,14 @@ Object { }, "range": Array [ 0, - 13, + 30, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -4230,61 +4772,133 @@ Object { }, "range": Array [ 0, - 1, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, ], "type": "Identifier", - "value": "x", + "value": "eval", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 20, "line": 1, }, "start": Object { - "column": 2, + "column": 19, "line": 1, }, }, "range": Array [ - 2, - 4, + 19, + 20, ], "type": "Punctuator", - "value": "=>", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 22, "line": 1, }, "start": Object { - "column": 5, + "column": 21, "line": 1, }, }, "range": Array [ - 5, - 6, + 21, + 22, ], "type": "Identifier", - "value": "y", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 23, "line": 1, }, "start": Object { - "column": 7, + "column": 22, "line": 1, }, }, "range": Array [ - 7, - 9, + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, ], "type": "Punctuator", "value": "=>", @@ -4292,17 +4906,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 29, "line": 1, }, "start": Object { - "column": 10, + "column": 27, "line": 1, }, }, "range": Array [ - 10, - 12, + 27, + 29, ], "type": "Numeric", "value": "42", @@ -4310,17 +4924,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 30, "line": 1, }, "start": Object { - "column": 12, + "column": 29, "line": 1, }, }, "range": Array [ - 12, - 13, + 29, + 30, ], "type": "Punctuator", "value": ";", @@ -4330,154 +4944,77 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/return-sequence.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-no-paren-arguments.src 1`] = ` Object { "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, Object { "expression": Object { "async": false, "body": Object { - "async": false, - "body": Object { - "expressions": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 26, - ], - "type": "SequenceExpression", - }, - "expression": true, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 27, + "column": 29, "line": 1, }, "start": Object { - "column": 8, + "column": 27, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - ], "range": Array [ - 8, 27, + 29, ], - "type": "ArrowFunctionExpression", + "raw": "42", + "type": "Literal", + "value": 42, }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, @@ -4485,48 +5022,48 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 23, "line": 1, }, "start": Object { - "column": 1, + "column": 14, "line": 1, }, }, - "name": "x", + "name": "arguments", "range": Array [ - 1, - 2, + 14, + 23, ], "type": "Identifier", }, ], "range": Array [ - 0, - 28, + 14, + 29, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 29, + "column": 30, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 29, + 14, + 30, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 29, + "column": 30, "line": 1, }, "start": Object { @@ -4536,14 +5073,14 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -4553,61 +5090,61 @@ Object { }, "range": Array [ 0, - 1, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, "range": Array [ - 1, - 2, + 12, + 13, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 23, "line": 1, }, "start": Object { - "column": 2, + "column": 14, "line": 1, }, }, "range": Array [ - 2, - 3, + 14, + 23, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "arguments", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 26, "line": 1, }, "start": Object { - "column": 4, + "column": 24, "line": 1, }, }, "range": Array [ - 4, - 6, + 24, + 26, ], "type": "Punctuator", "value": "=>", @@ -4615,164 +5152,230 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 29, "line": 1, }, "start": Object { - "column": 7, + "column": 27, "line": 1, }, }, "range": Array [ - 7, - 8, + 27, + 29, ], - "type": "Punctuator", - "value": "(", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 30, "line": 1, }, "start": Object { - "column": 8, + "column": 29, "line": 1, }, }, "range": Array [ - 8, - 9, + 29, + 30, ], "type": "Punctuator", - "value": "(", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-no-paren-eval.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "y", - }, - Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 0, "line": 1, }, }, "range": Array [ - 10, - 11, + 0, + 13, ], - "type": "Punctuator", - "value": ",", + "type": "ExpressionStatement", }, Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "raw": "42", + "type": "Literal", + "value": 42, }, - "start": Object { - "column": 12, - "line": 1, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "eval", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 14, + 24, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - "value": "z", - }, - Object { "loc": Object { "end": Object { - "column": 14, + "column": 25, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 25, ], - "type": "Punctuator", - "value": ")", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 0, "line": 1, }, }, "range": Array [ - 15, - 17, + 0, + 12, ], - "type": "Punctuator", - "value": "=>", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 13, "line": 1, }, "start": Object { - "column": 18, + "column": 12, "line": 1, }, }, "range": Array [ - 18, - 19, + 12, + 13, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 18, "line": 1, }, "start": Object { - "column": 19, + "column": 14, "line": 1, }, }, "range": Array [ - 19, - 20, + 14, + 18, ], "type": "Identifier", - "value": "x", + "value": "eval", }, Object { "loc": Object { @@ -4781,21 +5384,21 @@ Object { "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ - 20, + 19, 21, ], "type": "Punctuator", - "value": ",", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 24, "line": 1, }, "start": Object { @@ -4805,235 +5408,254 @@ Object { }, "range": Array [ 22, - 23, + 24, ], - "type": "Identifier", - "value": "y", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 25, "line": 1, }, "start": Object { - "column": 23, + "column": 24, "line": 1, }, }, "range": Array [ - 23, 24, + 25, ], "type": "Punctuator", - "value": ",", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/error-two-lines.src 1`] = ` +Object { + "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 8, + 16, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 25, + "column": 0, "line": 1, }, }, "range": Array [ - 25, - 26, + 0, + 17, ], - "type": "Identifier", - "value": "z", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 3, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 3, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 5, "line": 1, }, "start": Object { - "column": 27, + "column": 4, "line": 1, }, }, "range": Array [ - 27, - 28, + 4, + 5, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 7, "line": 1, }, "start": Object { - "column": 28, + "column": 6, "line": 1, }, }, "range": Array [ - 28, - 29, + 6, + 7, ], "type": "Punctuator", - "value": ";", + "value": "=", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/arrowFunctions/single-param.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "raw": "\\"test\\"", - "type": "Literal", - "value": "test", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "e", - "range": Array [ - 0, - 1, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 0, - 11, - ], - "type": "ArrowFunctionExpression", - }, "loc": Object { "end": Object { - "column": 12, + "column": 9, "line": 1, }, "start": Object { - "column": 0, + "column": 8, "line": 1, }, }, "range": Array [ - 0, - 12, + 8, + 9, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 12, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 10, "line": 1, }, "start": Object { - "column": 0, + "column": 9, "line": 1, }, }, "range": Array [ - 0, - 1, + 9, + 10, ], - "type": "Identifier", - "value": "e", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 3, + "line": 2, }, "start": Object { - "column": 2, - "line": 1, + "column": 1, + "line": 2, }, }, "range": Array [ - 2, - 4, + 12, + 14, ], "type": "Punctuator", "value": "=>", @@ -5041,35 +5663,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 5, - 11, + 15, + 16, ], - "type": "String", - "value": "\\"test\\"", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -5079,7 +5701,9 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/single-param-parens.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/error-wrapped-param.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/arrowFunctions/expression.src 1`] = ` Object { "body": Array [ Object { @@ -5088,32 +5712,31 @@ Object { "body": Object { "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 7, + "column": 6, "line": 1, }, }, + "name": "x", "range": Array [ + 6, 7, - 13, ], - "raw": "\\"test\\"", - "type": "Literal", - "value": "test", + "type": "Identifier", }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 0, + "column": 1, "line": 1, }, }, @@ -5129,7 +5752,7 @@ Object { "line": 1, }, }, - "name": "e", + "name": "x", "range": Array [ 1, 2, @@ -5138,14 +5761,14 @@ Object { }, ], "range": Array [ - 0, - 13, + 1, + 7, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { @@ -5155,14 +5778,14 @@ Object { }, "range": Array [ 0, - 14, + 9, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { @@ -5172,7 +5795,7 @@ Object { }, "range": Array [ 0, - 14, + 9, ], "sourceType": "script", "tokens": Array [ @@ -5210,48 +5833,48 @@ Object { 2, ], "type": "Identifier", - "value": "e", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { - "column": 2, + "column": 3, "line": 1, }, }, "range": Array [ - 2, 3, + 5, ], "type": "Punctuator", - "value": ")", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, 6, + 7, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { @@ -5261,25 +5884,25 @@ Object { }, "range": Array [ 7, - 13, + 8, ], - "type": "String", - "value": "\\"test\\"", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 14, + 8, + 9, ], "type": "Punctuator", "value": ";", @@ -5289,7 +5912,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/arrowFunctions/single-param-return-identifier.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/iife.src 1`] = ` Object { "body": Array [ Object { @@ -5298,27 +5921,86 @@ Object { "body": Object { "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, - "name": "earth", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "property", + "range": Array [ + 8, + 16, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 8, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + }, + ], "range": Array [ - 9, - 14, + 6, + 22, ], - "type": "Identifier", + "type": "ObjectExpression", }, "expression": true, "generator": false, "id": null, "loc": Object { "end": Object { - "column": 14, + "column": 23, "line": 1, }, "start": Object { @@ -5330,31 +6012,31 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, + "column": 1, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, - "name": "sun", + "name": "e", "range": Array [ + 0, 1, - 4, ], "type": "Identifier", }, ], "range": Array [ 0, - 14, + 23, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 15, + "column": 24, "line": 1, }, "start": Object { @@ -5364,14 +6046,14 @@ Object { }, "range": Array [ 0, - 15, + 24, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 15, + "column": 24, "line": 1, }, "start": Object { @@ -5381,7 +6063,7 @@ Object { }, "range": Array [ 0, - 15, + 24, ], "sourceType": "script", "tokens": Array [ @@ -5400,8 +6082,8 @@ Object { 0, 1, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { @@ -5410,39 +6092,39 @@ Object { "line": 1, }, "start": Object { - "column": 1, + "column": 2, "line": 1, }, }, "range": Array [ - 1, + 2, 4, ], - "type": "Identifier", - "value": "sun", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, 5, + 6, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 1, }, "start": Object { @@ -5452,142 +6134,115 @@ Object { }, "range": Array [ 6, - 8, + 7, ], "type": "Punctuator", - "value": "=>", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { - "column": 9, + "column": 8, "line": 1, }, }, "range": Array [ - 9, - 14, + 8, + 16, ], "type": "Identifier", - "value": "earth", + "value": "property", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 15, + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": ":", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/binaryLiterals/invalid.src 1`] = `"';' expected."`; - -exports[`ecmaFeatures fixtures/binaryLiterals/lowercase.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, }, - "range": Array [ - 0, - 5, - ], - "raw": "0b101", - "type": "Literal", - "value": 5, }, + "range": Array [ + 18, + 20, + ], + "type": "Numeric", + "value": "42", + }, + Object { "loc": Object { "end": Object { - "column": 6, + "column": 22, "line": 1, }, "start": Object { - "column": 0, + "column": 21, "line": 1, }, }, "range": Array [ - 0, - 6, + 21, + 22, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 7, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 23, "line": 1, }, "start": Object { - "column": 0, + "column": 22, "line": 1, }, }, "range": Array [ - 0, - 5, + 22, + 23, ], - "type": "Numeric", - "value": "0b101", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 24, "line": 1, }, "start": Object { - "column": 5, + "column": 23, "line": 1, }, }, "range": Array [ - 5, - 6, + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -5597,14 +6252,37 @@ Object { } `; -exports[`ecmaFeatures fixtures/binaryLiterals/uppercase.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/multiple-params.src 1`] = ` Object { "body": Array [ Object { "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 5, + "column": 16, "line": 1, }, "start": Object { @@ -5612,17 +6290,53 @@ Object { "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + ], "range": Array [ 0, - 5, + 16, ], - "raw": "0B101", - "type": "Literal", - "value": 5, + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 6, + "column": 17, "line": 1, }, "start": Object { @@ -5632,15 +6346,15 @@ Object { }, "range": Array [ 0, - 6, + 17, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { "column": 0, @@ -5649,14 +6363,14 @@ Object { }, "range": Array [ 0, - 7, + 17, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -5666,127 +6380,47 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Numeric", - "value": "0B101", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 2, "line": 1, }, "start": Object { - "column": 5, + "column": 1, "line": 1, }, }, "range": Array [ - 5, - 6, + 1, + 2, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "a", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/blockBindings/const.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 15, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 16, + "column": 3, "line": 1, }, "start": Object { - "column": 0, + "column": 2, "line": 1, }, }, "range": Array [ - 0, - 16, + 2, + 3, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ",", }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { @@ -5794,85 +6428,85 @@ Object { "line": 1, }, "start": Object { - "column": 0, + "column": 4, "line": 1, }, }, "range": Array [ - 0, + 4, 5, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ + 5, 6, - 9, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 7, "line": 1, }, }, "range": Array [ - 10, - 11, + 7, + 9, ], "type": "Punctuator", - "value": "=", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 10, "line": 1, }, }, "range": Array [ - 12, - 15, + 10, + 16, ], - "type": "Identifier", - "value": "bar", + "type": "String", + "value": "\\"test\\"", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 15, + "column": 16, "line": 1, }, }, "range": Array [ - 15, 16, + 17, ], "type": "Punctuator", "value": ";", @@ -5882,69 +6516,127 @@ Object { } `; -exports[`ecmaFeatures fixtures/blockBindings/let.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/no-auto-return.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, - "name": "foo", + "name": "a", "range": Array [ - 4, - 7, + 1, + 2, ], "type": "Identifier", }, - "init": Object { + Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 1, }, "start": Object { - "column": 10, + "column": 4, "line": 1, }, }, - "name": "bar", + "name": "b", "range": Array [ - 10, - 13, + 4, + 5, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 13, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", + ], + "range": Array [ + 0, + 17, + ], + "type": "ArrowFunctionExpression", + }, "loc": Object { "end": Object { - "column": 14, + "column": 18, "line": 1, }, "start": Object { @@ -5954,15 +6646,15 @@ Object { }, "range": Array [ 0, - 14, + 18, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { "column": 0, @@ -5971,14 +6663,14 @@ Object { }, "range": Array [ 0, - 15, + 18, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -5988,15 +6680,51 @@ Object { }, "range": Array [ 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, 3, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -6006,10 +6734,28 @@ Object { }, "range": Array [ 4, - 7, + 5, ], "type": "Identifier", - "value": "foo", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -6018,21 +6764,21 @@ Object { "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ - 8, + 7, 9, ], "type": "Punctuator", - "value": "=", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { @@ -6042,10 +6788,10 @@ Object { }, "range": Array [ 10, - 13, + 11, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -6054,13 +6800,67 @@ Object { "line": 1, }, "start": Object { - "column": 13, + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -6070,163 +6870,73 @@ Object { } `; -exports[`ecmaFeatures fixtures/blockBindings/let-in-switchcase.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-arguments.src 1`] = ` Object { "body": Array [ Object { - "cases": Array [ - Object { - "consequent": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "name": "t", - "range": Array [ - 31, - 32, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 37, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 38, - ], - "type": "VariableDeclaration", - }, - Object { - "label": null, - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 45, - ], - "type": "BreakStatement", - }, - ], + "expression": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 45, + "column": 15, "line": 1, }, "start": Object { - "column": 18, + "column": 13, "line": 1, }, }, "range": Array [ - 18, - 45, + 13, + 15, ], - "test": Object { + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 25, + "column": 9, "line": 1, }, "start": Object { - "column": 23, + "column": 0, "line": 1, }, }, + "name": "arguments", "range": Array [ - 23, - 25, + 0, + 9, ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "type": "SwitchCase", - }, - ], - "discriminant": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, + "type": "Identifier", }, - }, - "name": "answer", + ], "range": Array [ - 8, - 14, + 0, + 15, ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 47, + "column": 16, "line": 1, }, "start": Object { @@ -6236,15 +6946,15 @@ Object { }, "range": Array [ 0, - 47, + 16, ], - "type": "SwitchStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -6253,14 +6963,14 @@ Object { }, "range": Array [ 0, - 48, + 16, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { @@ -6270,46 +6980,28 @@ Object { }, "range": Array [ 0, - 6, + 9, ], - "type": "Keyword", - "value": "switch", + "type": "Identifier", + "value": "arguments", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { - "column": 7, + "column": 10, "line": 1, }, }, "range": Array [ - 7, - 8, + 10, + 12, ], "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 14, - ], - "type": "Identifier", - "value": "answer", + "value": "=>", }, Object { "loc": Object { @@ -6318,157 +7010,187 @@ Object { "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, "range": Array [ - 14, + 13, 15, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 17, ], "type": "Punctuator", - "value": "{", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "raw": "42", + "type": "Literal", + "value": 42, }, - "start": Object { - "column": 18, - "line": 1, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "eval", + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 10, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 18, - 22, - ], - "type": "Keyword", - "value": "case", - }, - Object { "loc": Object { "end": Object { - "column": 25, + "column": 11, "line": 1, }, "start": Object { - "column": 23, + "column": 0, "line": 1, }, }, "range": Array [ - 23, - 25, + 0, + 11, ], - "type": "Numeric", - "value": "42", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ":", + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 30, - ], - "type": "Keyword", - "value": "let", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 32, + "column": 4, "line": 1, }, "start": Object { - "column": 31, + "column": 0, "line": 1, }, }, "range": Array [ - 31, - 32, + 0, + 4, ], "type": "Identifier", - "value": "t", + "value": "eval", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 7, "line": 1, }, "start": Object { - "column": 33, + "column": 5, "line": 1, }, }, "range": Array [ - 33, - 34, + 5, + 7, ], "type": "Punctuator", - "value": "=", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 10, "line": 1, }, "start": Object { - "column": 35, + "column": 8, "line": 1, }, }, "range": Array [ - 35, - 37, + 8, + 10, ], "type": "Numeric", "value": "42", @@ -6476,299 +7198,111 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 37, - "line": 1, - }, - }, - "range": Array [ - 37, - 38, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 44, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 44, - ], - "type": "Keyword", - "value": "break", - }, - Object { - "loc": Object { - "end": Object { - "column": 45, + "column": 11, "line": 1, }, "start": Object { - "column": 44, + "column": 10, "line": 1, }, }, "range": Array [ - 44, - 45, + 10, + 11, ], "type": "Punctuator", "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 46, - "line": 1, - }, - }, - "range": Array [ - 46, - 47, - ], - "type": "Punctuator", - "value": "}", - }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/classes/class-accessor-properties.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-eval-params.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, }, - "kind": "get", + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 18, + "column": 5, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, + "name": "eval", "range": Array [ - 9, - 18, + 1, + 5, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 18, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 14, - 18, - ], - "type": "FunctionExpression", - }, + "type": "Identifier", }, Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "kind": "set", "loc": Object { "end": Object { - "column": 29, + "column": 8, "line": 1, }, "start": Object { - "column": 19, + "column": 7, "line": 1, }, }, + "name": "a", "range": Array [ - 19, - 29, + 7, + 8, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 29, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 24, - 29, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 8, - 31, ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", "range": Array [ - 6, - 7, + 0, + 15, ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 31, + "column": 16, "line": 1, }, "start": Object { @@ -6778,32 +7312,14 @@ Object { }, "range": Array [ 0, - 31, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 32, + 16, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 32, + "column": 16, "line": 1, }, "start": Object { @@ -6813,14 +7329,14 @@ Object { }, "range": Array [ 0, - 32, + 16, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -6830,205 +7346,253 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 5, ], "type": "Identifier", - "value": "A", + "value": "eval", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 8, + "column": 5, "line": 1, }, }, "range": Array [ - 8, - 9, + 5, + 6, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ - 9, - 12, + 7, + 8, ], "type": "Identifier", - "value": "get", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, "range": Array [ - 13, - 14, + 8, + 9, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 12, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 12, ], "type": "Punctuator", - "value": "(", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 13, "line": 1, }, }, "range": Array [ + 13, 15, - 16, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 17, ], "type": "Punctuator", - "value": "{", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/not-strict-octal.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "00", + "type": "Literal", + "value": 0, }, - "start": Object { - "column": 17, - "line": 1, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 9, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": "}", - }, - Object { "loc": Object { "end": Object { - "column": 22, + "column": 10, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 22, + 0, + 10, ], - "type": "Identifier", - "value": "set", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - "value": "b", + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 25, + "column": 1, "line": 1, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, "range": Array [ - 24, - 25, + 0, + 1, ], "type": "Punctuator", "value": "(", @@ -7036,35 +7600,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 2, "line": 1, }, "start": Object { - "column": 25, + "column": 1, "line": 1, }, }, "range": Array [ - 25, - 26, + 1, + 2, ], "type": "Identifier", - "value": "c", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 3, "line": 1, }, "start": Object { - "column": 26, + "column": 2, "line": 1, }, }, "range": Array [ - 26, - 27, + 2, + 3, ], "type": "Punctuator", "value": ")", @@ -7072,89 +7636,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, + "column": 6, "line": 1, }, "start": Object { - "column": 29, + "column": 4, "line": 1, }, }, "range": Array [ - 29, - 30, + 4, + 6, ], "type": "Punctuator", - "value": ";", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 9, "line": 1, }, "start": Object { - "column": 30, + "column": 7, "line": 1, }, }, "range": Array [ - 30, - 31, + 7, + 9, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "00", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 10, "line": 1, }, "start": Object { - "column": 31, + "column": 9, "line": 1, }, }, "range": Array [ - 31, - 32, + 9, + 10, ], "type": "Punctuator", "value": ";", @@ -7164,128 +7692,114 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-computed-static-method.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/return-arrow-function.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - }, - "kind": "method", + "expression": Object { + "async": false, + "body": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, - 23, + 10, + 12, ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 23, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 23, + "column": 6, "line": 1, }, "start": Object { - "column": 19, + "column": 5, "line": 1, }, }, - "params": Array [], + "name": "y", "range": Array [ - 19, - 23, + 5, + 6, ], - "type": "FunctionExpression", + "type": "Identifier", }, - }, - ], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + ], + "range": Array [ + 5, + 12, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 8, - 25, - ], - "type": "ClassBody", - }, - "id": Object { + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "A", + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + ], "range": Array [ - 6, - 7, + 0, + 12, ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { @@ -7295,32 +7809,14 @@ Object { }, "range": Array [ 0, - 25, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, + 13, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 26, + "column": 13, "line": 1, }, "start": Object { @@ -7330,14 +7826,14 @@ Object { }, "range": Array [ 0, - 26, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -7347,133 +7843,330 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 2, "line": 1, }, }, "range": Array [ - 6, - 7, + 2, + 4, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 8, + "column": 5, "line": 1, }, }, "range": Array [ - 8, - 9, + 5, + 6, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 7, "line": 1, }, }, "range": Array [ + 7, 9, - 15, ], - "type": "Keyword", - "value": "static", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, "range": Array [ - 16, - 17, + 10, + 12, ], - "type": "Punctuator", - "value": "[", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ";", }, - Object { - "loc": Object { + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/return-sequence.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "async": false, + "body": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "SequenceExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 8, + 27, + ], + "type": "ArrowFunctionExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 28, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { "end": Object { - "column": 19, + "column": 29, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 29, ], - "type": "Punctuator", - "value": "]", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 20, + "column": 1, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 20, + 0, + 1, ], "type": "Punctuator", "value": "(", @@ -7481,17 +8174,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 2, "line": 1, }, "start": Object { - "column": 20, + "column": 1, "line": 1, }, }, "range": Array [ - 20, - 21, + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, ], "type": "Punctuator", "value": ")", @@ -7499,186 +8210,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 6, "line": 1, }, "start": Object { - "column": 21, + "column": 4, "line": 1, }, }, "range": Array [ - 21, - 22, + 4, + 6, ], "type": "Punctuator", - "value": "{", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 8, "line": 1, }, "start": Object { - "column": 22, + "column": 7, "line": 1, }, }, "range": Array [ - 22, - 23, + 7, + 8, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 9, "line": 1, }, "start": Object { - "column": 23, + "column": 8, "line": 1, }, }, "range": Array [ - 23, - 24, + 8, + 9, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 10, "line": 1, }, "start": Object { - "column": 24, + "column": 9, "line": 1, }, }, "range": Array [ - 24, - 25, + 9, + 10, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 11, "line": 1, }, "start": Object { - "column": 25, + "column": 10, "line": 1, }, }, "range": Array [ - 25, - 26, + 10, + 11, ], "type": "Punctuator", - "value": ";", + "value": ",", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/class-expression.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 9, - ], - "type": "ClassBody", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, }, - "id": null, - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "start": Object { + "column": 12, + "line": 1, }, - "range": Array [ - 1, - 9, - ], - "superClass": null, - "type": "ClassExpression", }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "z", + }, + Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 1, }, "start": Object { - "column": 0, + "column": 13, "line": 1, }, }, "range": Array [ - 0, - 11, + 13, + 14, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 11, - "line": 1, + "type": "Punctuator", + "value": ")", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Punctuator", + "value": "=>", }, - }, - "range": Array [ - 0, - 11, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 19, "line": 1, }, "start": Object { - "column": 0, + "column": 18, "line": 1, }, }, "range": Array [ - 0, - 1, + 18, + 19, ], "type": "Punctuator", "value": "(", @@ -7686,71 +8372,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 1, + "column": 19, "line": 1, }, }, "range": Array [ - 1, - 6, + 19, + 20, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 8, + 20, + 21, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 23, "line": 1, }, "start": Object { - "column": 8, + "column": 22, "line": 1, }, }, "range": Array [ - 8, - 9, + 22, + 23, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 26, "line": 1, }, "start": Object { - "column": 9, + "column": 25, "line": 1, }, }, "range": Array [ - 9, - 10, + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -7758,17 +8480,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 28, "line": 1, }, "start": Object { - "column": 10, + "column": 27, "line": 1, }, }, "range": Array [ - 10, - 11, + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, ], "type": "Punctuator", "value": ";", @@ -7778,128 +8518,73 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-method-named-prototype.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/single-param.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "prototype", - "range": Array [ - 9, - 18, - ], - "type": "Identifier", + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - "kind": "method", + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 22, + "column": 1, "line": 1, }, "start": Object { - "column": 9, + "column": 0, "line": 1, }, }, + "name": "e", "range": Array [ - 9, - 22, + 0, + 1, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 22, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 18, - 22, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, + "type": "Identifier", }, - }, - "range": Array [ - 8, - 23, ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", "range": Array [ - 6, - 7, + 0, + 11, ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 1, }, "start": Object { @@ -7909,32 +8594,14 @@ Object { }, "range": Array [ 0, - 23, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, + 12, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { @@ -7944,14 +8611,14 @@ Object { }, "range": Array [ 0, - 24, + 12, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -7961,79 +8628,181 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 2, "line": 1, }, }, "range": Array [ - 6, - 7, + 2, + 4, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 5, "line": 1, }, }, "range": Array [ - 8, - 9, + 5, + 11, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, ], "type": "Punctuator", - "value": "{", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/arrowFunctions/single-param-parens.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 0, + 13, + ], + "type": "ArrowFunctionExpression", + }, "loc": Object { "end": Object { - "column": 18, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 0, "line": 1, }, }, "range": Array [ - 9, - 18, + 0, + 14, ], - "type": "Identifier", - "value": "prototype", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 19, + "column": 1, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 1, ], "type": "Punctuator", "value": "(", @@ -8041,89 +8810,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 2, "line": 1, }, "start": Object { - "column": 19, + "column": 1, "line": 1, }, }, "range": Array [ - 19, - 20, + 1, + 2, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "e", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 3, "line": 1, }, "start": Object { - "column": 20, + "column": 2, "line": 1, }, }, "range": Array [ - 20, - 21, + 2, + 3, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 6, "line": 1, }, "start": Object { - "column": 21, + "column": 4, "line": 1, }, }, "range": Array [ - 21, - 22, + 4, + 6, ], "type": "Punctuator", - "value": "}", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 13, "line": 1, }, "start": Object { - "column": 22, + "column": 7, "line": 1, }, }, "range": Array [ - 22, - 23, + 7, + 13, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"test\\"", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 1, }, "start": Object { - "column": 23, + "column": 13, "line": 1, }, }, "range": Array [ - 23, - 24, + 13, + 14, ], "type": "Punctuator", "value": ";", @@ -8133,128 +8902,72 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-method-named-static.src 1`] = ` +exports[`ecmaFeatures fixtures/arrowFunctions/single-param-return-identifier.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "static", - "range": Array [ - 9, - 15, - ], - "type": "Identifier", + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, }, - "kind": "method", + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "earth", + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 19, + "column": 4, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, + "name": "sun", "range": Array [ - 9, - 19, + 1, + 4, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 19, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 15, - 19, - ], - "type": "FunctionExpression", - }, + "type": "Identifier", }, ], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, "range": Array [ - 8, - 21, + 0, + 14, ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 21, + "column": 15, "line": 1, }, "start": Object { @@ -8264,32 +8977,14 @@ Object { }, "range": Array [ 0, - 21, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, + 15, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 22, + "column": 15, "line": 1, }, "start": Object { @@ -8299,14 +8994,14 @@ Object { }, "range": Array [ 0, - 22, + 15, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -8316,51 +9011,69 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 4, ], "type": "Identifier", - "value": "A", + "value": "sun", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { "column": 8, "line": 1, }, + "start": Object { + "column": 6, + "line": 1, + }, }, "range": Array [ + 6, 8, - 9, ], "type": "Punctuator", - "value": "{", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { @@ -8370,133 +9083,221 @@ Object { }, "range": Array [ 9, - 15, + 14, ], - "type": "Keyword", - "value": "static", + "type": "Identifier", + "value": "earth", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 14, "line": 1, }, }, "range": Array [ + 14, 15, - 16, ], "type": "Punctuator", - "value": "(", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/binaryLiterals/invalid.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/binaryLiterals/lowercase.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0b101", + "type": "Literal", + "value": 5, + }, "loc": Object { "end": Object { - "column": 17, + "column": 6, "line": 1, }, "start": Object { - "column": 16, + "column": 0, "line": 1, }, }, "range": Array [ - 16, - 17, + 0, + 6, ], - "type": "Punctuator", - "value": ")", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 18, + "column": 5, "line": 1, }, "start": Object { - "column": 17, + "column": 0, "line": 1, }, }, "range": Array [ - 17, - 18, + 0, + 5, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "0b101", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 6, "line": 1, }, "start": Object { - "column": 18, + "column": 5, "line": 1, }, }, "range": Array [ - 18, - 19, + 5, + 6, ], "type": "Punctuator", - "value": "}", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/binaryLiterals/uppercase.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0B101", + "type": "Literal", + "value": 5, + }, "loc": Object { "end": Object { - "column": 20, + "column": 6, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 20, + 0, + 6, ], - "type": "Punctuator", - "value": ";", + "type": "ExpressionStatement", }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, + "column": 5, "line": 1, }, "start": Object { - "column": 20, + "column": 0, "line": 1, }, }, "range": Array [ - 20, - 21, + 0, + 5, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "0B101", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 6, "line": 1, }, "start": Object { - "column": 21, + "column": 5, "line": 1, }, }, "range": Array [ - 21, - 22, + 5, + 6, ], "type": "Punctuator", "value": ";", @@ -8506,128 +9307,69 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-method-named-with-space.src 1`] = ` +exports[`ecmaFeatures fixtures/blockBindings/const.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "withSpace", - "range": Array [ - 9, - 18, - ], - "type": "Identifier", - }, - "kind": "method", + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 24, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, + "name": "foo", "range": Array [ + 6, 9, - 24, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 24, - ], - "type": "BlockStatement", + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, + "start": Object { + "column": 12, + "line": 1, }, - "params": Array [], - "range": Array [ - 19, - 24, - ], - "type": "FunctionExpression", }, + "name": "bar", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", }, - ], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 25, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, }, + "range": Array [ + 6, + 15, + ], + "type": "VariableDeclarator", }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 25, + "column": 16, "line": 1, }, "start": Object { @@ -8637,10 +9379,9 @@ Object { }, "range": Array [ 0, - 25, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { @@ -8655,7 +9396,7 @@ Object { }, "range": Array [ 0, - 26, + 17, ], "sourceType": "script", "tokens": Array [ @@ -8675,12 +9416,12 @@ Object { 5, ], "type": "Keyword", - "value": "class", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { @@ -8690,265 +9431,416 @@ Object { }, "range": Array [ 6, - 7, + 9, ], "type": "Identifier", - "value": "A", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 18, + 12, + 15, ], "type": "Identifier", - "value": "withSpace", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 16, "line": 1, }, "start": Object { - "column": 19, + "column": 15, "line": 1, }, }, "range": Array [ - 19, - 20, + 15, + 16, ], "type": "Punctuator", - "value": "(", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/blockBindings/let.src 1`] = ` +Object { + "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 21, + "column": 14, "line": 1, }, "start": Object { - "column": 20, + "column": 0, "line": 1, }, }, "range": Array [ - 20, - 21, + 0, + 14, ], - "type": "Punctuator", - "value": ")", + "type": "VariableDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 3, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 7, "line": 1, }, "start": Object { - "column": 23, + "column": 4, "line": 1, }, }, "range": Array [ - 23, - 24, + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { - "column": 24, + "column": 10, "line": 1, }, }, "range": Array [ - 24, - 25, + 10, + 13, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/classes/class-one-method.src 1`] = ` +exports[`ecmaFeatures fixtures/blockBindings/let-in-switchcase.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "t", + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 38, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 27, + "line": 1, }, }, - "name": "a", "range": Array [ - 14, - 15, + 27, + 38, ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "type": "VariableDeclaration", }, - "range": Array [ - 14, - 19, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 17, - 19, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + Object { + "label": null, "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 45, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 39, + "line": 1, }, }, - "params": Array [], "range": Array [ - 15, - 19, + 39, + 45, ], - "type": "FunctionExpression", + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 1, + "range": Array [ + 18, + 45, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "42", + "type": "Literal", + "value": 42, }, + "type": "SwitchCase", }, - "range": Array [ - 8, - 21, - ], - "type": "ClassBody", - }, - "id": Object { + ], + "discriminant": Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 1, }, "start": Object { - "column": 6, + "column": 8, "line": 1, }, }, - "name": "A", + "name": "answer", "range": Array [ - 6, - 7, + 8, + 14, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 47, + "line": 1, }, "start": Object { "column": 0, @@ -8957,33 +9849,15 @@ Object { }, "range": Array [ 0, - 21, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 1, - "line": 3, - }, - }, - "range": Array [ - 21, - 22, + 47, ], - "type": "EmptyStatement", + "type": "SwitchStatement", }, ], "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -8992,14 +9866,14 @@ Object { }, "range": Array [ 0, - 22, + 48, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { @@ -9009,33 +9883,33 @@ Object { }, "range": Array [ 0, - 5, + 6, ], "type": "Keyword", - "value": "class", + "value": "switch", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, 7, + 8, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { @@ -9045,255 +9919,388 @@ Object { }, "range": Array [ 8, - 9, + 14, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "answer", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ 14, 15, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 15, 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 6, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 16, - 17, + 18, + 22, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "case", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 17, - 18, + 23, + 25, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 30, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 27, + "line": 1, }, }, "range": Array [ - 20, - 21, + 27, + 30, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "t", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 1, - "line": 3, + "column": 35, + "line": 1, }, }, "range": Array [ - 21, - 22, + 35, + 37, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, ], "type": "Punctuator", "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/class-one-method-super.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-accessor-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 13, + "line": 1, }, }, "name": "a", "range": Array [ + 13, 14, - 15, ], "type": "Identifier", }, - "kind": "method", + "kind": "get", "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 18, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 14, - 41, + 9, + 18, ], "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 27, - 32, - ], - "type": "Super", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 27, - 34, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 27, - 35, - ], - "type": "ExpressionStatement", + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, }, + }, + "range": Array [ + 16, + 18, ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 14, + 18, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 29, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 29, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 17, - 41, + 27, + 29, ], "type": "BlockStatement", }, @@ -9302,18 +10309,37 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 29, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 24, + "line": 1, }, }, - "params": Array [], + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], "range": Array [ - 15, - 41, + 24, + 29, ], "type": "FunctionExpression", }, @@ -9321,8 +10347,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { "column": 8, @@ -9331,7 +10357,7 @@ Object { }, "range": Array [ 8, - 43, + 31, ], "type": "ClassBody", }, @@ -9355,8 +10381,8 @@ Object { }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { "column": 0, @@ -9365,7 +10391,7 @@ Object { }, "range": Array [ 0, - 43, + 31, ], "superClass": null, "type": "ClassDeclaration", @@ -9373,25 +10399,25 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 32, + "line": 1, }, "start": Object { - "column": 1, - "line": 5, + "column": 31, + "line": 1, }, }, "range": Array [ - 43, - 44, + 31, + 32, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 6, + "column": 32, + "line": 1, }, "start": Object { "column": 0, @@ -9400,7 +10426,7 @@ Object { }, "range": Array [ 0, - 45, + 32, ], "sourceType": "script", "tokens": Array [ @@ -9461,17 +10487,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, }, "range": Array [ + 13, 14, - 15, ], "type": "Identifier", "value": "a", @@ -9479,17 +10523,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ + 14, 15, - 16, ], "type": "Punctuator", "value": "(", @@ -9497,17 +10541,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 6, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ + 15, 16, - 17, ], "type": "Punctuator", "value": ")", @@ -9515,17 +10559,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ + 16, 17, - 18, ], "type": "Punctuator", "value": "{", @@ -9533,35 +10577,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 17, + "line": 1, }, }, "range": Array [ - 27, - 32, + 17, + 18, ], - "type": "Keyword", - "value": "super", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 19, + "line": 1, }, }, "range": Array [ - 32, - 33, + 19, + 22, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, ], "type": "Punctuator", "value": "(", @@ -9569,17 +10649,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 25, + "line": 1, }, }, "range": Array [ - 33, - 34, + 25, + 26, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -9587,35 +10685,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 28, + "line": 1, }, "start": Object { - "column": 15, - "line": 3, + "column": 27, + "line": 1, }, }, "range": Array [ - 34, - 35, + 27, + 28, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 29, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 28, + "line": 1, }, }, "range": Array [ - 40, - 41, + 28, + 29, ], "type": "Punctuator", "value": "}", @@ -9623,74 +10721,92 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 30, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 29, + "line": 1, }, }, "range": Array [ - 42, - 43, + 29, + 30, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 31, + "line": 1, }, "start": Object { - "column": 1, - "line": 5, + "column": 30, + "line": 1, }, }, "range": Array [ - 43, - 44, + 30, + 31, ], "type": "Punctuator", - "value": ";", + "value": "}", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/class-static-method.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-computed-static-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ Object { - "computed": false, + "computed": true, "key": Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "name": "a", "range": Array [ - 16, 17, + 18, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 21, + "column": 23, "line": 1, }, "start": Object { @@ -9700,7 +10816,7 @@ Object { }, "range": Array [ 9, - 21, + 23, ], "static": true, "type": "MethodDefinition", @@ -9710,17 +10826,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 21, + "column": 23, "line": 1, }, "start": Object { - "column": 19, + "column": 21, "line": 1, }, }, "range": Array [ - 19, 21, + 23, ], "type": "BlockStatement", }, @@ -9729,18 +10845,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 21, + "column": 23, "line": 1, }, "start": Object { - "column": 17, + "column": 19, "line": 1, }, }, "params": Array [], "range": Array [ - 17, - 21, + 19, + 23, ], "type": "FunctionExpression", }, @@ -9748,7 +10864,7 @@ Object { ], "loc": Object { "end": Object { - "column": 23, + "column": 25, "line": 1, }, "start": Object { @@ -9758,7 +10874,7 @@ Object { }, "range": Array [ 8, - 23, + 25, ], "type": "ClassBody", }, @@ -9782,7 +10898,7 @@ Object { }, "loc": Object { "end": Object { - "column": 23, + "column": 25, "line": 1, }, "start": Object { @@ -9792,7 +10908,7 @@ Object { }, "range": Array [ 0, - 23, + 25, ], "superClass": null, "type": "ClassDeclaration", @@ -9800,24 +10916,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { - "column": 23, + "column": 25, "line": 1, }, }, "range": Array [ - 23, - 24, + 25, + 26, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { @@ -9827,7 +10943,7 @@ Object { }, "range": Array [ 0, - 24, + 26, ], "sourceType": "script", "tokens": Array [ @@ -9918,8 +11034,8 @@ Object { 16, 17, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { @@ -9936,8 +11052,8 @@ Object { 17, 18, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -9955,7 +11071,7 @@ Object { 19, ], "type": "Punctuator", - "value": ")", + "value": "]", }, Object { "loc": Object { @@ -9973,7 +11089,7 @@ Object { 20, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { @@ -9991,7 +11107,7 @@ Object { 21, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { @@ -10009,7 +11125,7 @@ Object { 22, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { @@ -10047,42 +11163,264 @@ Object { "type": "Punctuator", "value": ";", }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/classes/class-static-method-named-prototype.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "ClassBody", + }, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "superClass": null, + "type": "ClassExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-method-named-prototype.src 1`] = ` Object { "body": Array [ Object { "body": Object { "body": Array [ Object { - "computed": true, + "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 28, + "column": 18, "line": 1, }, "start": Object { - "column": 17, + "column": 9, "line": 1, }, }, + "name": "prototype", "range": Array [ - 17, - 28, + 9, + 18, ], - "raw": "\\"prototype\\"", - "type": "Literal", - "value": "prototype", + "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { @@ -10092,9 +11430,9 @@ Object { }, "range": Array [ 9, - 33, + 22, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -10102,17 +11440,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 33, + 20, + 22, ], "type": "BlockStatement", }, @@ -10121,18 +11459,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 29, + "column": 18, "line": 1, }, }, "params": Array [], "range": Array [ - 29, - 33, + 18, + 22, ], "type": "FunctionExpression", }, @@ -10140,7 +11478,7 @@ Object { ], "loc": Object { "end": Object { - "column": 34, + "column": 23, "line": 1, }, "start": Object { @@ -10150,7 +11488,7 @@ Object { }, "range": Array [ 8, - 34, + 23, ], "type": "ClassBody", }, @@ -10174,7 +11512,7 @@ Object { }, "loc": Object { "end": Object { - "column": 34, + "column": 23, "line": 1, }, "start": Object { @@ -10184,7 +11522,7 @@ Object { }, "range": Array [ 0, - 34, + 23, ], "superClass": null, "type": "ClassDeclaration", @@ -10192,24 +11530,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 24, "line": 1, }, "start": Object { - "column": 34, + "column": 23, "line": 1, }, }, "range": Array [ - 34, - 35, + 23, + 24, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 35, + "column": 24, "line": 1, }, "start": Object { @@ -10219,7 +11557,7 @@ Object { }, "range": Array [ 0, - 35, + 24, ], "sourceType": "script", "tokens": Array [ @@ -10280,7 +11618,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { @@ -10290,79 +11628,25 @@ Object { }, "range": Array [ 9, - 15, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 28, - ], - "type": "String", - "value": "\\"prototype\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, + 18, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "prototype", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 29, + "column": 18, "line": 1, }, }, "range": Array [ - 29, - 30, + 18, + 19, ], "type": "Punctuator", "value": "(", @@ -10370,17 +11654,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 20, "line": 1, }, "start": Object { - "column": 30, + "column": 19, "line": 1, }, }, "range": Array [ - 30, - 31, + 19, + 20, ], "type": "Punctuator", "value": ")", @@ -10388,17 +11672,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 21, "line": 1, }, "start": Object { - "column": 31, + "column": 20, "line": 1, }, }, "range": Array [ - 31, - 32, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -10406,17 +11690,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, + "column": 22, "line": 1, }, "start": Object { - "column": 32, + "column": 21, "line": 1, }, }, "range": Array [ - 32, - 33, + 21, + 22, ], "type": "Punctuator", "value": "}", @@ -10424,17 +11708,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 23, "line": 1, }, "start": Object { - "column": 33, + "column": 22, "line": 1, }, }, "range": Array [ - 33, - 34, + 22, + 23, ], "type": "Punctuator", "value": "}", @@ -10442,17 +11726,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 24, "line": 1, }, "start": Object { - "column": 34, + "column": 23, "line": 1, }, }, "range": Array [ - 34, - 35, + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -10462,7 +11746,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-static-method-named-static.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-method-named-static.src 1`] = ` Object { "body": Array [ Object { @@ -10473,25 +11757,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 22, + "column": 15, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, "name": "static", "range": Array [ - 16, - 22, + 9, + 15, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 1, }, "start": Object { @@ -10501,9 +11785,9 @@ Object { }, "range": Array [ 9, - 26, + 19, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -10511,17 +11795,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 1, }, "start": Object { - "column": 24, + "column": 17, "line": 1, }, }, "range": Array [ - 24, - 26, + 17, + 19, ], "type": "BlockStatement", }, @@ -10530,18 +11814,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "params": Array [], "range": Array [ - 22, - 26, + 15, + 19, ], "type": "FunctionExpression", }, @@ -10549,7 +11833,7 @@ Object { ], "loc": Object { "end": Object { - "column": 28, + "column": 21, "line": 1, }, "start": Object { @@ -10559,7 +11843,7 @@ Object { }, "range": Array [ 8, - 28, + 21, ], "type": "ClassBody", }, @@ -10583,7 +11867,7 @@ Object { }, "loc": Object { "end": Object { - "column": 28, + "column": 21, "line": 1, }, "start": Object { @@ -10593,7 +11877,7 @@ Object { }, "range": Array [ 0, - 28, + 21, ], "superClass": null, "type": "ClassDeclaration", @@ -10601,24 +11885,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 1, }, "start": Object { - "column": 28, + "column": 21, "line": 1, }, }, "range": Array [ - 28, - 29, + 21, + 22, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 1, }, "start": Object { @@ -10628,7 +11912,7 @@ Object { }, "range": Array [ 0, - 29, + 22, ], "sourceType": "script", "tokens": Array [ @@ -10707,35 +11991,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { "column": 16, "line": 1, }, - }, - "range": Array [ - 16, - 22, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 23, + 15, + 16, ], "type": "Punctuator", "value": "(", @@ -10743,17 +12009,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 17, "line": 1, }, "start": Object { - "column": 23, + "column": 16, "line": 1, }, }, "range": Array [ - 23, - 24, + 16, + 17, ], "type": "Punctuator", "value": ")", @@ -10761,17 +12027,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 1, }, "start": Object { - "column": 24, + "column": 17, "line": 1, }, }, "range": Array [ - 24, - 25, + 17, + 18, ], "type": "Punctuator", "value": "{", @@ -10779,17 +12045,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 19, "line": 1, }, "start": Object { - "column": 25, + "column": 18, "line": 1, }, }, "range": Array [ - 25, - 26, + 18, + 19, ], "type": "Punctuator", "value": "}", @@ -10797,17 +12063,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 20, "line": 1, }, "start": Object { - "column": 26, + "column": 19, "line": 1, }, }, "range": Array [ - 26, - 27, + 19, + 20, ], "type": "Punctuator", "value": ";", @@ -10815,17 +12081,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 21, "line": 1, }, "start": Object { - "column": 27, + "column": 20, "line": 1, }, }, "range": Array [ - 27, - 28, + 20, + 21, ], "type": "Punctuator", "value": "}", @@ -10833,17 +12099,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 22, "line": 1, }, "start": Object { - "column": 28, + "column": 21, "line": 1, }, }, "range": Array [ - 28, - 29, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -10853,7 +12119,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-static-methods-and-accessor-properties.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-method-named-with-space.src 1`] = ` Object { "body": Array [ Object { @@ -10864,25 +12130,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, - "name": "a", + "name": "withSpace", "range": Array [ - 16, - 17, + 9, + 18, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 21, + "column": 24, "line": 1, }, "start": Object { @@ -10892,87 +12158,9 @@ Object { }, "range": Array [ 9, - 21, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 21, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 17, - 21, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - }, - "kind": "get", - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 38, + 24, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -10980,17 +12168,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { - "column": 36, + "column": 22, "line": 1, }, }, "range": Array [ - 36, - 38, + 22, + 24, ], "type": "BlockStatement", }, @@ -10999,115 +12187,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 38, + "column": 24, "line": 1, }, "start": Object { - "column": 34, + "column": 19, "line": 1, }, }, "params": Array [], "range": Array [ - 34, - 38, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 51, - "line": 1, - }, - "start": Object { - "column": 50, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 50, - 51, - ], - "type": "Identifier", - }, - "kind": "set", - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 56, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 54, - "line": 1, - }, - }, - "range": Array [ - 54, - 56, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 51, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 1, - }, - "start": Object { - "column": 52, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 52, - 53, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 51, - 56, + 19, + 24, ], "type": "FunctionExpression", }, @@ -11115,7 +12206,7 @@ Object { ], "loc": Object { "end": Object { - "column": 58, + "column": 25, "line": 1, }, "start": Object { @@ -11125,7 +12216,7 @@ Object { }, "range": Array [ 8, - 58, + 25, ], "type": "ClassBody", }, @@ -11149,7 +12240,7 @@ Object { }, "loc": Object { "end": Object { - "column": 58, + "column": 25, "line": 1, }, "start": Object { @@ -11159,33 +12250,16 @@ Object { }, "range": Array [ 0, - 58, + 25, ], "superClass": null, "type": "ClassDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 59, - "line": 1, - }, - "start": Object { - "column": 58, - "line": 1, - }, - }, - "range": Array [ - 58, - 59, - ], - "type": "EmptyStatement", - }, ], "loc": Object { "end": Object { - "column": 59, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -11194,7 +12268,7 @@ Object { }, "range": Array [ 0, - 59, + 26, ], "sourceType": "script", "tokens": Array [ @@ -11255,7 +12329,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { @@ -11265,64 +12339,10 @@ Object { }, "range": Array [ 9, - 15, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ 18, - 19, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "withSpace", }, Object { "loc": Object { @@ -11340,7 +12360,7 @@ Object { 20, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { @@ -11358,12 +12378,12 @@ Object { 21, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 23, "line": 1, }, "start": Object { @@ -11373,223 +12393,326 @@ Object { }, "range": Array [ 22, - 28, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 32, - ], - "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 36, + 23, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 24, "line": 1, }, "start": Object { - "column": 36, + "column": 23, "line": 1, }, }, "range": Array [ - 36, - 37, + 23, + 24, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 25, "line": 1, }, "start": Object { - "column": 37, + "column": 24, "line": 1, }, }, "range": Array [ - 37, - 38, + 24, + 25, ], "type": "Punctuator", "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-one-method.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 15, + 19, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ - 39, - 45, + 0, + 21, ], - "type": "Keyword", - "value": "static", + "superClass": null, + "type": "ClassDeclaration", }, Object { "loc": Object { "end": Object { - "column": 49, + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, "line": 1, }, "start": Object { - "column": 46, + "column": 0, "line": 1, }, }, "range": Array [ - 46, - 49, + 0, + 5, ], - "type": "Identifier", - "value": "set", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 51, + "column": 7, "line": 1, }, "start": Object { - "column": 50, + "column": 6, "line": 1, }, }, "range": Array [ - 50, - 51, + 6, + 7, ], "type": "Identifier", - "value": "a", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 9, "line": 1, }, "start": Object { - "column": 51, + "column": 8, "line": 1, }, }, "range": Array [ - 51, - 52, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 53, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 52, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 52, - 53, + 14, + 15, ], "type": "Identifier", - "value": "b", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 54, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 53, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 53, - 54, + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, ], "type": "Punctuator", "value": ")", @@ -11597,17 +12720,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 55, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 54, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 54, - 55, + 17, + 18, ], "type": "Punctuator", "value": "{", @@ -11615,17 +12738,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 56, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 55, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 55, - 56, + 18, + 19, ], "type": "Punctuator", "value": "}", @@ -11633,17 +12756,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 58, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 57, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 57, - 58, + 20, + 21, ], "type": "Punctuator", "value": "}", @@ -11651,17 +12774,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 59, - "line": 1, + "column": 2, + "line": 3, }, "start": Object { - "column": 58, - "line": 1, + "column": 1, + "line": 3, }, }, "range": Array [ - 58, - 59, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -11671,144 +12794,119 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-two-computed-static-methods.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-one-method-super.src 1`] = ` Object { "body": Array [ Object { "body": Object { "body": Array [ Object { - "computed": true, + "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 4, + "line": 2, }, }, "name": "a", "range": Array [ - 16, - 17, + 14, + 15, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 9, - 22, + 14, + 41, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Super", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "ExpressionStatement", }, - }, - "range": Array [ - 20, - 22, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 18, - 22, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 31, - 32, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 37, - ], - "static": true, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 35, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 35, - 37, + 17, + 41, ], "type": "BlockStatement", }, @@ -11817,18 +12915,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 33, - "line": 1, + "column": 5, + "line": 2, }, }, "params": Array [], "range": Array [ - 33, - 37, + 15, + 41, ], "type": "FunctionExpression", }, @@ -11836,8 +12934,8 @@ Object { ], "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 8, @@ -11846,7 +12944,7 @@ Object { }, "range": Array [ 8, - 38, + 43, ], "type": "ClassBody", }, @@ -11870,8 +12968,8 @@ Object { }, "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 0, @@ -11880,7 +12978,7 @@ Object { }, "range": Array [ 0, - 38, + 43, ], "superClass": null, "type": "ClassDeclaration", @@ -11888,25 +12986,25 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 2, + "line": 5, }, "start": Object { - "column": 38, - "line": 1, + "column": 1, + "line": 5, }, }, "range": Array [ - 38, - 39, + 43, + 44, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -11915,7 +13013,7 @@ Object { }, "range": Array [ 0, - 39, + 45, ], "sourceType": "script", "tokens": Array [ @@ -11976,30 +13074,30 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 9, + 14, 15, ], - "type": "Keyword", - "value": "static", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ @@ -12007,94 +13105,40 @@ Object { 16, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 2, }, }, "range": Array [ 16, 17, ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], "type": "Punctuator", "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 20, - 21, + 17, + 18, ], "type": "Punctuator", "value": "{", @@ -12102,102 +13146,30 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 30, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 31, - "line": 1, + "column": 8, + "line": 3, }, }, "range": Array [ - 31, + 27, 32, ], - "type": "Identifier", - "value": "b", + "type": "Keyword", + "value": "super", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 32, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ @@ -12205,40 +13177,22 @@ Object { 33, ], "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 34, - ], - "type": "Punctuator", "value": "(", }, Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, + "column": 15, + "line": 3, }, "start": Object { - "column": 34, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ + 33, 34, - 35, ], "type": "Punctuator", "value": ")", @@ -12246,35 +13200,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 35, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ + 34, 35, - 36, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 36, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 36, - 37, + 40, + 41, ], "type": "Punctuator", "value": "}", @@ -12282,17 +13236,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 37, - "line": 1, + "column": 0, + "line": 5, }, }, "range": Array [ - 37, - 38, + 42, + 43, ], "type": "Punctuator", "value": "}", @@ -12300,17 +13254,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 2, + "line": 5, }, "start": Object { - "column": 38, - "line": 1, + "column": 1, + "line": 5, }, }, "range": Array [ - 38, - 39, + 43, + 44, ], "type": "Punctuator", "value": ";", @@ -12320,7 +13274,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-two-methods.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-static-method.src 1`] = ` Object { "body": Array [ Object { @@ -12331,25 +13285,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 10, + "column": 17, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, "name": "a", "range": Array [ - 9, - 10, + 16, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 14, + "column": 21, "line": 1, }, "start": Object { @@ -12359,9 +13313,9 @@ Object { }, "range": Array [ 9, - 14, + 21, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -12369,95 +13323,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 14, + "column": 21, "line": 1, }, "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 14, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 10, - 14, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 19, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { "column": 19, "line": 1, }, - "start": Object { - "column": 17, - "line": 1, - }, }, "range": Array [ - 17, 19, + 21, ], "type": "BlockStatement", }, @@ -12466,18 +13342,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 19, + "column": 21, "line": 1, }, "start": Object { - "column": 15, + "column": 17, "line": 1, }, }, "params": Array [], "range": Array [ - 15, - 19, + 17, + 21, ], "type": "FunctionExpression", }, @@ -12485,7 +13361,7 @@ Object { ], "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -12495,7 +13371,7 @@ Object { }, "range": Array [ 8, - 20, + 23, ], "type": "ClassBody", }, @@ -12519,7 +13395,7 @@ Object { }, "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -12529,7 +13405,7 @@ Object { }, "range": Array [ 0, - 20, + 23, ], "superClass": null, "type": "ClassDeclaration", @@ -12537,24 +13413,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 24, "line": 1, }, "start": Object { - "column": 20, + "column": 23, "line": 1, }, }, "range": Array [ - 20, - 21, + 23, + 24, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 21, + "column": 24, "line": 1, }, "start": Object { @@ -12564,7 +13440,7 @@ Object { }, "range": Array [ 0, - 21, + 24, ], "sourceType": "script", "tokens": Array [ @@ -12625,7 +13501,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { @@ -12635,169 +13511,133 @@ Object { }, "range": Array [ 9, - 10, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, + 15, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 1, }, "start": Object { - "column": 12, + "column": 17, "line": 1, }, }, "range": Array [ - 12, - 13, + 17, + 18, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 1, }, "start": Object { - "column": 13, + "column": 18, "line": 1, }, }, "range": Array [ - 13, - 14, + 18, + 19, ], "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - "value": "b", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 20, "line": 1, }, "start": Object { - "column": 15, + "column": 19, "line": 1, }, }, "range": Array [ - 15, - 16, + 19, + 20, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 21, "line": 1, }, "start": Object { - "column": 16, + "column": 20, "line": 1, }, }, "range": Array [ - 16, - 17, + 20, + 21, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { - "column": 17, + "column": 21, "line": 1, }, }, "range": Array [ - 17, - 18, + 21, + 22, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 1, }, "start": Object { - "column": 18, + "column": 22, "line": 1, }, }, "range": Array [ - 18, - 19, + 22, + 23, ], "type": "Punctuator", "value": "}", @@ -12805,166 +13645,69 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 1, }, "start": Object { - "column": 19, + "column": 23, "line": 1, }, }, "range": Array [ - 19, - 20, + 23, + 24, ], "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": ";", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/classes/class-two-methods-computed-constructor.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-static-method-named-prototype.src 1`] = ` Object { "body": Array [ Object { "body": Object { "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 22, - ], - "raw": "\\"constructor\\"", - "type": "Literal", - "value": "constructor", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 26, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 26, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 22, - 26, - ], - "type": "FunctionExpression", - }, - }, Object { "computed": true, "key": Object { "loc": Object { "end": Object { - "column": 41, + "column": 28, "line": 1, }, "start": Object { - "column": 28, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 28, - 41, ], - "raw": "\\"constructor\\"", + "raw": "\\"prototype\\"", "type": "Literal", - "value": "constructor", + "value": "prototype", }, "kind": "method", "loc": Object { "end": Object { - "column": 46, + "column": 33, "line": 1, }, "start": Object { - "column": 27, + "column": 9, "line": 1, }, }, "range": Array [ - 27, - 46, + 9, + 33, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -12972,17 +13715,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 46, + "column": 33, "line": 1, }, "start": Object { - "column": 44, + "column": 31, "line": 1, }, }, "range": Array [ - 44, - 46, + 31, + 33, ], "type": "BlockStatement", }, @@ -12991,18 +13734,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 46, + "column": 33, "line": 1, }, "start": Object { - "column": 42, + "column": 29, "line": 1, }, }, "params": Array [], "range": Array [ - 42, - 46, + 29, + 33, ], "type": "FunctionExpression", }, @@ -13010,7 +13753,7 @@ Object { ], "loc": Object { "end": Object { - "column": 47, + "column": 34, "line": 1, }, "start": Object { @@ -13020,7 +13763,7 @@ Object { }, "range": Array [ 8, - 47, + 34, ], "type": "ClassBody", }, @@ -13044,7 +13787,7 @@ Object { }, "loc": Object { "end": Object { - "column": 47, + "column": 34, "line": 1, }, "start": Object { @@ -13054,7 +13797,7 @@ Object { }, "range": Array [ 0, - 47, + 34, ], "superClass": null, "type": "ClassDeclaration", @@ -13062,24 +13805,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, + "column": 35, "line": 1, }, "start": Object { - "column": 47, + "column": 34, "line": 1, }, }, "range": Array [ - 47, - 48, + 34, + 35, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 48, + "column": 35, "line": 1, }, "start": Object { @@ -13089,7 +13832,7 @@ Object { }, "range": Array [ 0, - 48, + 35, ], "sourceType": "script", "tokens": Array [ @@ -13150,7 +13893,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 15, "line": 1, }, "start": Object { @@ -13160,82 +13903,28 @@ Object { }, "range": Array [ 9, - 22, - ], - "type": "String", - "value": "\\"constructor\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, + 15, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 1, }, "start": Object { - "column": 25, + "column": 16, "line": 1, }, }, "range": Array [ - 25, - 26, + 16, + 17, ], "type": "Punctuator", - "value": "}", + "value": "[", }, Object { "loc": Object { @@ -13244,21 +13933,21 @@ Object { "line": 1, }, "start": Object { - "column": 27, + "column": 17, "line": 1, }, }, "range": Array [ - 27, + 17, 28, ], - "type": "Punctuator", - "value": "[", + "type": "String", + "value": "\\"prototype\\"", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 29, "line": 1, }, "start": Object { @@ -13268,25 +13957,7 @@ Object { }, "range": Array [ 28, - 41, - ], - "type": "String", - "value": "\\"constructor\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "range": Array [ - 41, - 42, + 29, ], "type": "Punctuator", "value": "]", @@ -13294,17 +13965,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, + "column": 30, "line": 1, }, "start": Object { - "column": 42, + "column": 29, "line": 1, }, }, "range": Array [ - 42, - 43, + 29, + 30, ], "type": "Punctuator", "value": "(", @@ -13312,17 +13983,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, + "column": 31, "line": 1, }, "start": Object { - "column": 43, + "column": 30, "line": 1, }, }, "range": Array [ - 43, - 44, + 30, + 31, ], "type": "Punctuator", "value": ")", @@ -13330,17 +14001,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 45, + "column": 32, "line": 1, }, "start": Object { - "column": 44, + "column": 31, "line": 1, }, }, "range": Array [ - 44, - 45, + 31, + 32, ], "type": "Punctuator", "value": "{", @@ -13348,17 +14019,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 46, + "column": 33, "line": 1, }, "start": Object { - "column": 45, + "column": 32, "line": 1, }, }, "range": Array [ - 45, - 46, + 32, + 33, ], "type": "Punctuator", "value": "}", @@ -13366,17 +14037,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 47, + "column": 34, "line": 1, }, "start": Object { - "column": 46, + "column": 33, "line": 1, }, }, "range": Array [ - 46, - 47, + 33, + 34, ], "type": "Punctuator", "value": "}", @@ -13384,17 +14055,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 48, + "column": 35, "line": 1, }, "start": Object { - "column": 47, + "column": 34, "line": 1, }, }, "range": Array [ - 47, - 48, + 34, + 35, ], "type": "Punctuator", "value": ";", @@ -13404,7 +14075,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-two-methods-semi.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-static-method-named-static.src 1`] = ` Object { "body": Array [ Object { @@ -13415,115 +14086,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 14, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 14, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 10, - 14, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { "column": 16, "line": 1, }, - "start": Object { - "column": 15, - "line": 1, - }, }, - "name": "b", + "name": "static", "range": Array [ - 15, 16, + 22, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 20, + "column": 26, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 20, + 9, + 26, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -13531,17 +14124,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 20, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 24, "line": 1, }, }, "range": Array [ - 18, - 20, + 24, + 26, ], "type": "BlockStatement", }, @@ -13550,18 +14143,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 20, + "column": 26, "line": 1, }, "start": Object { - "column": 16, + "column": 22, "line": 1, }, }, "params": Array [], "range": Array [ - 16, - 20, + 22, + 26, ], "type": "FunctionExpression", }, @@ -13569,7 +14162,7 @@ Object { ], "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { @@ -13579,7 +14172,7 @@ Object { }, "range": Array [ 8, - 21, + 28, ], "type": "ClassBody", }, @@ -13603,7 +14196,7 @@ Object { }, "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { @@ -13613,7 +14206,7 @@ Object { }, "range": Array [ 0, - 21, + 28, ], "superClass": null, "type": "ClassDeclaration", @@ -13621,24 +14214,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 29, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 22, + 28, + 29, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 22, + "column": 29, "line": 1, }, "start": Object { @@ -13648,7 +14241,7 @@ Object { }, "range": Array [ 0, - 22, + 29, ], "sourceType": "script", "tokens": Array [ @@ -13709,7 +14302,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { @@ -13719,205 +14312,133 @@ Object { }, "range": Array [ 9, - 10, + 15, ], - "type": "Identifier", - "value": "a", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 22, "line": 1, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 11, + 16, + 22, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 1, }, "start": Object { - "column": 11, + "column": 22, "line": 1, }, }, "range": Array [ - 11, - 12, + 22, + 23, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 24, "line": 1, }, "start": Object { - "column": 12, + "column": 23, "line": 1, }, }, "range": Array [ - 12, - 13, + 23, + 24, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 25, "line": 1, }, "start": Object { - "column": 13, + "column": 24, "line": 1, }, }, "range": Array [ - 13, - 14, + 24, + 25, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 26, "line": 1, }, "start": Object { - "column": 14, + "column": 25, "line": 1, }, }, "range": Array [ - 14, - 15, + 25, + 26, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 27, "line": 1, }, "start": Object { - "column": 15, + "column": 26, "line": 1, }, }, "range": Array [ - 15, - 16, + 26, + 27, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 28, "line": 1, }, "start": Object { - "column": 16, + "column": 27, "line": 1, }, }, "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, + 27, + 28, ], "type": "Punctuator", "value": "}", @@ -13925,17 +14446,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 29, "line": 1, }, "start": Object { - "column": 21, + "column": 28, "line": 1, }, }, "range": Array [ - 21, - 22, + 28, + 29, ], "type": "Punctuator", "value": ";", @@ -13945,7 +14466,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-two-methods-three-semi.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-static-methods-and-accessor-properties.src 1`] = ` Object { "body": Array [ Object { @@ -13956,37 +14477,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "name": "a", "range": Array [ - 10, - 11, + 16, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ - 10, - 15, + 9, + 21, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -13994,17 +14515,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 13, + "column": 19, "line": 1, }, }, "range": Array [ - 13, - 15, + 19, + 21, ], "type": "BlockStatement", }, @@ -14013,18 +14534,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 11, + "column": 17, "line": 1, }, }, "params": Array [], "range": Array [ - 11, - 15, + 17, + 21, ], "type": "FunctionExpression", }, @@ -14034,37 +14555,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 17, + "column": 34, "line": 1, }, "start": Object { - "column": 16, + "column": 33, "line": 1, }, }, - "name": "b", + "name": "a", "range": Array [ - 16, - 17, + 33, + 34, ], "type": "Identifier", }, - "kind": "method", + "kind": "get", "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 16, + "column": 22, "line": 1, }, }, "range": Array [ - 16, - 21, + 22, + 38, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -14072,17 +14593,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 19, + "column": 36, "line": 1, }, }, "range": Array [ - 19, - 21, + 36, + 38, ], "type": "BlockStatement", }, @@ -14091,18 +14612,115 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 17, + "column": 34, "line": 1, }, }, "params": Array [], "range": Array [ - 17, - 21, + 34, + 38, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 56, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 56, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 51, + 56, ], "type": "FunctionExpression", }, @@ -14110,7 +14728,7 @@ Object { ], "loc": Object { "end": Object { - "column": 23, + "column": 58, "line": 1, }, "start": Object { @@ -14120,7 +14738,7 @@ Object { }, "range": Array [ 8, - 23, + 58, ], "type": "ClassBody", }, @@ -14144,7 +14762,7 @@ Object { }, "loc": Object { "end": Object { - "column": 23, + "column": 58, "line": 1, }, "start": Object { @@ -14154,7 +14772,7 @@ Object { }, "range": Array [ 0, - 23, + 58, ], "superClass": null, "type": "ClassDeclaration", @@ -14162,24 +14780,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 59, "line": 1, }, "start": Object { - "column": 23, + "column": 58, "line": 1, }, }, "range": Array [ - 23, - 24, + 58, + 59, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 24, + "column": 59, "line": 1, }, "start": Object { @@ -14189,7 +14807,7 @@ Object { }, "range": Array [ 0, - 24, + 59, ], "sourceType": "script", "tokens": Array [ @@ -14250,7 +14868,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { @@ -14260,25 +14878,25 @@ Object { }, "range": Array [ 9, - 10, + 15, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 11, + 16, + 17, ], "type": "Identifier", "value": "a", @@ -14286,17 +14904,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 18, "line": 1, }, "start": Object { - "column": 11, + "column": 17, "line": 1, }, }, "range": Array [ - 11, - 12, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -14304,17 +14922,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, "range": Array [ - 12, - 13, + 18, + 19, ], "type": "Punctuator", "value": ")", @@ -14322,17 +14940,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 20, "line": 1, }, "start": Object { - "column": 13, + "column": 19, "line": 1, }, }, "range": Array [ - 13, - 14, + 19, + 20, ], "type": "Punctuator", "value": "{", @@ -14340,17 +14958,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { - "column": 14, + "column": 20, "line": 1, }, }, "range": Array [ - 14, - 15, + 20, + 21, ], "type": "Punctuator", "value": "}", @@ -14358,53 +14976,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 28, "line": 1, }, "start": Object { - "column": 15, + "column": 22, "line": 1, }, }, "range": Array [ - 15, - 16, + 22, + 28, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 32, "line": 1, }, "start": Object { - "column": 16, + "column": 29, "line": 1, }, }, "range": Array [ - 16, - 17, + 29, + 32, ], "type": "Identifier", - "value": "b", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 34, "line": 1, }, "start": Object { - "column": 17, + "column": 33, "line": 1, }, }, "range": Array [ - 17, - 18, + 33, + 34, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, ], "type": "Punctuator", "value": "(", @@ -14412,17 +15048,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 36, "line": 1, }, "start": Object { - "column": 18, + "column": 35, "line": 1, }, }, "range": Array [ - 18, - 19, + 35, + 36, ], "type": "Punctuator", "value": ")", @@ -14430,17 +15066,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 37, "line": 1, }, "start": Object { - "column": 19, + "column": 36, "line": 1, }, }, "range": Array [ - 19, - 20, + 36, + 37, ], "type": "Punctuator", "value": "{", @@ -14448,17 +15084,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 38, "line": 1, }, "start": Object { - "column": 20, + "column": 37, "line": 1, }, }, "range": Array [ - 20, - 21, + 37, + 38, ], "type": "Punctuator", "value": "}", @@ -14466,92 +15102,218 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 45, "line": 1, }, "start": Object { - "column": 21, + "column": 39, "line": 1, }, }, "range": Array [ - 21, - 22, + 39, + 45, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 49, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 53, "line": 1, }, "start": Object { - "column": 22, + "column": 52, "line": 1, }, }, "range": Array [ - 22, - 23, + 52, + 53, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 55, "line": 1, }, "start": Object { - "column": 23, + "column": 54, "line": 1, }, }, "range": Array [ - 23, - 24, + 54, + 55, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/class-two-methods-two-semi.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-computed-static-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, "name": "a", "range": Array [ - 9, - 10, + 16, + 17, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { @@ -14561,9 +15323,9 @@ Object { }, "range": Array [ 9, - 14, + 22, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -14571,17 +15333,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 12, + "column": 20, "line": 1, }, }, "range": Array [ - 12, - 14, + 20, + 22, ], "type": "BlockStatement", }, @@ -14590,58 +15352,58 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 10, + "column": 18, "line": 1, }, }, "params": Array [], "range": Array [ - 10, - 14, + 18, + 22, ], "type": "FunctionExpression", }, }, Object { - "computed": false, + "computed": true, "key": Object { "loc": Object { "end": Object { - "column": 16, + "column": 32, "line": 1, }, "start": Object { - "column": 15, + "column": 31, "line": 1, }, }, "name": "b", "range": Array [ - 15, - 16, + 31, + 32, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 20, + "column": 37, "line": 1, }, "start": Object { - "column": 15, + "column": 24, "line": 1, }, }, "range": Array [ - 15, - 20, + 24, + 37, ], - "static": false, + "static": true, "type": "MethodDefinition", "value": Object { "async": false, @@ -14649,17 +15411,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 20, + "column": 37, "line": 1, }, "start": Object { - "column": 18, + "column": 35, "line": 1, }, }, "range": Array [ - 18, - 20, + 35, + 37, ], "type": "BlockStatement", }, @@ -14668,18 +15430,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 20, + "column": 37, "line": 1, }, "start": Object { - "column": 16, + "column": 33, "line": 1, }, }, "params": Array [], "range": Array [ - 16, - 20, + 33, + 37, ], "type": "FunctionExpression", }, @@ -14687,7 +15449,7 @@ Object { ], "loc": Object { "end": Object { - "column": 22, + "column": 38, "line": 1, }, "start": Object { @@ -14697,7 +15459,7 @@ Object { }, "range": Array [ 8, - 22, + 38, ], "type": "ClassBody", }, @@ -14721,7 +15483,7 @@ Object { }, "loc": Object { "end": Object { - "column": 22, + "column": 38, "line": 1, }, "start": Object { @@ -14731,7 +15493,7 @@ Object { }, "range": Array [ 0, - 22, + 38, ], "superClass": null, "type": "ClassDeclaration", @@ -14739,24 +15501,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 39, "line": 1, }, "start": Object { - "column": 22, + "column": 38, "line": 1, }, }, "range": Array [ - 22, - 23, + 38, + 39, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 23, + "column": 39, "line": 1, }, "start": Object { @@ -14766,7 +15528,7 @@ Object { }, "range": Array [ 0, - 23, + 39, ], "sourceType": "script", "tokens": Array [ @@ -14827,7 +15589,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { @@ -14837,7 +15599,43 @@ Object { }, "range": Array [ 9, - 10, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, ], "type": "Identifier", "value": "a", @@ -14845,17 +15643,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { - "column": 10, + "column": 17, "line": 1, }, }, "range": Array [ - 10, - 11, + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, ], "type": "Punctuator", "value": "(", @@ -14863,17 +15679,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 19, "line": 1, }, }, "range": Array [ - 11, - 12, + 19, + 20, ], "type": "Punctuator", "value": ")", @@ -14881,17 +15697,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 21, "line": 1, }, "start": Object { - "column": 12, + "column": 20, "line": 1, }, }, "range": Array [ - 12, - 13, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -14899,17 +15715,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 13, + "column": 21, "line": 1, }, }, "range": Array [ - 13, - 14, + 21, + 22, ], "type": "Punctuator", "value": "}", @@ -14917,17 +15733,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 1, }, "start": Object { - "column": 14, + "column": 22, "line": 1, }, }, "range": Array [ - 14, - 15, + 22, + 23, ], "type": "Punctuator", "value": ";", @@ -14935,17 +15751,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 30, "line": 1, }, "start": Object { - "column": 15, + "column": 24, "line": 1, }, }, "range": Array [ - 15, - 16, + 24, + 30, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, ], "type": "Identifier", "value": "b", @@ -14953,107 +15805,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 33, "line": 1, }, "start": Object { - "column": 16, + "column": 32, "line": 1, }, }, "range": Array [ - 16, - 17, + 32, + 33, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 34, "line": 1, }, "start": Object { - "column": 17, + "column": 33, "line": 1, }, }, "range": Array [ - 17, - 18, + 33, + 34, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 35, "line": 1, }, "start": Object { - "column": 18, + "column": 34, "line": 1, }, }, "range": Array [ - 18, - 19, + 34, + 35, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 36, "line": 1, }, "start": Object { - "column": 19, + "column": 35, "line": 1, }, }, "range": Array [ - 19, - 20, + 35, + 36, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 37, "line": 1, }, "start": Object { - "column": 20, + "column": 36, "line": 1, }, }, "range": Array [ - 20, - 21, + 36, + 37, ], "type": "Punctuator", - "value": ";", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 38, "line": 1, }, "start": Object { - "column": 21, + "column": 37, "line": 1, }, }, "range": Array [ - 21, - 22, + 37, + 38, ], "type": "Punctuator", "value": "}", @@ -15061,17 +15913,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 39, "line": 1, }, "start": Object { - "column": 22, + "column": 38, "line": 1, }, }, "range": Array [ - 22, - 23, + 38, + 39, ], "type": "Punctuator", "value": ";", @@ -15081,7 +15933,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-two-static-methods-named-constructor.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-two-methods.src 1`] = ` Object { "body": Array [ Object { @@ -15092,25 +15944,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 27, + "column": 10, "line": 1, }, "start": Object { - "column": 16, + "column": 9, "line": 1, }, }, - "name": "constructor", + "name": "a", "range": Array [ - 16, - 27, + 9, + 10, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 31, + "column": 14, "line": 1, }, "start": Object { @@ -15120,9 +15972,9 @@ Object { }, "range": Array [ 9, - 31, + 14, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -15130,17 +15982,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 31, + "column": 14, "line": 1, }, "start": Object { - "column": 29, + "column": 12, "line": 1, }, }, "range": Array [ - 29, - 31, + 12, + 14, ], "type": "BlockStatement", }, @@ -15149,18 +16001,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 31, + "column": 14, "line": 1, }, "start": Object { - "column": 27, + "column": 10, "line": 1, }, }, "params": Array [], "range": Array [ - 27, - 31, + 10, + 14, ], "type": "FunctionExpression", }, @@ -15170,37 +16022,37 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 50, + "column": 15, "line": 1, }, "start": Object { - "column": 39, + "column": 14, "line": 1, }, }, - "name": "constructor", + "name": "b", "range": Array [ - 39, - 50, + 14, + 15, ], "type": "Identifier", }, "kind": "method", "loc": Object { "end": Object { - "column": 54, + "column": 19, "line": 1, }, "start": Object { - "column": 32, + "column": 14, "line": 1, }, }, "range": Array [ - 32, - 54, + 14, + 19, ], - "static": true, + "static": false, "type": "MethodDefinition", "value": Object { "async": false, @@ -15208,17 +16060,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 54, + "column": 19, "line": 1, }, "start": Object { - "column": 52, + "column": 17, "line": 1, }, }, "range": Array [ - 52, - 54, + 17, + 19, ], "type": "BlockStatement", }, @@ -15227,18 +16079,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 54, + "column": 19, "line": 1, }, "start": Object { - "column": 50, + "column": 15, "line": 1, }, }, "params": Array [], "range": Array [ - 50, - 54, + 15, + 19, ], "type": "FunctionExpression", }, @@ -15246,7 +16098,7 @@ Object { ], "loc": Object { "end": Object { - "column": 55, + "column": 20, "line": 1, }, "start": Object { @@ -15256,7 +16108,7 @@ Object { }, "range": Array [ 8, - 55, + 20, ], "type": "ClassBody", }, @@ -15280,7 +16132,7 @@ Object { }, "loc": Object { "end": Object { - "column": 55, + "column": 20, "line": 1, }, "start": Object { @@ -15290,7 +16142,7 @@ Object { }, "range": Array [ 0, - 55, + 20, ], "superClass": null, "type": "ClassDeclaration", @@ -15298,24 +16150,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 56, + "column": 21, "line": 1, }, "start": Object { - "column": 55, + "column": 20, "line": 1, }, }, "range": Array [ - 55, - 56, + 20, + 21, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 56, + "column": 21, "line": 1, }, "start": Object { @@ -15325,7 +16177,7 @@ Object { }, "range": Array [ 0, - 56, + 21, ], "sourceType": "script", "tokens": Array [ @@ -15386,7 +16238,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { @@ -15396,43 +16248,25 @@ Object { }, "range": Array [ 9, - 15, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 27, + 10, ], "type": "Identifier", - "value": "constructor", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 11, "line": 1, }, "start": Object { - "column": 27, + "column": 10, "line": 1, }, }, "range": Array [ - 27, - 28, + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -15440,17 +16274,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 12, "line": 1, }, "start": Object { - "column": 28, + "column": 11, "line": 1, }, }, "range": Array [ - 28, - 29, + 11, + 12, ], "type": "Punctuator", "value": ")", @@ -15458,17 +16292,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 30, + "column": 13, "line": 1, }, "start": Object { - "column": 29, + "column": 12, "line": 1, }, }, "range": Array [ - 29, - 30, + 12, + 13, ], "type": "Punctuator", "value": "{", @@ -15476,17 +16310,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 14, "line": 1, }, "start": Object { - "column": 30, + "column": 13, "line": 1, }, }, "range": Array [ - 30, - 31, + 13, + 14, ], "type": "Punctuator", "value": "}", @@ -15494,53 +16328,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, + "column": 15, "line": 1, }, "start": Object { - "column": 32, + "column": 14, "line": 1, }, }, "range": Array [ - 32, - 38, - ], - "type": "Keyword", - "value": "static", - }, - Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 50, + 14, + 15, ], "type": "Identifier", - "value": "constructor", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 51, + "column": 16, "line": 1, }, "start": Object { - "column": 50, + "column": 15, "line": 1, }, }, "range": Array [ - 50, - 51, + 15, + 16, ], "type": "Punctuator", "value": "(", @@ -15548,17 +16364,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 52, + "column": 17, "line": 1, }, "start": Object { - "column": 51, + "column": 16, "line": 1, }, }, "range": Array [ - 51, - 52, + 16, + 17, ], "type": "Punctuator", "value": ")", @@ -15566,17 +16382,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, + "column": 18, "line": 1, }, "start": Object { - "column": 52, + "column": 17, "line": 1, }, }, "range": Array [ - 52, - 53, + 17, + 18, ], "type": "Punctuator", "value": "{", @@ -15584,17 +16400,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 54, + "column": 19, "line": 1, }, "start": Object { - "column": 53, + "column": 18, "line": 1, }, }, "range": Array [ - 53, - 54, + 18, + 19, ], "type": "Punctuator", "value": "}", @@ -15602,17 +16418,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 55, + "column": 20, "line": 1, }, "start": Object { - "column": 54, + "column": 19, "line": 1, }, }, "range": Array [ - 54, - 55, + 19, + 20, ], "type": "Punctuator", "value": "}", @@ -15620,17 +16436,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 56, + "column": 21, "line": 1, }, "start": Object { - "column": 55, + "column": 20, "line": 1, }, }, "range": Array [ - 55, - 56, + 20, + 21, ], "type": "Punctuator", "value": ";", @@ -15640,7 +16456,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/class-with-constructor.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-two-methods-computed-constructor.src 1`] = ` Object { "body": Array [ Object { @@ -15651,7 +16467,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 20, + "column": 22, "line": 1, }, "start": Object { @@ -15659,17 +16475,18 @@ Object { "line": 1, }, }, - "name": "constructor", "range": Array [ 9, - 20, + 22, ], - "type": "Identifier", + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", }, "kind": "constructor", "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { @@ -15679,7 +16496,7 @@ Object { }, "range": Array [ 9, - 24, + 26, ], "static": false, "type": "MethodDefinition", @@ -15689,17 +16506,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { - "column": 22, + "column": 24, "line": 1, }, }, "range": Array [ - 22, 24, + 26, ], "type": "BlockStatement", }, @@ -15708,18 +16525,97 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { - "column": 20, + "column": 22, "line": 1, }, }, "params": Array [], "range": Array [ - 20, - 24, + 22, + 26, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 41, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 46, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 46, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 42, + 46, ], "type": "FunctionExpression", }, @@ -15727,7 +16623,7 @@ Object { ], "loc": Object { "end": Object { - "column": 25, + "column": 47, "line": 1, }, "start": Object { @@ -15737,7 +16633,7 @@ Object { }, "range": Array [ 8, - 25, + 47, ], "type": "ClassBody", }, @@ -15761,7 +16657,7 @@ Object { }, "loc": Object { "end": Object { - "column": 25, + "column": 47, "line": 1, }, "start": Object { @@ -15771,7 +16667,7 @@ Object { }, "range": Array [ 0, - 25, + 47, ], "superClass": null, "type": "ClassDeclaration", @@ -15779,24 +16675,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 48, "line": 1, }, "start": Object { - "column": 25, + "column": 47, "line": 1, }, }, "range": Array [ - 25, - 26, + 47, + 48, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 26, + "column": 48, "line": 1, }, "start": Object { @@ -15806,7 +16702,7 @@ Object { }, "range": Array [ 0, - 26, + 48, ], "sourceType": "script", "tokens": Array [ @@ -15867,7 +16763,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 22, "line": 1, }, "start": Object { @@ -15877,25 +16773,25 @@ Object { }, "range": Array [ 9, - 20, + 22, ], - "type": "Identifier", - "value": "constructor", + "type": "String", + "value": "\\"constructor\\"", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 23, "line": 1, }, "start": Object { - "column": 20, + "column": 22, "line": 1, }, }, "range": Array [ - 20, - 21, + 22, + 23, ], "type": "Punctuator", "value": "(", @@ -15903,17 +16799,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { - "column": 21, + "column": 23, "line": 1, }, }, "range": Array [ - 21, - 22, + 23, + 24, ], "type": "Punctuator", "value": ")", @@ -15921,17 +16817,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 25, "line": 1, }, "start": Object { - "column": 22, + "column": 24, "line": 1, }, }, "range": Array [ - 22, - 23, + 24, + 25, ], "type": "Punctuator", "value": "{", @@ -15939,17 +16835,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { - "column": 23, + "column": 25, "line": 1, }, }, "range": Array [ - 23, - 24, + 25, + 26, ], "type": "Punctuator", "value": "}", @@ -15957,284 +16853,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 27, "line": 1, }, }, "range": Array [ - 24, - 25, + 27, + 28, ], "type": "Punctuator", - "value": "}", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 41, "line": 1, }, "start": Object { - "column": 25, + "column": 28, "line": 1, }, }, "range": Array [ - 25, - 26, + 28, + 41, ], - "type": "Punctuator", - "value": ";", + "type": "String", + "value": "\\"constructor\\"", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/class-with-constructor-parameters.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "constructor", - "range": Array [ - 9, - 20, - ], - "type": "Identifier", - }, - "kind": "constructor", - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 32, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 32, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 20, - 32, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 33, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 33, + "column": 42, "line": 1, }, "start": Object { - "column": 0, + "column": 41, "line": 1, }, }, "range": Array [ - 0, - 33, + 41, + 42, ], - "superClass": null, - "type": "ClassDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "]", }, - }, - "range": Array [ - 0, - 34, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 43, "line": 1, }, "start": Object { - "column": 0, + "column": 42, "line": 1, }, }, "range": Array [ - 0, - 5, + 42, + 43, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 44, "line": 1, }, "start": Object { - "column": 6, + "column": 43, "line": 1, }, }, "range": Array [ - 6, - 7, + 43, + 44, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 45, "line": 1, }, "start": Object { - "column": 8, + "column": 44, "line": 1, }, }, "range": Array [ - 8, - 9, + 44, + 45, ], "type": "Punctuator", "value": "{", @@ -16242,171 +16961,63 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 46, "line": 1, }, "start": Object { - "column": 9, + "column": 45, "line": 1, }, }, "range": Array [ - 9, - 20, + 45, + 46, ], - "type": "Identifier", - "value": "constructor", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 47, "line": 1, }, "start": Object { - "column": 20, + "column": 46, "line": 1, }, }, "range": Array [ - 20, - 21, + 46, + 47, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 48, "line": 1, }, "start": Object { - "column": 21, + "column": 47, "line": 1, }, }, "range": Array [ - 21, - 24, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 33, + 47, + 48, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/classes/class-with-constructor-with-space.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-two-methods-semi.src 1`] = ` Object { "body": Array [ Object { @@ -16417,7 +17028,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 20, + "column": 10, "line": 1, }, "start": Object { @@ -16425,17 +17036,17 @@ Object { "line": 1, }, }, - "name": "constructor", + "name": "a", "range": Array [ 9, - 20, + 10, ], "type": "Identifier", }, - "kind": "constructor", + "kind": "method", "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 1, }, "start": Object { @@ -16445,7 +17056,7 @@ Object { }, "range": Array [ 9, - 25, + 14, ], "static": false, "type": "MethodDefinition", @@ -16455,17 +17066,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 1, }, "start": Object { - "column": 23, + "column": 12, "line": 1, }, }, "range": Array [ - 23, - 25, + 12, + 14, ], "type": "BlockStatement", }, @@ -16474,18 +17085,96 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, "params": Array [], "range": Array [ - 21, - 25, + 10, + 14, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 16, + 20, ], "type": "FunctionExpression", }, @@ -16493,7 +17182,7 @@ Object { ], "loc": Object { "end": Object { - "column": 26, + "column": 21, "line": 1, }, "start": Object { @@ -16503,7 +17192,7 @@ Object { }, "range": Array [ 8, - 26, + 21, ], "type": "ClassBody", }, @@ -16527,7 +17216,7 @@ Object { }, "loc": Object { "end": Object { - "column": 26, + "column": 21, "line": 1, }, "start": Object { @@ -16537,7 +17226,7 @@ Object { }, "range": Array [ 0, - 26, + 21, ], "superClass": null, "type": "ClassDeclaration", @@ -16545,25 +17234,25 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 22, "line": 1, }, "start": Object { - "column": 26, + "column": 21, "line": 1, }, }, "range": Array [ - 26, - 27, + 21, + 22, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -16572,7 +17261,7 @@ Object { }, "range": Array [ 0, - 28, + 22, ], "sourceType": "script", "tokens": Array [ @@ -16633,7 +17322,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 10, "line": 1, }, "start": Object { @@ -16643,25 +17332,25 @@ Object { }, "range": Array [ 9, - 20, + 10, ], "type": "Identifier", - "value": "constructor", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 11, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, "range": Array [ - 21, - 22, + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -16669,17 +17358,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 1, }, "start": Object { - "column": 22, + "column": 11, "line": 1, }, }, "range": Array [ - 22, - 23, + 11, + 12, ], "type": "Punctuator", "value": ")", @@ -16687,17 +17376,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { - "column": 23, + "column": 12, "line": 1, }, }, "range": Array [ - 23, - 24, + 12, + 13, ], "type": "Punctuator", "value": "{", @@ -16705,17 +17394,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 1, }, "start": Object { - "column": 24, + "column": 13, "line": 1, }, }, "range": Array [ - 24, - 25, + 13, + 14, ], "type": "Punctuator", "value": "}", @@ -16723,482 +17412,504 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 27, + 15, + 16, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "b", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/derived-class-assign-to-var.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - "init": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 27, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 27, - ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "raw": "0", - "type": "Literal", - "value": 0, - }, - "type": "ClassExpression", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 27, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 28, + "column": 17, "line": 1, }, "start": Object { - "column": 0, + "column": 16, "line": 1, }, }, "range": Array [ - 0, - 28, + 16, + 17, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "(", }, - }, - "range": Array [ - 0, - 28, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 18, "line": 1, }, "start": Object { - "column": 0, + "column": 17, "line": 1, }, }, "range": Array [ - 0, - 3, + 17, + 18, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 19, "line": 1, }, "start": Object { - "column": 4, + "column": 18, "line": 1, }, }, "range": Array [ - 4, - 5, + 18, + 19, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 20, "line": 1, }, "start": Object { - "column": 6, + "column": 19, "line": 1, }, }, "range": Array [ - 6, - 7, + 19, + 20, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 20, "line": 1, }, }, "range": Array [ - 8, - 13, + 20, + 21, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 22, "line": 1, }, "start": Object { - "column": 14, + "column": 21, "line": 1, }, }, "range": Array [ - 14, - 15, + 21, + 22, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": ";", }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 16, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-methods-three-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 15, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 15, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 21, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, "line": 1, }, }, "range": Array [ - 16, + 0, 23, ], - "type": "Keyword", - "value": "extends", + "superClass": null, + "type": "ClassDeclaration", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 24, - 25, ], - "type": "Numeric", - "value": "0", + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 26, + "column": 5, "line": 1, }, "start": Object { - "column": 25, + "column": 0, "line": 1, }, }, "range": Array [ - 25, - 26, + 0, + 5, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 7, "line": 1, }, "start": Object { - "column": 26, + "column": 6, "line": 1, }, }, "range": Array [ - 26, - 27, + 6, + 7, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 9, "line": 1, }, "start": Object { - "column": 27, + "column": 8, "line": 1, }, }, "range": Array [ - 27, - 28, + 8, + 9, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/derived-class-expression.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 18, - ], - "type": "ClassBody", - }, - "id": null, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, - "range": Array [ - 1, - 18, - ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "raw": "0", - "type": "Literal", - "value": 0, + "start": Object { + "column": 9, + "line": 1, }, - "type": "ClassExpression", }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { - "column": 20, + "column": 11, "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 20, + 10, + 11, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "a", }, - }, - "range": Array [ - 0, - 20, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { - "column": 0, + "column": 11, "line": 1, }, }, "range": Array [ - 0, - 1, + 11, + 12, ], "type": "Punctuator", "value": "(", @@ -17206,20 +17917,20 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, "range": Array [ - 1, - 6, + 12, + 13, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -17228,16 +17939,34 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, "range": Array [ - 7, + 13, 14, ], - "type": "Keyword", - "value": "extends", + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -17254,8 +17983,8 @@ Object { 15, 16, ], - "type": "Numeric", - "value": "0", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { @@ -17272,8 +18001,8 @@ Object { 16, 17, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { @@ -17291,7 +18020,7 @@ Object { 18, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { @@ -17327,172 +18056,58 @@ Object { 20, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/empty-class.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, }, - "range": Array [ - 8, - 10, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + "start": Object { + "column": 20, + "line": 1, }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 1, }, "start": Object { - "column": 0, + "column": 21, "line": 1, }, }, "range": Array [ - 0, - 10, + 21, + 22, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 23, "line": 1, }, "start": Object { - "column": 10, + "column": 22, "line": 1, }, }, "range": Array [ - 10, - 11, - ], - "type": "EmptyStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 11, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - "value": "A", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, + 22, + 23, ], "type": "Punctuator", "value": "}", @@ -17500,17 +18115,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 24, "line": 1, }, "start": Object { - "column": 10, + "column": 23, "line": 1, }, }, "range": Array [ - 10, - 11, + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -17520,15 +18135,172 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/empty-class-double-semi.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-two-methods-two-semi.src 1`] = ` Object { "body": Array [ Object { "body": Object { - "body": Array [], + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 14, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 16, + 20, + ], + "type": "FunctionExpression", + }, + }, + ], "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 1, }, "start": Object { @@ -17538,7 +18310,7 @@ Object { }, "range": Array [ 8, - 10, + 22, ], "type": "ClassBody", }, @@ -17562,7 +18334,7 @@ Object { }, "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 1, }, "start": Object { @@ -17572,7 +18344,7 @@ Object { }, "range": Array [ 0, - 10, + 22, ], "superClass": null, "type": "ClassDeclaration", @@ -17580,24 +18352,24 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 23, "line": 1, }, "start": Object { - "column": 10, + "column": 22, "line": 1, }, }, "range": Array [ - 10, - 11, + 22, + 23, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 11, + "column": 23, "line": 1, }, "start": Object { @@ -17607,7 +18379,7 @@ Object { }, "range": Array [ 0, - 11, + 23, ], "sourceType": "script", "tokens": Array [ @@ -17680,8 +18452,8 @@ Object { 9, 10, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -17699,291 +18471,169 @@ Object { 11, ], "type": "Punctuator", - "value": ";", + "value": "(", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/empty-class-semi.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 11, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 0, + "column": 11, "line": 1, }, }, "range": Array [ - 0, 11, + 12, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, 12, + 13, ], - "type": "EmptyStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 12, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 14, "line": 1, }, "start": Object { - "column": 0, + "column": 13, "line": 1, }, }, "range": Array [ - 0, - 5, + 13, + 14, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 1, }, "start": Object { - "column": 6, + "column": 14, "line": 1, }, }, "range": Array [ - 6, - 7, + 14, + 15, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 16, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, "range": Array [ - 8, - 9, + 15, + 16, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 17, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, "range": Array [ - 9, - 10, + 16, + 17, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { - "column": 10, + "column": 17, "line": 1, }, }, "range": Array [ - 10, - 11, + 17, + 18, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 19, "line": 1, }, "start": Object { - "column": 11, + "column": 18, "line": 1, }, }, "range": Array [ - 11, - 12, + 18, + 19, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/empty-literal-derived-class.src 1`] = ` -Object { - "body": Array [ Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 19, "line": 1, }, }, "range": Array [ - 0, + 19, 20, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "raw": "0", - "type": "Literal", - "value": 0, - }, - "type": "ClassDeclaration", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -18000,22 +18650,295 @@ Object { 20, 21, ], - "type": "EmptyStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, + "type": "Punctuator", + "value": ";", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/class-two-static-methods-named-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 27, + 31, + ], + "type": "FunctionExpression", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 54, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 50, + 54, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 55, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, }, "range": Array [ 0, - 21, + 56, ], "sourceType": "script", "tokens": Array [ @@ -18058,7 +18981,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 9, "line": 1, }, "start": Object { @@ -18068,15 +18991,33 @@ Object { }, "range": Array [ 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, 15, ], "type": "Keyword", - "value": "extends", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 27, "line": 1, }, "start": Object { @@ -18086,229 +19027,169 @@ Object { }, "range": Array [ 16, - 17, + 27, ], - "type": "Numeric", - "value": "0", + "type": "Identifier", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 28, "line": 1, }, "start": Object { - "column": 18, + "column": 27, "line": 1, }, }, "range": Array [ - 18, - 19, + 27, + 28, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 29, "line": 1, }, "start": Object { - "column": 19, + "column": 28, "line": 1, }, }, "range": Array [ - 19, - 20, + 28, + 29, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 30, "line": 1, }, "start": Object { - "column": 20, + "column": 29, "line": 1, }, }, "range": Array [ - 20, - 21, + 29, + 30, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/classes/named-class-expression.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "start": Object { + "column": 30, + "line": 1, }, - "range": Array [ - 1, - 11, - ], - "superClass": null, - "type": "ClassExpression", }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { "loc": Object { "end": Object { - "column": 13, + "column": 38, "line": 1, }, "start": Object { - "column": 0, + "column": 32, "line": 1, }, }, "range": Array [ - 0, - 13, + 32, + 38, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "static", }, - }, - "range": Array [ - 0, - 13, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 50, "line": 1, }, "start": Object { - "column": 0, + "column": 39, "line": 1, }, }, "range": Array [ - 0, - 1, + 39, + 50, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 51, "line": 1, }, "start": Object { - "column": 1, + "column": 50, "line": 1, }, }, "range": Array [ - 1, - 6, + 50, + 51, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 52, "line": 1, }, "start": Object { - "column": 7, + "column": 51, "line": 1, }, }, "range": Array [ - 7, - 8, + 51, + 52, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 53, "line": 1, }, "start": Object { - "column": 9, + "column": 52, "line": 1, }, }, "range": Array [ - 9, - 10, + 52, + 53, ], "type": "Punctuator", "value": "{", @@ -18316,17 +19197,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 54, "line": 1, }, "start": Object { - "column": 10, + "column": 53, "line": 1, }, }, "range": Array [ - 10, - 11, + 53, + 54, ], "type": "Punctuator", "value": "}", @@ -18334,35 +19215,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 55, "line": 1, }, "start": Object { - "column": 11, + "column": 54, "line": 1, }, }, "range": Array [ - 11, - 12, + 54, + 55, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 56, "line": 1, }, "start": Object { - "column": 12, + "column": 55, "line": 1, }, }, "range": Array [ - 12, - 13, + 55, + 56, ], "type": "Punctuator", "value": ";", @@ -18372,85 +19253,128 @@ Object { } `; -exports[`ecmaFeatures fixtures/classes/named-derived-class-expression.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-with-constructor.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "range": Array [ + 9, + 20, + ], + "type": "Identifier", }, - }, - "range": Array [ - 18, - 20, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, - "start": Object { - "column": 7, - "line": 1, + "range": Array [ + 9, + 24, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 20, + 24, + ], + "type": "FunctionExpression", }, }, - "name": "A", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, + ], "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 1, }, "start": Object { - "column": 1, + "column": 8, "line": 1, }, }, "range": Array [ - 1, - 20, + 8, + 25, ], - "superClass": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 17, - 18, - ], - "raw": "0", - "type": "Literal", - "value": 0, }, - "type": "ClassExpression", + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 25, "line": 1, }, "start": Object { @@ -18460,14 +19384,32 @@ Object { }, "range": Array [ 0, - 22, + 25, ], - "type": "ExpressionStatement", + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 1, }, "start": Object { @@ -18477,14 +19419,14 @@ Object { }, "range": Array [ 0, - 22, + 26, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -18494,51 +19436,51 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, 6, + 7, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, + 9, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 20, "line": 1, }, "start": Object { @@ -18548,43 +19490,61 @@ Object { }, "range": Array [ 9, - 16, + 20, ], - "type": "Keyword", - "value": "extends", + "type": "Identifier", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 21, "line": 1, }, "start": Object { - "column": 17, + "column": 20, "line": 1, }, }, "range": Array [ - 17, - 18, + 20, + 21, ], - "type": "Numeric", - "value": "0", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 22, "line": 1, }, "start": Object { - "column": 18, + "column": 21, "line": 1, }, }, "range": Array [ - 18, - 19, + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, ], "type": "Punctuator", "value": "{", @@ -18592,17 +19552,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 1, }, "start": Object { - "column": 19, + "column": 23, "line": 1, }, }, "range": Array [ - 19, - 20, + 23, + 24, ], "type": "Punctuator", "value": "}", @@ -18610,35 +19570,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 25, "line": 1, }, "start": Object { - "column": 20, + "column": 24, "line": 1, }, }, "range": Array [ - 20, - 21, + 24, + 25, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 1, }, "start": Object { - "column": 21, + "column": 25, "line": 1, }, }, "range": Array [ - 21, - 22, + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -18648,7 +19608,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/defaultParams/class-constructor.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-with-constructor-parameters.src 1`] = ` Object { "body": Array [ Object { @@ -18659,35 +19619,35 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, "name": "constructor", "range": Array [ - 14, - 25, + 9, + 20, ], "type": "Identifier", }, "kind": "constructor", "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 14, - 44, + 9, + 32, ], "static": false, "type": "MethodDefinition", @@ -18697,17 +19657,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 27, - "line": 2, + "column": 30, + "line": 1, }, }, "range": Array [ - 37, - 44, + 30, + 32, ], "type": "BlockStatement", }, @@ -18716,73 +19676,55 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 20, + "line": 1, }, }, "params": Array [ Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, }, - "name": "foo", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 26, + "line": 1, }, }, + "name": "bar", "range": Array [ 26, - 35, + 29, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 30, - 35, - ], - "raw": "'bar'", - "type": "Literal", - "value": "bar", - }, - "type": "AssignmentPattern", + "type": "Identifier", }, ], "range": Array [ - 25, - 44, + 20, + 32, ], "type": "FunctionExpression", }, @@ -18790,8 +19732,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 33, + "line": 1, }, "start": Object { "column": 8, @@ -18800,7 +19742,7 @@ Object { }, "range": Array [ 8, - 46, + 33, ], "type": "ClassBody", }, @@ -18824,8 +19766,8 @@ Object { }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 33, + "line": 1, }, "start": Object { "column": 0, @@ -18834,7 +19776,7 @@ Object { }, "range": Array [ 0, - 46, + 33, ], "superClass": null, "type": "ClassDeclaration", @@ -18843,7 +19785,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 2, }, "start": Object { "column": 0, @@ -18852,7 +19794,7 @@ Object { }, "range": Array [ 0, - 47, + 34, ], "sourceType": "script", "tokens": Array [ @@ -18913,17 +19855,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 14, - 25, + 9, + 20, ], "type": "Identifier", "value": "constructor", @@ -18931,17 +19873,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 25, - 26, + 20, + 21, ], "type": "Punctuator", "value": "(", @@ -18949,17 +19891,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 26, - 29, + 21, + 24, ], "type": "Identifier", "value": "foo", @@ -18967,53 +19909,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 29, - 30, + 24, + 25, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 30, - 35, + 26, + 29, ], - "type": "String", - "value": "'bar'", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ - 35, - 36, + 29, + 30, ], "type": "Punctuator", "value": ")", @@ -19021,17 +19963,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 27, - "line": 2, + "column": 30, + "line": 1, }, }, "range": Array [ - 37, - 38, + 30, + 31, ], "type": "Punctuator", "value": "{", @@ -19039,17 +19981,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 31, + "line": 1, }, }, "range": Array [ - 43, - 44, + 31, + 32, ], "type": "Punctuator", "value": "}", @@ -19057,17 +19999,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 33, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 32, + "line": 1, }, }, "range": Array [ - 45, - 46, + 32, + 33, ], "type": "Punctuator", "value": "}", @@ -19077,7 +20019,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/defaultParams/class-method.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/class-with-constructor-with-space.src 1`] = ` Object { "body": Array [ Object { @@ -19088,35 +20030,35 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, - "name": "foo", + "name": "constructor", "range": Array [ - 14, - 17, + 9, + 20, ], "type": "Identifier", }, - "kind": "method", + "kind": "constructor", "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 14, - 36, + 9, + 25, ], "static": false, "type": "MethodDefinition", @@ -19126,17 +20068,17 @@ Object { "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 29, - 36, + 23, + 25, ], "type": "BlockStatement", }, @@ -19145,73 +20087,18 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 21, + "line": 1, }, }, - "params": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 18, - 21, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 18, - 27, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 22, - 27, - ], - "raw": "'baz'", - "type": "Literal", - "value": "baz", - }, - "type": "AssignmentPattern", - }, - ], + "params": Array [], "range": Array [ - 17, - 36, + 21, + 25, ], "type": "FunctionExpression", }, @@ -19219,8 +20106,8 @@ Object { ], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 26, + "line": 1, }, "start": Object { "column": 8, @@ -19229,7 +20116,7 @@ Object { }, "range": Array [ 8, - 38, + 26, ], "type": "ClassBody", }, @@ -19253,8 +20140,8 @@ Object { }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 26, + "line": 1, }, "start": Object { "column": 0, @@ -19263,16 +20150,33 @@ Object { }, "range": Array [ 0, - 38, + 26, ], "superClass": null, "type": "ClassDeclaration", }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "EmptyStatement", + }, ], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 2, }, "start": Object { "column": 0, @@ -19281,7 +20185,7 @@ Object { }, "range": Array [ 0, - 39, + 28, ], "sourceType": "script", "tokens": Array [ @@ -19342,66 +20246,30 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 18, - 21, + 9, + 20, ], "type": "Identifier", - "value": "bar", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ @@ -19409,76 +20277,76 @@ Object { 22, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ 22, - 27, + 23, ], - "type": "String", - "value": "'baz'", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 27, - 28, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 29, - 30, + 24, + 25, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 25, + "line": 1, }, }, "range": Array [ - 35, - 36, + 25, + 26, ], "type": "Punctuator", "value": "}", @@ -19486,145 +20354,160 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 27, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 26, + "line": 1, }, }, "range": Array [ - 37, - 38, + 26, + 27, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/defaultParams/declaration.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/derived-class-assign-to-var.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ + "declarations": Array [ Object { - "left": Object { + "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 5, "line": 1, }, "start": Object { - "column": 11, + "column": 4, "line": 1, }, }, - "name": "a", + "name": "x", "range": Array [ - 11, - 12, + 4, + 5, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, + "init": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "ClassBody", }, - "start": Object { - "column": 11, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", }, - }, - "range": Array [ - 11, - 16, - ], - "right": Object { "loc": Object { "end": Object { - "column": 16, + "column": 27, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, "range": Array [ - 15, - 16, + 8, + 27, ], - "raw": "1", - "type": "Literal", - "value": 1, + "superClass": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "ClassExpression", }, - "type": "AssignmentPattern", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", }, ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 20, + 28, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 20, + "column": 28, "line": 1, }, "start": Object { @@ -19634,14 +20517,14 @@ Object { }, "range": Array [ 0, - 20, + 28, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 1, }, "start": Object { @@ -19651,133 +20534,133 @@ Object { }, "range": Array [ 0, - 8, + 3, ], "type": "Keyword", - "value": "function", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 1, }, "start": Object { - "column": 9, + "column": 4, "line": 1, }, }, "range": Array [ - 9, - 10, + 4, + 5, ], "type": "Identifier", - "value": "f", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "range": Array [ - 10, - 11, + 6, + 7, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 12, + 8, + 13, ], - "type": "Identifier", - "value": "a", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 1, }, "start": Object { - "column": 15, + "column": 16, "line": 1, }, }, "range": Array [ - 15, 16, + 23, ], - "type": "Numeric", - "value": "1", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], "type": "Punctuator", "value": "{", @@ -19785,164 +20668,106 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 27, "line": 1, }, "start": Object { - "column": 19, + "column": 26, "line": 1, }, }, "range": Array [ - 19, - 20, + 26, + 27, ], "type": "Punctuator", "value": "}", }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/defaultParams/expression.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/derived-class-expression.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "left": Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 1, + "column": 18, "line": 1, }, "start": Object { - "column": 0, + "column": 16, "line": 1, }, }, - "name": "x", "range": Array [ - 0, - 1, + 16, + 18, ], - "type": "Identifier", + "type": "ClassBody", }, + "id": null, "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 0, + "column": 1, "line": 1, }, }, - "operator": "=", "range": Array [ - 0, - 22, + 1, + 18, ], - "right": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 22, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "superClass": Object { "loc": Object { "end": Object { - "column": 22, + "column": 16, "line": 1, }, "start": Object { - "column": 4, + "column": 15, "line": 1, }, }, - "params": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 18, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "AssignmentPattern", - }, - ], "range": Array [ - 4, - 22, + 15, + 16, ], - "type": "FunctionExpression", + "raw": "0", + "type": "Literal", + "value": 0, }, - "type": "AssignmentExpression", + "type": "ClassExpression", }, "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 1, }, "start": Object { @@ -19952,14 +20777,14 @@ Object { }, "range": Array [ 0, - 22, + 20, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 1, }, "start": Object { @@ -19969,7 +20794,7 @@ Object { }, "range": Array [ 0, - 22, + 20, ], "sourceType": "script", "tokens": Array [ @@ -19988,98 +20813,80 @@ Object { 0, 1, ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 3, - ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 6, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 12, + 1, + 6, ], "type": "Keyword", - "value": "function", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 7, "line": 1, }, }, "range": Array [ - 12, - 13, + 7, + 14, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 16, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 14, + 15, + 16, ], - "type": "Identifier", - "value": "y", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 17, "line": 1, }, "start": Object { - "column": 15, + "column": 16, "line": 1, }, }, "range": Array [ - 15, 16, + 17, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { @@ -20096,8 +20903,8 @@ Object { 17, 18, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -20120,240 +20927,69 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { "column": 20, "line": 1, }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, "start": Object { - "column": 21, + "column": 19, "line": 1, }, }, "range": Array [ - 21, - 22, + 19, + 20, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/defaultParams/method.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/empty-class.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 0, - 1, - ], - "type": "Identifier", - }, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 27, + "column": 10, "line": 1, }, "start": Object { - "column": 0, + "column": 8, "line": 1, }, }, - "operator": "=", "range": Array [ - 0, - 27, + 8, + 10, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 6, - 25, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 25, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "params": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 21, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "AssignmentPattern", - }, - ], - "range": Array [ - 9, - 25, - ], - "type": "FunctionExpression", - }, - }, - ], - "range": Array [ - 4, - 27, - ], - "type": "ObjectExpression", }, - "type": "AssignmentExpression", + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 27, + "column": 10, "line": 1, }, "start": Object { @@ -20363,14 +20999,32 @@ Object { }, "range": Array [ 0, - 27, + 10, ], - "type": "ExpressionStatement", + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 27, + "column": 11, "line": 1, }, "start": Object { @@ -20380,14 +21034,14 @@ Object { }, "range": Array [ 0, - 27, + 11, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -20397,46 +21051,10 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 3, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, 5, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { @@ -20454,30 +21072,30 @@ Object { 7, ], "type": "Identifier", - "value": "f", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, + 9, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 10, "line": 1, }, "start": Object { @@ -20487,115 +21105,175 @@ Object { }, "range": Array [ 9, - 17, + 10, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 1, }, "start": Object { - "column": 17, + "column": 10, "line": 1, }, }, "range": Array [ - 17, - 18, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/empty-class-double-semi.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 19, + "column": 10, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 10, ], - "type": "Identifier", - "value": "a", + "superClass": null, + "type": "ClassDeclaration", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 11, "line": 1, }, "start": Object { - "column": 19, + "column": 10, "line": 1, }, }, "range": Array [ - 19, - 20, + 10, + 11, ], - "type": "Punctuator", - "value": "=", + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, + "column": 5, "line": 1, }, "start": Object { - "column": 20, + "column": 0, "line": 1, }, }, "range": Array [ - 20, - 21, + 0, + 5, ], - "type": "Numeric", - "value": "1", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 7, "line": 1, }, "start": Object { - "column": 21, + "column": 6, "line": 1, }, }, "range": Array [ - 21, - 22, + 6, + 7, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 9, "line": 1, }, "start": Object { - "column": 23, + "column": 8, "line": 1, }, }, "range": Array [ - 23, - 24, + 8, + 9, ], "type": "Punctuator", "value": "{", @@ -20603,17 +21281,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 10, "line": 1, }, "start": Object { - "column": 24, + "column": 9, "line": 1, }, }, "range": Array [ - 24, - 25, + 9, + 10, ], "type": "Punctuator", "value": "}", @@ -20621,202 +21299,69 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 11, "line": 1, }, "start": Object { - "column": 26, + "column": 10, "line": 1, }, }, "range": Array [ - 26, - 27, + 10, + 11, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/defaultParams/not-all-params.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/empty-class-semi.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - "init": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 35, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 28, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 28, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "type": "AssignmentPattern", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", - }, - ], - "range": Array [ - 10, - 35, - ], - "type": "FunctionExpression", + "start": Object { + "column": 8, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + }, + "range": Array [ + 8, + 11, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 4, - 35, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 36, + "column": 11, "line": 1, }, "start": Object { @@ -20826,14 +21371,32 @@ Object { }, "range": Array [ 0, - 36, + 11, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 36, + "column": 12, "line": 1, }, "start": Object { @@ -20843,14 +21406,14 @@ Object { }, "range": Array [ 0, - 36, + 12, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -20860,10 +21423,10 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { @@ -20872,16 +21435,16 @@ Object { "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, + 6, 7, ], "type": "Identifier", - "value": "foo", + "value": "A", }, Object { "loc": Object { @@ -20899,202 +21462,262 @@ Object { 9, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 18, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 11, "line": 1, }, "start": Object { - "column": 18, + "column": 10, "line": 1, }, }, "range": Array [ - 18, - 19, + 10, + 11, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 12, "line": 1, }, "start": Object { - "column": 19, + "column": 11, "line": 1, }, }, "range": Array [ - 19, - 20, + 11, + 12, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/classes/empty-literal-derived-class.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": ",", - }, - Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 20, ], - "type": "Identifier", - "value": "b", + "superClass": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "ClassDeclaration", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 21, "line": 1, }, "start": Object { - "column": 24, + "column": 20, "line": 1, }, }, "range": Array [ - 24, - 25, + 20, + 21, ], - "type": "Punctuator", - "value": "=", + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 28, + "column": 5, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 28, + 0, + 5, ], - "type": "Numeric", - "value": "42", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 7, "line": 1, }, "start": Object { - "column": 28, + "column": 6, "line": 1, }, }, "range": Array [ - 28, - 29, + 6, + 7, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 15, "line": 1, }, "start": Object { - "column": 30, + "column": 8, "line": 1, }, }, "range": Array [ - 30, - 31, + 8, + 15, ], - "type": "Identifier", - "value": "c", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 17, "line": 1, }, "start": Object { - "column": 31, + "column": 16, "line": 1, }, }, "range": Array [ - 31, - 32, + 16, + 17, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 19, "line": 1, }, "start": Object { - "column": 33, + "column": 18, "line": 1, }, }, "range": Array [ - 33, - 34, + 18, + 19, ], "type": "Punctuator", "value": "{", @@ -21102,17 +21725,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 20, "line": 1, }, "start": Object { - "column": 34, + "column": 19, "line": 1, }, }, "range": Array [ - 34, - 35, + 19, + 20, ], "type": "Punctuator", "value": "}", @@ -21120,17 +21743,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 36, + "column": 21, "line": 1, }, "start": Object { - "column": 35, + "column": 20, "line": 1, }, }, "range": Array [ - 35, - 36, + 20, + 21, ], "type": "Punctuator", "value": ";", @@ -21140,123 +21763,32 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/array-member.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/invalid-class-declaration.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "ok", - "range": Array [ - 1, - 3, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "v", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - "range": Array [ - 1, - 5, - ], - "type": "MemberExpression", - }, - ], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "ArrayPattern", - }, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, - "operator": "=", "range": Array [ - 0, - 11, + 6, + 8, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "20", - "type": "Literal", - "value": 20, - }, - "type": "AssignmentExpression", + "type": "ClassBody", }, + "id": null, "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -21266,15 +21798,33 @@ Object { }, "range": Array [ 0, - 12, + 8, ], - "type": "ExpressionStatement", + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -21283,14 +21833,14 @@ Object { }, "range": Array [ 0, - 12, + 10, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -21300,82 +21850,28 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 3, - ], - "type": "Identifier", - "value": "ok", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 4, - ], - "type": "Punctuator", - "value": ".", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, 5, ], - "type": "Identifier", - "value": "v", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 1, }, "start": Object { - "column": 5, + "column": 6, "line": 1, }, }, "range": Array [ - 5, 6, + 7, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { @@ -21393,40 +21889,22 @@ Object { 8, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { "column": 9, "line": 1, }, - }, - "range": Array [ - 9, - 11, - ], - "type": "Numeric", - "value": "20", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 12, + 8, + 9, ], "type": "Punctuator", "value": ";", @@ -21436,141 +21914,128 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/array-to-array.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/invalid-class-setter-declaration.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 2, + "column": 17, "line": 1, }, "start": Object { - "column": 1, + "column": 14, "line": 1, }, }, - "name": "a", + "name": "foo", "range": Array [ - 1, - 2, + 14, + 17, ], "type": "Identifier", }, - Object { + "kind": "set", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 22, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 5, + "column": 22, "line": 1, }, "start": Object { - "column": 4, + "column": 17, "line": 1, }, }, - "name": "b", + "params": Array [], "range": Array [ - 4, - 5, + 17, + 22, ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "FunctionExpression", }, }, - "range": Array [ - 0, - 6, - ], - "type": "ArrayPattern", + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 1, }, "start": Object { - "column": 0, + "column": 6, "line": 1, }, }, - "operator": "=", + "name": "A", "range": Array [ - 0, - 15, + 6, + 7, ], - "right": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 15, - ], - "type": "ArrayExpression", - }, - "type": "AssignmentExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 1, }, "start": Object { @@ -21580,15 +22045,33 @@ Object { }, "range": Array [ 0, - 16, + 23, ], - "type": "ExpressionStatement", + "superClass": null, + "type": "ClassDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -21597,14 +22080,14 @@ Object { }, "range": Array [ 0, - 16, + 25, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -21614,205 +22097,187 @@ Object { }, "range": Array [ 0, - 1, + 5, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, "range": Array [ - 1, - 2, + 6, + 7, ], "type": "Identifier", - "value": "a", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 9, "line": 1, }, "start": Object { - "column": 2, + "column": 8, "line": 1, }, }, "range": Array [ - 2, - 3, + 8, + 9, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 13, "line": 1, }, "start": Object { - "column": 4, + "column": 10, "line": 1, }, }, "range": Array [ - 4, - 5, + 10, + 13, ], "type": "Identifier", - "value": "b", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 17, "line": 1, }, "start": Object { - "column": 5, + "column": 14, "line": 1, }, }, "range": Array [ - 5, - 6, + 14, + 17, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 18, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, "range": Array [ - 7, - 8, + 17, + 18, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 19, "line": 1, }, "start": Object { - "column": 9, + "column": 18, "line": 1, }, }, "range": Array [ - 9, - 10, + 18, + 19, ], "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - "value": "b", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 21, "line": 1, }, "start": Object { - "column": 11, + "column": 20, "line": 1, }, }, "range": Array [ - 11, - 12, + 20, + 21, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 13, + "column": 21, "line": 1, }, }, "range": Array [ - 13, - 14, + 21, + 22, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 1, }, "start": Object { - "column": 14, + "column": 22, "line": 1, }, }, "range": Array [ - 14, - 15, + 22, + 23, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 23, "line": 1, }, }, "range": Array [ - 15, - 16, + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -21822,85 +22287,64 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/array-var-undefined.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/named-class-expression.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "expression": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - "range": Array [ - 4, - 7, - ], - "type": "ArrayPattern", - }, - "init": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "start": Object { + "column": 9, + "line": 1, }, - "range": Array [ - 10, - 12, - ], - "type": "ArrayExpression", }, + "range": Array [ + 9, + 11, + ], + "type": "ClassBody", + }, + "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, + "name": "A", "range": Array [ - 4, - 12, + 7, + 8, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 11, + ], + "superClass": null, + "type": "ClassExpression", + }, "loc": Object { "end": Object { "column": 13, @@ -21915,7 +22359,7 @@ Object { 0, 13, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { @@ -21937,7 +22381,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -21947,28 +22391,10 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, + 1, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { @@ -21977,52 +22403,52 @@ Object { "line": 1, }, "start": Object { - "column": 5, + "column": 1, "line": 1, }, }, "range": Array [ - 5, + 1, 6, ], - "type": "Identifier", - "value": "a", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, 7, + 8, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "range": Array [ - 8, 9, + 10, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { @@ -22040,7 +22466,7 @@ Object { 11, ], "type": "Punctuator", - "value": "[", + "value": "}", }, Object { "loc": Object { @@ -22058,7 +22484,7 @@ Object { 12, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { @@ -22083,185 +22509,86 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-array.src 1`] = ` +exports[`ecmaFeatures fixtures/classes/named-derived-class-expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "consturctor", - "range": Array [ - 14, - 25, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "expression": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, }, - "range": Array [ - 14, - 45, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 38, - 45, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 36, - ], - "type": "ArrayPattern", - }, - ], - "range": Array [ - 25, - 45, - ], - "type": "FunctionExpression", + "start": Object { + "column": 18, + "line": 1, }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, }, + "name": "A", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", }, - "range": Array [ - 8, - 47, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 20, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, - "name": "A", "range": Array [ - 6, - 7, + 1, + 20, ], - "type": "Identifier", + "superClass": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "ClassExpression", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -22270,16 +22597,15 @@ Object { }, "range": Array [ 0, - 47, + 22, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -22288,14 +22614,14 @@ Object { }, "range": Array [ 0, - 48, + 22, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -22305,187 +22631,133 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ + 1, 6, - 7, ], - "type": "Identifier", - "value": "A", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 8, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ + 7, 8, - 9, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 25, ], "type": "Identifier", - "value": "consturctor", + "value": "A", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 26, - 27, + 9, + 16, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "extends", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { "column": 17, - "line": 2, + "line": 1, }, }, "range": Array [ - 27, - 30, + 17, + 18, ], - "type": "Identifier", - "value": "foo", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 30, - 31, + 18, + 19, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - "value": "bar", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 35, - 36, + 19, + 20, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 26, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 36, - 37, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -22493,63 +22765,27 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 21, + "line": 1, }, }, "range": Array [ - 46, - 47, + 21, + 22, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-defaults-array.src 1`] = ` +exports[`ecmaFeatures fixtures/defaultParams/class-constructor.src 1`] = ` Object { "body": Array [ Object { @@ -22568,14 +22804,14 @@ Object { "line": 2, }, }, - "name": "consturctor", + "name": "constructor", "range": Array [ 14, 25, ], "type": "Identifier", }, - "kind": "method", + "kind": "constructor", "loc": Object { "end": Object { "column": 5, @@ -22588,7 +22824,7 @@ Object { }, "range": Array [ 14, - 49, + 44, ], "static": false, "type": "MethodDefinition", @@ -22602,13 +22838,13 @@ Object { "line": 3, }, "start": Object { - "column": 32, + "column": 27, "line": 2, }, }, "range": Array [ - 42, - 49, + 37, + 44, ], "type": "BlockStatement", }, @@ -22627,119 +22863,27 @@ Object { }, "params": Array [ Object { - "elements": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 27, - 32, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "type": "AssignmentPattern", - }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, }, - "range": Array [ - 34, - 39, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "raw": "4", - "type": "Literal", - "value": 4, + "start": Object { + "column": 16, + "line": 2, }, - "type": "AssignmentPattern", }, - ], + "name": "foo", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 30, + "column": 25, "line": 2, }, "start": Object { @@ -22749,14 +22893,33 @@ Object { }, "range": Array [ 26, - 40, + 35, ], - "type": "ArrayPattern", + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "type": "AssignmentPattern", }, ], "range": Array [ 25, - 49, + 44, ], "type": "FunctionExpression", }, @@ -22774,7 +22937,7 @@ Object { }, "range": Array [ 8, - 51, + 46, ], "type": "ClassBody", }, @@ -22808,7 +22971,7 @@ Object { }, "range": Array [ 0, - 51, + 46, ], "superClass": null, "type": "ClassDeclaration", @@ -22826,7 +22989,7 @@ Object { }, "range": Array [ 0, - 52, + 47, ], "sourceType": "script", "tokens": Array [ @@ -22900,7 +23063,7 @@ Object { 25, ], "type": "Identifier", - "value": "consturctor", + "value": "constructor", }, Object { "loc": Object { @@ -22923,7 +23086,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 2, }, "start": Object { @@ -22933,10 +23096,10 @@ Object { }, "range": Array [ 26, - 27, + 29, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { @@ -22945,21 +23108,21 @@ Object { "line": 2, }, "start": Object { - "column": 17, + "column": 19, "line": 2, }, }, "range": Array [ - 27, + 29, 30, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 25, "line": 2, }, "start": Object { @@ -22969,178 +23132,70 @@ Object { }, "range": Array [ 30, - 31, + 35, ], - "type": "Punctuator", - "value": "=", + "type": "String", + "value": "'bar'", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 2, }, "start": Object { - "column": 21, + "column": 25, "line": 2, }, }, "range": Array [ - 31, - 32, + 35, + 36, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 28, "line": 2, }, "start": Object { - "column": 22, + "column": 27, "line": 2, }, }, "range": Array [ - 32, - 33, + 37, + 38, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 24, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 34, - 37, + 43, + 44, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 27, - "line": 2, - }, - }, - "range": Array [ - 37, - 38, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Numeric", - "value": "4", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 42, - 43, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 48, - 49, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -23148,8 +23203,8 @@ Object { }, }, "range": Array [ - 50, - 51, + 45, + 46, ], "type": "Punctuator", "value": "}", @@ -23159,7 +23214,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-defaults-object.src 1`] = ` +exports[`ecmaFeatures fixtures/defaultParams/class-method.src 1`] = ` Object { "body": Array [ Object { @@ -23170,7 +23225,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { @@ -23178,10 +23233,10 @@ Object { "line": 2, }, }, - "name": "consturctor", + "name": "foo", "range": Array [ 14, - 25, + 17, ], "type": "Identifier", }, @@ -23198,7 +23253,7 @@ Object { }, "range": Array [ 14, - 49, + 36, ], "static": false, "type": "MethodDefinition", @@ -23212,13 +23267,13 @@ Object { "line": 3, }, "start": Object { - "column": 32, + "column": 19, "line": 2, }, }, "range": Array [ - 42, - 49, + 29, + 36, ], "type": "BlockStatement", }, @@ -23231,220 +23286,69 @@ Object { "line": 3, }, "start": Object { - "column": 15, + "column": 7, "line": 2, }, }, "params": Array [ Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 30, + "column": 17, "line": 2, }, "start": Object { - "column": 16, + "column": 8, "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 27, - 32, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 27, - 32, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, + "range": Array [ + 18, + 27, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, }, - "method": false, - "range": Array [ - 34, - 39, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 34, - 37, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 34, - 39, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "raw": "4", - "type": "Literal", - "value": 4, - }, - "type": "AssignmentPattern", + "start": Object { + "column": 12, + "line": 2, }, }, - ], - "range": Array [ - 26, - 40, - ], - "type": "ObjectPattern", + "range": Array [ + 22, + 27, + ], + "raw": "'baz'", + "type": "Literal", + "value": "baz", + }, + "type": "AssignmentPattern", }, ], "range": Array [ - 25, - 49, + 17, + 36, ], "type": "FunctionExpression", }, @@ -23462,7 +23366,7 @@ Object { }, "range": Array [ 8, - 51, + 38, ], "type": "ClassBody", }, @@ -23496,7 +23400,7 @@ Object { }, "range": Array [ 0, - 51, + 38, ], "superClass": null, "type": "ClassDeclaration", @@ -23514,7 +23418,7 @@ Object { }, "range": Array [ 0, - 52, + 39, ], "sourceType": "script", "tokens": Array [ @@ -23575,7 +23479,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { @@ -23585,25 +23489,25 @@ Object { }, "range": Array [ 14, - 25, + 17, ], "type": "Identifier", - "value": "consturctor", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 8, "line": 2, }, "start": Object { - "column": 15, + "column": 7, "line": 2, }, }, "range": Array [ - 25, - 26, + 17, + 18, ], "type": "Punctuator", "value": "(", @@ -23611,53 +23515,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, + "column": 11, "line": 2, }, "start": Object { - "column": 17, + "column": 8, "line": 2, }, }, "range": Array [ - 27, - 30, + 18, + 21, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 12, "line": 2, }, "start": Object { - "column": 20, + "column": 11, "line": 2, }, }, "range": Array [ - 30, - 31, + 21, + 22, ], "type": "Punctuator", "value": "=", @@ -23665,463 +23551,218 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 17, "line": 2, }, "start": Object { - "column": 21, + "column": 12, "line": 2, }, }, "range": Array [ - 31, - 32, + 22, + 27, ], - "type": "Numeric", - "value": "3", + "type": "String", + "value": "'baz'", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 18, "line": 2, }, "start": Object { - "column": 22, + "column": 17, "line": 2, }, }, "range": Array [ - 32, - 33, + 27, + 28, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 20, "line": 2, }, "start": Object { - "column": 24, + "column": 19, "line": 2, }, }, "range": Array [ - 34, - 37, + 29, + 30, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 2, + "column": 5, + "line": 3, }, "start": Object { - "column": 27, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 37, - 38, + 35, + 36, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 2, + "column": 1, + "line": 4, }, "start": Object { - "column": 28, - "line": 2, + "column": 0, + "line": 4, }, }, "range": Array [ + 37, 38, - 39, - ], - "type": "Numeric", - "value": "4", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "range": Array [ - 39, - 40, ], "type": "Punctuator", "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/declaration.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 2, - }, - "start": Object { - "column": 30, - "line": 2, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 32, - "line": 2, - }, - }, - "range": Array [ - 42, - 43, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 48, - 49, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 50, - 51, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-object.src 1`] = ` -Object { - "body": Array [ - Object { + "async": false, "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "consturctor", - "range": Array [ - 14, - 25, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 45, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 38, - 45, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 27, - 30, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 32, - 35, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 32, - 35, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 26, - 36, - ], - "type": "ObjectPattern", - }, - ], - "range": Array [ - 25, - 45, - ], - "type": "FunctionExpression", - }, - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 20, + "line": 1, }, "start": Object { - "column": 8, + "column": 18, "line": 1, }, }, "range": Array [ - 8, - 47, + 18, + 20, ], - "type": "ClassBody", + "type": "BlockStatement", }, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "A", + "name": "f", "range": Array [ - 6, - 7, + 9, + 10, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 20, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + ], "range": Array [ 0, - 47, + 20, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 20, + "line": 1, }, "start": Object { "column": 0, @@ -24130,14 +23771,14 @@ Object { }, "range": Array [ 0, - 48, + 20, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -24147,241 +23788,151 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "class", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 7, + 9, + 10, ], "type": "Identifier", - "value": "A", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 14, - 25, + 11, + 12, ], "type": "Identifier", - "value": "consturctor", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 25, - 26, + 13, + 14, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 27, - 30, + 15, + 16, ], - "type": "Identifier", - "value": "foo", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 30, - 31, + 16, + 17, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 32, - 35, + 18, + 19, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 35, - 36, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 36, - 37, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 2, - }, - "start": Object { - "column": 28, - "line": 2, - }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 44, - 45, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 46, - 47, + 19, + 20, ], "type": "Punctuator", "value": "}", @@ -24391,185 +23942,145 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/class-method-params-array.src 1`] = ` +exports[`ecmaFeatures fixtures/defaultParams/expression.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, }, - "kind": "method", + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 22, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 14, - 37, + 20, + 22, ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 13, + "line": 1, }, }, + "name": "y", "range": Array [ - 30, - 37, + 13, + 14, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 13, + "line": 1, }, }, - "params": Array [ - Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 18, - 28, - ], - "type": "ArrayPattern", - }, - ], "range": Array [ - 17, - 37, + 13, + 18, ], - "type": "FunctionExpression", + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 39, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + ], + "range": Array [ + 4, + 22, + ], + "type": "FunctionExpression", }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -24578,16 +24089,15 @@ Object { }, "range": Array [ 0, - 39, + 22, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 22, + "line": 1, }, "start": Object { "column": 0, @@ -24596,14 +24106,14 @@ Object { }, "range": Array [ 0, - 40, + 22, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -24613,79 +24123,61 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, + 1, ], "type": "Identifier", - "value": "A", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 3, "line": 1, }, "start": Object { - "column": 8, + "column": 2, "line": 1, }, }, "range": Array [ - 8, - 9, + 2, + 3, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { "column": 4, - "line": 2, + "line": 1, }, }, "range": Array [ - 14, - 17, + 4, + 12, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": "(", @@ -24693,107 +24185,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 19, - 22, + 13, + 14, ], "type": "Identifier", - "value": "bar", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 22, - 23, + 15, + 16, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - "value": "baz", + "value": "=", }, Object { "loc": Object { "end": Object { "column": 18, - "line": 2, + "line": 1, }, "start": Object { "column": 17, - "line": 2, + "line": 1, }, }, "range": Array [ - 27, - 28, + 17, + 18, ], - "type": "Punctuator", - "value": "]", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { "column": 19, - "line": 2, + "line": 1, }, "start": Object { "column": 18, - "line": 2, + "line": 1, }, }, "range": Array [ - 28, - 29, + 18, + 19, ], "type": "Punctuator", "value": ")", @@ -24802,16 +24258,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 2, + "line": 1, }, "start": Object { "column": 20, - "line": 2, + "line": 1, }, }, "range": Array [ - 30, - 31, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -24819,295 +24275,223 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 36, - 37, + 21, + 22, ], "type": "Punctuator", "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/method.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", }, - }, - "range": Array [ - 38, - 39, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/class-method-params-defaults-array.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 27, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 4, + "line": 1, }, - "range": Array [ - 14, - 41, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 7, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 6, + "line": 1, }, }, + "name": "f", "range": Array [ - 34, - 41, + 6, + 7, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + "kind": "init", "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 6, + "line": 1, }, }, - "params": Array [ - Object { - "elements": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, + "method": false, + "range": Array [ + 6, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 18, + "line": 1, }, }, + "name": "a", "range": Array [ + 18, 19, - 24, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "type": "AssignmentPattern", + "type": "Identifier", }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, }, + }, + "range": Array [ + 18, + 21, + ], + "right": Object { "loc": Object { "end": Object { "column": 21, - "line": 2, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 26, - 31, + 20, + 21, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "raw": "4", - "type": "Literal", - "value": 4, - }, - "type": "AssignmentPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, + "raw": "1", + "type": "Literal", + "value": 1, }, + "type": "AssignmentPattern", }, - "range": Array [ - 18, - 32, - ], - "type": "ArrayPattern", - }, - ], - "range": Array [ - 17, - 41, - ], - "type": "FunctionExpression", + ], + "range": Array [ + 9, + 25, + ], + "type": "FunctionExpression", + }, }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 43, - ], - "type": "ClassBody", - }, - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, + ], + "range": Array [ + 4, + 27, + ], + "type": "ObjectExpression", }, - "name": "A", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 27, + "line": 1, }, "start": Object { "column": 0, @@ -25116,16 +24500,15 @@ Object { }, "range": Array [ 0, - 43, + 27, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 27, + "line": 1, }, "start": Object { "column": 0, @@ -25134,14 +24517,14 @@ Object { }, "range": Array [ 0, - 44, + 27, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -25151,43 +24534,43 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 3, "line": 1, }, "start": Object { - "column": 6, + "column": 2, "line": 1, }, }, "range": Array [ - 6, - 7, + 2, + 3, ], - "type": "Identifier", - "value": "A", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { - "column": 8, + "column": 4, "line": 1, }, }, "range": Array [ - 8, - 9, + 4, + 5, ], "type": "Punctuator", "value": "{", @@ -25196,88 +24579,106 @@ Object { "loc": Object { "end": Object { "column": 7, - "line": 2, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 14, - 17, + 6, + 7, ], "type": "Identifier", - "value": "foo", + "value": "f", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 2, + "line": 1, }, "start": Object { "column": 7, - "line": 2, + "line": 1, }, }, "range": Array [ - 17, - 18, + 7, + 8, ], "type": "Punctuator", - "value": "(", + "value": ":", }, Object { "loc": Object { "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { "column": 9, - "line": 2, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ + 17, 18, - 19, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ + 18, 19, - 22, ], "type": "Identifier", - "value": "bar", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 22, - 23, + 19, + 20, ], "type": "Punctuator", "value": "=", @@ -25285,71 +24686,354 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 23, - 24, + 20, + 21, ], "type": "Numeric", - "value": "3", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 24, - 25, + 21, + 22, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, }, }, "range": Array [ 26, - 29, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/defaultParams/not-all-params.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "type": "AssignmentPattern", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 10, + 35, + ], + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, ], "type": "Identifier", - "value": "baz", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 2, + "column": 9, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 8, + "line": 1, }, }, "range": Array [ - 29, - 30, + 8, + 9, ], "type": "Punctuator", "value": "=", @@ -25357,53 +25041,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 30, - 31, + 10, + 18, ], - "type": "Numeric", - "value": "4", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, }, "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { "column": 21, - "line": 2, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, }, }, "range": Array [ - 31, - 32, + 20, + 21, ], "type": "Punctuator", - "value": "]", + "value": ",", }, Object { "loc": Object { "end": Object { "column": 23, - "line": 2, + "line": 1, }, "start": Object { "column": 22, - "line": 2, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, }, }, "range": Array [ + 31, 32, - 33, ], "type": "Punctuator", "value": ")", @@ -25411,17 +25221,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 34, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 33, + "line": 1, }, }, "range": Array [ + 33, 34, - 35, ], "type": "Punctuator", "value": "{", @@ -25429,17 +25239,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 34, + "line": 1, }, }, "range": Array [ - 40, - 41, + 34, + 35, ], "type": "Punctuator", "value": "}", @@ -25447,355 +25257,144 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 36, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 35, + "line": 1, }, }, "range": Array [ - 42, - 43, + 35, + 36, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/class-method-params-defaults-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/array-member.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 1, + "line": 1, }, }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 41, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "object": Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 3, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 1, + "line": 1, }, }, + "name": "ok", "range": Array [ - 34, - 41, + 1, + 3, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 2, - }, + "type": "Identifier", }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, + "property": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 19, - 24, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, - 24, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 26, - 31, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 31, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 18, - 32, - ], - "type": "ObjectPattern", }, - ], + "name": "v", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, "range": Array [ - 17, - 41, + 1, + 5, ], - "type": "FunctionExpression", + "type": "MemberExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", }, - "range": Array [ - 8, - 43, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "A", + "operator": "=", "range": Array [ - 6, - 7, + 0, + 11, ], - "type": "Identifier", + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 1, }, "start": Object { "column": 0, @@ -25804,16 +25403,15 @@ Object { }, "range": Array [ 0, - 43, + 12, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 12, + "line": 1, }, "start": Object { "column": 0, @@ -25822,14 +25420,14 @@ Object { }, "range": Array [ 0, - 44, + 12, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -25839,133 +25437,97 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 3, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 3, ], "type": "Identifier", - "value": "A", + "value": "ok", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 4, "line": 1, }, "start": Object { - "column": 8, + "column": 3, "line": 1, }, }, "range": Array [ - 8, - 9, + 3, + 4, ], "type": "Punctuator", - "value": "{", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 2, + "line": 1, }, }, "range": Array [ - 14, - 17, + 4, + 5, ], "type": "Identifier", - "value": "foo", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 6, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 17, - 18, + 5, + 6, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { "column": 8, - "line": 2, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 22, - 23, + 7, + 8, ], "type": "Punctuator", "value": "=", @@ -25973,445 +25535,180 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 23, - 24, + 9, + 11, ], "type": "Numeric", - "value": "3", + "value": "20", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 24, - 25, + 11, + 12, ], "type": "Punctuator", - "value": ",", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/array-to-array.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 29, - ], - "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Numeric", - "value": "3", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 31, - 32, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 32, - 33, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 24, - "line": 2, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 40, - 41, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 42, - 43, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/class-method-params-object.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 2, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 1, + "line": 1, }, }, - "name": "foo", + "name": "a", "range": Array [ - 14, - 17, + 1, + 2, ], "type": "Identifier", }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 37, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 30, - 37, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + Object { "loc": Object { "end": Object { "column": 5, - "line": 3, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 4, + "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 19, - 22, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 24, - 27, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "name": "baz", - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 18, - 28, - ], - "type": "ObjectPattern", - }, - ], + "name": "b", "range": Array [ - 17, - 37, + 4, + 5, ], - "type": "FunctionExpression", + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", }, - "range": Array [ - 8, - 39, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, - "name": "A", + "operator": "=", "range": Array [ - 6, - 7, + 0, + 15, ], - "type": "Identifier", + "right": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -26420,16 +25717,15 @@ Object { }, "range": Array [ 0, - 39, + 16, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 16, + "line": 1, }, "start": Object { "column": 0, @@ -26438,14 +25734,14 @@ Object { }, "range": Array [ 0, - 40, + 16, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -26455,366 +25751,296 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "class", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 2, "line": 1, }, "start": Object { - "column": 6, + "column": 1, "line": 1, }, }, "range": Array [ - 6, - 7, + 1, + 2, ], "type": "Identifier", - "value": "A", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 3, "line": 1, }, "start": Object { - "column": 8, + "column": 2, "line": 1, }, }, "range": Array [ - 8, - 9, + 2, + 3, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 2, + "line": 1, }, }, "range": Array [ - 14, - 17, + 4, + 5, ], "type": "Identifier", - "value": "foo", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 6, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 17, - 18, + 5, + 6, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 18, - 19, + 7, + 8, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, - 22, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, + "line": 1, }, }, "range": Array [ - 22, - 23, + 9, + 10, ], "type": "Punctuator", - "value": ",", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 10, + "line": 1, }, }, "range": Array [ - 24, - 27, + 10, + 11, ], "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 17, - "line": 2, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": "}", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 18, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 28, - 29, + 11, + 12, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 2, + "column": 14, + "line": 1, }, "start": Object { - "column": 20, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 30, - 31, + 13, + 14, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 15, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 14, + "line": 1, }, }, "range": Array [ - 36, - 37, + 14, + 15, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 16, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 15, + "line": 1, }, }, "range": Array [ - 38, - 39, + 15, + 16, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/array-var-undefined.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { - "left": Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 2, + "column": 6, "line": 1, }, "start": Object { - "column": 1, + "column": 5, "line": 1, }, }, - "name": "x", + "name": "a", "range": Array [ - 1, - 2, + 5, + 6, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 1, - 5, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 5, - ], - "raw": "10", - "type": "Literal", - "value": 10, + "start": Object { + "column": 4, + "line": 1, }, - "type": "AssignmentPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, }, + "range": Array [ + 4, + 7, + ], + "type": "ArrayPattern", }, - "range": Array [ - 0, - 6, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "ArrayExpression", }, - }, - "operator": "=", - "range": Array [ - 0, - 10, - ], - "right": Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { - "column": 9, + "column": 4, "line": 1, }, }, - "name": "x", "range": Array [ - 9, - 10, + 4, + 12, ], - "type": "Identifier", + "type": "VariableDeclarator", }, - "type": "AssignmentExpression", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { @@ -26824,14 +26050,14 @@ Object { }, "range": Array [ 0, - 10, + 13, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { @@ -26841,14 +26067,14 @@ Object { }, "range": Array [ 0, - 10, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -26858,7 +26084,25 @@ Object { }, "range": Array [ 0, - 1, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Punctuator", "value": "[", @@ -26866,343 +26110,295 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 6, "line": 1, }, "start": Object { - "column": 1, + "column": 5, "line": 1, }, }, "range": Array [ - 1, - 2, + 5, + 6, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { - "column": 2, + "column": 6, "line": 1, }, }, "range": Array [ - 2, - 3, + 6, + 7, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 3, + "column": 8, "line": 1, }, }, "range": Array [ - 3, - 5, + 8, + 9, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 6, + 10, + 11, ], "type": "Punctuator", - "value": "]", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, - 8, + 11, + 12, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 13, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-array-all.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-array.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, }, - "range": Array [ - 5, - 11, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, + "start": Object { + "column": 4, + "line": 2, }, - "type": "AssignmentPattern", }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 45, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 13, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 13, - 18, + 38, + 45, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "raw": "5", - "type": "Literal", - "value": 5, + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, }, - "type": "AssignmentPattern", }, - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", }, - "start": Object { - "column": 20, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", }, - }, - "name": "z", - "range": Array [ - 20, - 21, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 25, - ], - "right": Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 26, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 24, - 25, + 26, + 36, ], - "raw": "1", - "type": "Literal", - "value": 1, + "type": "ArrayPattern", }, - "type": "AssignmentPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + ], + "range": Array [ + 25, + 45, + ], + "type": "FunctionExpression", }, - "range": Array [ - 4, - 26, - ], - "type": "ArrayPattern", }, - "init": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 4, - 30, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -27211,15 +26407,16 @@ Object { }, "range": Array [ 0, - 31, + 47, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -27228,14 +26425,14 @@ Object { }, "range": Array [ 0, - 31, + 48, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -27245,634 +26442,501 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { "column": 6, "line": 1, }, - "start": Object { - "column": 5, - "line": 1, - }, }, "range": Array [ - 5, 6, + 7, ], "type": "Identifier", - "value": "x", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ 9, - 11, - ], - "type": "Numeric", - "value": "10", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 13, 14, + 25, ], "type": "Identifier", - "value": "y", + "value": "consturctor", }, Object { "loc": Object { "end": Object { "column": 16, - "line": 1, + "line": 2, }, "start": Object { "column": 15, - "line": 1, + "line": 2, }, }, "range": Array [ - 15, - 16, + 25, + 26, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 17, - 18, + 26, + 27, ], - "type": "Numeric", - "value": "5", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 18, - 19, + 27, + 30, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 1, + "line": 2, }, "start": Object { "column": 20, - "line": 1, + "line": 2, }, }, "range": Array [ - 20, - 21, + 30, + 31, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { "column": 22, - "line": 1, + "line": 2, }, }, "range": Array [ - 22, - 23, + 32, + 35, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 26, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 25, + "line": 2, }, }, "range": Array [ - 24, - 25, + 35, + 36, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 25, - 26, + 36, + 37, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 27, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 27, - 28, + 38, + 39, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 29, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 29, - 30, + 44, + 45, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 30, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 30, - 31, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-array-longform-nested-multi.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-defaults-array.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { "column": 4, - "line": 1, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { "column": 5, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 5, - 9, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 32, + "line": 2, }, }, - "method": false, "range": Array [ - 11, - 15, + 42, + 49, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, + "type": "BlockStatement", }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 17, - 18, - ], - "type": "Identifier", + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "start": Object { + "column": 15, + "line": 2, }, - "method": false, - "range": Array [ - 17, - 32, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "properties": Array [ + }, + "params": Array [ + Object { + "elements": Array [ Object { - "computed": false, - "key": Object { + "left": Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 17, + "line": 2, }, }, - "name": "a", + "name": "foo", "range": Array [ - 22, - 23, + 27, + 30, ], "type": "Identifier", }, - "kind": "init", "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 17, + "line": 2, }, }, - "method": false, "range": Array [ - 22, - 31, + 27, + 32, ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, }, - "name": "a", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", }, + "range": Array [ + 31, + 32, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + Object { + "left": Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 24, + "line": 2, }, }, + "name": "bar", "range": Array [ - 25, - 31, + 34, + 37, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, }, - "range": Array [ - 29, - 31, - ], - "raw": "10", - "type": "Literal", - "value": 10, }, - "type": "AssignmentPattern", + "range": Array [ + 38, + 39, + ], + "raw": "4", + "type": "Literal", + "value": 4, }, + "type": "AssignmentPattern", }, ], + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, "range": Array [ - 20, - 32, + 26, + 40, ], - "type": "ObjectPattern", + "type": "ArrayPattern", }, - }, - ], - "range": Array [ - 4, - 34, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 37, - "line": 1, - }, + ], + "range": Array [ + 25, + 49, + ], + "type": "FunctionExpression", }, - "name": "b", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 4, - 38, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 8, + 51, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -27881,15 +26945,16 @@ Object { }, "range": Array [ 0, - 39, + 51, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -27898,14 +26963,14 @@ Object { }, "range": Array [ 0, - 39, + 52, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -27915,169 +26980,169 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 5, + 6, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, - 6, + 8, + 9, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 6, - 7, + 14, + 25, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "consturctor", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 8, - 9, + 25, + 26, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 9, - 10, + 26, + 27, ], "type": "Punctuator", - "value": ",", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 11, - 12, + 27, + 30, ], "type": "Identifier", - "value": "y", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 12, - 13, + 30, + 31, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 14, - 15, + 31, + 32, ], - "type": "Identifier", - "value": "y", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 15, - 16, + 32, + 33, ], "type": "Punctuator", "value": ",", @@ -28085,494 +27150,651 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 17, - 18, + 34, + 37, ], "type": "Identifier", - "value": "z", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 27, + "line": 2, }, }, "range": Array [ - 18, - 19, + 37, + 38, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 20, - 21, + 38, + 39, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 30, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 22, - 23, + 39, + 40, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 31, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 30, + "line": 2, }, }, "range": Array [ - 23, - 24, + 40, + 41, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 25, - "line": 1, + "column": 32, + "line": 2, }, }, "range": Array [ - 25, - 26, + 42, + 43, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 27, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 27, - 28, + 48, + 49, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 29, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 29, - 31, + 50, + 51, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-defaults-object.src 1`] = ` +Object { + "body": Array [ Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 49, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 27, + 32, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 34, + 39, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 26, + 40, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 25, + 49, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 51, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 31, + "column": 0, "line": 1, }, }, "range": Array [ - 31, - 32, + 0, + 51, ], - "type": "Punctuator", - "value": "}", + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 34, + "column": 5, "line": 1, }, "start": Object { - "column": 33, + "column": 0, "line": 1, }, }, "range": Array [ - 33, - 34, + 0, + 5, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 7, "line": 1, }, "start": Object { - "column": 35, + "column": 6, "line": 1, }, }, "range": Array [ - 35, - 36, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 37, - "line": 1, - }, - }, - "range": Array [ - 37, - 38, + 6, + 7, ], "type": "Identifier", - "value": "b", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 9, "line": 1, }, "start": Object { - "column": 38, + "column": 8, "line": 1, }, }, "range": Array [ - 38, - 39, + 8, + 9, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/defaults-array-multi.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 18, - ], - "type": "ArrayPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 0, - 23, + 14, + 25, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "consturctor", }, - }, - "range": Array [ - 0, - 23, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 0, - 3, + 25, + 26, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 4, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 4, - 5, + 26, + 27, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 5, - 6, + 27, + 30, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 7, - 8, + 30, + 31, ], "type": "Punctuator", "value": "=", @@ -28580,35 +27802,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 9, - 11, + 31, + 32, ], "type": "Numeric", - "value": "10", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 11, - 12, + 32, + 33, ], "type": "Punctuator", "value": ",", @@ -28616,326 +27838,409 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 13, - 14, + 34, + 37, ], "type": "Identifier", - "value": "y", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 27, + "line": 2, }, }, "range": Array [ - 14, - 15, + 37, + 38, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 16, - 17, + 38, + 39, ], - "type": "Identifier", - "value": "z", + "type": "Numeric", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 30, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 17, - 18, + 39, + 40, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 31, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 30, + "line": 2, }, }, "range": Array [ - 19, - 20, + 40, + 41, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 32, + "line": 2, }, }, "range": Array [ - 21, - 22, + 42, + 43, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 22, - 23, + 48, + 49, ], "type": "Punctuator", - "value": ";", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-array-nested-all.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/class-constructor-params-object.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, }, + }, + "name": "consturctor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 45, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 5, - 11, + 38, + 45, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, }, - "type": "AssignmentPattern", }, - Object { - "elements": Array [ - Object { - "left": Object { + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 17, + "line": 2, }, }, - "name": "z", + "method": false, "range": Array [ - 15, - 16, + 27, + 30, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", }, }, - "range": Array [ - 15, - 21, - ], - "right": Object { + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 22, + "line": 2, }, }, + "method": false, "range": Array [ - 19, - 21, + 32, + 35, ], - "raw": "10", - "type": "Literal", - "value": 10, + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + }, }, - "type": "AssignmentPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + ], + "range": Array [ + 26, + 36, + ], + "type": "ObjectPattern", }, - "range": Array [ - 13, - 22, - ], - "type": "ArrayPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + ], + "range": Array [ + 25, + 45, + ], + "type": "FunctionExpression", }, - "range": Array [ - 4, - 23, - ], - "type": "ArrayPattern", }, - "init": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 4, - 27, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -28944,15 +28249,16 @@ Object { }, "range": Array [ 0, - 28, + 47, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -28961,14 +28267,14 @@ Object { }, "range": Array [ 0, - 28, + 48, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -28978,424 +28284,429 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { "column": 6, "line": 1, }, - "start": Object { - "column": 5, - "line": 1, - }, }, "range": Array [ - 5, 6, + 7, ], "type": "Identifier", - "value": "x", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, + 9, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 9, - 11, + 14, + 25, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "consturctor", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 11, - 12, + 25, + 26, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 13, - 14, + 26, + 27, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 17, + "line": 2, }, }, "range": Array [ - 15, - 16, + 27, + 30, ], "type": "Identifier", - "value": "z", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 17, - 18, + 30, + 31, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 19, - 21, + 32, + 35, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 26, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 25, + "line": 2, }, }, "range": Array [ - 21, - 22, + 35, + 36, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 27, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 22, - 23, + 36, + 37, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 29, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 28, + "line": 2, }, }, "range": Array [ - 24, - 25, + 38, + 39, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 26, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 26, - 27, + 44, + 45, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 27, - 28, + 46, + 47, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-array-nested-multi.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/class-method-params-array.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 37, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { "column": 5, - "line": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 2, }, }, "range": Array [ - 5, - 11, + 30, + 37, ], - "right": Object { + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 9, - 11, + 18, + 28, ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "type": "ArrayPattern", }, - "range": Array [ - 13, - 18, - ], - "type": "ArrayPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + ], + "range": Array [ + 17, + 37, + ], + "type": "FunctionExpression", }, - "range": Array [ - 4, - 19, - ], - "type": "ArrayPattern", }, - "init": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 4, - 23, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -29404,15 +28715,16 @@ Object { }, "range": Array [ 0, - 24, + 39, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -29421,14 +28733,14 @@ Object { }, "range": Array [ 0, - 24, + 40, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -29438,151 +28750,169 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 5, + 6, + 7, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, - 6, + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 2, }, "start": Object { "column": 7, - "line": 1, + "line": 2, }, }, "range": Array [ - 7, - 8, + 17, + 18, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 9, - 11, + 18, + 19, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 11, - 12, + 19, + 22, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 13, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 13, - 14, + 22, + 23, ], "type": "Punctuator", - "value": "[", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 17, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 15, - 16, + 24, + 27, ], "type": "Identifier", - "value": "z", + "value": "baz", }, Object { "loc": Object { "end": Object { "column": 18, - "line": 1, + "line": 2, }, "start": Object { "column": 17, - "line": 1, + "line": 2, }, }, "range": Array [ - 17, - 18, + 27, + 28, ], "type": "Punctuator", "value": "]", @@ -29591,237 +28921,330 @@ Object { "loc": Object { "end": Object { "column": 19, - "line": 1, + "line": 2, }, "start": Object { "column": 18, - "line": 1, + "line": 2, }, }, "range": Array [ - 18, - 19, + 28, + 29, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 21, - "line": 1, + "line": 2, }, "start": Object { "column": 20, - "line": 1, + "line": 2, }, }, "range": Array [ - 20, - 21, + 30, + 31, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 22, - 23, + 36, + 37, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 23, - 24, + 38, + 39, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/class-method-params-defaults-array.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { "column": 4, - "line": 1, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { "column": 5, - "line": 1, + "line": 3, }, - }, - "method": false, + "start": Object { + "column": 24, + "line": 2, + }, + }, "range": Array [ - 5, - 11, + 34, + 41, ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", }, - "start": Object { - "column": 5, - "line": 1, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "3", + "type": "Literal", + "value": 3, }, + "type": "AssignmentPattern", }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + }, + ], "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 5, - 11, + 18, + 32, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", + "type": "ArrayPattern", }, - }, - ], - "range": Array [ - 4, - 12, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, + ], + "range": Array [ + 17, + 41, + ], + "type": "FunctionExpression", }, - "name": "x", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 4, - 16, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { "column": 0, @@ -29830,15 +29253,16 @@ Object { }, "range": Array [ 0, - 16, + 43, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -29847,14 +29271,14 @@ Object { }, "range": Array [ 0, - 16, + 44, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -29864,406 +29288,11777 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, - 5, + 6, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, - 6, + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 2, }, "start": Object { "column": 7, - "line": 1, + "line": 2, }, }, "range": Array [ - 7, - 8, + 17, + 18, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 9, - 11, + 18, + 19, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 11, - 12, + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 1, + "line": 2, }, "start": Object { "column": 13, - "line": 1, + "line": 2, }, }, "range": Array [ - 13, - 14, + 23, + 24, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 15, - 16, + 26, + 29, ], "type": "Identifier", - "value": "x", + "value": "baz", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/defaults-object-all.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 5, - 11, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-method-params-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", }, - "start": Object { - "column": 9, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 19, + 24, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", }, }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 26, + 31, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 18, + 32, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 17, + 41, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/class-method-params-object.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 37, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 24, + 27, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 18, + 28, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 17, + 37, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 10, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentPattern", + }, + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-longform-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 15, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 22, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 20, + 32, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 34, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 38, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 18, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-nested-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 22, + ], + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 23, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-array-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 19, + ], + "type": "ArrayPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 12, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 20, + 25, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 26, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 15, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 17, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 14, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 27, + 36, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 4, + 37, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 22, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 27, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-mixed-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 8, + 17, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 19, + 20, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 21, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 4, + 18, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-nested-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 18, + 24, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 16, + 25, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 26, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/defaults-object-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 18, + 19, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 16, + 21, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 22, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/destructured-array-catch.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "block": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "method": false, + "range": Array [ + 35, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 34, + 37, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "param": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "ArrayPattern", + }, + "range": Array [ + 49, + 69, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 69, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 71, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 71, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "stack", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/destructured-object-catch.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "block": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "method": false, + "range": Array [ + 35, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 34, + 37, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "param": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "method": false, + "range": Array [ + 56, + 61, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 55, + 62, + ], + "type": "ObjectPattern", + }, + "range": Array [ + 49, + 69, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 69, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 71, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 71, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "stack", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/invalid-defaults-object-assign.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, }, - "type": "AssignmentPattern", }, + "name": "Object", + "range": Array [ + 3, + 9, + ], + "type": "Identifier", }, - Object { - "computed": false, - "key": Object { + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { - "column": 13, + "column": 3, "line": 1, }, }, - "name": "y", + "name": "Object", "range": Array [ - 13, - 14, + 3, + 9, ], "type": "Identifier", }, - "kind": "init", "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 3, "line": 1, }, }, - "method": false, "range": Array [ - 13, - 18, + 3, + 11, ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, + "right": Object { "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 10, "line": 1, }, }, "range": Array [ - 13, - 18, + 10, + 11, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "raw": "5", - "type": "Literal", - "value": 5, + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "type": "AssignmentPattern", }, + "name": "String", + "range": Array [ + 13, + 19, + ], + "type": "Identifier", }, - Object { - "computed": false, - "key": Object { + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 1, }, "start": Object { - "column": 20, + "column": 13, "line": 1, }, }, - "name": "z", + "name": "String", "range": Array [ - 20, - 21, + 13, + 19, ], "type": "Identifier", }, - "kind": "init", "loc": Object { "end": Object { - "column": 25, + "column": 21, "line": 1, }, "start": Object { - "column": 20, + "column": 13, "line": 1, }, }, - "method": false, "range": Array [ - 20, - 25, + 13, + 21, ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, + "right": Object { "loc": Object { "end": Object { - "column": 25, + "column": 21, "line": 1, }, "start": Object { @@ -30273,76 +41068,60 @@ Object { }, "range": Array [ 20, - 25, + 21, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "AssignmentPattern", + "raw": "0", + "type": "Literal", + "value": 0, }, - }, - ], - "range": Array [ - 4, - 26, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, + "type": "AssignmentPattern", }, }, - "name": "a", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", + ], + "range": Array [ + 1, + 23, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "operator": "=", + "range": Array [ + 0, + 29, + ], + "right": Object { "loc": Object { "end": Object { - "column": 30, + "column": 29, "line": 1, }, "start": Object { - "column": 4, + "column": 27, "line": 1, }, }, + "properties": Array [], "range": Array [ - 4, - 30, + 27, + 29, ], - "type": "VariableDeclarator", + "type": "ObjectExpression", }, - ], - "kind": "var", + "type": "AssignmentExpression", + }, "loc": Object { "end": Object { - "column": 31, + "column": 29, "line": 1, }, "start": Object { @@ -30352,15 +41131,15 @@ Object { }, "range": Array [ 0, - 31, + 29, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -30369,14 +41148,14 @@ Object { }, "range": Array [ 0, - 31, + 30, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -30386,25 +41165,25 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 2, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 5, + 1, + 2, ], "type": "Punctuator", "value": "{", @@ -30412,35 +41191,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { - "column": 5, + "column": 3, "line": 1, }, }, "range": Array [ - 5, - 6, + 3, + 9, ], "type": "Identifier", - "value": "x", + "value": "Object", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, "range": Array [ - 7, - 8, + 9, + 10, ], "type": "Punctuator", "value": "=", @@ -30452,16 +41231,16 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, + 10, 11, ], "type": "Numeric", - "value": "10", + "value": "0", }, Object { "loc": Object { @@ -30484,7 +41263,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 1, }, "start": Object { @@ -30494,64 +41273,28 @@ Object { }, "range": Array [ 13, - 14, + 19, ], "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": "=", + "value": "String", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 20, "line": 1, }, "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Numeric", - "value": "5", - }, - Object { - "loc": Object { - "end": Object { "column": 19, "line": 1, }, - "start": Object { - "column": 18, - "line": 1, - }, }, "range": Array [ - 18, 19, + 20, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { @@ -30568,8 +41311,8 @@ Object { 20, 21, ], - "type": "Identifier", - "value": "z", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { @@ -30587,25 +41330,25 @@ Object { 23, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 24, - 25, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -30623,7 +41366,7 @@ Object { 26, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { @@ -30641,206 +41384,150 @@ Object { 28, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { "column": 29, "line": 1, }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, "start": Object { - "column": 30, + "column": 28, "line": 1, }, }, "range": Array [ - 30, - 31, + 28, + 29, ], "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/named-param.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "init", + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { "column": 15, "line": 1, }, "start": Object { - "column": 6, + "column": 3, "line": 1, }, }, - "method": false, + "name": "responseText", "range": Array [ - 6, + 3, 15, ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, }, - "range": Array [ - 9, - 15, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 15, - ], - "raw": "10", - "type": "Literal", - "value": 10, + "start": Object { + "column": 17, + "line": 1, }, - "type": "AssignmentPattern", }, - }, - ], - "range": Array [ - 4, - 17, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, + "name": "text", + "range": Array [ + 17, + 21, + ], + "type": "Identifier", }, }, - "name": "x", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", + ], + "range": Array [ + 1, + 23, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, }, + }, + "operator": "=", + "range": Array [ + 1, + 29, + ], + "right": Object { "loc": Object { "end": Object { - "column": 21, + "column": 29, "line": 1, }, "start": Object { - "column": 4, + "column": 26, "line": 1, }, }, + "name": "res", "range": Array [ - 4, - 21, + 26, + 29, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", + "type": "AssignmentExpression", + }, "loc": Object { "end": Object { - "column": 22, + "column": 31, "line": 1, }, "start": Object { @@ -30850,14 +41537,14 @@ Object { }, "range": Array [ 0, - 22, + 31, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 22, + "column": 31, "line": 1, }, "start": Object { @@ -30867,14 +41554,14 @@ Object { }, "range": Array [ 0, - 22, + 31, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -30884,25 +41571,25 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 2, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 5, + 1, + 2, ], "type": "Punctuator", "value": "{", @@ -30910,35 +41597,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 1, }, "start": Object { - "column": 6, + "column": 3, "line": 1, }, }, "range": Array [ - 6, - 7, + 3, + 15, ], "type": "Identifier", - "value": "x", + "value": "responseText", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 15, "line": 1, }, }, "range": Array [ - 7, - 8, + 15, + 16, ], "type": "Punctuator", "value": ":", @@ -30946,125 +41633,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 21, "line": 1, }, "start": Object { - "column": 9, + "column": 17, "line": 1, }, }, "range": Array [ - 9, - 10, + 17, + 21, ], "type": "Identifier", - "value": "x", + "value": "text", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 1, }, "start": Object { - "column": 11, + "column": 22, "line": 1, }, }, "range": Array [ - 11, - 12, + 22, + 23, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 15, - ], - "type": "Numeric", - "value": "10", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { - "column": 16, + "column": 24, "line": 1, }, }, "range": Array [ - 16, - 17, + 24, + 25, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 29, "line": 1, }, "start": Object { - "column": 18, + "column": 26, "line": 1, }, }, "range": Array [ - 18, - 19, + 26, + 29, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "res", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 30, "line": 1, }, "start": Object { - "column": 20, + "column": 29, "line": 1, }, }, "range": Array [ - 20, - 21, + 29, + 30, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 31, "line": 1, }, "start": Object { - "column": 21, + "column": 30, "line": 1, }, }, "range": Array [ - 21, - 22, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -31074,48 +41743,18 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform-all.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/nested-array.src 1`] = ` Object { "body": Array [ Object { "declarations": Array [ Object { "id": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "properties": Array [ + "elements": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", "loc": Object { "end": Object { - "column": 14, + "column": 6, "line": 1, }, "start": Object { @@ -31123,282 +41762,186 @@ Object { "line": 1, }, }, - "method": false, + "name": "x", "range": Array [ 5, - 14, + 6, ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 14, - ], - "right": Object { + "type": "Identifier", + }, + null, + Object { + "elements": Array [ + null, + Object { "loc": Object { "end": Object { "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, + "name": "z", "range": Array [ - 12, + 13, 14, ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, + "type": "Identifier", }, - "name": "y", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "kind": "init", + ], "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { - "column": 16, + "column": 10, "line": 1, }, }, - "method": false, "range": Array [ - 16, - 25, + 10, + 15, ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 25, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 25, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, }, + }, + "range": Array [ + 4, + 16, + ], + "type": "ArrayPattern", + }, + "init": Object { + "elements": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, }, - "name": "z", - "range": Array [ - 27, - 28, - ], - "type": "Identifier", }, - "kind": "init", + "range": Array [ + 20, + 21, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + Object { "loc": Object { "end": Object { - "column": 36, + "column": 23, "line": 1, }, "start": Object { - "column": 27, + "column": 22, "line": 1, }, }, - "method": false, "range": Array [ - 27, - 36, + 22, + 23, ], - "shorthand": false, - "type": "Property", - "value": Object { - "left": Object { + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 31, + "column": 26, "line": 1, }, "start": Object { - "column": 30, + "column": 25, "line": 1, }, }, - "name": "z", "range": Array [ - 30, - 31, + 25, + 26, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, + "raw": "3", + "type": "Literal", + "value": 3, }, - "range": Array [ - 30, - 36, - ], - "right": Object { + Object { "loc": Object { "end": Object { - "column": 36, + "column": 28, "line": 1, }, "start": Object { - "column": 34, + "column": 27, "line": 1, }, }, "range": Array [ - 34, - 36, + 27, + 28, ], - "raw": "10", + "raw": "4", "type": "Literal", - "value": 10, + "value": 4, + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, }, - "type": "AssignmentPattern", }, + "range": Array [ + 24, + 29, + ], + "type": "ArrayExpression", }, ], - "range": Array [ - 4, - 37, - ], - "type": "ObjectPattern", - }, - "init": Object { "loc": Object { "end": Object { - "column": 41, + "column": 30, "line": 1, }, "start": Object { - "column": 40, + "column": 19, "line": 1, }, }, - "name": "a", "range": Array [ - 40, - 41, + 19, + 30, ], - "type": "Identifier", + "type": "ArrayExpression", }, "loc": Object { "end": Object { - "column": 41, + "column": 30, "line": 1, }, "start": Object { @@ -31408,7 +41951,7 @@ Object { }, "range": Array [ 4, - 41, + 30, ], "type": "VariableDeclarator", }, @@ -31416,7 +41959,7 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 42, + "column": 31, "line": 1, }, "start": Object { @@ -31426,14 +41969,14 @@ Object { }, "range": Array [ 0, - 42, + 31, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 42, + "column": 31, "line": 1, }, "start": Object { @@ -31443,7 +41986,7 @@ Object { }, "range": Array [ 0, - 42, + 31, ], "sourceType": "script", "tokens": Array [ @@ -31481,7 +42024,7 @@ Object { 5, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { @@ -31517,7 +42060,7 @@ Object { 7, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { @@ -31534,8 +42077,8 @@ Object { 8, 9, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { @@ -31553,25 +42096,43 @@ Object { 11, ], "type": "Punctuator", - "value": "=", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, 14, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { @@ -31589,25 +42150,25 @@ Object { 15, ], "type": "Punctuator", - "value": ",", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 17, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -31625,7 +42186,7 @@ Object { 18, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { @@ -31642,59 +42203,41 @@ Object { 19, 20, ], - "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], "type": "Punctuator", - "value": "=", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 21, "line": 1, }, "start": Object { - "column": 23, + "column": 20, "line": 1, }, }, "range": Array [ - 23, - 25, + 20, + 21, ], "type": "Numeric", - "value": "10", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 22, "line": 1, }, "start": Object { - "column": 25, + "column": 21, "line": 1, }, }, "range": Array [ - 25, - 26, + 21, + 22, ], "type": "Punctuator", "value": ",", @@ -31702,161 +42245,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 23, "line": 1, }, "start": Object { - "column": 27, + "column": 22, "line": 1, }, }, "range": Array [ - 27, - 28, + 22, + 23, ], - "type": "Identifier", - "value": "z", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 24, "line": 1, }, "start": Object { - "column": 28, + "column": 23, "line": 1, }, }, "range": Array [ - 28, - 29, + 23, + 24, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 25, "line": 1, }, "start": Object { - "column": 30, + "column": 24, "line": 1, }, }, "range": Array [ - 30, - 31, + 24, + 25, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 26, "line": 1, }, "start": Object { - "column": 32, + "column": 25, "line": 1, }, }, "range": Array [ - 32, - 33, + 25, + 26, ], - "type": "Punctuator", - "value": "=", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 27, "line": 1, }, "start": Object { - "column": 34, + "column": 26, "line": 1, }, }, "range": Array [ - 34, - 36, + 26, + 27, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 37, + "column": 28, "line": 1, }, "start": Object { - "column": 36, + "column": 27, "line": 1, }, }, "range": Array [ - 36, - 37, + 27, + 28, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 29, "line": 1, }, "start": Object { - "column": 38, + "column": 28, "line": 1, }, }, "range": Array [ - 38, - 39, + 28, + 29, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 30, "line": 1, }, "start": Object { - "column": 40, + "column": 29, "line": 1, }, }, "range": Array [ - 40, - 41, + 29, + 30, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 31, "line": 1, }, "start": Object { - "column": 41, + "column": 30, "line": 1, }, }, "range": Array [ - 41, - 42, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -31866,7 +42409,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-object-longform-multi.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/nested-object.src 1`] = ` Object { "body": Array [ Object { @@ -31875,11 +42418,202 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 27, + "column": 24, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 11, + 22, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 14, + 22, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 4, + 24, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 52, "line": 1, }, "start": Object { - "column": 4, + "column": 27, "line": 1, }, }, @@ -31889,56 +42623,57 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 6, + "column": 30, "line": 1, }, "start": Object { - "column": 5, + "column": 29, "line": 1, }, }, "name": "x", "range": Array [ - 5, - 6, + 29, + 30, ], "type": "Identifier", }, "kind": "init", "loc": Object { "end": Object { - "column": 9, + "column": 35, "line": 1, }, "start": Object { - "column": 5, + "column": 29, "line": 1, }, }, "method": false, "range": Array [ - 5, - 9, + 29, + 35, ], "shorthand": false, "type": "Property", "value": Object { "loc": Object { "end": Object { - "column": 9, + "column": 35, "line": 1, }, "start": Object { - "column": 8, + "column": 32, "line": 1, }, }, - "name": "x", "range": Array [ - 8, - 9, + 32, + 35, ], - "type": "Identifier", + "raw": "\\"3\\"", + "type": "Literal", + "value": "3", }, }, Object { @@ -31946,179 +42681,127 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 12, + "column": 38, "line": 1, }, "start": Object { - "column": 11, + "column": 37, "line": 1, }, }, - "name": "y", + "name": "z", "range": Array [ - 11, - 12, + 37, + 38, ], "type": "Identifier", }, "kind": "init", "loc": Object { "end": Object { - "column": 20, + "column": 50, "line": 1, }, "start": Object { - "column": 11, + "column": 37, "line": 1, }, }, "method": false, "range": Array [ - 11, - 20, + 37, + 50, ], "shorthand": false, "type": "Property", "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 20, + "column": 50, "line": 1, }, "start": Object { - "column": 14, + "column": 40, "line": 1, }, }, - "range": Array [ - 14, - 20, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", }, - "start": Object { - "column": 18, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 42, + 48, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 48, + ], + "raw": "\\"b\\"", + "type": "Literal", + "value": "b", }, }, - "range": Array [ - 18, - 20, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 22, - 23, ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 22, - 26, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "z", "range": Array [ - 25, - 26, + 40, + 50, ], - "type": "Identifier", + "type": "ObjectExpression", }, }, ], "range": Array [ - 4, 27, + 52, ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 30, - 31, - ], - "type": "Identifier", + "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 31, + "column": 52, "line": 1, }, "start": Object { @@ -32128,7 +42811,7 @@ Object { }, "range": Array [ 4, - 31, + 52, ], "type": "VariableDeclarator", }, @@ -32136,7 +42819,7 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 32, + "column": 53, "line": 1, }, "start": Object { @@ -32146,14 +42829,14 @@ Object { }, "range": Array [ 0, - 32, + 53, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 32, + "column": 53, "line": 1, }, "start": Object { @@ -32163,7 +42846,7 @@ Object { }, "range": Array [ 0, - 32, + 53, ], "sourceType": "script", "tokens": Array [ @@ -32255,7 +42938,7 @@ Object { 9, ], "type": "Identifier", - "value": "x", + "value": "y", }, Object { "loc": Object { @@ -32291,7 +42974,7 @@ Object { 12, ], "type": "Identifier", - "value": "y", + "value": "z", }, Object { "loc": Object { @@ -32326,8 +43009,8 @@ Object { 14, 15, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -32344,62 +43027,62 @@ Object { 16, 17, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 18, "line": 1, }, "start": Object { - "column": 18, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 18, - 20, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ + 19, 20, - 21, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 22, "line": 1, }, "start": Object { - "column": 22, + "column": 21, "line": 1, }, }, "range": Array [ + 21, 22, - 23, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -32417,7 +43100,7 @@ Object { 24, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { @@ -32434,44 +43117,44 @@ Object { 25, 26, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 28, "line": 1, }, "start": Object { - "column": 26, + "column": 27, "line": 1, }, }, "range": Array [ - 26, 27, + 28, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 30, "line": 1, }, "start": Object { - "column": 28, + "column": 29, "line": 1, }, }, "range": Array [ - 28, 29, + 30, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { @@ -32488,23 +43171,203 @@ Object { 30, 31, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "String", + "value": "\\"3\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "String", + "value": "\\"b\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 53, "line": 1, }, "start": Object { - "column": 31, + "column": 52, "line": 1, }, }, "range": Array [ - 31, - 32, + 52, + 53, ], "type": "Punctuator", "value": ";", @@ -32514,7 +43377,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-object-mixed-multi.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/object-var-named.src 1`] = ` Object { "body": Array [ Object { @@ -32523,7 +43386,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 21, + "column": 9, "line": 1, }, "start": Object { @@ -32545,7 +43408,7 @@ Object { "line": 1, }, }, - "name": "x", + "name": "a", "range": Array [ 5, 6, @@ -32555,7 +43418,7 @@ Object { "kind": "init", "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -32566,175 +43429,25 @@ Object { "method": false, "range": Array [ 5, - 6, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "method": false, - "range": Array [ 8, - 17, ], "shorthand": false, "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 17, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 17, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 19, - 20, - ], - "shorthand": true, - "type": "Property", "value": Object { "loc": Object { "end": Object { - "column": 20, + "column": 8, "line": 1, }, "start": Object { - "column": 19, + "column": 7, "line": 1, }, }, - "name": "z", + "name": "b", "range": Array [ - 19, - 20, + 7, + 8, ], "type": "Identifier", }, @@ -32742,31 +43455,31 @@ Object { ], "range": Array [ 4, - 21, + 9, ], "type": "ObjectPattern", }, "init": Object { "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 1, }, "start": Object { - "column": 24, + "column": 12, "line": 1, }, }, - "name": "a", + "properties": Array [], "range": Array [ - 24, - 25, + 12, + 14, ], - "type": "Identifier", + "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 1, }, "start": Object { @@ -32776,7 +43489,7 @@ Object { }, "range": Array [ 4, - 25, + 14, ], "type": "VariableDeclarator", }, @@ -32784,7 +43497,7 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { @@ -32794,14 +43507,14 @@ Object { }, "range": Array [ 0, - 26, + 15, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { @@ -32811,7 +43524,7 @@ Object { }, "range": Array [ 0, - 26, + 15, ], "sourceType": "script", "tokens": Array [ @@ -32867,7 +43580,7 @@ Object { 6, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { @@ -32885,76 +43598,58 @@ Object { 7, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 8, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ + 7, 8, - 9, ], "type": "Identifier", - "value": "y", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 8, "line": 1, }, }, "range": Array [ + 8, 9, - 10, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { "column": 11, "line": 1, }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - "value": "y", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, "start": Object { - "column": 13, + "column": 10, "line": 1, }, }, "range": Array [ - 13, - 14, + 10, + 11, ], "type": "Punctuator", "value": "=", @@ -32962,71 +43657,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 17, - ], - "type": "Numeric", - "value": "10", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - "value": "z", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 14, "line": 1, }, "start": Object { - "column": 20, + "column": 13, "line": 1, }, }, "range": Array [ - 20, - 21, + 13, + 14, ], "type": "Punctuator", "value": "}", @@ -33034,53 +43693,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, + "column": 15, "line": 1, }, "start": Object { - "column": 25, + "column": 14, "line": 1, }, }, "range": Array [ - 25, - 26, + 14, + 15, ], "type": "Punctuator", "value": ";", @@ -33090,227 +43713,77 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/defaults-object-multi.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/object-var-undefined.src 1`] = ` Object { "body": Array [ Object { "declarations": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 5, - 11, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 13, - 14, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, }, + }, + "properties": Array [ Object { "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 17, + "column": 6, "line": 1, }, "start": Object { - "column": 16, + "column": 5, "line": 1, }, }, - "name": "z", + "name": "a", "range": Array [ - 16, - 17, + 5, + 6, ], "type": "Identifier", }, "kind": "init", "loc": Object { "end": Object { - "column": 17, + "column": 6, "line": 1, }, "start": Object { - "column": 16, + "column": 5, "line": 1, }, }, "method": false, "range": Array [ - 16, - 17, + 5, + 6, ], "shorthand": true, "type": "Property", "value": Object { "loc": Object { "end": Object { - "column": 17, + "column": 6, "line": 1, }, "start": Object { - "column": 16, + "column": 5, "line": 1, }, }, - "name": "z", + "name": "a", "range": Array [ - 16, - 17, + 5, + 6, ], "type": "Identifier", }, @@ -33318,31 +43791,31 @@ Object { ], "range": Array [ 4, - 18, + 7, ], "type": "ObjectPattern", }, "init": Object { "loc": Object { "end": Object { - "column": 22, + "column": 12, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, - "name": "a", + "properties": Array [], "range": Array [ - 21, - 22, + 10, + 12, ], - "type": "Identifier", + "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 22, + "column": 12, "line": 1, }, "start": Object { @@ -33352,7 +43825,7 @@ Object { }, "range": Array [ 4, - 22, + 12, ], "type": "VariableDeclarator", }, @@ -33360,7 +43833,7 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 23, + "column": 13, "line": 1, }, "start": Object { @@ -33370,14 +43843,14 @@ Object { }, "range": Array [ 0, - 23, + 13, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 23, + "column": 13, "line": 1, }, "start": Object { @@ -33387,7 +43860,7 @@ Object { }, "range": Array [ 0, - 23, + 13, ], "sourceType": "script", "tokens": Array [ @@ -33443,130 +43916,76 @@ Object { 6, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 1, }, "start": Object { - "column": 7, + "column": 6, "line": 1, }, }, "range": Array [ + 6, 7, - 8, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { "column": 9, "line": 1, }, - }, - "range": Array [ - 9, - 11, - ], - "type": "Numeric", - "value": "10", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ - 11, - 12, + 8, + 9, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - "value": "y", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { - "column": 14, + "column": 10, "line": 1, }, }, "range": Array [ - 14, - 15, + 10, + 11, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - "value": "z", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 1, }, "start": Object { - "column": 17, + "column": 11, "line": 1, }, }, "range": Array [ - 17, - 18, + 11, + 12, ], "type": "Punctuator", "value": "}", @@ -33574,387 +43993,164 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 19, + "column": 12, "line": 1, }, }, "range": Array [ - 19, - 20, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/param-defaults-array.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, }, - "start": Object { - "column": 21, - "line": 1, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - "value": "a", - }, - Object { "loc": Object { "end": Object { "column": 23, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/defaults-object-nested-all.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ + "params": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 5, - 11, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - "kind": "init", + "elements": Array [ + Object { + "left": Object { "loc": Object { "end": Object { - "column": 25, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, - "method": false, + "name": "x", "range": Array [ + 12, 13, - 25, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 18, - 24, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 24, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 24, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 16, - 25, - ], - "type": "ObjectPattern", - }, + "type": "Identifier", }, - ], - "range": Array [ - 4, - 26, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, }, - "start": Object { - "column": 29, - "line": 1, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, }, + "type": "AssignmentPattern", }, - "name": "a", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - }, + ], "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 4, + "column": 11, "line": 1, }, }, "range": Array [ - 4, - 30, + 11, + 19, ], - "type": "VariableDeclarator", + "type": "ArrayPattern", }, ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, "range": Array [ 0, - 31, + 23, ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 1, }, "start": Object { @@ -33964,14 +44160,14 @@ Object { }, "range": Array [ 0, - 31, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 8, "line": 1, }, "start": Object { @@ -33981,64 +44177,28 @@ Object { }, "range": Array [ 0, - 3, + 8, ], "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "{", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "=", + "value": "a", }, Object { "loc": Object { @@ -34047,16 +44207,16 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, + 10, 11, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -34074,25 +44234,25 @@ Object { 12, ], "type": "Punctuator", - "value": ",", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 14, ], "type": "Identifier", - "value": "y", + "value": "x", }, Object { "loc": Object { @@ -34110,12 +44270,12 @@ Object { 15, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -34125,10 +44285,10 @@ Object { }, "range": Array [ 16, - 17, + 18, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { @@ -34145,429 +44305,245 @@ Object { 18, 19, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ + 19, 20, - 21, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { "column": 22, "line": 1, }, - }, - "range": Array [ - 22, - 24, - ], - "type": "Numeric", - "value": "10", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, "start": Object { - "column": 24, + "column": 21, "line": 1, }, }, "range": Array [ - 24, - 25, + 21, + 22, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { - "column": 25, + "column": 22, "line": 1, }, }, "range": Array [ - 25, - 26, + 22, + 23, ], "type": "Punctuator", "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/param-defaults-object.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", }, - "range": Array [ - 27, - 28, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - "value": "a", - }, - Object { "loc": Object { "end": Object { - "column": 31, + "column": 23, "line": 1, }, "start": Object { - "column": 30, + "column": 0, "line": 1, }, }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/defaults-object-nested-multi.src 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ + "params": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 5, + "column": 12, "line": 1, }, }, - "method": false, + "name": "x", "range": Array [ - 5, - 11, + 12, + 13, ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 11, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 11, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, }, }, - Object { - "computed": false, - "key": Object { + "method": false, + "range": Array [ + 12, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, - "name": "y", + "name": "x", "range": Array [ + 12, 13, - 14, ], "type": "Identifier", }, - "kind": "init", "loc": Object { "end": Object { - "column": 21, + "column": 18, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, - "method": false, "range": Array [ - 13, - 21, + 12, + 18, ], - "shorthand": false, - "type": "Property", - "value": Object { + "right": Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 18, - 19, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, + "column": 18, + "line": 1, }, - ], + "start": Object { + "column": 16, + "line": 1, + }, + }, "range": Array [ 16, - 21, + 18, ], - "type": "ObjectPattern", + "raw": "10", + "type": "Literal", + "value": 10, }, + "type": "AssignmentPattern", }, - ], - "range": Array [ - 4, - 22, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, }, - }, + ], "range": Array [ - 4, - 26, + 11, + 19, ], - "type": "VariableDeclarator", + "type": "ObjectPattern", }, ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, "range": Array [ 0, - 27, + 23, ], - "type": "VariableDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 27, + "column": 23, "line": 1, }, "start": Object { @@ -34577,14 +44553,14 @@ Object { }, "range": Array [ 0, - 27, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 8, "line": 1, }, "start": Object { @@ -34594,64 +44570,28 @@ Object { }, "range": Array [ 0, - 3, + 8, ], "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "{", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "=", + "value": "a", }, Object { "loc": Object { @@ -34660,16 +44600,16 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, + 10, 11, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -34687,25 +44627,25 @@ Object { 12, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 14, ], "type": "Identifier", - "value": "y", + "value": "x", }, Object { "loc": Object { @@ -34723,12 +44663,12 @@ Object { 15, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -34738,10 +44678,10 @@ Object { }, "range": Array [ 16, - 17, + 18, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { @@ -34758,26 +44698,26 @@ Object { 18, 19, ], - "type": "Identifier", - "value": "z", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ + 19, 20, - 21, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { @@ -34795,328 +44735,51 @@ Object { 22, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { "column": 23, "line": 1, }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, "start": Object { - "column": 26, + "column": 22, "line": 1, }, }, "range": Array [ - 26, - 27, + 22, + 23, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/destructured-array-catch.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/param-defaults-object-nested.src 1`] = ` Object { "body": Array [ Object { "async": false, "body": Object { - "body": Array [ - Object { - "block": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "name": "b", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "method": false, - "range": Array [ - 35, - 36, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "name": "b", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 34, - 37, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 40, - 41, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 34, - 41, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 30, - 42, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 24, - 46, - ], - "type": "BlockStatement", - }, - "finalizer": null, - "handler": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "range": Array [ - 64, - 69, - ], - "type": "BlockStatement", - }, - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "param": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "name": "stack", - "range": Array [ - 56, - 61, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 5, - }, - }, - "range": Array [ - 55, - 62, - ], - "type": "ArrayPattern", - }, - "range": Array [ - 49, - 69, - ], - "type": "CatchClause", - }, - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 20, - 69, - ], - "type": "TryStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 38, + "line": 1, }, "start": Object { - "column": 16, + "column": 36, "line": 1, }, }, "range": Array [ - 16, - 71, + 36, + 38, ], "type": "BlockStatement", }, @@ -35133,7 +44796,7 @@ Object { "line": 1, }, }, - "name": "x", + "name": "a", "range": Array [ 9, 10, @@ -35142,8 +44805,8 @@ Object { }, "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 38, + "line": 1, }, "start": Object { "column": 0, @@ -35154,108 +44817,295 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 34, "line": 1, }, "start": Object { "column": 11, "line": 1, }, - }, - "properties": Array [ + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, Object { "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 13, + "column": 21, "line": 1, }, "start": Object { - "column": 12, + "column": 20, "line": 1, }, }, - "name": "a", + "name": "y", "range": Array [ - 12, - 13, + 20, + 21, ], "type": "Identifier", }, "kind": "init", "loc": Object { "end": Object { - "column": 13, + "column": 33, "line": 1, }, "start": Object { - "column": 12, + "column": 20, "line": 1, }, }, "method": false, "range": Array [ - 12, - 13, + 20, + 33, ], - "shorthand": true, + "shorthand": false, "type": "Property", "value": Object { "loc": Object { "end": Object { - "column": 13, + "column": 33, "line": 1, }, "start": Object { - "column": 12, + "column": 23, "line": 1, }, }, - "name": "a", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 25, + 31, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], "range": Array [ - 12, - 13, + 23, + 33, ], - "type": "Identifier", + "type": "ObjectPattern", }, }, ], "range": Array [ 11, - 14, + 34, ], "type": "ObjectPattern", }, ], "range": Array [ 0, - 71, + 38, ], "type": "FunctionDeclaration", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 7, + "column": 39, + "line": 1, }, "start": Object { - "column": 1, - "line": 7, + "column": 38, + "line": 1, }, }, "range": Array [ - 71, - 72, + 38, + 39, ], "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 2, - "line": 7, + "column": 39, + "line": 1, }, "start": Object { "column": 0, @@ -35264,7 +45114,7 @@ Object { }, "range": Array [ 0, - 72, + 39, ], "sourceType": "script", "tokens": Array [ @@ -35302,7 +45152,7 @@ Object { 10, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { @@ -35356,94 +45206,112 @@ Object { 13, ], "type": "Identifier", - "value": "a", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 15, + 16, + 18, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 1, }, "start": Object { - "column": 16, + "column": 18, "line": 1, }, }, "range": Array [ - 16, - 17, + 18, + 19, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ 20, - 23, + 21, ], - "type": "Keyword", - "value": "try", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 6, - "line": 2, + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, }, }, "range": Array [ + 23, 24, - 25, ], "type": "Punctuator", "value": "{", @@ -35451,66 +45319,120 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 25, + "line": 1, }, }, "range": Array [ - 30, + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, 33, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 34, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 33, + "line": 1, }, }, "range": Array [ + 33, 34, - 35, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 35, + "line": 1, }, "start": Object { - "column": 9, - "line": 3, + "column": 34, + "line": 1, }, }, "range": Array [ + 34, 35, - 36, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 37, + "line": 1, }, "start": Object { - "column": 10, - "line": 3, + "column": 36, + "line": 1, }, }, "range": Array [ @@ -35518,17 +45440,35 @@ Object { 37, ], "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 39, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 38, + "line": 1, }, }, "range": Array [ @@ -35536,94 +45476,213 @@ Object { 39, ], "type": "Punctuator", - "value": "=", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-array.src 1`] = ` +Object { + "body": Array [ Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "ArrayPattern", }, - }, + ], "range": Array [ - 40, - 41, + 0, + 22, ], - "type": "Identifier", - "value": "a", + "type": "FunctionDeclaration", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 15, - "line": 3, + "column": 22, + "line": 1, }, }, "range": Array [ - 41, - 42, + 22, + 23, ], - "type": "Punctuator", - "value": ";", + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 8, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 45, - 46, + 0, + 8, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 10, + "line": 1, }, "start": Object { - "column": 2, - "line": 5, + "column": 9, + "line": 1, }, }, "range": Array [ - 49, - 54, + 9, + 10, ], - "type": "Keyword", - "value": "catch", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 11, + "line": 1, }, "start": Object { - "column": 7, - "line": 5, + "column": 10, + "line": 1, }, }, "range": Array [ - 54, - 55, + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -35631,17 +45690,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 12, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 55, - 56, + 11, + 12, ], "type": "Punctuator", "value": "[", @@ -35650,572 +45709,289 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 5, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 13, + "line": 1, }, }, "range": Array [ - 56, - 61, + 13, + 14, ], "type": "Identifier", - "value": "stack", + "value": "a", }, Object { "loc": Object { "end": Object { "column": 15, - "line": 5, + "line": 1, }, "start": Object { "column": 14, - "line": 5, - }, - }, - "range": Array [ - 61, - 62, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 5, - }, - "start": Object { - "column": 15, - "line": 5, + "line": 1, }, }, "range": Array [ - 62, - 63, + 14, + 15, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 17, + "line": 1, }, "start": Object { - "column": 17, - "line": 5, + "column": 16, + "line": 1, }, }, "range": Array [ - 64, - 65, + 16, + 17, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 6, + "column": 19, + "line": 1, }, "start": Object { - "column": 2, - "line": 6, + "column": 18, + "line": 1, }, }, "range": Array [ - 68, - 69, + 18, + 19, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 20, + "line": 1, }, "start": Object { - "column": 0, - "line": 7, + "column": 19, + "line": 1, }, }, "range": Array [ - 70, - 71, + 19, + 20, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 7, - }, - "start": Object { - "column": 1, - "line": 7, + "column": 21, + "line": 1, }, - }, - "range": Array [ - 71, - 72, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/destructured-object-catch.src 1`] = ` -Object { - "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "block": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "name": "b", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "method": false, - "range": Array [ - 35, - 36, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "name": "b", - "range": Array [ - 35, - 36, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 34, - 37, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "name": "a", - "range": Array [ - 40, - 41, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 34, - 41, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 16, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 30, - 42, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 3, - "line": 4, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 24, - 46, - ], - "type": "BlockStatement", - }, - "finalizer": null, - "handler": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 17, - "line": 5, - }, - }, - "range": Array [ - 64, - 69, - ], - "type": "BlockStatement", - }, - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 5, - }, - }, - "param": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 5, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "name": "stack", - "range": Array [ - 56, - 61, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "method": false, - "range": Array [ - 56, - 61, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 9, - "line": 5, - }, - }, - "name": "stack", - "range": Array [ - 56, - 61, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 55, - 62, - ], - "type": "ObjectPattern", - }, - "range": Array [ - 49, - 69, - ], - "type": "CatchClause", - }, - "loc": Object { - "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 20, - 69, - ], - "type": "TryStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 7, - }, - "start": Object { - "column": 16, - "line": 1, - }, + "start": Object { + "column": 20, + "line": 1, }, - "range": Array [ - 16, - 71, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, }, - "name": "x", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 23, + "line": 1, }, "start": Object { - "column": 0, + "column": 22, "line": 1, }, }, - "params": Array [ - Object { + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-array-wrapped.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 14, + "column": 23, "line": 1, }, "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { "column": 11, "line": 1, }, + "start": Object { + "column": 10, + "line": 1, + }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "name": "x", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 14, "line": 1, }, }, "name": "a", "range": Array [ - 12, - 13, + 14, + 15, ], "type": "Identifier", }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 12, - 13, - ], - "shorthand": true, - "type": "Property", - "value": Object { + Object { "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 1, }, "start": Object { - "column": 12, + "column": 17, "line": 1, }, }, - "name": "a", + "name": "b", "range": Array [ - 12, - 13, + 17, + 18, ], "type": "Identifier", }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, }, - ], - "range": Array [ - 11, - 14, - ], - "type": "ObjectPattern", - }, - ], - "range": Array [ - 0, - 71, - ], - "type": "FunctionDeclaration", - }, - Object { + "range": Array [ + 12, + 20, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "FunctionExpression", + }, "loc": Object { "end": Object { - "column": 2, - "line": 7, + "column": 25, + "line": 1, }, "start": Object { - "column": 1, - "line": 7, + "column": 0, + "line": 1, }, }, "range": Array [ - 71, - 72, + 0, + 25, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 2, - "line": 7, + "column": 25, + "line": 1, }, "start": Object { "column": 0, @@ -36224,14 +46000,14 @@ Object { }, "range": Array [ 0, - 72, + 25, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -36241,28 +46017,28 @@ Object { }, "range": Array [ 0, - 8, + 1, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 9, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, "range": Array [ + 1, 9, - 10, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { @@ -36279,8 +46055,8 @@ Object { 10, 11, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { @@ -36298,7 +46074,7 @@ Object { 12, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { @@ -36315,95 +46091,113 @@ Object { 12, 13, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, 14, + 15, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, ], "type": "Punctuator", - "value": "{", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 2, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ 20, - 23, + 21, ], - "type": "Keyword", - "value": "try", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 6, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 24, - 25, + 21, + 22, ], "type": "Punctuator", "value": "{", @@ -36411,197 +46205,355 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 22, + "line": 1, }, }, "range": Array [ - 30, - 33, + 22, + 23, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 24, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 23, + "line": 1, }, }, "range": Array [ - 34, - 35, + 23, + 24, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 3, + "column": 25, + "line": 1, }, "start": Object { - "column": 9, - "line": 3, + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-multi-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 14, + 19, + ], + "type": "ObjectPattern", }, - }, - "range": Array [ - 35, - 36, ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 3, - }, - "start": Object { - "column": 10, - "line": 3, - }, - }, "range": Array [ - 36, - 37, + 0, + 22, ], - "type": "Punctuator", - "value": "}", + "type": "FunctionDeclaration", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 22, + "line": 1, }, }, "range": Array [ - 38, - 39, + 22, + 23, ], - "type": "Punctuator", - "value": "=", + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 40, - 41, + 0, + 8, ], - "type": "Identifier", - "value": "a", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 10, + "line": 1, }, "start": Object { - "column": 15, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 41, - 42, + 9, + 10, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 4, + "column": 11, + "line": 1, }, "start": Object { - "column": 2, - "line": 4, + "column": 10, + "line": 1, }, }, "range": Array [ - 45, - 46, + 10, + 11, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 12, + "line": 1, }, "start": Object { - "column": 2, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 49, - 54, + 11, + 12, ], - "type": "Keyword", - "value": "catch", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 5, + "column": 13, + "line": 1, }, "start": Object { - "column": 7, - "line": 5, + "column": 12, + "line": 1, }, }, "range": Array [ - 54, - 55, + 12, + 13, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 15, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 14, + "line": 1, }, }, "range": Array [ - 55, - 56, + 14, + 15, ], "type": "Punctuator", "value": "{", @@ -36609,35 +46561,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 5, + "column": 17, + "line": 1, }, "start": Object { - "column": 9, - "line": 5, + "column": 16, + "line": 1, }, }, "range": Array [ - 56, - 61, + 16, + 17, ], "type": "Identifier", - "value": "stack", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 5, + "column": 19, + "line": 1, }, "start": Object { - "column": 14, - "line": 5, + "column": 18, + "line": 1, }, }, "range": Array [ - 61, - 62, + 18, + 19, ], "type": "Punctuator", "value": "}", @@ -36645,17 +46597,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 20, + "line": 1, }, "start": Object { - "column": 15, - "line": 5, + "column": 19, + "line": 1, }, }, "range": Array [ - 62, - 63, + 19, + 20, ], "type": "Punctuator", "value": ")", @@ -36663,17 +46615,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 5, + "column": 21, + "line": 1, }, "start": Object { - "column": 17, - "line": 5, + "column": 20, + "line": 1, }, }, "range": Array [ - 64, - 65, + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -36681,35 +46633,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 6, - }, - "start": Object { - "column": 2, - "line": 6, - }, - }, - "range": Array [ - 68, - 69, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 7, + "column": 22, + "line": 1, }, "start": Object { - "column": 0, - "line": 7, + "column": 21, + "line": 1, }, }, "range": Array [ - 70, - 71, + 21, + 22, ], "type": "Punctuator", "value": "}", @@ -36717,17 +46651,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, - "line": 7, + "column": 23, + "line": 1, }, "start": Object { - "column": 1, - "line": 7, + "column": 22, + "line": 1, }, }, "range": Array [ - 71, - 72, + 22, + 23, ], "type": "Punctuator", "value": ";", @@ -36737,226 +46671,338 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/named-param.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/params-nested-array.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, }, - "properties": Array [ + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "responseText", - "range": Array [ - 3, - 15, - ], - "type": "Identifier", - }, - "kind": "init", "loc": Object { "end": Object { - "column": 21, + "column": 13, "line": 1, }, "start": Object { - "column": 3, + "column": 12, "line": 1, }, }, - "method": false, + "name": "x", "range": Array [ - 3, - 21, + 12, + 13, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, + "type": "Identifier", + }, + null, + Object { + "elements": Array [ + null, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, }, + "name": "z", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, - "name": "text", - "range": Array [ - 17, - 21, - ], - "type": "Identifier", }, + "range": Array [ + 17, + 22, + ], + "type": "ArrayPattern", }, ], - "range": Array [ - 1, - 23, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "operator": "=", - "range": Array [ - 1, - 29, - ], - "right": Object { "loc": Object { "end": Object { - "column": 29, + "column": 23, "line": 1, }, "start": Object { - "column": 26, + "column": 11, "line": 1, }, }, - "name": "res", "range": Array [ - 26, - 29, + 11, + 23, ], - "type": "Identifier", + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 27, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, }, - "type": "AssignmentExpression", }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 0, + "column": 11, "line": 1, }, }, "range": Array [ - 0, - 31, + 11, + 12, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 31, - "line": 1, + "type": "Punctuator", + "value": "[", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", }, - }, - "range": Array [ - 0, - 31, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 14, "line": 1, }, "start": Object { - "column": 0, + "column": 13, "line": 1, }, }, "range": Array [ - 0, - 1, + 13, + 14, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 16, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, "range": Array [ - 1, - 2, + 15, + 16, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 3, + "column": 17, "line": 1, }, }, "range": Array [ - 3, - 15, + 17, + 18, ], - "type": "Identifier", - "value": "responseText", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, "range": Array [ - 15, - 16, + 18, + 19, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { @@ -36965,16 +47011,34 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 20, "line": 1, }, }, "range": Array [ - 17, + 20, 21, ], "type": "Identifier", - "value": "text", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { @@ -36992,76 +47056,76 @@ Object { 23, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 24, - 25, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 26, "line": 1, }, "start": Object { - "column": 26, + "column": 25, "line": 1, }, }, "range": Array [ + 25, 26, - 29, ], - "type": "Identifier", - "value": "res", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 27, "line": 1, }, "start": Object { - "column": 29, + "column": 26, "line": 1, }, }, "range": Array [ - 29, - 30, + 26, + 27, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 28, "line": 1, }, "start": Object { - "column": 30, + "column": 27, "line": 1, }, }, "range": Array [ - 30, - 31, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -37071,342 +47135,327 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/nested-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/params-nested-object.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ Object { - "id": Object { - "elements": Array [ - Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 6, + "column": 13, "line": 1, }, "start": Object { - "column": 5, + "column": 12, "line": 1, }, }, "name": "x", "range": Array [ - 5, - 6, + 12, + 13, ], "type": "Identifier", }, - null, - Object { - "elements": Array [ - null, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - }, - ], + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 16, + ], + "shorthand": false, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 10, + "column": 15, "line": 1, }, }, + "name": "y", "range": Array [ - 10, 15, + 16, ], - "type": "ArrayPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, + "type": "Identifier", }, }, - "range": Array [ - 4, - 16, - ], - "type": "ArrayPattern", - }, - "init": Object { - "elements": Array [ - Object { + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 1, }, "start": Object { - "column": 20, + "column": 18, "line": 1, }, }, + "name": "z", "range": Array [ - 20, - 21, + 18, + 19, ], - "raw": "1", - "type": "Literal", - "value": 1, + "type": "Identifier", }, - Object { + "kind": "init", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 18, + 29, + ], + "shorthand": false, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 23, + "column": 29, "line": 1, }, "start": Object { - "column": 22, + "column": 21, "line": 1, }, }, - "range": Array [ - 22, - 23, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - Object { - "elements": Array [ + "properties": Array [ Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, }, + "name": "a", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", }, - "range": Array [ - 25, - 26, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - Object { + "kind": "init", "loc": Object { "end": Object { - "column": 28, + "column": 27, "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, + "method": false, "range": Array [ + 23, 27, - 28, ], - "raw": "4", - "type": "Literal", - "value": 4, + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, }, ], - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, "range": Array [ - 24, + 21, 29, ], - "type": "ArrayExpression", - }, - ], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, + "type": "ObjectPattern", }, }, - "range": Array [ - 19, - 30, - ], - "type": "ArrayExpression", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, + ], "range": Array [ - 4, - 30, + 11, + 31, ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "ObjectPattern", }, - }, - "range": Array [ - 0, - 31, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 31, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, "range": Array [ 0, - 3, + 35, ], - "type": "Keyword", - "value": "var", + "type": "FunctionDeclaration", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 36, "line": 1, }, "start": Object { - "column": 4, + "column": 35, "line": 1, }, }, "range": Array [ - 4, - 5, + 35, + 36, ], - "type": "Punctuator", - "value": "[", + "type": "EmptyStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - "value": "x", + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 0, "line": 1, }, }, "range": Array [ - 6, - 7, + 0, + 8, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "range": Array [ - 8, 9, + 10, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -37424,7 +47473,7 @@ Object { 11, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { @@ -37442,43 +47491,43 @@ Object { 12, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 14, ], "type": "Identifier", - "value": "z", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, "range": Array [ + 13, 14, - 15, ], "type": "Punctuator", - "value": "]", + "value": ":", }, Object { "loc": Object { @@ -37495,62 +47544,62 @@ Object { 15, 16, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, "range": Array [ + 16, 17, - 18, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 19, "line": 1, }, "start": Object { - "column": 19, + "column": 18, "line": 1, }, }, "range": Array [ + 18, 19, - 20, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 19, "line": 1, }, }, "range": Array [ + 19, 20, - 21, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { @@ -37568,166 +47617,166 @@ Object { 22, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 24, "line": 1, }, "start": Object { - "column": 22, + "column": 23, "line": 1, }, }, "range": Array [ - 22, 23, + 24, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 25, "line": 1, }, "start": Object { - "column": 23, + "column": 24, "line": 1, }, }, "range": Array [ - 23, 24, + 25, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 27, "line": 1, }, "start": Object { - "column": 24, + "column": 26, "line": 1, }, }, "range": Array [ - 24, - 25, + 26, + 27, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 29, "line": 1, }, "start": Object { - "column": 25, + "column": 28, "line": 1, }, }, "range": Array [ - 25, - 26, + 28, + 29, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 31, "line": 1, }, "start": Object { - "column": 26, + "column": 30, "line": 1, }, }, "range": Array [ - 26, - 27, + 30, + 31, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 32, "line": 1, }, "start": Object { - "column": 27, + "column": 31, "line": 1, }, }, "range": Array [ - 27, - 28, + 31, + 32, ], - "type": "Numeric", - "value": "4", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 34, "line": 1, }, "start": Object { - "column": 28, + "column": 33, "line": 1, }, }, "range": Array [ - 28, - 29, + 33, + 34, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 35, "line": 1, }, "start": Object { - "column": 29, + "column": 34, "line": 1, }, }, "range": Array [ - 29, - 30, + 34, + 35, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 36, "line": 1, }, "start": Object { - "column": 30, + "column": 35, "line": 1, }, }, "range": Array [ - 30, - 31, + 35, + 36, ], "type": "Punctuator", "value": ";", @@ -37737,434 +47786,221 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/nested-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/params-object.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { - "column": 5, + "column": 13, "line": 1, }, }, - "method": false, + "name": "a", "range": Array [ - 5, - 9, + 13, + 14, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, + "type": "Identifier", }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, }, - "kind": "init", + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 13, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 13, "line": 1, }, }, - "method": false, + "name": "a", "range": Array [ - 11, - 22, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 16, - 20, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 14, - 22, - ], - "type": "ObjectPattern", - }, - }, - ], - "range": Array [ - 4, - 24, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 52, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - }, - "kind": "init", + 13, + 14, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 35, + "column": 17, "line": 1, }, "start": Object { - "column": 29, + "column": 16, "line": 1, }, }, - "method": false, + "name": "b", "range": Array [ - 29, - 35, + 16, + 17, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 35, - ], - "raw": "\\"3\\"", - "type": "Literal", - "value": "3", - }, + "type": "Identifier", }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 37, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 37, - 38, - ], - "type": "Identifier", + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, - "kind": "init", + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 50, + "column": 17, "line": 1, }, "start": Object { - "column": 37, + "column": 16, "line": 1, }, }, - "method": false, + "name": "b", "range": Array [ - 37, - 50, + 16, + 17, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 1, - }, - "start": Object { - "column": 40, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 42, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 42, - 43, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 42, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 42, - 48, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 45, - "line": 1, - }, - }, - "range": Array [ - 45, - 48, - ], - "raw": "\\"b\\"", - "type": "Literal", - "value": "b", - }, - }, - ], - "range": Array [ - 40, - 50, - ], - "type": "ObjectExpression", - }, + "type": "Identifier", }, - ], - "range": Array [ - 27, - 52, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 52, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, }, - }, + ], "range": Array [ - 4, - 52, + 11, + 19, ], - "type": "VariableDeclarator", + "type": "ObjectPattern", }, ], - "kind": "var", + "range": Array [ + 0, + 22, + ], + "type": "FunctionDeclaration", + }, + Object { "loc": Object { "end": Object { - "column": 53, + "column": 23, "line": 1, }, "start": Object { - "column": 0, + "column": 22, "line": 1, }, }, "range": Array [ - 0, - 53, + 22, + 23, ], - "type": "VariableDeclaration", + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 53, + "column": 23, "line": 1, }, "start": Object { @@ -38174,14 +48010,14 @@ Object { }, "range": Array [ 0, - 53, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 8, "line": 1, }, "start": Object { @@ -38191,97 +48027,97 @@ Object { }, "range": Array [ 0, - 3, + 8, ], "type": "Keyword", - "value": "var", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 10, "line": 1, }, "start": Object { - "column": 4, + "column": 9, "line": 1, }, }, "range": Array [ - 4, - 5, + 9, + 10, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 6, + 10, + 11, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 11, "line": 1, }, }, "range": Array [ - 6, - 7, + 11, + 12, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { - "column": 8, + "column": 13, "line": 1, }, }, "range": Array [ - 8, - 9, + 13, + 14, ], "type": "Identifier", - "value": "y", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 14, "line": 1, }, }, "range": Array [ - 9, - 10, + 14, + 15, ], "type": "Punctuator", "value": ",", @@ -38289,53 +48125,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], "type": "Identifier", - "value": "z", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 19, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, "range": Array [ - 12, - 13, + 18, + 19, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { - "column": 14, + "column": 19, "line": 1, }, }, "range": Array [ - 14, - 15, + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, ], "type": "Punctuator", "value": "{", @@ -38343,143 +48197,322 @@ Object { Object { "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 23, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": ":", - }, - Object { + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring/params-object-wrapped.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 17, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "FunctionExpression", + }, "loc": Object { "end": Object { - "column": 20, + "column": 25, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 20, + 0, + 25, ], - "type": "Identifier", - "value": "b", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": "}", + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 26, + "column": 1, "line": 1, }, "start": Object { - "column": 25, + "column": 0, "line": 1, }, }, "range": Array [ - 25, - 26, + 0, + 1, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 9, "line": 1, }, "start": Object { - "column": 27, + "column": 1, "line": 1, }, }, "range": Array [ - 27, - 28, + 1, + 9, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 11, "line": 1, }, "start": Object { - "column": 29, + "column": 10, "line": 1, }, }, "range": Array [ - 29, - 30, + 10, + 11, ], "type": "Identifier", "value": "x", @@ -38487,179 +48520,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 12, "line": 1, }, "start": Object { - "column": 30, + "column": 11, "line": 1, }, }, "range": Array [ - 30, - 31, + 11, + 12, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 35, - ], - "type": "String", - "value": "\\"3\\"", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 13, "line": 1, }, "start": Object { - "column": 35, + "column": 12, "line": 1, }, }, "range": Array [ - 35, - 36, + 12, + 13, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 15, "line": 1, }, "start": Object { - "column": 37, + "column": 14, "line": 1, }, }, "range": Array [ - 37, - 38, + 14, + 15, ], "type": "Identifier", - "value": "z", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 16, "line": 1, }, "start": Object { - "column": 38, + "column": 15, "line": 1, }, }, "range": Array [ - 38, - 39, + 15, + 16, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 18, "line": 1, }, "start": Object { - "column": 40, + "column": 17, "line": 1, }, }, "range": Array [ - 40, - 41, + 17, + 18, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 20, "line": 1, }, "start": Object { - "column": 42, + "column": 19, "line": 1, }, }, "range": Array [ - 42, - 43, + 19, + 20, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 44, + "column": 21, "line": 1, }, "start": Object { - "column": 43, + "column": 20, "line": 1, }, }, "range": Array [ - 43, - 44, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 22, "line": 1, }, "start": Object { - "column": 45, + "column": 21, "line": 1, }, }, "range": Array [ - 45, - 48, + 21, + 22, ], - "type": "String", - "value": "\\"b\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 50, + "column": 23, "line": 1, }, "start": Object { - "column": 49, + "column": 22, "line": 1, }, }, "range": Array [ - 49, - 50, + 22, + 23, ], "type": "Punctuator", "value": "}", @@ -38667,35 +48682,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 52, + "column": 24, "line": 1, }, "start": Object { - "column": 51, + "column": 23, "line": 1, }, }, "range": Array [ - 51, - 52, + 23, + 24, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 53, + "column": 25, "line": 1, }, "start": Object { - "column": 52, + "column": 24, "line": 1, }, }, "range": Array [ - 52, - 53, + 24, + 25, ], "type": "Punctuator", "value": ";", @@ -38705,124 +48720,102 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/object-var-named.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring/sparse-array.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + null, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, }, - "method": false, - "range": Array [ - 5, - 8, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", + "start": Object { + "column": 4, + "line": 1, }, }, - ], - "range": Array [ - 4, - 9, - ], - "type": "ObjectPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "name": "b", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", }, - "properties": Array [], - "range": Array [ - 12, - 14, - ], - "type": "ObjectExpression", + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "operator": "=", + "range": Array [ + 0, + 14, + ], + "right": Object { "loc": Object { "end": Object { "column": 14, "line": 1, }, "start": Object { - "column": 4, + "column": 9, "line": 1, }, }, + "name": "array", "range": Array [ - 4, + 9, 14, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", + "type": "AssignmentExpression", + }, "loc": Object { "end": Object { "column": 15, @@ -38837,7 +48830,7 @@ Object { 0, 15, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { @@ -38859,7 +48852,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -38869,43 +48862,25 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, + 1, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 2, "line": 1, }, "start": Object { - "column": 5, + "column": 1, "line": 1, }, }, "range": Array [ - 5, - 6, + 1, + 2, ], "type": "Identifier", "value": "a", @@ -38913,92 +48888,92 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 3, "line": 1, }, "start": Object { - "column": 6, + "column": 2, "line": 1, }, }, "range": Array [ - 6, - 7, + 2, + 3, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 4, "line": 1, }, "start": Object { - "column": 7, + "column": 3, "line": 1, }, }, "range": Array [ - 7, - 8, + 3, + 4, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { - "column": 8, + "column": 4, "line": 1, }, }, "range": Array [ - 8, - 9, + 4, + 5, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 6, "line": 1, }, "start": Object { - "column": 10, + "column": 5, "line": 1, }, }, "range": Array [ - 10, - 11, + 5, + 6, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 8, "line": 1, }, "start": Object { - "column": 12, + "column": 7, "line": 1, }, }, "range": Array [ - 12, - 13, + 7, + 8, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { @@ -39007,16 +48982,16 @@ Object { "line": 1, }, "start": Object { - "column": 13, + "column": 9, "line": 1, }, }, "range": Array [ - 13, + 9, 14, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "array", }, Object { "loc": Object { @@ -39041,127 +49016,91 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/object-var-undefined.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-array.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, - "properties": Array [ + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "elements": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 1, }, "start": Object { - "column": 5, + "column": 2, "line": 1, }, }, - "method": false, + "name": "y", "range": Array [ - 5, - 6, + 2, + 3, ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, + "type": "Identifier", }, ], - "range": Array [ - 4, - 7, - ], - "type": "ObjectPattern", - }, - "init": Object { "loc": Object { "end": Object { - "column": 12, + "column": 4, "line": 1, }, "start": Object { - "column": 10, + "column": 1, "line": 1, }, }, - "properties": Array [], "range": Array [ - 10, - 12, + 1, + 4, ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "type": "ArrayPattern", }, - "range": Array [ - 4, - 12, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", + ], + "range": Array [ + 0, + 10, + ], + "type": "ArrowFunctionExpression", + }, "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { @@ -39171,14 +49110,14 @@ Object { }, "range": Array [ 0, - 13, + 11, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { @@ -39188,14 +49127,14 @@ Object { }, "range": Array [ 0, - 13, + 11, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -39205,133 +49144,133 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 2, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 5, + 1, + 2, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 1, }, "start": Object { - "column": 5, + "column": 2, "line": 1, }, }, "range": Array [ - 5, - 6, + 2, + 3, ], "type": "Identifier", - "value": "a", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 4, "line": 1, }, "start": Object { - "column": 6, + "column": 3, "line": 1, }, }, "range": Array [ - 6, - 7, + 3, + 4, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { - "column": 8, + "column": 4, "line": 1, }, }, "range": Array [ - 8, - 9, + 4, + 5, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 8, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "range": Array [ - 10, - 11, + 6, + 8, ], "type": "Punctuator", - "value": "{", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, "line": 1, }, "start": Object { - "column": 11, + "column": 9, "line": 1, }, }, "range": Array [ - 11, - 12, + 9, + 10, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { - "column": 12, + "column": 10, "line": 1, }, }, "range": Array [ - 12, - 13, + 10, + 11, ], "type": "Punctuator", "value": ";", @@ -39341,144 +49280,145 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/param-defaults-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-array.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", }, - "range": Array [ - 21, - 23, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 0, "line": 1, }, }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "elements": Array [ - Object { - "left": Object { + "params": Array [ + Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 13, + "column": 3, "line": 1, }, "start": Object { - "column": 12, + "column": 2, "line": 1, }, }, - "name": "x", + "name": "y", "range": Array [ - 12, - 13, + 2, + 3, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 18, - ], - "right": Object { + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 16, + "column": 5, "line": 1, }, }, "range": Array [ - 16, - 18, + 5, + 8, ], - "raw": "10", - "type": "Literal", - "value": 10, + "type": "ArrayPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, }, - "type": "AssignmentPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, }, + "range": Array [ + 1, + 9, + ], + "type": "ArrayPattern", }, - "range": Array [ - 11, - 19, - ], - "type": "ArrayPattern", + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, }, - ], + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 23, + 16, ], - "type": "FunctionDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 23, + "column": 16, "line": 1, }, "start": Object { @@ -39488,14 +49428,14 @@ Object { }, "range": Array [ 0, - 23, + 16, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -39505,61 +49445,79 @@ Object { }, "range": Array [ 0, - 8, + 1, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 2, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, "range": Array [ - 9, - 10, + 1, + 2, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, ], "type": "Identifier", - "value": "a", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 4, "line": 1, }, "start": Object { - "column": 10, + "column": 3, "line": 1, }, }, "range": Array [ - 10, - 11, + 3, + 4, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 6, "line": 1, }, "start": Object { - "column": 11, + "column": 5, "line": 1, }, }, "range": Array [ - 11, - 12, + 5, + 6, ], "type": "Punctuator", "value": "[", @@ -39567,17 +49525,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 12, + "column": 6, "line": 1, }, }, "range": Array [ - 12, - 13, + 6, + 7, ], "type": "Identifier", "value": "x", @@ -39585,293 +49543,372 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 8, "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, - 15, + 7, + 8, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 9, "line": 1, }, "start": Object { - "column": 16, + "column": 8, "line": 1, }, }, "range": Array [ - 16, - 18, + 8, + 9, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 10, "line": 1, }, "start": Object { - "column": 18, + "column": 9, "line": 1, }, }, "range": Array [ - 18, - 19, + 9, + 10, ], "type": "Punctuator", - "value": "]", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 19, + "column": 11, "line": 1, }, }, "range": Array [ - 19, - 20, + 11, + 13, ], "type": "Punctuator", - "value": ")", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 15, "line": 1, }, "start": Object { - "column": 21, + "column": 14, "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 15, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 16, "line": 1, }, "start": Object { - "column": 22, + "column": 15, "line": 1, }, }, "range": Array [ - 22, - 23, + 15, + 16, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/param-defaults-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-object.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, }, + "name": "x", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", }, - "range": Array [ - 21, - 23, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 17, "line": 1, }, "start": Object { - "column": 9, + "column": 0, "line": 1, }, }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 13, + "column": 3, "line": 1, }, "start": Object { - "column": 12, + "column": 2, "line": 1, }, }, - "name": "x", + "method": false, "range": Array [ - 12, - 13, + 2, + 3, ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", }, }, - "method": false, - "range": Array [ - 12, - 18, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 13, + "column": 6, "line": 1, }, "start": Object { - "column": 12, + "column": 5, "line": 1, }, }, - "name": "x", + "name": "a", "range": Array [ - 12, - 13, + 5, + 6, ], "type": "Identifier", }, + "kind": "init", "loc": Object { "end": Object { - "column": 18, + "column": 10, "line": 1, }, "start": Object { - "column": 12, + "column": 5, "line": 1, }, }, + "method": false, "range": Array [ - 12, - 18, + 5, + 10, ], - "right": Object { + "shorthand": false, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 18, + "column": 10, "line": 1, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 8, + 9, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + }, + ], "range": Array [ - 16, - 18, + 7, + 10, ], - "raw": "10", - "type": "Literal", - "value": 10, + "type": "ObjectPattern", }, - "type": "AssignmentPattern", }, - }, - ], - "range": Array [ - 11, - 19, - ], - "type": "ObjectPattern", + ], + "range": Array [ + 1, + 11, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 17, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, }, - ], + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 23, + 18, ], - "type": "FunctionDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 23, + "column": 18, "line": 1, }, "start": Object { @@ -39881,14 +49918,14 @@ Object { }, "range": Array [ 0, - 23, + 18, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -39898,541 +49935,506 @@ Object { }, "range": Array [ 0, - 8, + 1, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 2, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, "range": Array [ - 9, - 10, + 1, + 2, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 3, "line": 1, }, "start": Object { - "column": 10, + "column": 2, "line": 1, }, }, "range": Array [ - 10, - 11, + 2, + 3, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 4, "line": 1, }, "start": Object { - "column": 11, + "column": 3, "line": 1, }, }, "range": Array [ - 11, - 12, + 3, + 4, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 6, "line": 1, }, "start": Object { - "column": 12, + "column": 5, "line": 1, }, }, "range": Array [ - 12, - 13, + 5, + 6, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 1, }, "start": Object { - "column": 14, + "column": 6, "line": 1, }, }, "range": Array [ - 14, - 15, + 6, + 7, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, - 18, + 7, + 8, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { - "column": 18, + "column": 8, "line": 1, }, }, "range": Array [ - 18, - 19, + 8, + 9, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 10, "line": 1, }, "start": Object { - "column": 19, + "column": 9, "line": 1, }, }, "range": Array [ - 19, - 20, + 9, + 10, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 11, "line": 1, }, "start": Object { - "column": 21, + "column": 10, "line": 1, }, }, "range": Array [ - 21, - 22, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 12, "line": 1, }, "start": Object { - "column": 22, + "column": 11, "line": 1, }, }, "range": Array [ - 22, - 23, + 11, + 12, ], "type": "Punctuator", - "value": "}", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/param-defaults-object-nested.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 36, - 38, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "x", + }, + Object { "loc": Object { "end": Object { - "column": 38, + "column": 18, "line": 1, }, "start": Object { - "column": 0, + "column": 17, "line": 1, }, }, - "params": Array [ - Object { + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 34, + "column": 27, "line": 1, }, "start": Object { - "column": 11, + "column": 26, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", + "name": "x", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "start": Object { + "column": 1, + "line": 1, }, - "method": false, - "range": Array [ - 12, - 18, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 1, }, "start": Object { - "column": 12, + "column": 2, "line": 1, }, }, - "name": "x", + "name": "foo", "range": Array [ - 12, - 13, + 2, + 5, ], "type": "Identifier", }, + "kind": "init", "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 12, + "column": 2, "line": 1, }, }, + "method": false, "range": Array [ - 12, - 18, + 2, + 8, ], - "right": Object { + "shorthand": false, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, + "name": "y", "range": Array [ - 16, - 18, + 7, + 8, ], - "raw": "10", - "type": "Literal", - "value": 10, + "type": "Identifier", }, - "type": "AssignmentPattern", }, - }, - Object { - "computed": false, - "key": Object { + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 21, + "column": 20, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, - "name": "y", + "method": false, "range": Array [ + 10, 20, - 21, ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 20, - 33, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, + "start": Object { + "column": 12, + "line": 1, }, - "method": false, - "range": Array [ - 25, - 31, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 26, + "column": 16, "line": 1, }, "start": Object { - "column": 25, + "column": 13, "line": 1, }, }, - "name": "z", + "name": "bar", "range": Array [ - 25, - 26, + 13, + 16, ], "type": "Identifier", }, + "kind": "init", "loc": Object { "end": Object { - "column": 31, + "column": 19, "line": 1, }, "start": Object { - "column": 25, + "column": 13, "line": 1, }, }, + "method": false, "range": Array [ - 25, - 31, + 13, + 19, ], - "right": Object { + "shorthand": false, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 31, + "column": 19, "line": 1, }, "start": Object { - "column": 29, + "column": 18, "line": 1, }, }, + "name": "x", "range": Array [ - 29, - 31, + 18, + 19, ], - "raw": "10", - "type": "Literal", - "value": 10, + "type": "Identifier", }, - "type": "AssignmentPattern", }, - }, - ], - "range": Array [ - 23, - 33, - ], - "type": "ObjectPattern", + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + }, }, - }, - ], - "range": Array [ - 11, - 34, - ], - "type": "ObjectPattern", - }, - ], - "range": Array [ - 0, - 38, - ], - "type": "FunctionDeclaration", - }, - Object { + ], + "range": Array [ + 1, + 21, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 27, + ], + "type": "ArrowFunctionExpression", + }, "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 28, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { @@ -40442,14 +50444,14 @@ Object { }, "range": Array [ 0, - 39, + 28, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -40459,43 +50461,7 @@ Object { }, "range": Array [ 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, + 1, ], "type": "Punctuator", "value": "(", @@ -40503,17 +50469,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 2, "line": 1, }, "start": Object { - "column": 11, + "column": 1, "line": 1, }, }, "range": Array [ - 11, - 12, + 1, + 2, ], "type": "Punctuator", "value": "{", @@ -40521,71 +50487,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 1, }, "start": Object { - "column": 12, + "column": 2, "line": 1, }, }, "range": Array [ - 12, - 13, + 2, + 5, ], "type": "Identifier", - "value": "x", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 6, "line": 1, }, "start": Object { - "column": 14, + "column": 5, "line": 1, }, }, "range": Array [ - 14, - 15, + 5, + 6, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, - 18, + 7, + 8, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { - "column": 18, + "column": 8, "line": 1, }, }, "range": Array [ - 18, - 19, + 8, + 9, ], "type": "Punctuator", "value": ",", @@ -40593,35 +50559,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 11, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 11, ], "type": "Identifier", - "value": "y", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 12, "line": 1, }, "start": Object { - "column": 21, + "column": 11, "line": 1, }, }, "range": Array [ - 21, - 22, + 11, + 12, ], "type": "Punctuator", "value": ":", @@ -40629,17 +50595,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { - "column": 23, + "column": 12, "line": 1, }, }, "range": Array [ - 23, - 24, + 12, + 13, ], "type": "Punctuator", "value": "{", @@ -40647,71 +50613,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 16, "line": 1, }, "start": Object { - "column": 25, + "column": 13, "line": 1, }, }, "range": Array [ - 25, - 26, + 13, + 16, ], "type": "Identifier", - "value": "z", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 17, "line": 1, }, "start": Object { - "column": 27, + "column": 16, "line": 1, }, }, "range": Array [ - 27, - 28, + 16, + 17, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 19, "line": 1, }, "start": Object { - "column": 29, + "column": 18, "line": 1, }, }, "range": Array [ - 29, - 31, + 18, + 19, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 20, "line": 1, }, "start": Object { - "column": 32, + "column": 19, "line": 1, }, }, "range": Array [ - 32, - 33, + 19, + 20, ], "type": "Punctuator", "value": "}", @@ -40719,17 +50685,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 34, + "column": 21, "line": 1, }, "start": Object { - "column": 33, + "column": 20, "line": 1, }, }, "range": Array [ - 33, - 34, + 20, + 21, ], "type": "Punctuator", "value": "}", @@ -40737,17 +50703,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, + "column": 22, "line": 1, }, "start": Object { - "column": 34, + "column": 21, "line": 1, }, }, "range": Array [ - 34, - 35, + 21, + 22, ], "type": "Punctuator", "value": ")", @@ -40755,53 +50721,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 37, + "column": 25, "line": 1, }, "start": Object { - "column": 36, + "column": 23, "line": 1, }, }, "range": Array [ - 36, - 37, + 23, + 25, ], "type": "Punctuator", - "value": "{", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 38, + "column": 27, "line": 1, }, "start": Object { - "column": 37, + "column": 26, "line": 1, }, }, "range": Array [ - 37, - 38, + 26, + 27, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 39, + "column": 28, "line": 1, }, "start": Object { - "column": 38, + "column": 27, "line": 1, }, }, "range": Array [ - 38, - 39, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -40811,143 +50777,147 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/params-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-object.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, - "range": Array [ - 20, - 22, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { "column": 10, "line": 1, }, "start": Object { - "column": 9, + "column": 0, "line": 1, }, }, - "name": "x", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, }, - "name": "a", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", }, - "start": Object { - "column": 16, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", }, }, - "name": "b", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + ], + "range": Array [ + 1, + 4, + ], + "type": "ObjectPattern", }, - "range": Array [ - 11, - 19, - ], - "type": "ArrayPattern", - }, - ], - "range": Array [ - 0, - 22, - ], - "type": "FunctionDeclaration", - }, - Object { + ], + "range": Array [ + 0, + 10, + ], + "type": "ArrowFunctionExpression", + }, "loc": Object { "end": Object { - "column": 23, + "column": 11, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 11, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 23, + "column": 11, "line": 1, }, "start": Object { @@ -40957,14 +50927,14 @@ Object { }, "range": Array [ 0, - 23, + 11, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -40974,43 +50944,7 @@ Object { }, "range": Array [ 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, + 1, ], "type": "Punctuator", "value": "(", @@ -41018,107 +50952,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, + "column": 2, "line": 1, }, "start": Object { - "column": 14, + "column": 1, "line": 1, }, }, "range": Array [ - 14, - 15, + 1, + 2, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 3, "line": 1, }, "start": Object { - "column": 16, + "column": 2, "line": 1, }, }, "range": Array [ - 16, - 17, + 2, + 3, ], "type": "Identifier", - "value": "b", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 4, "line": 1, }, "start": Object { - "column": 18, + "column": 3, "line": 1, }, }, "range": Array [ - 18, - 19, + 3, + 4, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 5, "line": 1, }, "start": Object { - "column": 19, + "column": 4, "line": 1, }, }, "range": Array [ - 19, - 20, + 4, + 5, ], "type": "Punctuator", "value": ")", @@ -41126,53 +51024,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 8, "line": 1, }, "start": Object { - "column": 20, + "column": 6, "line": 1, }, }, "range": Array [ - 20, - 21, + 6, + 8, ], "type": "Punctuator", - "value": "{", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 10, "line": 1, }, "start": Object { - "column": 21, + "column": 9, "line": 1, }, }, "range": Array [ - 21, - 22, + 9, + 10, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 11, "line": 1, }, "start": Object { - "column": 22, + "column": 10, "line": 1, }, }, "range": Array [ - 22, - 23, + 10, + 11, ], "type": "Punctuator", "value": ";", @@ -41182,57 +51080,40 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/params-array-wrapped.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-array.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "async": false, "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 23, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 1, }, "start": Object { - "column": 10, + "column": 14, "line": 1, }, }, "name": "x", "range": Array [ - 10, - 11, + 14, + 15, ], "type": "Identifier", }, + "expression": true, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 23, + "column": 15, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, @@ -41240,68 +51121,86 @@ Object { Object { "elements": Array [ Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, + "left": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", }, - "name": "a", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 2, "line": 1, }, }, - "name": "b", "range": Array [ - 17, - 18, + 2, + 8, ], - "type": "Identifier", + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", }, ], "loc": Object { "end": Object { - "column": 20, + "column": 9, "line": 1, }, "start": Object { - "column": 12, + "column": 1, "line": 1, }, }, "range": Array [ - 12, - 20, + 1, + 9, ], "type": "ArrayPattern", }, ], "range": Array [ - 1, - 23, + 0, + 15, ], - "type": "FunctionExpression", + "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { @@ -41311,14 +51210,14 @@ Object { }, "range": Array [ 0, - 25, + 15, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { @@ -41328,7 +51227,7 @@ Object { }, "range": Array [ 0, - 25, + 15, ], "sourceType": "script", "tokens": Array [ @@ -41353,7 +51252,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 2, "line": 1, }, "start": Object { @@ -41363,61 +51262,7 @@ Object { }, "range": Array [ 1, - 9, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, + 2, ], "type": "Punctuator", "value": "[", @@ -41425,71 +51270,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 3, "line": 1, }, "start": Object { - "column": 14, + "column": 2, "line": 1, }, }, "range": Array [ - 14, - 15, + 2, + 3, ], "type": "Identifier", - "value": "a", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 5, "line": 1, }, "start": Object { - "column": 15, + "column": 4, "line": 1, }, }, "range": Array [ - 15, - 16, + 4, + 5, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 6, "line": 1, }, }, "range": Array [ - 17, - 18, + 6, + 8, ], - "type": "Identifier", - "value": "b", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 9, "line": 1, }, "start": Object { - "column": 19, + "column": 8, "line": 1, }, }, "range": Array [ - 19, - 20, + 8, + 9, ], "type": "Punctuator", "value": "]", @@ -41497,17 +51342,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 10, "line": 1, }, "start": Object { - "column": 20, + "column": 9, "line": 1, }, }, "range": Array [ - 20, - 21, + 9, + 10, ], "type": "Punctuator", "value": ")", @@ -41515,648 +51360,766 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, + "column": 13, "line": 1, }, "start": Object { - "column": 23, + "column": 11, "line": 1, }, }, "range": Array [ - 23, - 24, + 11, + 13, ], "type": "Punctuator", - "value": ")", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { - "column": 24, + "column": 14, "line": 1, }, }, "range": Array [ - 24, - 25, + 14, + 15, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "x", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/params-multi-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-object.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 22, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { + "expression": Object { + "async": false, + "body": Object { "loc": Object { "end": Object { - "column": 12, + "column": 15, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, - "name": "a", + "name": "x", "range": Array [ - 11, - 12, + 14, + 15, ], "type": "Identifier", }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 17, + "column": 8, "line": 1, }, "start": Object { - "column": 16, + "column": 2, "line": 1, }, }, - "name": "b", + "method": false, "range": Array [ - 16, - 17, + 2, + 8, ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 16, - 17, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", }, - "start": Object { - "column": 16, - "line": 1, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, }, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", }, - "name": "b", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", }, - }, - ], - "range": Array [ - 14, - 19, - ], - "type": "ObjectPattern", - }, - ], - "range": Array [ - 0, - 22, - ], - "type": "FunctionDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "EmptyStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + ], + "range": Array [ + 1, + 9, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 15, + ], + "type": "ArrowFunctionExpression", }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "x", - }, - Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 1, }, "start": Object { - "column": 10, + "column": 0, "line": 1, }, }, "range": Array [ - 10, - 11, + 0, + 15, ], - "type": "Punctuator", - "value": "(", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 12, + "column": 1, "line": 1, }, "start": Object { - "column": 11, + "column": 0, "line": 1, }, }, "range": Array [ - 11, - 12, + 0, + 1, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 2, "line": 1, }, "start": Object { - "column": 12, + "column": 1, "line": 1, }, }, "range": Array [ - 12, - 13, + 1, + 2, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 3, "line": 1, }, "start": Object { - "column": 14, + "column": 2, "line": 1, }, }, "range": Array [ - 14, - 15, + 2, + 3, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 5, "line": 1, }, "start": Object { - "column": 16, + "column": 4, "line": 1, }, }, "range": Array [ - 16, - 17, + 4, + 5, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 8, "line": 1, }, "start": Object { - "column": 18, + "column": 6, "line": 1, }, }, "range": Array [ - 18, - 19, + 6, + 8, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 9, "line": 1, }, "start": Object { - "column": 19, + "column": 8, "line": 1, }, }, "range": Array [ - 19, - 20, + 8, + 9, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 10, "line": 1, }, "start": Object { - "column": 20, + "column": 9, "line": 1, }, }, "range": Array [ - 20, - 21, + 9, + 10, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 13, "line": 1, }, "start": Object { - "column": 21, + "column": 11, "line": 1, }, }, "range": Array [ - 21, - 22, + 11, + 13, ], "type": "Punctuator", - "value": "}", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 15, "line": 1, }, "start": Object { - "column": 22, + "column": 14, "line": 1, }, }, "range": Array [ - 22, - 23, + 14, + 15, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "x", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring/params-nested-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-object-nested.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 27, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { + "expression": Object { + "async": false, + "body": Object { "elements": Array [ Object { "loc": Object { "end": Object { - "column": 13, + "column": 31, "line": 1, }, "start": Object { - "column": 12, + "column": 30, "line": 1, }, }, "name": "x", "range": Array [ - 12, - 13, + 30, + 31, ], "type": "Identifier", }, - null, Object { - "elements": Array [ - null, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - ], "loc": Object { "end": Object { - "column": 22, + "column": 34, "line": 1, }, "start": Object { - "column": 17, + "column": 33, "line": 1, }, }, + "name": "z", "range": Array [ - 17, - 22, + 33, + 34, ], - "type": "ArrayPattern", + "type": "Identifier", }, ], "loc": Object { "end": Object { - "column": 23, + "column": 35, "line": 1, }, "start": Object { - "column": 11, + "column": 29, "line": 1, }, }, "range": Array [ - 11, - 23, + 29, + 35, ], - "type": "ArrayPattern", + "type": "ArrayExpression", }, - ], - "range": Array [ - 0, - 27, - ], - "type": "FunctionDeclaration", - }, - Object { + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 10, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 15, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + }, + }, + ], + "range": Array [ + 13, + 23, + ], + "type": "ObjectPattern", + }, + }, + ], + "range": Array [ + 1, + 24, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 0, + 35, + ], + "type": "ArrowFunctionExpression", + }, "loc": Object { "end": Object { - "column": 28, + "column": 35, "line": 1, }, "start": Object { - "column": 27, + "column": 0, "line": 1, }, }, "range": Array [ - 27, - 28, + 0, + 35, ], - "type": "EmptyStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 28, + "column": 35, "line": 1, }, "start": Object { @@ -42166,14 +52129,14 @@ Object { }, "range": Array [ 0, - 28, + 35, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -42183,43 +52146,7 @@ Object { }, "range": Array [ 0, - 8, - ], - "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, + 1, ], "type": "Punctuator", "value": "(", @@ -42227,35 +52154,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 2, "line": 1, }, "start": Object { - "column": 11, + "column": 1, "line": 1, }, }, "range": Array [ - 11, - 12, + 1, + 2, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 3, "line": 1, }, "start": Object { - "column": 12, + "column": 2, "line": 1, }, }, "range": Array [ - 12, - 13, + 2, + 3, ], "type": "Identifier", "value": "x", @@ -42263,71 +52190,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, + "column": 5, "line": 1, }, "start": Object { - "column": 15, + "column": 4, "line": 1, }, }, "range": Array [ - 15, - 16, + 4, + 5, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 6, "line": 1, }, }, "range": Array [ - 17, - 18, + 6, + 8, ], - "type": "Punctuator", - "value": "[", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { - "column": 18, + "column": 8, "line": 1, }, }, "range": Array [ - 18, - 19, + 8, + 9, ], "type": "Punctuator", "value": ",", @@ -42335,89 +52244,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 11, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 11, ], "type": "Identifier", - "value": "z", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": "]", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 12, "line": 1, }, "start": Object { - "column": 23, + "column": 11, "line": 1, }, }, "range": Array [ - 23, - 24, + 11, + 12, ], "type": "Punctuator", - "value": ")", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 14, "line": 1, }, "start": Object { - "column": 25, + "column": 13, "line": 1, }, }, "range": Array [ - 25, - 26, + 13, + 14, ], "type": "Punctuator", "value": "{", @@ -42425,470 +52298,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 26, + "column": 15, "line": 1, }, }, "range": Array [ - 26, - 27, + 15, + 16, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 18, "line": 1, }, "start": Object { - "column": 27, + "column": 17, "line": 1, }, }, "range": Array [ - 27, - 28, + 17, + 18, ], "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/params-nested-object.src 1`] = ` -Object { - "body": Array [ - Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 35, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 12, - 16, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 18, - 29, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 23, - 27, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 21, - 29, - ], - "type": "ObjectPattern", - }, - }, - ], - "range": Array [ - 11, - 31, - ], - "type": "ObjectPattern", - }, - ], - "range": Array [ - 0, - 35, - ], - "type": "FunctionDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "range": Array [ - 35, - 36, - ], - "type": "EmptyStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 36, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "script", - "tokens": Array [ + "value": "=", + }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 0, + "column": 19, "line": 1, }, }, "range": Array [ - 0, - 8, + 19, + 21, ], - "type": "Keyword", - "value": "function", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 23, "line": 1, }, "start": Object { - "column": 9, + "column": 22, "line": 1, }, }, "range": Array [ - 9, - 10, + 22, + 23, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 24, "line": 1, }, "start": Object { - "column": 10, + "column": 23, "line": 1, }, }, "range": Array [ - 10, - 11, + 23, + 24, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 25, "line": 1, }, "start": Object { - "column": 11, + "column": 24, "line": 1, }, }, "range": Array [ - 11, - 12, + 24, + 25, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 28, "line": 1, }, "start": Object { - "column": 12, + "column": 26, "line": 1, }, }, "range": Array [ - 12, - 13, + 26, + 28, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 30, "line": 1, }, "start": Object { - "column": 13, + "column": 29, "line": 1, }, }, "range": Array [ - 13, - 14, + 29, + 30, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 31, "line": 1, }, "start": Object { - "column": 15, + "column": 30, "line": 1, }, }, "range": Array [ - 15, - 16, + 30, + 31, ], "type": "Identifier", - "value": "y", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 32, "line": 1, }, "start": Object { - "column": 16, + "column": 31, "line": 1, }, }, "range": Array [ - 16, - 17, + 31, + 32, ], "type": "Punctuator", "value": ",", @@ -42896,17 +52478,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 34, "line": 1, }, "start": Object { - "column": 18, + "column": 33, "line": 1, }, }, "range": Array [ - 18, - 19, + 33, + 34, ], "type": "Identifier", "value": "z", @@ -42914,197 +52496,278 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 35, "line": 1, }, "start": Object { - "column": 19, + "column": 34, "line": 1, }, }, "range": Array [ - 19, - 20, + 34, + 35, ], "type": "Punctuator", - "value": ":", + "value": "]", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/array-const-undefined.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "ArrayPattern", + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 21, - 22, ], - "type": "Punctuator", - "value": "{", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 24, + "column": 15, "line": 1, }, "start": Object { - "column": 23, + "column": 0, "line": 1, }, }, "range": Array [ - 23, - 24, + 0, + 15, ], - "type": "Identifier", - "value": "a", + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 25, + "column": 5, "line": 1, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, "range": Array [ - 24, - 25, + 0, + 5, ], - "type": "Punctuator", - "value": ":", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 7, "line": 1, }, "start": Object { - "column": 26, + "column": 6, "line": 1, }, }, "range": Array [ - 26, - 27, + 6, + 7, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 8, "line": 1, }, "start": Object { - "column": 28, + "column": 7, "line": 1, }, }, "range": Array [ - 28, - 29, + 7, + 8, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 9, "line": 1, }, "start": Object { - "column": 30, + "column": 8, "line": 1, }, }, "range": Array [ - 30, - 31, + 8, + 9, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 11, "line": 1, }, "start": Object { - "column": 31, + "column": 10, "line": 1, }, }, "range": Array [ - 31, - 32, + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 13, "line": 1, }, "start": Object { - "column": 33, + "column": 12, "line": 1, }, }, "range": Array [ - 33, - 34, + 12, + 13, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 14, "line": 1, }, "start": Object { - "column": 34, + "column": 13, "line": 1, }, }, "range": Array [ - 34, - 35, + 13, + 14, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 36, + "column": 15, "line": 1, }, "start": Object { - "column": 35, + "column": 14, "line": 1, }, }, "range": Array [ - 35, - 36, + 14, + 15, ], "type": "Punctuator", "value": ";", @@ -43114,221 +52777,105 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/params-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/array-let-undefined.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 22, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ + "declarations": Array [ Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "id": Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 14, + "column": 6, "line": 1, }, "start": Object { - "column": 13, + "column": 5, "line": 1, }, }, "name": "a", "range": Array [ - 13, - 14, + 5, + 6, ], "type": "Identifier", }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "method": false, - "range": Array [ - 13, - 14, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 13, - 14, - ], - "type": "Identifier", + "start": Object { + "column": 4, + "line": 1, }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, + "range": Array [ + 4, + 7, + ], + "type": "ArrayPattern", + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, }, - "method": false, - "range": Array [ - 16, - 17, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", + "start": Object { + "column": 10, + "line": 1, }, }, - ], + "range": Array [ + 10, + 12, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, "range": Array [ - 11, - 19, + 4, + 12, ], - "type": "ObjectPattern", + "type": "VariableDeclarator", }, ], - "range": Array [ - 0, - 22, - ], - "type": "FunctionDeclaration", - }, - Object { + "kind": "let", "loc": Object { "end": Object { - "column": 23, + "column": 13, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 13, ], - "type": "EmptyStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 23, + "column": 13, "line": 1, }, "start": Object { @@ -43338,14 +52885,14 @@ Object { }, "range": Array [ 0, - 23, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 1, }, "start": Object { @@ -43355,28 +52902,82 @@ Object { }, "range": Array [ 0, - 8, + 3, ], "type": "Keyword", - "value": "function", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, "line": 1, }, "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { "column": 9, "line": 1, }, + "start": Object { + "column": 8, + "line": 1, + }, }, "range": Array [ + 8, 9, - 10, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { @@ -43394,7 +52995,7 @@ Object { 11, ], "type": "Punctuator", - "value": "(", + "value": "[", }, Object { "loc": Object { @@ -43412,355 +53013,488 @@ Object { 12, ], "type": "Punctuator", - "value": "{", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 14, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-const-named.src 1`] = ` +Object { + "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 7, + 10, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 6, + 11, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 14, + 16, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 15, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 8, "line": 1, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, - 17, + 7, + 8, ], "type": "Identifier", - "value": "b", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 9, "line": 1, }, "start": Object { - "column": 18, + "column": 8, "line": 1, }, }, "range": Array [ - 18, - 19, + 8, + 9, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 10, "line": 1, }, "start": Object { - "column": 19, + "column": 9, "line": 1, }, }, "range": Array [ - 19, - 20, + 9, + 10, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 11, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 13, "line": 1, }, "start": Object { - "column": 21, + "column": 12, "line": 1, }, }, "range": Array [ - 21, - 22, + 12, + 13, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 15, "line": 1, }, "start": Object { - "column": 22, + "column": 14, "line": 1, }, }, "range": Array [ - 22, - 23, + 14, + 15, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring/params-object-wrapped.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 23, - ], - "type": "BlockStatement", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", + "start": Object { + "column": 15, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 14, - 15, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-const-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, + }, + "properties": Array [ Object { "computed": false, "key": Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 7, "line": 1, }, }, - "name": "b", + "name": "a", "range": Array [ - 17, - 18, + 7, + 8, ], "type": "Identifier", }, "kind": "init", "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 7, "line": 1, }, }, "method": false, "range": Array [ - 17, - 18, + 7, + 8, ], "shorthand": true, "type": "Property", "value": Object { "loc": Object { "end": Object { - "column": 18, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 7, "line": 1, }, }, - "name": "b", + "name": "a", "range": Array [ - 17, - 18, + 7, + 8, ], "type": "Identifier", }, }, ], "range": Array [ - 12, - 20, + 6, + 9, ], "type": "ObjectPattern", }, - ], - "range": Array [ - 1, - 23, - ], - "type": "FunctionExpression", - }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { @@ -43770,14 +53504,14 @@ Object { }, "range": Array [ 0, - 25, + 15, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { @@ -43787,14 +53521,14 @@ Object { }, "range": Array [ 0, - 25, + 15, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 5, "line": 1, }, "start": Object { @@ -43804,79 +53538,25 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 9, + 5, ], "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": "(", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 12, + "column": 6, "line": 1, }, }, "range": Array [ - 12, - 13, + 6, + 7, ], "type": "Punctuator", "value": "{", @@ -43884,17 +53564,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 8, "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, - 15, + 7, + 8, ], "type": "Identifier", "value": "a", @@ -43902,53 +53582,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, + "column": 9, "line": 1, }, "start": Object { - "column": 19, + "column": 8, "line": 1, }, }, "range": Array [ - 19, - 20, + 8, + 9, ], "type": "Punctuator", "value": "}", @@ -43956,35 +53600,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 11, "line": 1, }, "start": Object { - "column": 20, + "column": 10, "line": 1, }, }, "range": Array [ - 20, - 21, + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 13, "line": 1, }, "start": Object { - "column": 21, + "column": 12, "line": 1, }, }, "range": Array [ - 21, - 22, + 12, + 13, ], "type": "Punctuator", "value": "{", @@ -43992,17 +53636,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 1, }, "start": Object { - "column": 22, + "column": 13, "line": 1, }, }, "range": Array [ - 22, - 23, + 13, + 14, ], "type": "Punctuator", "value": "}", @@ -44010,35 +53654,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, + "column": 15, "line": 1, }, "start": Object { - "column": 24, + "column": 14, "line": 1, }, }, "range": Array [ - 24, - 25, + 14, + 15, ], "type": "Punctuator", "value": ";", @@ -44048,102 +53674,124 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring/sparse-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-let-named.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, }, - "name": "a", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", }, - null, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", }, - "start": Object { - "column": 4, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 5, + 8, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", }, }, - "name": "b", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, + ], + "range": Array [ + 4, + 9, + ], + "type": "ObjectPattern", }, - "start": Object { - "column": 0, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", }, - }, - "operator": "=", - "range": Array [ - 0, - 14, - ], - "right": Object { "loc": Object { "end": Object { "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 4, "line": 1, }, }, - "name": "array", "range": Array [ - 9, + 4, 14, ], - "type": "Identifier", + "type": "VariableDeclarator", }, - "type": "AssignmentExpression", - }, + ], + "kind": "let", "loc": Object { "end": Object { "column": 15, @@ -44158,7 +53806,7 @@ Object { 0, 15, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { @@ -44180,7 +53828,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -44190,25 +53838,43 @@ Object { }, "range": Array [ 0, - 1, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 6, "line": 1, }, "start": Object { - "column": 1, + "column": 5, "line": 1, }, }, "range": Array [ - 1, - 2, + 5, + 6, ], "type": "Identifier", "value": "a", @@ -44216,92 +53882,92 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { - "column": 2, + "column": 6, "line": 1, }, }, "range": Array [ - 2, - 3, + 6, + 7, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 8, "line": 1, }, "start": Object { - "column": 3, + "column": 7, "line": 1, }, }, "range": Array [ - 3, - 4, + 7, + 8, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 8, "line": 1, }, }, "range": Array [ - 4, - 5, + 8, + 9, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 11, "line": 1, }, "start": Object { - "column": 5, + "column": 10, "line": 1, }, }, "range": Array [ - 5, - 6, + 10, + 11, ], "type": "Punctuator", - "value": "]", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 13, "line": 1, }, "start": Object { - "column": 7, + "column": 12, "line": 1, }, }, "range": Array [ - 7, - 8, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { @@ -44310,16 +53976,16 @@ Object { "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, + 13, 14, ], - "type": "Identifier", - "value": "array", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -44344,91 +54010,127 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-let-undefined.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, - }, - "name": "x", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "elements": Array [ + "properties": Array [ Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 3, + "column": 6, "line": 1, }, "start": Object { - "column": 2, + "column": 5, "line": 1, }, }, - "name": "y", + "method": false, "range": Array [ - 2, - 3, + 5, + 6, ], - "type": "Identifier", + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, }, ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + }, + "init": Object { "loc": Object { "end": Object { - "column": 4, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 10, "line": 1, }, }, + "properties": Array [], "range": Array [ - 1, - 4, + 10, + 12, ], - "type": "ArrayPattern", + "type": "ObjectExpression", }, - ], - "range": Array [ - 0, - 10, - ], - "type": "ArrowFunctionExpression", - }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { @@ -44438,14 +54140,14 @@ Object { }, "range": Array [ 0, - 11, + 13, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { @@ -44455,14 +54157,14 @@ Object { }, "range": Array [ 0, - 11, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -44472,133 +54174,133 @@ Object { }, "range": Array [ 0, - 1, + 3, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 5, "line": 1, }, "start": Object { - "column": 1, + "column": 4, "line": 1, }, }, "range": Array [ - 1, - 2, + 4, + 5, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 6, "line": 1, }, "start": Object { - "column": 2, + "column": 5, "line": 1, }, }, "range": Array [ - 2, - 3, + 5, + 6, ], "type": "Identifier", - "value": "y", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { - "column": 3, + "column": 6, "line": 1, }, }, "range": Array [ - 3, - 4, + 6, + 7, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 8, "line": 1, }, }, "range": Array [ - 4, - 5, + 8, + 9, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 10, "line": 1, }, }, "range": Array [ - 6, - 8, + 10, + 11, ], "type": "Punctuator", - "value": "=>", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { - "column": 9, + "column": 11, "line": 1, }, }, "range": Array [ - 9, - 10, + 11, + 12, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 11, + 12, + 13, ], "type": "Punctuator", "value": ";", @@ -44608,145 +54310,180 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-array.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, }, - "name": "x", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", }, - "expression": true, - "generator": false, - "id": null, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { - "column": 0, + "column": 9, "line": 1, }, }, - "params": Array [ - Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { "elements": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 13, "line": 1, }, "start": Object { - "column": 2, + "column": 12, "line": 1, }, }, - "name": "y", + "name": "x", "range": Array [ - 2, - 3, + 12, + 13, ], "type": "Identifier", }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 20, + ], + "right": Object { + "elements": Array [ Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], "loc": Object { "end": Object { - "column": 8, + "column": 19, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, "range": Array [ - 5, - 8, + 18, + 19, ], - "type": "ArrayPattern", + "raw": "1", + "type": "Literal", + "value": 1, }, ], "loc": Object { "end": Object { - "column": 9, + "column": 20, "line": 1, }, "start": Object { - "column": 1, + "column": 17, "line": 1, }, }, "range": Array [ - 1, - 9, + 17, + 20, ], - "type": "ArrayPattern", + "type": "ArrayExpression", }, - ], - "range": Array [ - 0, - 15, - ], - "type": "ArrowFunctionExpression", - }, + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 0, + 24, + ], + "type": "FunctionDeclaration", + }, + Object { "loc": Object { "end": Object { - "column": 16, + "column": 25, "line": 1, }, "start": Object { - "column": 0, + "column": 24, "line": 1, }, }, "range": Array [ - 0, - 16, + 24, + 25, ], - "type": "ExpressionStatement", + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 16, + "column": 25, "line": 1, }, "start": Object { @@ -44756,14 +54493,14 @@ Object { }, "range": Array [ 0, - 16, + 25, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -44773,7 +54510,43 @@ Object { }, "range": Array [ 0, - 1, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -44781,17 +54554,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 11, "line": 1, }, }, "range": Array [ - 1, - 2, + 11, + 12, ], "type": "Punctuator", "value": "[", @@ -44799,107 +54572,107 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 13, "line": 1, }, "start": Object { - "column": 2, + "column": 12, "line": 1, }, }, "range": Array [ - 2, - 3, + 12, + 13, ], "type": "Identifier", - "value": "y", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 14, "line": 1, }, "start": Object { - "column": 3, + "column": 13, "line": 1, }, }, "range": Array [ - 3, - 4, + 13, + 14, ], "type": "Punctuator", - "value": ",", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 16, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "range": Array [ - 5, - 6, + 15, + 16, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 18, "line": 1, }, "start": Object { - "column": 6, + "column": 17, "line": 1, }, }, "range": Array [ - 6, - 7, + 17, + 18, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 19, "line": 1, }, "start": Object { - "column": 7, + "column": 18, "line": 1, }, }, "range": Array [ - 7, - 8, + 18, + 19, ], - "type": "Punctuator", - "value": "]", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 20, "line": 1, }, "start": Object { - "column": 8, + "column": 19, "line": 1, }, }, "range": Array [ - 8, - 9, + 19, + 20, ], "type": "Punctuator", "value": "]", @@ -44907,17 +54680,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 21, "line": 1, }, "start": Object { - "column": 9, + "column": 20, "line": 1, }, }, "range": Array [ - 9, - 10, + 20, + 21, ], "type": "Punctuator", "value": ")", @@ -44925,53 +54698,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 23, "line": 1, }, "start": Object { - "column": 11, + "column": 22, "line": 1, }, }, "range": Array [ - 11, - 13, + 22, + 23, ], "type": "Punctuator", - "value": "=>", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 24, "line": 1, }, "start": Object { - "column": 14, + "column": 23, "line": 1, }, }, "range": Array [ - 14, - 15, + 23, + 24, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 25, "line": 1, }, "start": Object { - "column": 15, + "column": 24, "line": 1, }, }, "range": Array [ - 15, - 16, + 24, + 25, ], "type": "Punctuator", "value": ";", @@ -44981,36 +54754,32 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-object.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { + "left": Object { "loc": Object { "end": Object { - "column": 17, + "column": 1, "line": 1, }, "start": Object { - "column": 16, + "column": 0, "line": 1, }, }, - "name": "x", + "name": "f", "range": Array [ - 16, - 17, + 0, + 1, ], "type": "Identifier", }, - "expression": true, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 17, + "column": 30, "line": 1, }, "start": Object { @@ -45018,208 +54787,261 @@ Object { "line": 1, }, }, - "params": Array [ - Object { + "operator": "=", + "range": Array [ + 0, + 30, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 11, + "column": 30, "line": 1, }, "start": Object { - "column": 1, + "column": 28, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - "kind": "init", + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "left": Object { "loc": Object { "end": Object { - "column": 3, + "column": 16, "line": 1, }, "start": Object { - "column": 2, + "column": 13, "line": 1, }, }, - "method": false, - "range": Array [ - 2, - 3, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", }, - }, - "name": "y", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, }, - "start": Object { - "column": 5, - "line": 1, + "method": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", }, }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", + ], + "range": Array [ + 13, + 16, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, }, - "kind": "init", + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 26, + ], + "right": Object { "loc": Object { "end": Object { - "column": 10, + "column": 26, "line": 1, }, "start": Object { - "column": 5, + "column": 19, "line": 1, }, }, - "method": false, - "range": Array [ - 5, - 10, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "kind": "init", + "properties": Array [ + Object { + "computed": false, + "key": Object { "loc": Object { "end": Object { - "column": 9, + "column": 21, "line": 1, }, "start": Object { - "column": 8, + "column": 20, "line": 1, }, }, - "method": false, + "name": "x", "range": Array [ - 8, - 9, + 20, + 21, ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 20, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, }, - "name": "x", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", }, + "range": Array [ + 23, + 25, + ], + "raw": "10", + "type": "Literal", + "value": 10, }, - ], - "range": Array [ - 7, - 10, - ], - "type": "ObjectPattern", - }, + }, + ], + "range": Array [ + 19, + 26, + ], + "type": "ObjectExpression", }, - ], - "range": Array [ - 1, - 11, - ], - "type": "ObjectPattern", - }, - ], - "range": Array [ - 0, - 17, - ], - "type": "ArrowFunctionExpression", + "type": "AssignmentPattern", + }, + ], + "range": Array [ + 4, + 30, + ], + "type": "FunctionExpression", + }, + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 18, + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, "line": 1, }, "start": Object { @@ -45228,42 +55050,62 @@ Object { }, }, "range": Array [ - 0, - 18, + 0, + 1, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "function", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 13, "line": 1, }, "start": Object { - "column": 0, + "column": 12, "line": 1, }, }, "range": Array [ - 0, - 1, + 12, + 13, ], "type": "Punctuator", "value": "(", @@ -45271,17 +55113,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 14, "line": 1, }, "start": Object { - "column": 1, + "column": 13, "line": 1, }, }, "range": Array [ - 1, - 2, + 13, + 14, ], "type": "Punctuator", "value": "{", @@ -45289,143 +55131,143 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 14, "line": 1, }, }, "range": Array [ - 2, - 3, + 14, + 15, ], "type": "Identifier", - "value": "y", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 16, "line": 1, }, "start": Object { - "column": 3, + "column": 15, "line": 1, }, }, "range": Array [ - 3, - 4, + 15, + 16, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 18, "line": 1, }, "start": Object { - "column": 5, + "column": 17, "line": 1, }, }, "range": Array [ - 5, - 6, + 17, + 18, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 20, "line": 1, }, "start": Object { - "column": 6, + "column": 19, "line": 1, }, }, "range": Array [ - 6, - 7, + 19, + 20, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 7, + "column": 20, "line": 1, }, }, "range": Array [ - 7, - 8, + 20, + 21, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 22, "line": 1, }, "start": Object { - "column": 8, + "column": 21, "line": 1, }, }, "range": Array [ - 8, - 9, + 21, + 22, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 25, "line": 1, }, "start": Object { - "column": 9, + "column": 23, "line": 1, }, }, "range": Array [ - 9, - 10, + 23, + 25, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 26, "line": 1, }, "start": Object { - "column": 10, + "column": 25, "line": 1, }, }, "range": Array [ - 10, - 11, + 25, + 26, ], "type": "Punctuator", "value": "}", @@ -45433,17 +55275,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 27, "line": 1, }, "start": Object { - "column": 11, + "column": 26, "line": 1, }, }, "range": Array [ - 11, - 12, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -45451,53 +55293,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 29, "line": 1, }, "start": Object { - "column": 13, + "column": 28, "line": 1, }, }, "range": Array [ - 13, - 15, + 28, + 29, ], "type": "Punctuator", - "value": "=>", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 30, "line": 1, }, "start": Object { - "column": 16, + "column": 29, "line": 1, }, }, "range": Array [ - 16, - 17, + 29, + 30, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 31, "line": 1, }, "start": Object { - "column": 17, + "column": 30, "line": 1, }, }, "range": Array [ - 17, - 18, + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -45507,245 +55349,282 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-object-short.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - }, - "expression": true, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 27, + "column": 22, "line": 1, }, "start": Object { - "column": 0, + "column": 1, "line": 1, }, }, - "params": Array [ + "properties": Array [ Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { "column": 21, "line": 1, }, "start": Object { - "column": 1, + "column": 2, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 2, - 5, - ], - "type": "Identifier", - }, - "kind": "init", + "method": true, + "range": Array [ + 2, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 8, + "column": 21, "line": 1, }, "start": Object { - "column": 2, + "column": 19, "line": 1, }, }, - "method": false, "range": Array [ - 2, - 8, + 19, + 21, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, + "type": "BlockStatement", }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + "start": Object { + "column": 3, + "line": 1, }, - "method": false, - "range": Array [ - 10, - 20, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + }, + "params": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 16, + "column": 6, "line": 1, }, "start": Object { - "column": 13, + "column": 5, "line": 1, }, }, - "name": "bar", + "method": false, "range": Array [ - 13, - 16, + 5, + 6, ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", }, }, - "method": false, - "range": Array [ - 13, - 19, - ], - "shorthand": false, - "type": "Property", - "value": Object { + ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 19, + "column": 16, "line": 1, }, "start": Object { - "column": 18, + "column": 11, "line": 1, }, }, - "name": "x", + "method": false, "range": Array [ - 18, - 19, + 11, + 16, ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 12, - 20, - ], - "type": "ObjectPattern", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 10, + 17, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", }, - }, - ], - "range": Array [ - 1, - 21, - ], - "type": "ObjectPattern", + ], + "range": Array [ + 3, + 21, + ], + "type": "FunctionExpression", + }, }, ], "range": Array [ - 0, - 27, + 1, + 22, ], - "type": "ArrowFunctionExpression", + "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 28, + "column": 24, "line": 1, }, "start": Object { @@ -45755,14 +55634,14 @@ Object { }, "range": Array [ 0, - 28, + 24, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 28, + "column": 24, "line": 1, }, "start": Object { @@ -45772,7 +55651,7 @@ Object { }, "range": Array [ 0, - 28, + 24, ], "sourceType": "script", "tokens": Array [ @@ -45815,7 +55694,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -45825,46 +55704,82 @@ Object { }, "range": Array [ 2, - 5, + 3, ], "type": "Identifier", - "value": "foo", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 4, "line": 1, }, "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { "column": 5, "line": 1, }, + "start": Object { + "column": 4, + "line": 1, + }, }, "range": Array [ + 4, 5, - 6, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { "column": 7, "line": 1, }, + "start": Object { + "column": 6, + "line": 1, + }, }, "range": Array [ + 6, 7, - 8, ], - "type": "Identifier", - "value": "y", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -45882,7 +55797,7 @@ Object { 9, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { @@ -45899,8 +55814,8 @@ Object { 10, 11, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -45917,8 +55832,8 @@ Object { 11, 12, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { @@ -45936,7 +55851,7 @@ Object { 13, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { @@ -45945,16 +55860,16 @@ Object { "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, + 14, 16, ], - "type": "Identifier", - "value": "bar", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { @@ -45972,25 +55887,25 @@ Object { 17, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 18, "line": 1, }, "start": Object { - "column": 18, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 18, - 19, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -46008,7 +55923,7 @@ Object { 20, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { @@ -46044,58 +55959,40 @@ Object { 22, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 23, "line": 1, }, "start": Object { - "column": 23, + "column": 22, "line": 1, }, }, "range": Array [ + 22, 23, - 25, ], "type": "Punctuator", - "value": "=>", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Identifier", - "value": "x", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 24, "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, "range": Array [ - 27, - 28, + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -46105,130 +56002,68 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/arrow-param-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-forOf/loop.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "expression": true, - "generator": false, - "id": null, + "await": false, + "body": Object { "loc": Object { "end": Object { - "column": 10, + "column": 17, "line": 1, }, "start": Object { - "column": 0, + "column": 16, "line": 1, }, }, - "params": Array [ + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", + }, + "left": Object { + "elements": Array [ Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 6, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 2, - 3, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - }, - ], + "name": "a", "range": Array [ - 1, - 4, + 6, + 7, ], - "type": "ObjectPattern", + "type": "Identifier", }, ], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, "range": Array [ - 0, - 10, + 5, + 8, ], - "type": "ArrowFunctionExpression", + "type": "ArrayPattern", }, "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { @@ -46238,15 +56073,33 @@ Object { }, "range": Array [ 0, - 11, + 17, ], - "type": "ExpressionStatement", + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", }, ], "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -46255,14 +56108,14 @@ Object { }, "range": Array [ 0, - 11, + 18, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -46272,7 +56125,25 @@ Object { }, "range": Array [ 0, - 1, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Punctuator", "value": "(", @@ -46280,125 +56151,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 6, "line": 1, }, "start": Object { - "column": 1, + "column": 5, "line": 1, }, }, "range": Array [ - 1, - 2, + 5, + 6, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { - "column": 2, + "column": 6, "line": 1, }, }, "range": Array [ - 2, - 3, + 6, + 7, ], "type": "Identifier", - "value": "y", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 8, "line": 1, }, "start": Object { - "column": 3, + "column": 7, "line": 1, }, }, "range": Array [ - 3, - 4, + 7, + 8, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 11, "line": 1, }, "start": Object { - "column": 4, + "column": 9, "line": 1, }, }, "range": Array [ - 4, - 5, + 9, + 11, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "of", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 1, }, "start": Object { - "column": 6, + "column": 12, "line": 1, }, }, "range": Array [ - 6, - 8, + 12, + 15, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 10, + 15, + 16, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 16, "line": 1, }, }, "range": Array [ - 10, - 11, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -46408,127 +56279,236 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-array.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/complex-destructured.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "elements": Array [ - Object { - "left": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { - "column": 2, + "column": 6, "line": 1, }, }, - "name": "x", + "method": false, "range": Array [ - 2, - 3, + 6, + 7, ], - "type": "Identifier", + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, }, + ], + "range": Array [ + 1, + 9, + ], + "type": "ObjectPattern", + }, + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 1, }, "start": Object { - "column": 2, + "column": 14, "line": 1, }, }, + "name": "c", "range": Array [ - 2, - 8, + 14, + 15, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 8, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - ], - "loc": Object { - "end": Object { - "column": 9, - "line": 1, + "type": "Identifier", }, - "start": Object { - "column": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, + "range": Array [ + 11, + 15, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, - "range": Array [ - 1, - 9, - ], - "type": "ArrayPattern", }, - ], + "range": Array [ + 0, + 16, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", "range": Array [ 0, - 15, + 20, ], - "type": "ArrowFunctionExpression", + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { @@ -46538,14 +56518,14 @@ Object { }, "range": Array [ 0, - 15, + 21, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 15, + "column": 21, "line": 1, }, "start": Object { @@ -46555,7 +56535,7 @@ Object { }, "range": Array [ 0, - 15, + 21, ], "sourceType": "script", "tokens": Array [ @@ -46575,7 +56555,7 @@ Object { 1, ], "type": "Punctuator", - "value": "(", + "value": "[", }, Object { "loc": Object { @@ -46593,25 +56573,25 @@ Object { 2, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { - "column": 2, + "column": 3, "line": 1, }, }, "range": Array [ - 2, 3, + 4, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { @@ -46629,12 +56609,12 @@ Object { 5, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 1, }, "start": Object { @@ -46644,10 +56624,10 @@ Object { }, "range": Array [ 6, - 8, + 7, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { @@ -46665,7 +56645,7 @@ Object { 9, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { @@ -46683,12 +56663,12 @@ Object { 10, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { @@ -46698,10 +56678,10 @@ Object { }, "range": Array [ 11, - 13, + 14, ], "type": "Punctuator", - "value": "=>", + "value": "...", }, Object { "loc": Object { @@ -46719,173 +56699,237 @@ Object { 15, ], "type": "Identifier", - "value": "x", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-object.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/destructured-array-literal.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "async": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, + "start": Object { + "column": 1, + "line": 1, }, - "method": false, - "range": Array [ - 2, - 8, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 3, + "column": 9, "line": 1, }, "start": Object { - "column": 2, + "column": 8, "line": 1, }, }, - "name": "x", + "name": "b", "range": Array [ - 2, - 3, + 8, + 9, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 8, - ], - "right": Object { + Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 11, "line": 1, }, }, + "name": "c", "range": Array [ - 6, - 8, + 11, + 12, ], - "raw": "10", - "type": "Literal", - "value": 10, + "type": "Identifier", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, - "type": "AssignmentPattern", }, + "range": Array [ + 7, + 13, + ], + "type": "ArrayPattern", }, - ], - "range": Array [ - 1, - 9, - ], - "type": "ObjectPattern", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, }, - ], + "range": Array [ + 0, + 14, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", "range": Array [ 0, - 15, + 18, ], - "type": "ArrowFunctionExpression", + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "type": "AssignmentExpression", }, "loc": Object { "end": Object { - "column": 15, + "column": 19, "line": 1, }, "start": Object { @@ -46895,15 +56939,15 @@ Object { }, "range": Array [ 0, - 15, + 19, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -46912,7 +56956,7 @@ Object { }, "range": Array [ 0, - 15, + 20, ], "sourceType": "script", "tokens": Array [ @@ -46932,7 +56976,7 @@ Object { 1, ], "type": "Punctuator", - "value": "(", + "value": "[", }, Object { "loc": Object { @@ -46949,8 +56993,8 @@ Object { 1, 2, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { @@ -46967,13 +57011,13 @@ Object { 2, 3, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { @@ -46983,10 +57027,10 @@ Object { }, "range": Array [ 4, - 5, + 7, ], "type": "Punctuator", - "value": "=", + "value": "...", }, Object { "loc": Object { @@ -46995,16 +57039,16 @@ Object { "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, + 7, 8, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { @@ -47021,8 +57065,8 @@ Object { 8, 9, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { @@ -47040,12 +57084,12 @@ Object { 10, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { @@ -47055,399 +57099,297 @@ Object { }, "range": Array [ 11, + 12, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 13, ], "type": "Punctuator", - "value": "=>", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, "range": Array [ + 13, 14, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, ], "type": "Identifier", - "value": "x", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring-and-arrowFunctions/param-defaults-object-nested.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/destructuring-param.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { "elements": Array [ Object { "loc": Object { "end": Object { - "column": 31, + "column": 13, "line": 1, }, "start": Object { - "column": 30, + "column": 12, "line": 1, }, }, - "name": "x", + "name": "a", "range": Array [ - 30, - 31, + 12, + 13, ], "type": "Identifier", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 16, "line": 1, }, "start": Object { - "column": 33, + "column": 15, "line": 1, }, }, - "name": "z", + "name": "b", "range": Array [ - 33, - 34, + 15, + 16, ], "type": "Identifier", }, - ], - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 35, - ], - "type": "ArrayExpression", - }, - "expression": true, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 2, - 8, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { + Object { + "argument": Object { + "elements": Array [ + Object { "loc": Object { "end": Object { - "column": 3, + "column": 24, "line": 1, }, "start": Object { - "column": 2, + "column": 22, "line": 1, }, }, - "name": "x", + "name": "ok", "range": Array [ - 2, - 3, + 22, + 24, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 8, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 8, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - "kind": "init", + ], "loc": Object { "end": Object { - "column": 23, + "column": 25, "line": 1, }, "start": Object { - "column": 10, + "column": 21, "line": 1, }, }, - "method": false, "range": Array [ - 10, - 23, + 21, + 25, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 15, - 21, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 21, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "type": "AssignmentPattern", - }, - }, - ], - "range": Array [ - 13, - 23, - ], - "type": "ObjectPattern", - }, + "type": "ArrayPattern", }, - ], - "range": Array [ - 1, - 24, - ], - "type": "ObjectPattern", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "RestElement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, - ], - "range": Array [ - 0, - 35, - ], - "type": "ArrowFunctionExpression", - }, + "range": Array [ + 11, + 26, + ], + "type": "ArrayPattern", + }, + ], + "range": Array [ + 0, + 30, + ], + "type": "FunctionDeclaration", + }, + Object { "loc": Object { "end": Object { - "column": 35, + "column": 31, "line": 1, }, "start": Object { - "column": 0, + "column": 30, "line": 1, }, }, "range": Array [ - 0, - 35, + 30, + 31, ], - "type": "ExpressionStatement", + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 35, + "column": 31, "line": 1, }, "start": Object { @@ -47457,14 +57399,14 @@ Object { }, "range": Array [ 0, - 35, + 31, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -47474,7 +57416,43 @@ Object { }, "range": Array [ 0, - 1, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -47482,377 +57460,786 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 11, "line": 1, }, }, "range": Array [ - 1, - 2, + 11, + 12, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 13, "line": 1, }, "start": Object { - "column": 2, + "column": 12, "line": 1, }, }, "range": Array [ - 2, - 3, + 12, + 13, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 14, "line": 1, }, "start": Object { - "column": 4, + "column": 13, "line": 1, }, }, "range": Array [ - 4, - 5, + 13, + 14, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 16, "line": 1, }, "start": Object { - "column": 6, + "column": 15, "line": 1, }, }, "range": Array [ - 6, - 8, + 15, + 16, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Identifier", + "value": "ok", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, "line": 1, }, - "start": Object { - "column": 8, - "line": 1, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/destructuring-and-spread/error-complex-destructured-spread-first.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "RestElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 9, + 10, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 7, + 15, + ], + "type": "ObjectPattern", + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", }, + "type": "AssignmentExpression", }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": ",", - }, - Object { "loc": Object { "end": Object { - "column": 11, + "column": 21, "line": 1, }, "start": Object { - "column": 10, + "column": 0, "line": 1, }, }, "range": Array [ - 10, - 11, + 0, + 21, ], - "type": "Identifier", - "value": "y", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 12, + "column": 1, "line": 1, }, "start": Object { - "column": 11, + "column": 0, "line": 1, }, }, "range": Array [ - 11, - 12, + 0, + 1, ], "type": "Punctuator", - "value": ":", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 4, "line": 1, }, "start": Object { - "column": 13, + "column": 1, "line": 1, }, }, "range": Array [ - 13, - 14, + 1, + 4, ], "type": "Punctuator", - "value": "{", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 5, "line": 1, }, "start": Object { - "column": 15, + "column": 4, "line": 1, }, }, "range": Array [ - 15, - 16, + 4, + 5, ], "type": "Identifier", - "value": "z", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 6, "line": 1, }, "start": Object { - "column": 17, + "column": 5, "line": 1, }, }, "range": Array [ - 17, - 18, + 5, + 6, ], "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 21, - ], - "type": "Numeric", - "value": "10", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 8, "line": 1, }, "start": Object { - "column": 22, + "column": 7, "line": 1, }, }, "range": Array [ - 22, - 23, + 7, + 8, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 10, "line": 1, }, "start": Object { - "column": 23, + "column": 9, "line": 1, }, }, "range": Array [ - 23, - 24, + 9, + 10, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 11, "line": 1, }, "start": Object { - "column": 24, + "column": 10, "line": 1, }, }, "range": Array [ - 24, - 25, + 10, + 11, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 13, "line": 1, }, "start": Object { - "column": 26, + "column": 12, "line": 1, }, }, "range": Array [ - 26, - 28, + 12, + 13, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 15, "line": 1, }, "start": Object { - "column": 29, + "column": 14, "line": 1, }, }, "range": Array [ - 29, - 30, + 14, + 15, ], "type": "Punctuator", - "value": "[", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 16, "line": 1, }, "start": Object { - "column": 30, + "column": 15, "line": 1, }, }, "range": Array [ - 30, - 31, + 15, + 16, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 18, "line": 1, }, "start": Object { - "column": 31, + "column": 17, "line": 1, }, }, "range": Array [ - 31, - 32, + 17, + 18, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 20, "line": 1, }, "start": Object { - "column": 33, + "column": 19, "line": 1, }, }, "range": Array [ - 33, - 34, + 19, + 20, ], "type": "Identifier", - "value": "z", + "value": "d", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 34, + "column": 20, "line": 1, }, }, "range": Array [ - 34, - 35, + 20, + 21, ], "type": "Punctuator", - "value": "]", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/array-const-undefined.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/multi-destructured.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + Object { + "argument": Object { "loc": Object { "end": Object { "column": 8, @@ -47863,69 +58250,84 @@ Object { "line": 1, }, }, - "name": "a", + "name": "b", "range": Array [ 7, 8, ], "type": "Identifier", }, - ], - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 8, + ], + "type": "RestElement", }, - "range": Array [ - 6, - 9, - ], - "type": "ArrayPattern", - }, - "init": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, }, - "range": Array [ - 12, - 14, - ], - "type": "ArrayExpression", + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "operator": "=", + "range": Array [ + 0, + 13, + ], + "right": Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 6, + "column": 12, "line": 1, }, }, + "name": "c", "range": Array [ - 6, - 14, + 12, + 13, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "const", + "type": "AssignmentExpression", + }, "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { @@ -47935,14 +58337,14 @@ Object { }, "range": Array [ 0, - 15, + 14, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { @@ -47952,14 +58354,14 @@ Object { }, "range": Array [ 0, - 15, + 14, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 1, "line": 1, }, "start": Object { @@ -47969,10 +58371,46 @@ Object { }, "range": Array [ 0, - 5, + 1, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { @@ -47981,16 +58419,16 @@ Object { "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, + 4, 7, ], "type": "Punctuator", - "value": "[", + "value": "...", }, Object { "loc": Object { @@ -48008,7 +58446,7 @@ Object { 8, ], "type": "Identifier", - "value": "a", + "value": "b", }, Object { "loc": Object { @@ -48061,8 +58499,8 @@ Object { 12, 13, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "c", }, Object { "loc": Object { @@ -48080,24 +58518,6 @@ Object { 14, ], "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", "value": ";", }, ], @@ -48105,88 +58525,103 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/array-let-undefined.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/single-destructured.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { + "expression": Object { + "left": Object { + "elements": Array [ + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 6, + "column": 5, "line": 1, }, "start": Object { - "column": 5, + "column": 4, "line": 1, }, }, "name": "a", "range": Array [ + 4, 5, - 6, ], "type": "Identifier", }, - ], - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, }, + "range": Array [ + 1, + 5, + ], + "type": "RestElement", }, - "range": Array [ - 4, - 7, - ], - "type": "ArrayPattern", - }, - "init": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, }, - "range": Array [ - 10, - 12, - ], - "type": "ArrayExpression", + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 10, + ], + "right": Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, "line": 1, }, "start": Object { - "column": 4, + "column": 9, "line": 1, }, }, + "name": "b", "range": Array [ - 4, - 12, + 9, + 10, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "let", + "type": "AssignmentExpression", + }, "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { @@ -48196,14 +58631,14 @@ Object { }, "range": Array [ 0, - 13, + 11, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { @@ -48213,14 +58648,14 @@ Object { }, "range": Array [ 0, - 13, + 11, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -48230,43 +58665,43 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 4, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ + 1, 4, - 5, ], "type": "Punctuator", - "value": "[", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 5, "line": 1, }, "start": Object { - "column": 5, + "column": 4, "line": 1, }, }, "range": Array [ + 4, 5, - 6, ], "type": "Identifier", "value": "a", @@ -48274,17 +58709,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 6, "line": 1, }, "start": Object { - "column": 6, + "column": 5, "line": 1, }, }, "range": Array [ + 5, 6, - 7, ], "type": "Punctuator", "value": "]", @@ -48292,17 +58727,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 8, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ + 7, 8, - 9, ], "type": "Punctuator", "value": "=", @@ -48310,53 +58745,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ + 9, 10, - 11, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { "column": 11, "line": 1, }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, "start": Object { - "column": 12, + "column": 10, "line": 1, }, }, "range": Array [ - 12, - 13, + 10, + 11, ], "type": "Punctuator", "value": ";", @@ -48366,127 +58783,238 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-const-named.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-complex-destructured.src 1`] = ` Object { "body": Array [ Object { "declarations": Array [ Object { "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 7, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 10, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 5, + 13, + ], + "type": "ObjectPattern", }, - }, - "properties": Array [ Object { - "computed": false, - "key": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 8, + "column": 19, "line": 1, }, "start": Object { - "column": 7, + "column": 18, "line": 1, }, }, - "name": "a", + "name": "c", "range": Array [ - 7, - 8, + 18, + 19, ], "type": "Identifier", }, - "kind": "init", "loc": Object { "end": Object { - "column": 10, + "column": 19, "line": 1, }, "start": Object { - "column": 7, + "column": 15, "line": 1, }, }, - "method": false, "range": Array [ - 7, - 10, + 15, + 19, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, + "type": "RestElement", }, ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, "range": Array [ - 6, - 11, + 4, + 20, ], - "type": "ObjectPattern", + "type": "ArrayPattern", }, "init": Object { "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 14, + "column": 23, "line": 1, }, }, - "properties": Array [], + "name": "d", "range": Array [ - 14, - 16, + 23, + 24, ], - "type": "ObjectExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 16, + "column": 24, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 16, + 4, + 24, ], "type": "VariableDeclarator", }, ], - "kind": "const", + "kind": "var", "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { @@ -48496,14 +59024,14 @@ Object { }, "range": Array [ 0, - 17, + 25, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 17, + "column": 25, "line": 1, }, "start": Object { @@ -48513,14 +59041,14 @@ Object { }, "range": Array [ 0, - 17, + 25, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -48530,25 +59058,43 @@ Object { }, "range": Array [ 0, - 5, + 3, ], "type": "Keyword", - "value": "const", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { "column": 6, "line": 1, }, + "start": Object { + "column": 5, + "line": 1, + }, }, "range": Array [ + 5, 6, - 7, ], "type": "Punctuator", "value": "{", @@ -48587,22 +59133,22 @@ Object { 9, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 1, }, "start": Object { - "column": 9, + "column": 10, "line": 1, }, }, "range": Array [ - 9, 10, + 11, ], "type": "Identifier", "value": "b", @@ -48610,17 +59156,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 11, + 12, + 13, ], "type": "Punctuator", "value": "}", @@ -48628,71 +59174,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 12, + "column": 13, "line": 1, }, }, "range": Array [ - 12, 13, + 14, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 18, ], "type": "Punctuator", - "value": "{", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, "range": Array [ - 15, - 16, + 18, + 19, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 22, "line": 1, }, "start": Object { - "column": 16, + "column": 21, "line": 1, }, }, "range": Array [ - 16, - 17, + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, ], "type": "Punctuator", "value": ";", @@ -48702,127 +59302,160 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-const-undefined.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-destructured-array-literal.src 1`] = ` Object { "body": Array [ Object { "declarations": Array [ Object { "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", }, - }, - "properties": Array [ Object { - "computed": false, - "key": Object { + "argument": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, - "name": "a", "range": Array [ - 7, - 8, + 11, + 17, ], - "type": "Identifier", + "type": "ArrayPattern", }, - "kind": "init", "loc": Object { "end": Object { - "column": 8, + "column": 17, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, - "method": false, "range": Array [ - 7, 8, + 17, ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, + "type": "RestElement", }, ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, "range": Array [ - 6, - 9, + 4, + 18, ], - "type": "ObjectPattern", + "type": "ArrayPattern", }, "init": Object { "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 12, + "column": 21, "line": 1, }, }, - "properties": Array [], + "name": "d", "range": Array [ - 12, - 14, + 21, + 22, ], - "type": "ObjectExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 14, + 4, + 22, ], "type": "VariableDeclarator", }, ], - "kind": "const", + "kind": "var", "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 1, }, "start": Object { @@ -48832,14 +59465,14 @@ Object { }, "range": Array [ 0, - 15, + 23, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 1, }, "start": Object { @@ -48849,14 +59482,14 @@ Object { }, "range": Array [ 0, - 15, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -48866,43 +59499,43 @@ Object { }, "range": Array [ 0, - 5, + 3, ], "type": "Keyword", - "value": "const", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { - "column": 6, + "column": 4, "line": 1, }, }, "range": Array [ - 6, - 7, + 4, + 5, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, - 8, + 5, + 6, ], "type": "Identifier", "value": "a", @@ -48910,7 +59543,25 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, "line": 1, }, "start": Object { @@ -48920,28 +59571,28 @@ Object { }, "range": Array [ 8, - 9, + 11, ], "type": "Punctuator", - "value": "}", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, ], "type": "Punctuator", - "value": "=", + "value": "[", }, Object { "loc": Object { @@ -48958,8 +59609,8 @@ Object { 12, 13, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { @@ -48977,22 +59628,112 @@ Object { 14, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, 15, + 16, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, ], "type": "Punctuator", "value": ";", @@ -49002,48 +59743,18 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-let-named.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-multi-destructured.src 1`] = ` Object { "body": Array [ Object { "declarations": Array [ Object { "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "properties": Array [ + "elements": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -49051,60 +59762,86 @@ Object { "line": 1, }, }, - "method": false, + "name": "a", "range": Array [ 5, - 8, + 6, ], - "shorthand": false, - "type": "Property", - "value": Object { + "type": "Identifier", + }, + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "name": "b", "range": Array [ - 7, - 8, + 11, + 12, ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "RestElement", }, ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, "range": Array [ 4, - 9, + 13, ], - "type": "ObjectPattern", + "type": "ArrayPattern", }, "init": Object { "loc": Object { "end": Object { - "column": 14, + "column": 17, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, - "properties": Array [], + "name": "c", "range": Array [ - 12, - 14, + 16, + 17, ], - "type": "ObjectExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 14, + "column": 17, "line": 1, }, "start": Object { @@ -49114,15 +59851,15 @@ Object { }, "range": Array [ 4, - 14, + 17, ], "type": "VariableDeclarator", }, ], - "kind": "let", + "kind": "var", "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { @@ -49132,14 +59869,14 @@ Object { }, "range": Array [ 0, - 15, + 18, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { @@ -49149,7 +59886,7 @@ Object { }, "range": Array [ 0, - 15, + 18, ], "sourceType": "script", "tokens": Array [ @@ -49169,7 +59906,7 @@ Object { 3, ], "type": "Keyword", - "value": "let", + "value": "var", }, Object { "loc": Object { @@ -49187,7 +59924,7 @@ Object { 5, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { @@ -49223,112 +59960,112 @@ Object { 7, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 11, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, + 11, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, "range": Array [ - 8, - 9, + 11, + 12, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 10, + "column": 12, "line": 1, }, }, "range": Array [ - 10, - 11, + 12, + 13, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 14, "line": 1, }, }, "range": Array [ - 12, - 13, + 14, + 15, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 17, "line": 1, }, "start": Object { - "column": 13, + "column": 16, "line": 1, }, }, "range": Array [ - 13, - 14, + 16, + 17, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 17, "line": 1, }, }, "range": Array [ - 14, - 15, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -49338,109 +60075,87 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-blockBindings/object-let-undefined.src 1`] = ` +exports[`ecmaFeatures fixtures/destructuring-and-spread/var-single-destructured.src 1`] = ` Object { "body": Array [ Object { "declarations": Array [ Object { "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "properties": Array [ + "elements": Array [ Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 5, - 6, - ], - "shorthand": true, - "type": "Property", - "value": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "name": "a", "range": Array [ - 5, - 6, + 8, + 9, ], "type": "Identifier", }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "RestElement", }, ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, "range": Array [ 4, - 7, + 10, ], - "type": "ObjectPattern", + "type": "ArrayPattern", }, "init": Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 10, + "column": 13, "line": 1, }, }, - "properties": Array [], + "name": "b", "range": Array [ - 10, - 12, + 13, + 14, ], - "type": "ObjectExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { @@ -49450,15 +60165,15 @@ Object { }, "range": Array [ 4, - 12, + 14, ], "type": "VariableDeclarator", }, ], - "kind": "let", + "kind": "var", "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -49468,14 +60183,14 @@ Object { }, "range": Array [ 0, - 13, + 15, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -49485,7 +60200,7 @@ Object { }, "range": Array [ 0, - 13, + 15, ], "sourceType": "script", "tokens": Array [ @@ -49505,7 +60220,7 @@ Object { 3, ], "type": "Keyword", - "value": "let", + "value": "var", }, Object { "loc": Object { @@ -49523,12 +60238,12 @@ Object { 5, ], "type": "Punctuator", - "value": "{", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -49538,97 +60253,97 @@ Object { }, "range": Array [ 5, - 6, + 8, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { - "column": 6, + "column": 8, "line": 1, }, }, "range": Array [ - 6, - 7, + 8, + 9, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "range": Array [ - 8, 9, + 10, ], "type": "Punctuator", - "value": "=", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, 11, + 12, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 13, "line": 1, }, }, "range": Array [ - 11, - 12, + 13, + 14, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 14, "line": 1, }, }, "range": Array [ - 12, - 13, + 14, + 15, ], "type": "Punctuator", "value": ";", @@ -49638,17 +60353,17 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-array.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalAsyncIteration/async-generators.src 1`] = ` Object { "body": Array [ Object { - "async": false, + "async": true, "body": Object { "body": Array [], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 22, @@ -49657,33 +60372,68 @@ Object { }, "range": Array [ 22, - 24, + 26, ], "type": "BlockStatement", }, "expression": false, - "generator": false, + "generator": true, "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 19, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, - "name": "f", + "name": "foo", "range": Array [ - 9, - 10, + 16, + 19, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 24, + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 26, + ], + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, "line": 1, }, "start": Object { @@ -49691,128 +60441,320 @@ Object { "line": 1, }, }, - "params": Array [ - Object { - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalAsyncIteration/async-iterator.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "await": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 2, }, - "name": "x", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, }, + "range": Array [ + 59, + 67, + ], + "type": "BlockStatement", }, - "range": Array [ - 11, - 14, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 20, - ], - "right": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "item", + "range": Array [ + 44, + 48, + ], + "type": "Identifier", }, - "start": Object { - "column": 18, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, }, + "range": Array [ + 44, + 48, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, }, - "range": Array [ - 18, - 19, - ], - "raw": "1", - "type": "Literal", - "value": 1, }, - ], + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclaration", + }, "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 17, - 20, + 27, + 67, ], - "type": "ArrayExpression", + "right": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "name": "items", + "range": Array [ + 52, + 57, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 69, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, }, - "type": "AssignmentPattern", }, - ], - "range": Array [ - 0, - 24, - ], - "type": "FunctionDeclaration", - }, - Object { + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 24, + "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ - 24, - 25, + 0, + 69, ], - "type": "EmptyStatement", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -49821,14 +60763,14 @@ Object { }, "range": Array [ 0, - 25, + 70, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 5, "line": 1, }, "start": Object { @@ -49838,7 +60780,25 @@ Object { }, "range": Array [ 0, - 8, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, ], "type": "Keyword", "value": "function", @@ -49846,35 +60806,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 18, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 10, + 15, + 18, ], "type": "Identifier", - "value": "f", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 19, "line": 1, }, "start": Object { - "column": 10, + "column": 18, "line": 1, }, }, "range": Array [ - 10, - 11, + 18, + 19, ], "type": "Punctuator", "value": "(", @@ -49882,143 +60842,179 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 19, "line": 1, }, }, "range": Array [ - 11, - 12, + 19, + 20, ], "type": "Punctuator", - "value": "[", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 22, "line": 1, }, "start": Object { - "column": 12, + "column": 21, "line": 1, }, }, "range": Array [ - 12, - 13, + 21, + 22, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { "column": 13, - "line": 1, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, }, }, "range": Array [ - 13, - 14, + 31, + 36, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { "column": 15, - "line": 1, + "line": 2, }, }, "range": Array [ - 15, - 16, + 38, + 43, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 21, + "line": 2, }, }, "range": Array [ - 17, - 18, + 44, + 48, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "item", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 28, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 26, + "line": 2, }, }, "range": Array [ - 18, - 19, + 49, + 51, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "of", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 34, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 19, - 20, + 52, + 57, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "items", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 35, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 34, + "line": 2, }, }, "range": Array [ - 20, - 21, + 57, + 58, ], "type": "Punctuator", "value": ")", @@ -50026,17 +61022,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 37, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 36, + "line": 2, }, }, "range": Array [ - 22, - 23, + 59, + 60, ], "type": "Punctuator", "value": "{", @@ -50044,17 +61040,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 23, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 23, - 24, + 66, + 67, ], "type": "Punctuator", "value": "}", @@ -50062,280 +61058,161 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 5, }, }, "range": Array [ - 24, - 25, + 68, + 69, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-object.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalDynamicImport/dynamic-import.src 1`] = ` Object { "body": Array [ Object { "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 0, - 1, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "operator": "=", - "range": Array [ - 0, - 30, - ], - "right": Object { - "async": false, - "body": Object { - "body": Array [], + "arguments": Array [ + Object { "loc": Object { "end": Object { - "column": 30, + "column": 23, "line": 1, }, "start": Object { - "column": 28, + "column": 19, "line": 1, }, }, + "name": "main", "range": Array [ - 28, - 30, + 19, + 23, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + ], + "callee": Object { + "computed": false, "loc": Object { "end": Object { - "column": 30, + "column": 18, "line": 1, }, "start": Object { - "column": 4, + "column": 0, "line": 1, }, }, - "params": Array [ - Object { - "left": Object { + "object": Object { + "arguments": Array [ + Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 1, }, "start": Object { - "column": 13, + "column": 7, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 14, - 15, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - }, - ], "range": Array [ - 13, - 16, + 7, + 12, ], - "type": "ObjectPattern", + "raw": "'foo'", + "type": "Literal", + "value": "foo", }, + ], + "callee": Object { "loc": Object { "end": Object { - "column": 26, + "column": 6, "line": 1, }, "start": Object { - "column": 13, + "column": 0, "line": 1, }, }, "range": Array [ - 13, - 26, + 0, + 6, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 20, - 25, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 25, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - }, - ], - "range": Array [ - 19, - 26, - ], - "type": "ObjectExpression", + "type": "Import", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "type": "AssignmentPattern", }, - ], + "name": "then", + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + }, "range": Array [ - 4, - 30, + 0, + 18, ], - "type": "FunctionExpression", + "type": "MemberExpression", }, - "type": "AssignmentExpression", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "CallExpression", }, "loc": Object { "end": Object { - "column": 31, + "column": 25, "line": 1, }, "start": Object { @@ -50345,15 +61222,15 @@ Object { }, "range": Array [ 0, - 31, + 25, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -50362,14 +61239,14 @@ Object { }, "range": Array [ 0, - 31, + 26, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -50379,28 +61256,28 @@ Object { }, "range": Array [ 0, - 1, + 6, ], - "type": "Identifier", - "value": "f", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { - "column": 2, + "column": 6, "line": 1, }, }, "range": Array [ - 2, - 3, + 6, + 7, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { @@ -50409,16 +61286,16 @@ Object { "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, "range": Array [ - 4, + 7, 12, ], - "type": "Keyword", - "value": "function", + "type": "String", + "value": "'foo'", }, Object { "loc": Object { @@ -50436,7 +61313,7 @@ Object { 13, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { @@ -50454,12 +61331,12 @@ Object { 14, ], "type": "Punctuator", - "value": "{", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { @@ -50469,51 +61346,33 @@ Object { }, "range": Array [ 14, - 15, + 18, ], "type": "Identifier", - "value": "x", + "value": "then", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 19, "line": 1, }, "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { "column": 18, "line": 1, }, - "start": Object { - "column": 17, - "line": 1, - }, }, "range": Array [ - 17, 18, + 19, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { @@ -50523,51 +61382,15 @@ Object { }, "range": Array [ 19, - 20, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, + 23, ], "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": ":", + "value": "main", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { @@ -50577,43 +61400,7 @@ Object { }, "range": Array [ 23, - 25, - ], - "type": "Numeric", - "value": "10", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, + 24, ], "type": "Punctuator", "value": ")", @@ -50621,53 +61408,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, + "column": 25, "line": 1, }, "start": Object { - "column": 30, + "column": 24, "line": 1, }, }, "range": Array [ - 30, - 31, + 24, + 25, ], "type": "Punctuator", "value": ";", @@ -50677,278 +61428,48 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-defaultParams/param-object-short.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/arg-spread.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 1, }, "start": Object { - "column": 1, + "column": 22, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "f", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "method": true, - "range": Array [ - 2, - 21, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 21, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "params": Array [ - Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 5, - 6, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 4, - 7, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 17, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 11, - 16, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 16, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - }, - ], - "range": Array [ - 10, - 17, - ], - "type": "ObjectExpression", - }, - "type": "AssignmentPattern", - }, - ], - "range": Array [ - 3, - 21, - ], - "type": "FunctionExpression", - }, - }, - ], "range": Array [ - 1, 22, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 9, + 10, ], - "type": "ObjectExpression", + "type": "Identifier", }, "loc": Object { "end": Object { @@ -50960,17 +61481,132 @@ Object { "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 11, + 20, + ], + "type": "ObjectPattern", + }, + ], "range": Array [ 0, 24, ], - "type": "ExpressionStatement", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -50979,14 +61615,14 @@ Object { }, "range": Array [ 0, - 24, + 25, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -50996,61 +61632,43 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 2, + 8, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 10, "line": 1, }, "start": Object { - "column": 2, + "column": 9, "line": 1, }, }, "range": Array [ - 2, - 3, + 9, + 10, ], "type": "Identifier", - "value": "f", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 11, "line": 1, }, "start": Object { - "column": 3, + "column": 10, "line": 1, }, }, "range": Array [ - 3, - 4, + 10, + 11, ], "type": "Punctuator", "value": "(", @@ -51058,17 +61676,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 12, "line": 1, }, "start": Object { - "column": 4, + "column": 11, "line": 1, }, }, "range": Array [ - 4, - 5, + 11, + 12, ], "type": "Punctuator", "value": "{", @@ -51076,477 +61694,590 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 13, "line": 1, }, "start": Object { - "column": 5, + "column": 12, "line": 1, }, }, "range": Array [ - 5, - 6, + 12, + 13, ], "type": "Identifier", - "value": "x", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 1, }, "start": Object { - "column": 6, + "column": 13, "line": 1, }, }, "range": Array [ - 6, - 7, + 13, + 14, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 18, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, "range": Array [ - 8, - 9, + 15, + 18, ], "type": "Punctuator", - "value": "=", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 19, "line": 1, }, "start": Object { - "column": 10, + "column": 18, "line": 1, }, }, "range": Array [ - 10, - 11, + 18, + 19, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 19, "line": 1, }, }, "range": Array [ - 11, - 12, + 19, + 20, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 21, "line": 1, }, "start": Object { - "column": 12, + "column": 20, "line": 1, }, }, "range": Array [ - 12, - 13, + 20, + 21, ], "type": "Punctuator", - "value": ":", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 23, "line": 1, }, "start": Object { - "column": 14, + "column": 22, "line": 1, }, }, "range": Array [ - 14, - 16, + 22, + 23, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 24, "line": 1, }, "start": Object { - "column": 16, + "column": 23, "line": 1, }, }, "range": Array [ - 16, - 17, + 23, + 24, ], "type": "Punctuator", "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/destructuring-assign-mirror.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 1, + 10, + ], + "type": "ObjectPattern", }, - "start": Object { - "column": 17, - "line": 1, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 22, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 13, + 22, + ], + "type": "ObjectExpression", }, + "type": "AssignmentExpression", }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": ")", - }, - Object { "loc": Object { "end": Object { - "column": 20, + "column": 23, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 20, + 0, + 23, ], - "type": "Punctuator", - "value": "{", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "}", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": "}", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, + "column": 1, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 1, ], "type": "Punctuator", - "value": ")", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 2, "line": 1, }, "start": Object { - "column": 23, + "column": 1, "line": 1, }, }, "range": Array [ - 23, - 24, + 1, + 2, ], "type": "Punctuator", - "value": ";", + "value": "{", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring-and-forOf/loop.src 1`] = ` -Object { - "body": Array [ Object { - "await": false, - "body": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "EmptyStatement", - }, - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 8, - ], - "type": "ArrayPattern", - }, "loc": Object { "end": Object { - "column": 17, + "column": 3, "line": 1, }, "start": Object { - "column": 0, + "column": 2, "line": 1, }, }, "range": Array [ - 0, - 17, + 2, + 3, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, - "type": "ForOfStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "a", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 4, "line": 1, }, "start": Object { - "column": 0, + "column": 3, "line": 1, }, }, "range": Array [ - 0, 3, + 4, ], - "type": "Keyword", - "value": "for", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 5, "line": 1, }, }, "range": Array [ - 4, 5, + 8, ], "type": "Punctuator", - "value": "(", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 9, "line": 1, }, "start": Object { - "column": 5, + "column": 8, "line": 1, }, }, "range": Array [ - 5, - 6, + 8, + 9, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 7, + 9, + 10, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, - 8, + 11, + 12, ], "type": "Punctuator", - "value": "]", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 11, + 13, + 14, ], - "type": "Identifier", - "value": "of", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -51555,16 +62286,16 @@ Object { "line": 1, }, "start": Object { - "column": 12, + "column": 14, "line": 1, }, }, "range": Array [ - 12, + 14, 15, ], "type": "Identifier", - "value": "foo", + "value": "a", }, Object { "loc": Object { @@ -51582,431 +62313,305 @@ Object { 16, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 20, "line": 1, }, "start": Object { - "column": 16, + "column": 17, "line": 1, }, }, "range": Array [ - 16, 17, + 20, ], "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring-and-spread/complex-destructured.src 1`] = ` -Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 3, - 4, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 3, - 4, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 3, - 4, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 6, - 7, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 1, - 9, - ], - "type": "ObjectPattern", - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 15, - ], - "type": "RestElement", - }, - ], - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 16, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "operator": "=", - "range": Array [ - 0, - 20, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "d", - "range": Array [ - 19, - 20, - ], - "type": "Identifier", - }, - "type": "AssignmentExpression", - }, + "value": "...", + }, + Object { "loc": Object { "end": Object { "column": 21, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, + 20, 21, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "b", }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 22, "line": 1, }, "start": Object { - "column": 0, + "column": 21, "line": 1, }, }, "range": Array [ - 0, - 1, + 21, + 22, ], "type": "Punctuator", - "value": "[", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 23, "line": 1, }, "start": Object { - "column": 1, + "column": 22, "line": 1, }, }, "range": Array [ - 1, - 2, + 22, + 23, ], "type": "Punctuator", - "value": "{", + "value": ")", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/function-parameter-object-spread.src 1`] = ` +Object { + "body": Array [ Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 4, + "column": 26, "line": 1, }, "start": Object { - "column": 3, + "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 13, + 21, + ], + "type": "ObjectPattern", + }, + ], "range": Array [ - 3, - 4, + 0, + 26, ], - "type": "Identifier", - "value": "a", + "type": "FunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 0, "line": 1, }, }, "range": Array [ - 4, - 5, + 0, + 8, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 12, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 7, + 9, + 12, ], "type": "Identifier", - "value": "b", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 12, "line": 1, }, }, "range": Array [ - 8, - 9, + 12, + 13, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 13, "line": 1, }, }, "range": Array [ - 9, - 10, + 13, + 14, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, 14, + 17, ], "type": "Punctuator", "value": "...", @@ -52014,250 +62619,315 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 1, }, "start": Object { - "column": 14, + "column": 17, "line": 1, }, }, "range": Array [ - 14, - 15, + 17, + 20, ], "type": "Identifier", - "value": "c", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 16, + 20, + 21, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { - "column": 17, + "column": 21, "line": 1, }, }, "range": Array [ - 17, - 18, + 21, + 22, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 1, }, "start": Object { - "column": 19, + "column": 23, "line": 1, }, }, "range": Array [ - 19, - 20, + 23, + 24, ], - "type": "Identifier", - "value": "d", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 26, "line": 1, }, "start": Object { - "column": 20, + "column": 25, "line": 1, }, }, "range": Array [ - 20, - 21, + 25, + 26, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/destructuring-and-spread/destructured-array-literal.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/invalid-rest.src 1`] = `"',' expected."`; + +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/invalid-rest-trailing-comma.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, }, - "name": "a", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", }, - Object { - "argument": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, }, - "name": "b", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "c", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", }, - ], + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 13, + "column": 7, "line": 1, }, "start": Object { - "column": 7, + "column": 6, "line": 1, }, }, + "method": false, "range": Array [ + 6, 7, - 13, ], - "type": "ArrayPattern", + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, - "start": Object { - "column": 4, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 9, + 10, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, }, - "range": Array [ - 4, - 13, - ], - "type": "RestElement", - }, - ], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 14, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 16, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 4, + 19, + ], + "type": "ObjectPattern", }, - "start": Object { - "column": 0, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", }, - }, - "operator": "=", - "range": Array [ - 0, - 18, - ], - "right": Object { "loc": Object { "end": Object { - "column": 18, + "column": 25, "line": 1, }, "start": Object { - "column": 17, + "column": 4, "line": 1, }, }, - "name": "d", "range": Array [ - 17, - 18, + 4, + 25, ], - "type": "Identifier", + "type": "VariableDeclarator", }, - "type": "AssignmentExpression", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { @@ -52267,9 +62937,9 @@ Object { }, "range": Array [ 0, - 19, + 26, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { @@ -52284,14 +62954,14 @@ Object { }, "range": Array [ 0, - 20, + 27, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -52301,187 +62971,187 @@ Object { }, "range": Array [ 0, - 1, + 3, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 5, "line": 1, }, "start": Object { - "column": 1, + "column": 4, "line": 1, }, }, "range": Array [ - 1, - 2, + 4, + 5, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, + "column": 7, "line": 1, }, "start": Object { - "column": 2, + "column": 6, "line": 1, }, }, "range": Array [ - 2, - 3, + 6, + 7, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, "range": Array [ - 4, 7, + 8, ], "type": "Punctuator", - "value": "...", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, "range": Array [ - 7, - 8, + 9, + 10, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 9, + "column": 12, "line": 1, }, }, "range": Array [ - 9, - 10, + 12, + 15, ], "type": "Punctuator", - "value": ",", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 16, "line": 1, }, "start": Object { - "column": 11, + "column": 15, "line": 1, }, }, "range": Array [ - 11, - 12, + 15, + 16, ], "type": "Identifier", - "value": "c", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 17, "line": 1, }, "start": Object { - "column": 12, + "column": 16, "line": 1, }, }, "range": Array [ - 12, - 13, + 16, + 17, ], "type": "Punctuator", - "value": "]", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 1, }, "start": Object { - "column": 13, + "column": 18, "line": 1, }, }, "range": Array [ - 13, - 14, + 18, + 19, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 1, }, "start": Object { - "column": 15, + "column": 20, "line": 1, }, }, "range": Array [ - 15, - 16, + 20, + 21, ], "type": "Punctuator", "value": "=", @@ -52489,35 +63159,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 25, "line": 1, }, "start": Object { - "column": 17, + "column": 22, "line": 1, }, }, "range": Array [ - 17, - 18, + 22, + 25, ], "type": "Identifier", - "value": "d", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -52527,198 +63197,472 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-spread/destructuring-param.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/object-rest.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 30, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ + "declarations": Array [ Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", }, - "start": Object { - "column": 12, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 9, + 10, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 16, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 4, + 18, + ], + "type": "ObjectPattern", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 23, + 27, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", }, - }, - "name": "a", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, }, - "start": Object { - "column": 15, - "line": 1, + "method": false, + "range": Array [ + 29, + 33, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "raw": "2", + "type": "Literal", + "value": 2, }, }, - "name": "b", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - Object { - "argument": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, }, - "name": "ok", - "range": Array [ - 22, - 24, - ], - "type": "Identifier", }, - ], + "name": "a", + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 25, + "column": 39, "line": 1, }, "start": Object { - "column": 21, + "column": 35, "line": 1, }, }, + "method": false, "range": Array [ - 21, - 25, + 35, + 39, ], - "type": "ArrayPattern", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 41, + 42, + ], + "type": "Identifier", }, - "start": Object { - "column": 18, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 41, + 45, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "raw": "4", + "type": "Literal", + "value": 4, }, }, - "range": Array [ - 18, - 25, - ], - "type": "RestElement", - }, - ], + ], + "range": Array [ + 21, + 47, + ], + "type": "ObjectExpression", + }, "loc": Object { "end": Object { - "column": 26, + "column": 47, "line": 1, }, "start": Object { - "column": 11, + "column": 4, "line": 1, }, }, "range": Array [ - 11, - 26, + 4, + 47, ], - "type": "ArrayPattern", + "type": "VariableDeclarator", }, ], - "range": Array [ - 0, - 30, - ], - "type": "FunctionDeclaration", - }, - Object { + "kind": "var", "loc": Object { "end": Object { - "column": 31, + "column": 48, "line": 1, }, "start": Object { - "column": 30, + "column": 0, "line": 1, }, }, "range": Array [ - 30, - 31, + 0, + 48, ], - "type": "EmptyStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -52727,14 +63671,14 @@ Object { }, "range": Array [ 0, - 31, + 49, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 1, }, "start": Object { @@ -52744,97 +63688,97 @@ Object { }, "range": Array [ 0, - 8, + 3, ], "type": "Keyword", - "value": "function", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 1, }, "start": Object { - "column": 9, + "column": 4, "line": 1, }, }, "range": Array [ - 9, - 10, + 4, + 5, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 7, "line": 1, }, "start": Object { - "column": 10, + "column": 6, "line": 1, }, }, "range": Array [ - 10, - 11, + 6, + 7, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { - "column": 11, + "column": 7, "line": 1, }, }, "range": Array [ - 11, - 12, + 7, + 8, ], "type": "Punctuator", - "value": "[", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 10, "line": 1, }, "start": Object { - "column": 12, + "column": 9, "line": 1, }, }, "range": Array [ - 12, - 13, + 9, + 10, ], "type": "Identifier", - "value": "a", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 11, "line": 1, }, "start": Object { - "column": 13, + "column": 10, "line": 1, }, }, "range": Array [ - 13, - 14, + 10, + 11, ], "type": "Punctuator", "value": ",", @@ -52842,128 +63786,128 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 15, - 16, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 17, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "z", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 18, "line": 1, }, "start": Object { - "column": 18, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 18, - 21, ], "type": "Punctuator", - "value": "...", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 1, }, "start": Object { - "column": 21, + "column": 19, "line": 1, }, }, "range": Array [ - 21, - 22, + 19, + 20, ], "type": "Punctuator", - "value": "[", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 22, "line": 1, }, "start": Object { - "column": 22, + "column": 21, "line": 1, }, }, "range": Array [ + 21, 22, - 24, ], - "type": "Identifier", - "value": "ok", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ + 23, 24, - 25, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 25, "line": 1, }, "start": Object { - "column": 25, + "column": 24, "line": 1, }, }, "range": Array [ + 24, 25, - 26, ], "type": "Punctuator", - "value": "]", + "value": ":", }, Object { "loc": Object { @@ -52980,245 +63924,113 @@ Object { 26, 27, ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 29, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 30, - ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 31, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring-and-spread/multi-destructured.src 1`] = ` -Object { - "body": Array [ - Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 1, - 2, - ], - "type": "Identifier", - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 8, - ], - "type": "RestElement", - }, - ], - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 9, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + "end": Object { + "column": 28, + "line": 1, }, - "operator": "=", - "range": Array [ - 0, - 13, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", + "start": Object { + "column": 27, + "line": 1, }, - "type": "AssignmentExpression", }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ",", + }, + Object { "loc": Object { "end": Object { - "column": 14, + "column": 30, "line": 1, }, "start": Object { - "column": 0, + "column": 29, "line": 1, }, }, "range": Array [ - 0, - 14, + 29, + 30, ], - "type": "ExpressionStatement", + "type": "Identifier", + "value": "y", }, - ], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Numeric", + "value": "2", }, - }, - "range": Array [ - 0, - 14, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 34, "line": 1, }, "start": Object { - "column": 0, + "column": 33, "line": 1, }, }, "range": Array [ - 0, - 1, + 33, + 34, ], "type": "Punctuator", - "value": "[", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 36, "line": 1, }, "start": Object { - "column": 1, + "column": 35, "line": 1, }, }, "range": Array [ - 1, - 2, + 35, + 36, ], "type": "Identifier", "value": "a", @@ -53226,53 +64038,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, + "column": 37, "line": 1, }, "start": Object { - "column": 2, + "column": 36, "line": 1, }, }, "range": Array [ - 2, - 3, + 36, + 37, ], "type": "Punctuator", - "value": ",", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 39, "line": 1, }, "start": Object { - "column": 4, + "column": 38, "line": 1, }, }, "range": Array [ - 4, - 7, + 38, + 39, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, ], "type": "Punctuator", - "value": "...", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 42, "line": 1, }, "start": Object { - "column": 7, + "column": 41, "line": 1, }, }, "range": Array [ - 7, - 8, + 41, + 42, ], "type": "Identifier", "value": "b", @@ -53280,71 +64110,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 43, "line": 1, }, "start": Object { - "column": 8, + "column": 42, "line": 1, }, }, "range": Array [ - 8, - 9, + 42, + 43, ], "type": "Punctuator", - "value": "]", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 45, "line": 1, }, "start": Object { - "column": 10, + "column": 44, "line": 1, }, }, "range": Array [ - 10, - 11, + 44, + 45, ], - "type": "Punctuator", - "value": "=", + "type": "Numeric", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 47, "line": 1, }, "start": Object { - "column": 12, + "column": 46, "line": 1, }, }, "range": Array [ - 12, - 13, + 46, + 47, ], - "type": "Identifier", - "value": "c", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 48, "line": 1, }, "start": Object { - "column": 13, + "column": 47, "line": 1, }, }, "range": Array [ - 13, - 14, + 47, + 48, ], "type": "Punctuator", "value": ";", @@ -53354,121 +64184,401 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-spread/single-destructured.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/property-spread.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "left": Object { - "elements": Array [ - Object { - "argument": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 42, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 56, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "name": "foo", + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + }, + "range": Array [ + 73, + 80, + ], + "type": "MemberExpression", + }, "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 14, + "line": 8, }, "start": Object { "column": 4, - "line": 1, + "line": 8, }, }, - "name": "a", "range": Array [ - 4, - 5, + 70, + 80, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, + "type": "ExperimentalSpreadProperty", }, - "range": Array [ - 1, - 5, - ], - "type": "RestElement", - }, - ], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + ], + "range": Array [ + 36, + 82, + ], + "type": "ObjectExpression", }, - }, - "operator": "=", - "range": Array [ - 0, - 10, - ], - "right": Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 5, }, }, - "name": "b", "range": Array [ - 9, - 10, + 32, + 82, ], - "type": "Identifier", + "type": "VariableDeclarator", }, - "type": "AssignmentExpression", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 11, + 28, + 83, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 10, }, "start": Object { "column": 0, @@ -53477,14 +64587,14 @@ Object { }, "range": Array [ 0, - 11, + 84, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -53494,472 +64604,259 @@ Object { }, "range": Array [ 0, - 1, + 3, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 7, "line": 1, }, "start": Object { - "column": 1, + "column": 4, "line": 1, }, }, "range": Array [ - 1, 4, + 7, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { - "column": 4, + "column": 7, "line": 1, }, }, "range": Array [ - 4, - 5, + 7, + 8, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 5, - 6, + 13, + 16, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "get", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 2, }, "start": Object { "column": 7, - "line": 1, + "line": 2, }, }, "range": Array [ - 7, - 8, + 16, + 17, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 9, - 10, + 22, + 25, ], "type": "Identifier", - "value": "b", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 8, + "line": 3, }, "start": Object { - "column": 10, - "line": 1, + "column": 7, + "line": 3, }, }, "range": Array [ - 10, - 11, + 25, + 26, ], "type": "Punctuator", "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring-and-spread/var-complex-destructured.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 7, - 8, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 10, - 11, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 10, - 11, - ], - "type": "Identifier", - }, - }, - ], - "range": Array [ - 5, - 13, - ], - "type": "ObjectPattern", - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 19, - ], - "type": "RestElement", - }, - ], - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 20, - ], - "type": "ArrayPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "d", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 24, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 25, + 28, + 31, ], - "type": "VariableDeclaration", + "type": "Keyword", + "value": "var", }, - ], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", }, - }, - "range": Array [ - 0, - 25, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 0, - 3, + 36, + 37, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 7, + "line": 6, }, "start": Object { "column": 4, - "line": 1, + "line": 6, }, }, "range": Array [ - 4, - 5, + 42, + 45, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 8, + "line": 6, }, "start": Object { - "column": 5, - "line": 1, + "column": 7, + "line": 6, }, }, "range": Array [ - 5, - 6, + 45, + 46, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 12, + "line": 6, }, "start": Object { - "column": 7, - "line": 1, + "column": 9, + "line": 6, }, }, "range": Array [ - 7, - 8, + 47, + 50, ], "type": "Identifier", - "value": "a", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 13, + "line": 6, }, "start": Object { - "column": 8, - "line": 1, + "column": 12, + "line": 6, }, }, "range": Array [ - 8, - 9, + 50, + 51, ], "type": "Punctuator", "value": ",", @@ -53967,53 +64864,71 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 7, + "line": 7, }, "start": Object { - "column": 10, - "line": 1, + "column": 4, + "line": 7, }, }, "range": Array [ - 10, - 11, + 56, + 59, ], "type": "Identifier", - "value": "b", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 8, + "line": 7, }, "start": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 7, }, }, "range": Array [ - 12, - 13, + 59, + 60, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 12, + "line": 7, }, "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { "column": 13, - "line": 1, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, }, }, "range": Array [ - 13, - 14, + 64, + 65, ], "type": "Punctuator", "value": ",", @@ -54021,17 +64936,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 7, + "line": 8, }, "start": Object { - "column": 15, - "line": 1, + "column": 4, + "line": 8, }, }, "range": Array [ - 15, - 18, + 70, + 73, ], "type": "Punctuator", "value": "...", @@ -54039,89 +64954,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 18, - "line": 1, + "column": 7, + "line": 8, }, }, "range": Array [ - 18, - 19, + 73, + 76, ], "type": "Identifier", - "value": "c", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 11, + "line": 8, }, "start": Object { - "column": 19, - "line": 1, + "column": 10, + "line": 8, }, }, "range": Array [ - 19, - 20, + 76, + 77, ], "type": "Punctuator", - "value": "]", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 14, + "line": 8, }, "start": Object { - "column": 21, - "line": 1, + "column": 11, + "line": 8, }, }, "range": Array [ - 21, - 22, + 77, + 80, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 23, - 24, + 81, + 82, ], - "type": "Identifier", - "value": "d", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 9, }, }, "range": Array [ - 24, - 25, + 82, + 83, ], "type": "Punctuator", "value": ";", @@ -54131,161 +65046,283 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-spread/var-destructured-array-literal.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-method-args.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "initialize", + "range": Array [ + 7, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 7, + 104, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 5, - "line": 1, + "column": 48, + "line": 2, }, }, - "name": "a", "range": Array [ - 5, - 6, + 51, + 104, ], - "type": "Identifier", + "type": "BlockStatement", }, - Object { - "argument": Object { - "elements": Array [ + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "properties": Array [ Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 16, + "line": 2, }, }, - "name": "b", + "method": false, "range": Array [ - 12, - 13, + 19, + 26, ], - "type": "Identifier", + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + }, }, Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 25, + "line": 2, }, }, - "name": "c", + "method": false, "range": Array [ - 15, - 16, + 28, + 36, ], - "type": "Identifier", - }, - ], - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + }, }, - }, - "range": Array [ - 11, - 17, - ], - "type": "ArrayPattern", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 17, - ], - "type": "RestElement", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 18, - ], - "type": "ArrayPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "d", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "name": "options", + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 38, + 48, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 18, + 49, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 17, + 104, + ], + "type": "FunctionExpression", }, }, - "range": Array [ - 4, - 22, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", + ], + "range": Array [ + 1, + 106, + ], + "type": "ObjectExpression", + }, "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, @@ -54294,15 +65331,15 @@ Object { }, "range": Array [ 0, - 23, + 108, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -54311,14 +65348,14 @@ Object { }, "range": Array [ 0, - 23, + 109, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -54328,182 +65365,56 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - "value": "a", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 11, + 1, ], "type": "Punctuator", - "value": "...", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 2, "line": 1, }, "start": Object { - "column": 11, + "column": 1, "line": 1, }, }, "range": Array [ - 11, - 12, + 1, + 2, ], "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - "value": "b", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - "value": "c", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 16, + 7, 17, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "initialize", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ @@ -54511,390 +65422,256 @@ Object { 18, ], "type": "Punctuator", - "value": "]", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ + 18, 19, - 20, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 21, - 22, + 19, + 26, ], "type": "Identifier", - "value": "d", + "value": "someVar", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 22, - 23, + 26, + 27, ], "type": "Punctuator", - "value": ";", + "value": ",", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/destructuring-and-spread/var-multi-destructured.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "elements": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 12, - ], - "type": "RestElement", - }, - ], - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 13, - ], - "type": "ArrayPattern", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 17, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 25, + "line": 2, }, }, "range": Array [ - 0, - 18, + 28, + 36, ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "otherVar", }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 34, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 33, + "line": 2, }, }, "range": Array [ - 0, - 3, + 36, + 37, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 38, + "line": 2, }, "start": Object { - "column": 4, - "line": 1, + "column": 35, + "line": 2, }, }, "range": Array [ - 4, - 5, + 38, + 41, ], "type": "Punctuator", - "value": "[", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 45, + "line": 2, }, "start": Object { - "column": 5, - "line": 1, + "column": 38, + "line": 2, }, }, "range": Array [ - 5, - 6, + 41, + 48, ], "type": "Identifier", - "value": "a", + "value": "options", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 46, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 45, + "line": 2, }, }, "range": Array [ - 6, - 7, + 48, + 49, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 47, + "line": 2, }, "start": Object { - "column": 8, - "line": 1, + "column": 46, + "line": 2, }, }, "range": Array [ - 8, - 11, + 49, + 50, ], "type": "Punctuator", - "value": "...", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 49, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 48, + "line": 2, }, }, "range": Array [ - 11, - 12, + 51, + 52, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 12, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 12, - 13, + 103, + 104, ], "type": "Punctuator", - "value": "]", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 5, }, }, "range": Array [ - 14, - 15, + 105, + 106, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 2, + "line": 5, }, "start": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 5, }, }, "range": Array [ - 16, - 17, + 106, + 107, ], - "type": "Identifier", - "value": "c", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 17, - "line": 1, + "column": 2, + "line": 5, }, }, "range": Array [ - 17, - 18, + 107, + 108, ], "type": "Punctuator", "value": ";", @@ -54904,53 +65681,16 @@ Object { } `; -exports[`ecmaFeatures fixtures/destructuring-and-spread/var-single-destructured.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-methods.src 1`] = ` Object { "body": Array [ Object { "declarations": Array [ Object { "id": Object { - "elements": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 9, - ], - "type": "RestElement", - }, - ], "loc": Object { "end": Object { - "column": 10, + "column": 5, "line": 1, }, "start": Object { @@ -54958,34 +65698,286 @@ Object { "line": 1, }, }, + "name": "x", "range": Array [ 4, - 10, + 5, ], - "type": "ArrayPattern", + "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 13, + "column": 8, "line": 1, }, }, - "name": "b", + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "initialize", + "range": Array [ + 14, + 24, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "range": Array [ + 14, + 111, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 58, + 111, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 26, + 33, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 35, + 43, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + }, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "name": "options", + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + }, + "computed": false, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 45, + 55, + ], + "shorthand": true, + "type": "ExperimentalRestProperty", + }, + ], + "range": Array [ + 25, + 56, + ], + "type": "ObjectPattern", + }, + ], + "range": Array [ + 24, + 111, + ], + "type": "FunctionExpression", + }, + }, + ], "range": Array [ - 13, - 14, + 8, + 113, ], - "type": "Identifier", + "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { "column": 4, @@ -54994,7 +65986,7 @@ Object { }, "range": Array [ 4, - 14, + 113, ], "type": "VariableDeclarator", }, @@ -55002,8 +65994,8 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 2, + "line": 5, }, "start": Object { "column": 0, @@ -55012,15 +66004,15 @@ Object { }, "range": Array [ 0, - 15, + 114, ], "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 2, + "line": 5, }, "start": Object { "column": 0, @@ -55029,7 +66021,7 @@ Object { }, "range": Array [ 0, - 15, + 114, ], "sourceType": "script", "tokens": Array [ @@ -55066,26 +66058,26 @@ Object { 4, 5, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 7, "line": 1, }, "start": Object { - "column": 5, + "column": 6, "line": 1, }, }, "range": Array [ - 5, - 8, + 6, + 7, ], "type": "Punctuator", - "value": "...", + "value": "=", }, Object { "loc": Object { @@ -55102,267 +66094,203 @@ Object { 8, 9, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 9, - 10, + 14, + 24, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "initialize", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 14, + "line": 2, }, }, "range": Array [ - 11, - 12, + 24, + 25, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 13, - 14, + 25, + 26, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 14, - 15, + 26, + 33, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "someVar", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/experimentalAsyncIteration/async-generators.src 1`] = ` -Object { - "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 26, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 16, - 19, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 24, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 23, + "line": 2, }, }, - "params": Array [], "range": Array [ - 0, - 26, + 33, + 34, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ",", }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 33, + "line": 2, }, "start": Object { - "column": 0, - "line": 1, + "column": 25, + "line": 2, }, }, "range": Array [ - 0, - 5, + 35, + 43, ], "type": "Identifier", - "value": "async", + "value": "otherVar", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 34, + "line": 2, }, "start": Object { - "column": 6, - "line": 1, + "column": 33, + "line": 2, }, }, "range": Array [ - 6, - 14, + 43, + 44, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 38, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 35, + "line": 2, }, }, "range": Array [ - 14, - 15, + 45, + 48, ], "type": "Punctuator", - "value": "*", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 45, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 38, + "line": 2, }, }, "range": Array [ - 16, - 19, + 48, + 55, ], "type": "Identifier", - "value": "foo", + "value": "options", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 46, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 45, + "line": 2, }, }, "range": Array [ - 19, - 20, + 55, + 56, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 47, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 46, + "line": 2, }, }, "range": Array [ - 20, - 21, + 56, + 57, ], "type": "Punctuator", "value": ")", @@ -55370,220 +66298,439 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 49, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 48, + "line": 2, }, }, "range": Array [ - 22, - 23, + 58, + 59, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, Object { "loc": Object { "end": Object { "column": 1, - "line": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 3, + "line": 5, }, }, "range": Array [ - 25, - 26, + 112, + 113, ], "type": "Punctuator", "value": "}", }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ";", + }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/experimentalAsyncIteration/async-iterator.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-properties.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "await": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", }, - "start": Object { - "column": 36, - "line": 2, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 42, + 45, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", }, }, - "range": Array [ - 59, - 67, - ], - "type": "BlockStatement", - }, - "left": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, }, - "name": "item", - "range": Array [ - 44, - 48, - ], - "type": "Identifier", }, - "init": null, + "name": "get", + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 51, + 54, + ], + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 7, + "line": 7, }, "start": Object { - "column": 21, - "line": 2, + "column": 4, + "line": 7, }, }, + "name": "get", "range": Array [ - 44, - 48, + 51, + 54, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 25, - "line": 2, + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 63, + 66, + ], + "type": "Identifier", }, - "start": Object { - "column": 15, - "line": 2, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, }, + "range": Array [ + 60, + 66, + ], + "type": "ExperimentalSpreadProperty", }, - "range": Array [ - 38, - 48, - ], - "type": "VariableDeclaration", - }, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, + ], "range": Array [ - 27, - 67, + 36, + 68, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 2, - }, - "start": Object { - "column": 29, - "line": 2, - }, - }, - "name": "items", - "range": Array [ - 52, - 57, - ], - "type": "Identifier", - }, - "type": "ForOfStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 69, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, + "type": "ObjectExpression", }, - "start": Object { - "column": 15, - "line": 1, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, }, + "range": Array [ + 32, + 68, + ], + "type": "VariableDeclarator", }, - "name": "foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 2, + "line": 9, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, - "params": Array [], "range": Array [ - 0, + 28, 69, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 10, }, "start": Object { "column": 0, @@ -55599,7 +66746,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 3, "line": 1, }, "start": Object { @@ -55609,43 +66756,25 @@ Object { }, "range": Array [ 0, - 5, - ], - "type": "Identifier", - "value": "async", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 14, + 3, ], "type": "Keyword", - "value": "function", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 7, "line": 1, }, "start": Object { - "column": 15, + "column": 4, "line": 1, }, }, "range": Array [ - 15, - 18, + 4, + 7, ], "type": "Identifier", "value": "foo", @@ -55653,56 +66782,20 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, + "column": 8, "line": 1, }, "start": Object { - "column": 21, + "column": 7, "line": 1, }, }, "range": Array [ - 21, - 22, + 7, + 8, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { @@ -55716,178 +66809,70 @@ Object { }, }, "range": Array [ - 27, - 30, - ], - "type": "Keyword", - "value": "for", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 31, - 36, + 13, + 16, ], "type": "Identifier", - "value": "await", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 8, "line": 2, }, "start": Object { - "column": 14, + "column": 7, "line": 2, }, }, "range": Array [ - 37, - 38, + 16, + 17, ], "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 38, - 43, - ], - "type": "Keyword", - "value": "const", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 21, - "line": 2, - }, - }, - "range": Array [ - 44, - 48, - ], - "type": "Identifier", - "value": "item", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 2, - }, - "start": Object { - "column": 26, - "line": 2, - }, - }, - "range": Array [ - 49, - 51, - ], - "type": "Identifier", - "value": "of", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 7, + "line": 3, }, "start": Object { - "column": 29, - "line": 2, + "column": 4, + "line": 3, }, }, "range": Array [ - 52, - 57, + 22, + 25, ], "type": "Identifier", - "value": "items", - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 2, - }, - "start": Object { - "column": 34, - "line": 2, - }, - }, - "range": Array [ - 57, - 58, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 2, - }, - "start": Object { - "column": 36, - "line": 2, - }, - }, - "range": Array [ - 59, - 60, - ], - "type": "Punctuator", - "value": "{", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 8, + "line": 3, }, "start": Object { - "column": 4, - "line": 4, + "column": 7, + "line": 3, }, }, "range": Array [ - 66, - 67, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 5, }, "start": Object { @@ -55896,358 +66881,206 @@ Object { }, }, "range": Array [ - 68, - 69, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/experimentalDynamicImport/dynamic-import.src 1`] = ` -Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "name": "main", - "range": Array [ - 19, - 23, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "object": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 12, - ], - "raw": "'foo'", - "type": "Literal", - "value": "foo", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Import", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 13, - ], - "type": "CallExpression", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "then", - "range": Array [ - 14, - 18, - ], - "type": "Identifier", - }, - "range": Array [ - 0, - 18, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 24, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 25, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + 28, + 31, + ], + "type": "Keyword", + "value": "var", }, - }, - "range": Array [ - 0, - 26, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 0, - 6, + 32, + 33, ], - "type": "Keyword", - "value": "import", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { "column": 7, - "line": 1, + "line": 5, }, "start": Object { "column": 6, - "line": 1, + "line": 5, }, }, "range": Array [ - 6, - 7, + 34, + 35, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 7, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 7, - 12, + 36, + 37, ], - "type": "String", - "value": "'foo'", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 7, + "line": 6, }, "start": Object { - "column": 12, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 12, - 13, + 42, + 45, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 8, + "line": 6, }, "start": Object { - "column": 13, - "line": 1, + "column": 7, + "line": 6, }, }, "range": Array [ - 13, - 14, + 45, + 46, ], "type": "Punctuator", - "value": ".", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 7, + "line": 7, }, "start": Object { - "column": 14, - "line": 1, + "column": 4, + "line": 7, }, }, "range": Array [ - 14, - 18, + 51, + 54, ], "type": "Identifier", - "value": "then", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 8, + "line": 7, }, "start": Object { - "column": 18, - "line": 1, + "column": 7, + "line": 7, }, }, "range": Array [ - 18, - 19, + 54, + 55, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 7, + "line": 8, }, "start": Object { - "column": 19, - "line": 1, + "column": 4, + "line": 8, }, }, "range": Array [ - 19, - 23, + 60, + 63, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 63, + 66, ], "type": "Identifier", - "value": "main", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 23, - 24, + 67, + 68, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { - "column": 24, - "line": 1, + "column": 1, + "line": 9, }, }, "range": Array [ - 24, - 25, + 68, + 69, ], "type": "Punctuator", "value": ";", @@ -56257,185 +67090,365 @@ Object { } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/arg-spread.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/single-spread.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 24, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", }, - "start": Object { - "column": 22, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", }, - "range": Array [ - 22, - 24, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", }, - "start": Object { - "column": 9, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", }, - "name": "c", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 8, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, - "params": Array [ + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, }, + "name": "x", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 12, + "line": 6, }, "start": Object { - "column": 12, - "line": 1, + "column": 4, + "line": 6, }, }, - "name": "a", + "method": false, "range": Array [ - 12, - 13, + 42, + 50, ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 47, + 50, + ], + "type": "Identifier", }, }, - "method": false, - "range": Array [ - 12, - 13, - ], - "shorthand": true, - "type": "Property", - "value": Object { + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 12, + "line": 7, }, "start": Object { - "column": 12, - "line": 1, + "column": 4, + "line": 7, }, }, - "name": "a", + "method": false, "range": Array [ - 12, - 13, + 56, + 64, ], - "type": "Identifier", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "get", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, }, - }, - Object { - "argument": Object { + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 18, - "line": 1, + "column": 4, + "line": 8, }, }, - "name": "b", "range": Array [ - 18, - 19, + 70, + 76, ], - "type": "Identifier", - }, - "computed": false, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "type": "ExperimentalSpreadProperty", }, - "range": Array [ - 15, - 19, - ], - "shorthand": true, - "type": "ExperimentalRestProperty", + ], + "range": Array [ + 36, + 78, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, }, - ], + "start": Object { + "column": 4, + "line": 5, + }, + }, "range": Array [ - 11, - 20, + 32, + 78, ], - "type": "ObjectPattern", + "type": "VariableDeclarator", }, ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, "range": Array [ - 0, - 24, + 28, + 79, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 10, }, "start": Object { "column": 0, @@ -56444,14 +67457,14 @@ Object { }, "range": Array [ 0, - 25, + 80, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 1, }, "start": Object { @@ -56461,97 +67474,79 @@ Object { }, "range": Array [ 0, - 8, + 3, ], "type": "Keyword", - "value": "function", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { - "column": 9, + "column": 4, "line": 1, }, }, "range": Array [ - 9, - 10, + 4, + 7, ], "type": "Identifier", - "value": "c", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": "(", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { - "column": 11, + "column": 7, "line": 1, }, }, "range": Array [ - 11, - 12, + 7, + 8, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 12, 13, + 16, ], "type": "Identifier", - "value": "a", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 13, - 14, + 16, + 17, ], "type": "Punctuator", "value": ",", @@ -56559,587 +67554,251 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 18, - ], - "type": "Punctuator", - "value": "...", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Identifier", - "value": "b", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 22, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ 22, - 23, + 25, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 8, + "line": 3, }, "start": Object { - "column": 23, - "line": 1, + "column": 7, + "line": 3, }, }, "range": Array [ - 23, - 24, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/destructuring-assign-mirror.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 2, - 3, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 2, - 3, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 8, - 9, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 9, - ], - "type": "ExperimentalRestProperty", - }, - ], - "range": Array [ - 1, - 10, - ], - "type": "ObjectPattern", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "operator": "=", - "range": Array [ - 1, - 22, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 14, - 15, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 14, - 15, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 20, - 21, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 21, - ], - "type": "ExperimentalSpreadProperty", - }, - ], - "range": Array [ - 13, - 22, - ], - "type": "ObjectExpression", - }, - "type": "AssignmentExpression", - }, "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 23, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + 28, + 31, + ], + "type": "Keyword", + "value": "var", }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 0, - 1, + 32, + 33, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { - "column": 1, - "line": 1, + "column": 6, + "line": 5, }, }, "range": Array [ - 1, - 2, + 34, + 35, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 2, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 2, - 3, + 36, + 37, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 7, + "line": 6, }, "start": Object { - "column": 3, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 3, - 4, + 42, + 45, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 6, }, "start": Object { - "column": 5, - "line": 1, + "column": 7, + "line": 6, }, }, "range": Array [ - 5, - 8, + 45, + 46, ], "type": "Punctuator", - "value": "...", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 12, + "line": 6, }, "start": Object { - "column": 8, - "line": 1, + "column": 9, + "line": 6, }, }, "range": Array [ - 8, - 9, + 47, + 50, ], "type": "Identifier", - "value": "b", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 13, + "line": 6, }, "start": Object { - "column": 9, - "line": 1, + "column": 12, + "line": 6, }, }, "range": Array [ - 9, - 10, + 50, + 51, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 7, + "line": 7, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 7, }, }, "range": Array [ - 11, - 12, + 56, + 59, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 8, + "line": 7, }, "start": Object { - "column": 13, - "line": 1, + "column": 7, + "line": 7, }, }, "range": Array [ - 13, - 14, + 59, + 60, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 12, + "line": 7, }, "start": Object { - "column": 14, - "line": 1, + "column": 9, + "line": 7, }, }, "range": Array [ - 14, - 15, + 61, + 64, ], "type": "Identifier", - "value": "a", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 13, + "line": 7, }, "start": Object { - "column": 15, - "line": 1, + "column": 12, + "line": 7, }, }, "range": Array [ - 15, - 16, + 64, + 65, ], "type": "Punctuator", "value": ",", @@ -57147,17 +67806,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 7, + "line": 8, }, "start": Object { - "column": 17, - "line": 1, + "column": 4, + "line": 8, }, }, "range": Array [ - 17, - 20, + 70, + 73, ], "type": "Punctuator", "value": "...", @@ -57165,35 +67824,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 20, - "line": 1, + "column": 7, + "line": 8, }, }, "range": Array [ - 20, - 21, + 73, + 76, ], "type": "Identifier", - "value": "b", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { - "column": 21, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 21, - 22, + 77, + 78, ], "type": "Punctuator", "value": "}", @@ -57201,142 +67860,213 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { - "column": 22, - "line": 1, + "column": 1, + "line": 9, }, }, "range": Array [ - 22, - 23, + 78, + 79, ], "type": "Punctuator", - "value": ")", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/function-parameter-object-spread.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/spread-trailing-comma.src 1`] = ` Object { "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 26, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 12, + "column": 16, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", }, - "start": Object { - "column": 13, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 3, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", }, }, - "properties": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, }, - "name": "bar", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", }, - "computed": false, + "name": "b", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { "loc": Object { "end": Object { - "column": 20, + "column": 7, "line": 1, }, "start": Object { - "column": 14, + "column": 6, "line": 1, }, }, + "name": "b", "range": Array [ - 14, - 20, + 6, + 7, ], - "shorthand": true, - "type": "ExperimentalRestProperty", + "type": "Identifier", }, - ], - "range": Array [ - 13, - 21, - ], - "type": "ObjectPattern", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "ExperimentalSpreadProperty", + }, + ], + "range": Array [ + 1, + 16, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, - ], + "start": Object { + "column": 0, + "line": 1, + }, + }, "range": Array [ 0, - 26, + 17, ], - "type": "FunctionDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { @@ -57351,14 +68081,14 @@ Object { }, "range": Array [ 0, - 27, + 18, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 1, "line": 1, }, "start": Object { @@ -57368,179 +68098,197 @@ Object { }, "range": Array [ 0, - 8, + 1, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 2, "line": 1, }, "start": Object { - "column": 9, + "column": 1, "line": 1, }, }, "range": Array [ - 9, - 12, + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, ], "type": "Identifier", - "value": "foo", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 1, }, "start": Object { - "column": 12, + "column": 4, "line": 1, }, }, "range": Array [ - 12, - 13, + 4, + 5, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 7, "line": 1, }, "start": Object { - "column": 13, + "column": 6, "line": 1, }, }, "range": Array [ - 13, - 14, + 6, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 8, "line": 1, }, "start": Object { - "column": 14, + "column": 7, "line": 1, }, }, "range": Array [ - 14, - 17, + 7, + 8, ], "type": "Punctuator", - "value": "...", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 12, "line": 1, }, "start": Object { - "column": 17, + "column": 9, "line": 1, }, }, "range": Array [ - 17, - 20, + 9, + 12, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 13, "line": 1, }, "start": Object { - "column": 20, + "column": 12, "line": 1, }, }, "range": Array [ - 20, - 21, + 12, + 13, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 1, }, "start": Object { - "column": 21, + "column": 13, "line": 1, }, }, "range": Array [ - 21, - 22, + 13, + 14, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 16, "line": 1, }, "start": Object { - "column": 23, + "column": 15, "line": 1, }, }, "range": Array [ - 23, - 24, + 15, + 16, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 1, }, "start": Object { - "column": 25, + "column": 16, "line": 1, }, }, "range": Array [ - 25, - 26, + 16, + 17, ], "type": "Punctuator", - "value": "}", + "value": ")", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/object-rest.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/two-spread.src 1`] = ` Object { "body": Array [ Object { @@ -57549,7 +68297,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 18, + "column": 7, "line": 1, }, "start": Object { @@ -57557,174 +68305,150 @@ Object { "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 6, - 7, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 9, - 10, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, + "start": Object { + "column": 4, + "line": 2, }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "z", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "computed": false, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 16, - ], - "shorthand": true, - "type": "ExperimentalRestProperty", + }, + "name": "get", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, }, + }, + "name": "set", + "range": Array [ + 22, + 25, ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", "range": Array [ - 4, - 18, + 32, + 33, ], - "type": "ObjectPattern", + "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { - "column": 21, - "line": 1, + "column": 8, + "line": 5, }, }, "properties": Array [ @@ -57733,253 +68457,148 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 23, - 27, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 29, - 30, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 29, - 33, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 33, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 36, - "line": 1, + "column": 7, + "line": 6, }, "start": Object { - "column": 35, - "line": 1, + "column": 4, + "line": 6, }, }, - "name": "a", + "name": "foo", "range": Array [ - 35, - 36, + 42, + 45, ], "type": "Identifier", }, "kind": "init", "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 12, + "line": 6, }, "start": Object { - "column": 35, - "line": 1, + "column": 4, + "line": 6, }, }, "method": false, "range": Array [ - 35, - 39, + 42, + 50, ], "shorthand": false, "type": "Property", "value": Object { "loc": Object { "end": Object { - "column": 39, - "line": 1, + "column": 12, + "line": 6, }, "start": Object { - "column": 38, - "line": 1, + "column": 9, + "line": 6, }, }, + "name": "foo", "range": Array [ - 38, - 39, + 47, + 50, ], - "raw": "3", - "type": "Literal", - "value": 3, + "type": "Identifier", }, }, Object { - "computed": false, - "key": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 10, + "line": 7, }, "start": Object { - "column": 41, - "line": 1, + "column": 7, + "line": 7, }, }, - "name": "b", + "name": "get", "range": Array [ - 41, - 42, + 59, + 62, ], "type": "Identifier", }, - "kind": "init", "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 10, + "line": 7, }, "start": Object { - "column": 41, - "line": 1, + "column": 4, + "line": 7, }, }, - "method": false, "range": Array [ - 41, - 45, + 56, + 62, ], - "shorthand": false, - "type": "Property", - "value": Object { + "type": "ExperimentalSpreadProperty", + }, + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 45, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 44, - "line": 1, + "column": 7, + "line": 8, }, }, + "name": "set", "range": Array [ - 44, - 45, + 71, + 74, ], - "raw": "4", - "type": "Literal", - "value": 4, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, }, + "range": Array [ + 68, + 74, + ], + "type": "ExperimentalSpreadProperty", }, ], "range": Array [ - 21, - 47, + 36, + 76, ], "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 47, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { "column": 4, - "line": 1, + "line": 5, }, }, "range": Array [ - 4, - 47, + 32, + 76, ], "type": "VariableDeclarator", }, @@ -57987,17 +68606,17 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 48, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 48, + 28, + 77, ], "type": "VariableDeclaration", }, @@ -58005,7 +68624,7 @@ Object { "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 10, }, "start": Object { "column": 0, @@ -58014,7 +68633,7 @@ Object { }, "range": Array [ 0, - 49, + 78, ], "sourceType": "script", "tokens": Array [ @@ -58039,7 +68658,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 7, "line": 1, }, "start": Object { @@ -58049,43 +68668,61 @@ Object { }, "range": Array [ 4, - 5, + 7, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 8, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, ], "type": "Identifier", - "value": "x", + "value": "get", }, Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 2, }, "start": Object { "column": 7, - "line": 1, + "line": 2, }, }, "range": Array [ - 7, - 8, + 16, + 17, ], "type": "Punctuator", "value": ",", @@ -58093,559 +68730,599 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 7, + "line": 3, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 9, - 10, + 22, + 25, ], "type": "Identifier", - "value": "y", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 8, + "line": 3, }, "start": Object { - "column": 10, - "line": 1, + "column": 7, + "line": 3, }, }, "range": Array [ - 10, - 11, + 25, + 26, ], "type": "Punctuator", - "value": ",", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { - "column": 12, - "line": 1, + "column": 0, + "line": 5, }, }, "range": Array [ - 12, - 15, + 28, + 31, ], - "type": "Punctuator", - "value": "...", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 15, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 15, - 16, + 32, + 33, ], "type": "Identifier", - "value": "z", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { - "column": 17, - "line": 1, + "column": 6, + "line": 5, }, }, "range": Array [ - 17, - 18, + 34, + 35, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 19, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 19, - 20, + 36, + 37, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 7, + "line": 6, }, "start": Object { - "column": 21, - "line": 1, + "column": 4, + "line": 6, }, }, "range": Array [ - 21, - 22, + 42, + 45, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, + "column": 8, + "line": 6, }, "start": Object { - "column": 23, - "line": 1, + "column": 7, + "line": 6, }, }, "range": Array [ - 23, - 24, + 45, + 46, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 12, + "line": 6, }, "start": Object { - "column": 24, - "line": 1, + "column": 9, + "line": 6, }, }, "range": Array [ - 24, - 25, + 47, + 50, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 13, + "line": 6, }, "start": Object { - "column": 26, - "line": 1, + "column": 12, + "line": 6, }, }, "range": Array [ - 26, - 27, + 50, + 51, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 7, + "line": 7, }, "start": Object { - "column": 27, - "line": 1, + "column": 4, + "line": 7, }, }, "range": Array [ - 27, - 28, + 56, + 59, ], "type": "Punctuator", - "value": ",", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 10, + "line": 7, }, "start": Object { - "column": 29, - "line": 1, + "column": 7, + "line": 7, }, }, "range": Array [ - 29, - 30, + 59, + 62, ], "type": "Identifier", - "value": "y", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 11, + "line": 7, }, "start": Object { - "column": 30, - "line": 1, + "column": 10, + "line": 7, }, }, "range": Array [ - 30, - 31, + 62, + 63, ], "type": "Punctuator", - "value": ":", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 7, + "line": 8, }, "start": Object { - "column": 32, - "line": 1, + "column": 4, + "line": 8, }, }, "range": Array [ - 32, - 33, + 68, + 71, ], - "type": "Numeric", - "value": "2", + "type": "Punctuator", + "value": "...", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 10, + "line": 8, }, "start": Object { - "column": 33, - "line": 1, + "column": 7, + "line": 8, }, }, "range": Array [ - 33, - 34, + 71, + 74, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 9, }, "start": Object { - "column": 35, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 35, - 36, + 75, + 76, ], - "type": "Identifier", - "value": "a", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 1, + "column": 2, + "line": 9, }, "start": Object { - "column": 36, - "line": 1, + "column": 1, + "line": 9, }, }, "range": Array [ - 36, - 37, + 76, + 77, ], "type": "Punctuator", - "value": ":", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/experimentalOptionalCatchBinding/optional-catch-binding.src 1`] = ` +Object { + "body": Array [ Object { + "block": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "param": null, + "range": Array [ + 7, + 15, + ], + "type": "CatchClause", + }, "loc": Object { "end": Object { - "column": 39, + "column": 15, "line": 1, }, "start": Object { - "column": 38, + "column": 0, "line": 1, }, }, "range": Array [ - 38, - 39, + 0, + 15, ], - "type": "Numeric", - "value": "3", + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 40, + "column": 3, "line": 1, }, "start": Object { - "column": 39, + "column": 0, "line": 1, }, }, "range": Array [ - 39, - 40, + 0, + 3, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "try", }, Object { "loc": Object { "end": Object { - "column": 42, + "column": 5, "line": 1, }, "start": Object { - "column": 41, + "column": 4, "line": 1, }, }, "range": Array [ - 41, - 42, + 4, + 5, ], - "type": "Identifier", - "value": "b", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 6, "line": 1, }, "start": Object { - "column": 42, + "column": 5, "line": 1, }, }, "range": Array [ - 42, - 43, + 5, + 6, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 12, "line": 1, }, "start": Object { - "column": 44, + "column": 7, "line": 1, }, }, "range": Array [ - 44, - 45, + 7, + 12, ], - "type": "Numeric", - "value": "4", + "type": "Keyword", + "value": "catch", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 14, "line": 1, }, "start": Object { - "column": 46, + "column": 13, "line": 1, }, }, "range": Array [ - 46, - 47, + 13, + 14, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 48, + "column": 15, "line": 1, }, "start": Object { - "column": 47, + "column": 14, "line": 1, }, }, "range": Array [ - 47, - 48, + 14, + 15, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/property-spread.src 1`] = ` +exports[`ecmaFeatures fixtures/experimentalOptionalCatchBinding/optional-catch-binding-finally.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", + "block": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, + "start": Object { + "column": 4, + "line": 1, }, - "range": Array [ - 4, - 7, - ], - "type": "VariableDeclarator", }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "get", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", + "range": Array [ + 4, + 6, + ], + "type": "BlockStatement", + }, + "finalizer": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, }, - "init": null, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "handler": Object { + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ 13, - 16, + 15, ], - "type": "VariableDeclarator", + "type": "BlockStatement", }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "set", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 22, - 25, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "param": null, + "range": Array [ + 7, + 15, + ], + "type": "CatchClause", + }, "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { "column": 0, @@ -58656,272 +69333,13 @@ Object { 0, 26, ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "name": "x", - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 8, - "line": 5, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 42, - 45, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "method": false, - "range": Array [ - 42, - 50, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 47, - 50, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "name": "get", - "range": Array [ - 56, - 59, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "method": false, - "range": Array [ - 56, - 64, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 7, - }, - "start": Object { - "column": 9, - "line": 7, - }, - }, - "name": "get", - "range": Array [ - 61, - 64, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "computed": false, - "loc": Object { - "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "object": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "name": "set", - "range": Array [ - 73, - 76, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { - "column": 11, - "line": 8, - }, - }, - "name": "foo", - "range": Array [ - 77, - 80, - ], - "type": "Identifier", - }, - "range": Array [ - 73, - 80, - ], - "type": "MemberExpression", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 70, - 80, - ], - "type": "ExperimentalSpreadProperty", - }, - ], - "range": Array [ - 36, - 82, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "range": Array [ - 32, - 82, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 2, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 28, - 83, - ], - "type": "VariableDeclaration", + "type": "TryStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 10, + "line": 2, }, "start": Object { "column": 0, @@ -58930,456 +69348,574 @@ Object { }, "range": Array [ 0, - 84, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 3, - ], - "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - "value": "foo", - }, + 27, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 3, "line": 1, }, "start": Object { - "column": 7, + "column": 0, "line": 1, }, }, "range": Array [ - 7, - 8, + 0, + 3, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "try", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 2, + "line": 1, }, }, "range": Array [ - 13, - 16, + 4, + 5, ], - "type": "Identifier", - "value": "get", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 6, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 16, - 17, + 5, + 6, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 22, - 25, + 7, + 12, ], - "type": "Identifier", - "value": "set", + "type": "Keyword", + "value": "catch", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 7, - "line": 3, + "column": 13, + "line": 1, }, }, "range": Array [ - 25, - 26, + 13, + 14, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 15, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 14, + "line": 1, }, }, "range": Array [ - 28, - 31, + 14, + 15, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 5, + "column": 16, + "line": 1, }, }, "range": Array [ - 32, - 33, + 16, + 23, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "finally", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 25, + "line": 1, }, "start": Object { - "column": 6, - "line": 5, + "column": 24, + "line": 1, }, }, "range": Array [ - 34, - 35, + 24, + 25, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 26, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 25, + "line": 1, }, }, "range": Array [ - 36, - 37, + 25, + 26, ], "type": "Punctuator", - "value": "{", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/exponentiationOperators/exponential-operators.src 1`] = ` +Object { + "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "**", + "range": Array [ + 8, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 15, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 42, - 45, + 0, + 15, ], - "type": "Identifier", - "value": "foo", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 6, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", }, - "start": Object { - "column": 7, - "line": 6, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "**=", + "range": Array [ + 16, + 23, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "4", + "type": "Literal", + "value": 4, }, + "type": "AssignmentExpression", }, - "range": Array [ - 45, - 46, - ], - "type": "Punctuator", - "value": ":", - }, - Object { "loc": Object { "end": Object { - "column": 12, - "line": 6, + "column": 8, + "line": 2, }, "start": Object { - "column": 9, - "line": 6, + "column": 0, + "line": 2, }, }, "range": Array [ - 47, - 50, + 16, + 24, ], - "type": "Identifier", - "value": "foo", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 3, + "line": 1, }, "start": Object { - "column": 12, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 50, - 51, + 0, + 3, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 5, + "line": 1, }, "start": Object { "column": 4, - "line": 7, + "line": 1, }, }, "range": Array [ - 56, - 59, + 4, + 5, ], "type": "Identifier", - "value": "get", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 7, + "line": 1, }, "start": Object { - "column": 7, - "line": 7, + "column": 6, + "line": 1, }, }, "range": Array [ - 59, - 60, + 6, + 7, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 7, + "column": 9, + "line": 1, }, "start": Object { - "column": 9, - "line": 7, + "column": 8, + "line": 1, }, }, "range": Array [ - 61, - 64, + 8, + 9, ], - "type": "Identifier", - "value": "get", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 12, + "line": 1, }, "start": Object { - "column": 12, - "line": 7, + "column": 10, + "line": 1, }, }, "range": Array [ - 64, - 65, + 10, + 12, ], "type": "Punctuator", - "value": ",", + "value": "**", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 14, + "line": 1, }, "start": Object { - "column": 4, - "line": 8, + "column": 13, + "line": 1, }, }, "range": Array [ - 70, - 73, + 13, + 14, ], - "type": "Punctuator", - "value": "...", + "type": "Numeric", + "value": "3", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 15, + "line": 1, }, "start": Object { - "column": 7, - "line": 8, + "column": 14, + "line": 1, }, }, "range": Array [ - 73, - 76, + 14, + 15, ], - "type": "Identifier", - "value": "set", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 8, + "column": 1, + "line": 2, }, "start": Object { - "column": 10, - "line": 8, + "column": 0, + "line": 2, }, }, "range": Array [ - 76, - 77, + 16, + 17, ], - "type": "Punctuator", - "value": ".", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 8, + "column": 5, + "line": 2, }, "start": Object { - "column": 11, - "line": 8, + "column": 2, + "line": 2, }, }, "range": Array [ - 77, - 80, + 18, + 21, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "**=", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 7, + "line": 2, }, "start": Object { - "column": 0, - "line": 9, + "column": 6, + "line": 2, }, }, "range": Array [ - 81, - 82, + 22, + 23, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "4", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 8, + "line": 2, }, "start": Object { - "column": 1, - "line": 9, + "column": 7, + "line": 2, }, }, - "range": Array [ - 82, - 83, + "range": Array [ + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -59389,283 +69925,255 @@ Object { } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-method-args.src 1`] = ` +exports[`ecmaFeatures fixtures/forOf/for-of-with-function-initializer.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { + "await": false, + "body": Object { + "expression": Object { + "arguments": Array [ + Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 62, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 61, + "line": 1, }, }, - "name": "initialize", + "name": "x", "range": Array [ - 7, - 17, + 61, + 62, ], "type": "Identifier", }, - "kind": "init", + ], + "callee": Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 60, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 53, + "line": 1, }, }, - "method": true, + "name": "process", "range": Array [ - 7, - 104, + 53, + 60, ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 48, - "line": 2, - }, - }, - "range": Array [ - 51, - 104, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 63, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 10, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 9, + "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "someVar", - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 19, - 26, - ], - "shorthand": true, - "type": "Property", - "value": Object { + "name": "i", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 35, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "someVar", - "range": Array [ - 19, - 26, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { "column": 33, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, + "line": 1, }, }, - "name": "otherVar", "range": Array [ - 28, - 36, + 33, + 35, ], - "type": "Identifier", + "raw": "10", + "type": "Literal", + "value": 10, }, - "kind": "init", "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 41, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 33, + "line": 1, }, }, - "method": false, + "operator": "in", "range": Array [ - 28, - 36, + 33, + 41, ], - "shorthand": true, - "type": "Property", - "value": Object { + "right": Object { + "elements": Array [], "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 41, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 39, + "line": 1, }, }, - "name": "otherVar", "range": Array [ - 28, - 36, + 39, + 41, ], - "type": "Identifier", + "type": "ArrayExpression", }, + "type": "BinaryExpression", }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 2, - }, - "start": Object { - "column": 38, - "line": 2, - }, - }, - "name": "options", - "range": Array [ - 41, - 48, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 41, + "line": 1, }, - "computed": false, - "loc": Object { - "end": Object { - "column": 45, - "line": 2, - }, - "start": Object { - "column": 35, - "line": 2, - }, + "start": Object { + "column": 26, + "line": 1, }, - "range": Array [ - 38, - 48, - ], - "shorthand": true, - "type": "ExperimentalRestProperty", }, - ], - "range": Array [ - 18, - 49, - ], - "type": "ObjectPattern", + "range": Array [ + 26, + 41, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, }, - ], + "range": Array [ + 24, + 43, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], "range": Array [ - 17, - 104, + 13, + 43, ], "type": "FunctionExpression", }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 43, + ], + "type": "VariableDeclarator", }, ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, "range": Array [ - 1, - 106, + 5, + 43, ], - "type": "ObjectExpression", + "type": "VariableDeclaration", }, "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 64, + "line": 1, }, "start": Object { "column": 0, @@ -59674,15 +70182,33 @@ Object { }, "range": Array [ 0, - 108, + 64, ], - "type": "ExpressionStatement", + "right": Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "list", + "range": Array [ + 47, + 51, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -59691,14 +70217,14 @@ Object { }, "range": Array [ 0, - 109, + 65, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -59708,7 +70234,25 @@ Object { }, "range": Array [ 0, - 1, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, ], "type": "Punctuator", "value": "(", @@ -59716,71 +70260,125 @@ Object { Object { "loc": Object { "end": Object { - "column": 2, + "column": 8, "line": 1, }, "start": Object { - "column": 1, + "column": 5, "line": 1, }, }, "range": Array [ - 1, - 2, + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 13, + "line": 1, }, }, "range": Array [ - 7, - 17, + 13, + 21, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, ], - "type": "Identifier", - "value": "initialize", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 23, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 17, - 18, + 22, + 23, ], "type": "Punctuator", - "value": "(", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 18, - 19, + 24, + 25, ], "type": "Punctuator", "value": "{", @@ -59788,156 +70386,156 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 32, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 26, + "line": 1, }, }, "range": Array [ - 19, 26, + 32, ], - "type": "Identifier", - "value": "someVar", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 35, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 33, + "line": 1, }, }, "range": Array [ - 26, - 27, + 33, + 35, ], - "type": "Punctuator", - "value": ",", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 38, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 36, + "line": 1, }, }, "range": Array [ - 28, 36, + 38, ], - "type": "Identifier", - "value": "otherVar", + "type": "Keyword", + "value": "in", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 40, + "line": 1, }, "start": Object { - "column": 33, - "line": 2, + "column": 39, + "line": 1, }, }, "range": Array [ - 36, - 37, + 39, + 40, ], "type": "Punctuator", - "value": ",", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 41, + "line": 1, }, "start": Object { - "column": 35, - "line": 2, + "column": 40, + "line": 1, }, }, "range": Array [ - 38, + 40, 41, ], "type": "Punctuator", - "value": "...", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 45, - "line": 2, + "column": 43, + "line": 1, }, "start": Object { - "column": 38, - "line": 2, + "column": 42, + "line": 1, }, }, "range": Array [ - 41, - 48, + 42, + 43, ], - "type": "Identifier", - "value": "options", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 46, - "line": 2, + "line": 1, }, "start": Object { - "column": 45, - "line": 2, + "column": 44, + "line": 1, }, }, "range": Array [ - 48, - 49, + 44, + 46, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "of", }, Object { "loc": Object { "end": Object { - "column": 47, - "line": 2, + "column": 51, + "line": 1, }, "start": Object { - "column": 46, - "line": 2, + "column": 47, + "line": 1, }, }, "range": Array [ - 49, - 50, + 47, + 51, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "list", }, Object { "loc": Object { "end": Object { - "column": 49, - "line": 2, + "column": 52, + "line": 1, }, "start": Object { - "column": 48, - "line": 2, + "column": 51, + "line": 1, }, }, "range": Array [ @@ -59945,58 +70543,76 @@ Object { 52, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 60, + "line": 1, }, "start": Object { - "column": 4, - "line": 4, + "column": 53, + "line": 1, }, }, "range": Array [ - 103, - 104, + 53, + 60, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "process", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 61, + "line": 1, }, "start": Object { - "column": 0, - "line": 5, + "column": 60, + "line": 1, }, }, "range": Array [ - 105, - 106, + 60, + 61, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 62, + "line": 1, }, "start": Object { - "column": 1, - "line": 5, + "column": 61, + "line": 1, }, }, "range": Array [ - 106, - 107, + 61, + 62, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, ], "type": "Punctuator", "value": ")", @@ -60004,17 +70620,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 64, + "line": 1, }, "start": Object { - "column": 2, - "line": 5, + "column": 63, + "line": 1, }, }, "range": Array [ - 107, - 108, + 63, + 64, ], "type": "Punctuator", "value": ";", @@ -60024,321 +70640,143 @@ Object { } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-methods.src 1`] = ` +exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-braces.src 1`] = ` Object { "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "initialize", - "range": Array [ - 14, - 24, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "method": true, - "range": Array [ - 14, - 111, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 48, - "line": 2, - }, - }, - "range": Array [ - 58, - 111, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "someVar", - "range": Array [ - 26, - 33, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 26, - 33, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "someVar", - "range": Array [ - 26, - 33, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, - }, - }, - "name": "otherVar", - "range": Array [ - 35, - 43, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, - }, - }, - "method": false, - "range": Array [ - 35, - 43, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 2, - }, - "start": Object { - "column": 25, - "line": 2, - }, - }, - "name": "otherVar", - "range": Array [ - 35, - 43, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 2, - }, - "start": Object { - "column": 38, - "line": 2, - }, - }, - "name": "options", - "range": Array [ - 48, - 55, - ], - "type": "Identifier", - }, - "computed": false, - "loc": Object { - "end": Object { - "column": 45, - "line": 2, - }, - "start": Object { - "column": 35, - "line": 2, - }, - }, - "range": Array [ - 45, - 55, - ], - "shorthand": true, - "type": "ExperimentalRestProperty", - }, - ], - "range": Array [ - 25, - 56, - ], - "type": "ObjectPattern", - }, - ], - "range": Array [ - 24, - 111, - ], - "type": "FunctionExpression", + Object { + "await": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "name": "doSomething", + "range": Array [ + 25, + 36, + ], + "type": "Identifier", }, - ], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 38, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, "range": Array [ - 8, - 113, + 25, + 39, ], - "type": "ObjectExpression", + "type": "ExpressionStatement", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 5, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 41, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", }, - "start": Object { - "column": 4, - "line": 1, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 4, - 113, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 1, + "line": 3, }, "start": Object { "column": 0, @@ -60347,15 +70785,33 @@ Object { }, "range": Array [ 0, - 114, + 41, ], - "type": "VariableDeclaration", + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", }, ], "loc": Object { "end": Object { - "column": 2, - "line": 5, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -60364,7 +70820,7 @@ Object { }, "range": Array [ 0, - 114, + 42, ], "sourceType": "script", "tokens": Array [ @@ -60384,7 +70840,7 @@ Object { 3, ], "type": "Keyword", - "value": "var", + "value": "for", }, Object { "loc": Object { @@ -60401,41 +70857,113 @@ Object { 4, 5, ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], "type": "Identifier", "value": "x", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 13, "line": 1, }, "start": Object { - "column": 6, + "column": 11, "line": 1, }, }, "range": Array [ - 6, - 7, + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 20, "line": 1, }, "start": Object { - "column": 8, + "column": 19, "line": 1, }, }, "range": Array [ - 8, - 9, + 19, + 20, ], "type": "Punctuator", "value": "{", @@ -60443,7 +70971,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 2, }, "start": Object { @@ -60452,188 +70980,430 @@ Object { }, }, "range": Array [ - 14, - 24, + 25, + 36, ], "type": "Identifier", - "value": "initialize", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-no-braces.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "range": Array [ + 23, + 34, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 36, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 3, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 24, - 25, + 0, + 3, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "for", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 4, + "line": 1, }, }, "range": Array [ - 25, - 26, + 4, + 5, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 5, + "line": 1, }, }, "range": Array [ - 26, - 33, + 5, + 8, ], - "type": "Identifier", - "value": "someVar", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 23, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 33, - 34, + 9, + 10, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 25, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 35, - 43, + 11, + 13, ], "type": "Identifier", - "value": "otherVar", + "value": "of", }, Object { "loc": Object { "end": Object { - "column": 34, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 33, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 43, - 44, + 14, + 17, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 38, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 35, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 45, - 48, + 17, + 18, ], "type": "Punctuator", - "value": "...", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 45, + "column": 15, "line": 2, }, "start": Object { - "column": 38, + "column": 4, "line": 2, }, }, "range": Array [ - 48, - 55, + 23, + 34, ], "type": "Identifier", - "value": "options", + "value": "doSomething", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 16, "line": 2, }, "start": Object { - "column": 45, + "column": 15, "line": 2, }, }, "range": Array [ - 55, - 56, + 34, + 35, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 47, + "column": 17, "line": 2, }, "start": Object { - "column": 46, + "column": 16, "line": 2, }, }, "range": Array [ - 56, - 57, + 35, + 36, ], "type": "Punctuator", "value": ")", @@ -60641,71 +71411,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 49, + "column": 18, "line": 2, }, "start": Object { - "column": 48, + "column": 17, "line": 2, }, }, "range": Array [ - 58, - 59, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "range": Array [ - 110, - 111, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 112, - 113, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 5, - }, - "start": Object { - "column": 1, - "line": 5, - }, - }, - "range": Array [ - 113, - 114, + 36, + 37, ], "type": "Punctuator", "value": ";", @@ -60715,52 +71431,18 @@ Object { } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/shorthand-properties.src 1`] = ` +exports[`ecmaFeatures fixtures/forOf/invalid-for-of-with-const-and-no-braces.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 7, - ], - "type": "VariableDeclarator", - }, - Object { - "id": Object { + "await": false, + "body": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 7, + "column": 15, "line": 2, }, "start": Object { @@ -60768,17 +71450,16 @@ Object { "line": 2, }, }, - "name": "get", + "name": "doSomething", "range": Array [ - 13, - 16, + 25, + 36, ], "type": "Identifier", }, - "init": null, "loc": Object { "end": Object { - "column": 7, + "column": 17, "line": 2, }, "start": Object { @@ -60787,293 +71468,122 @@ Object { }, }, "range": Array [ - 13, - 16, + 25, + 38, ], - "type": "VariableDeclarator", + "type": "CallExpression", }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "set", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", + "loc": Object { + "end": Object { + "column": 18, + "line": 2, }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, + "start": Object { + "column": 4, + "line": 2, }, - "range": Array [ - 22, - 25, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, }, + "range": Array [ + 25, + 39, + ], + "type": "ExpressionStatement", }, - "range": Array [ - 0, - 26, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "name": "x", - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 8, - "line": 5, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 42, - 45, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "method": false, - "range": Array [ - 42, - 45, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 42, - 45, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "name": "get", - "range": Array [ - 51, - 54, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "method": false, - "range": Array [ - 51, - 54, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "name": "get", - "range": Array [ - 51, - 54, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "name": "set", - "range": Array [ - 63, - 66, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, }, - "range": Array [ - 60, - 66, - ], - "type": "ExperimentalSpreadProperty", }, - ], + "name": "x", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, "range": Array [ - 36, - 68, + 11, + 12, ], - "type": "ObjectExpression", + "type": "VariableDeclarator", }, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 5, - }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 32, - 68, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 5, + 12, + ], + "type": "VariableDeclaration", + }, "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 18, + "line": 2, }, "start": Object { "column": 0, - "line": 5, + "line": 1, }, }, "range": Array [ - 28, - 69, + 0, + 39, ], - "type": "VariableDeclaration", + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 10, + "line": 3, }, "start": Object { "column": 0, @@ -61082,7 +71592,7 @@ Object { }, "range": Array [ 0, - 70, + 40, ], "sourceType": "script", "tokens": Array [ @@ -61102,12 +71612,12 @@ Object { 3, ], "type": "Keyword", - "value": "var", + "value": "for", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -61117,133 +71627,43 @@ Object { }, "range": Array [ 4, - 7, + 5, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - "value": "set", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 28, - 31, + 5, + 10, ], "type": "Keyword", - "value": "var", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 5, + "column": 11, + "line": 1, }, }, "range": Array [ - 32, - 33, + 11, + 12, ], "type": "Identifier", "value": "x", @@ -61251,53 +71671,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, - }, - "start": Object { - "column": 6, - "line": 5, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 5, + "column": 15, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 13, + "line": 1, }, }, "range": Array [ - 36, - 37, + 13, + 15, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "of", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 19, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 16, + "line": 1, }, }, "range": Array [ - 42, - 45, + 16, + 19, ], "type": "Identifier", "value": "foo", @@ -61305,125 +71707,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 20, + "line": 1, }, "start": Object { - "column": 7, - "line": 6, + "column": 19, + "line": 1, }, }, "range": Array [ - 45, - 46, + 19, + 20, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 15, + "line": 2, }, "start": Object { "column": 4, - "line": 7, + "line": 2, }, }, "range": Array [ - 51, - 54, + 25, + 36, ], "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 7, - }, - "start": Object { - "column": 7, - "line": 7, - }, - }, - "range": Array [ - 54, - 55, - ], - "type": "Punctuator", - "value": ",", + "value": "doSomething", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 16, + "line": 2, }, "start": Object { - "column": 4, - "line": 8, + "column": 15, + "line": 2, }, }, "range": Array [ - 60, - 63, + 36, + 37, ], "type": "Punctuator", - "value": "...", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "range": Array [ - 63, - 66, - ], - "type": "Identifier", - "value": "set", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 17, + "line": 2, }, "start": Object { - "column": 0, - "line": 9, + "column": 16, + "line": 2, }, }, "range": Array [ - 67, - 68, + 37, + 38, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 18, + "line": 2, }, "start": Object { - "column": 1, - "line": 9, + "column": 17, + "line": 2, }, }, "range": Array [ - 68, - 69, + 38, + 39, ], "type": "Punctuator", "value": ";", @@ -61433,365 +71799,159 @@ Object { } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/single-spread.src 1`] = ` +exports[`ecmaFeatures fixtures/forOf/invalid-for-of-with-let-and-no-braces.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 7, - ], - "type": "VariableDeclarator", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "get", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "VariableDeclarator", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": "set", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 22, - 25, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "name": "x", - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - }, - "init": Object { + "await": false, + "body": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 15, + "line": 2, }, "start": Object { - "column": 8, - "line": 5, + "column": 4, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 42, - 45, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "method": false, - "range": Array [ - 42, - 50, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 47, - 50, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "name": "get", - "range": Array [ - 56, - 59, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "method": false, - "range": Array [ - 56, - 64, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 7, - }, - "start": Object { - "column": 9, - "line": 7, - }, - }, - "name": "get", - "range": Array [ - 61, - 64, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "name": "set", - "range": Array [ - 73, - 76, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 70, - 76, - ], - "type": "ExperimentalSpreadProperty", - }, - ], + "name": "doSomething", "range": Array [ - 36, - 78, + 23, + 34, ], - "type": "ObjectExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 17, + "line": 2, }, "start": Object { "column": 4, - "line": 5, + "line": 2, }, }, "range": Array [ - 32, - 78, + 23, + 36, ], - "type": "VariableDeclarator", + "type": "CallExpression", }, - ], - "kind": "var", + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 18, + "line": 2, }, "start": Object { "column": 0, - "line": 5, + "line": 1, }, }, "range": Array [ - 28, - 79, + 0, + 37, ], - "type": "VariableDeclaration", + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + }, + "type": "ForOfStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 10, + "line": 3, }, "start": Object { "column": 0, @@ -61800,7 +71960,7 @@ Object { }, "range": Array [ 0, - 80, + 38, ], "sourceType": "script", "tokens": Array [ @@ -61820,12 +71980,12 @@ Object { 3, ], "type": "Keyword", - "value": "var", + "value": "for", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -61835,10 +71995,10 @@ Object { }, "range": Array [ 4, - 7, + 5, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -61847,373 +72007,491 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 5, "line": 1, }, }, "range": Array [ - 7, + 5, 8, ], - "type": "Punctuator", - "value": ",", + "type": "Keyword", + "value": "let", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 10, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, }, }, "range": Array [ + 11, 13, - 16, ], "type": "Identifier", - "value": "get", + "value": "of", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 15, + "line": 2, }, "start": Object { "column": 4, - "line": 3, + "line": 2, }, }, "range": Array [ - 22, - 25, + 23, + 34, ], "type": "Identifier", - "value": "set", + "value": "doSomething", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 16, + "line": 2, }, "start": Object { - "column": 7, - "line": 3, + "column": 15, + "line": 2, }, }, "range": Array [ - 25, - 26, + 34, + 35, ], "type": "Punctuator", - "value": ";", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 5, + "column": 17, + "line": 2, }, "start": Object { - "column": 0, - "line": 5, + "column": 16, + "line": 2, }, }, "range": Array [ - 28, - 31, + 35, + 36, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 18, + "line": 2, }, "start": Object { - "column": 4, - "line": 5, + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/anonymous-generator.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, }, + "params": Array [], + "range": Array [ + 1, + 25, + ], + "type": "FunctionExpression", }, - "range": Array [ - 32, - 33, - ], - "type": "Identifier", - "value": "x", - }, - Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 27, + "line": 1, }, "start": Object { - "column": 6, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 34, - 35, + 0, + 27, ], - "type": "Punctuator", - "value": "=", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 1, + "line": 1, }, "start": Object { - "column": 8, - "line": 5, + "column": 0, + "line": 1, }, }, "range": Array [ - 36, - 37, + 0, + 1, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 9, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 1, + "line": 1, }, }, "range": Array [ - 42, - 45, + 1, + 9, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 10, + "line": 1, }, "start": Object { - "column": 7, - "line": 6, + "column": 9, + "line": 1, }, }, "range": Array [ - 45, - 46, + 9, + 10, ], "type": "Punctuator", - "value": ":", + "value": "*", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 6, + "line": 1, }, "start": Object { - "column": 9, - "line": 6, + "column": 11, + "line": 1, }, }, "range": Array [ - 47, - 50, + 11, + 12, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 13, - "line": 6, + "line": 1, }, "start": Object { "column": 12, - "line": 6, + "line": 1, }, }, "range": Array [ - 50, - 51, + 12, + 13, ], "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "range": Array [ - 56, - 59, - ], - "type": "Identifier", - "value": "get", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 15, + "line": 1, }, "start": Object { - "column": 7, - "line": 7, + "column": 14, + "line": 1, }, }, "range": Array [ - 59, - 60, + 14, + 15, ], "type": "Punctuator", - "value": ":", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 7, + "column": 21, + "line": 1, }, "start": Object { - "column": 9, - "line": 7, + "column": 16, + "line": 1, }, }, "range": Array [ - 61, - 64, + 16, + 21, ], - "type": "Identifier", - "value": "get", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 23, + "line": 1, }, "start": Object { - "column": 12, - "line": 7, + "column": 22, + "line": 1, }, }, "range": Array [ - 64, - 65, + 22, + 23, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 8, + "column": 25, + "line": 1, }, "start": Object { - "column": 4, - "line": 8, + "column": 24, + "line": 1, }, }, "range": Array [ - 70, - 73, + 24, + 25, ], "type": "Punctuator", - "value": "...", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "range": Array [ - 73, - 76, - ], - "type": "Identifier", - "value": "set", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 26, + "line": 1, }, "start": Object { - "column": 0, - "line": 9, + "column": 25, + "line": 1, }, }, "range": Array [ - 77, - 78, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 27, + "line": 1, }, "start": Object { - "column": 1, - "line": 9, + "column": 26, + "line": 1, }, }, "range": Array [ - 78, - 79, + 26, + 27, ], "type": "Punctuator", "value": ";", @@ -62223,751 +72501,483 @@ Object { } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/spread-trailing-comma.src 1`] = ` +exports[`ecmaFeatures fixtures/generators/async-generator-function.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { + "async": true, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 1, - "line": 1, + "column": 22, + "line": 2, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 3, - 4, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 3, - 4, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 3, - 4, - ], - "type": "Identifier", - }, - }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 6, - 7, - ], - "shorthand": true, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "b", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "c", - "range": Array [ - 12, - 13, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 13, - ], - "type": "ExperimentalSpreadProperty", - }, - ], "range": Array [ - 1, - 16, + 23, + 27, ], - "type": "ObjectExpression", + "type": "BlockStatement", }, - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", }, - "range": Array [ - 0, - 17, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "sourceType": "script", - "tokens": Array [ - Object { "loc": Object { "end": Object { "column": 1, - "line": 1, + "line": 4, }, "start": Object { "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, + "line": 2, }, }, + "params": Array [], "range": Array [ 1, - 2, + 27, ], - "type": "Punctuator", - "value": "{", + "type": "FunctionDeclaration", }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 4, - ], - "type": "Identifier", - "value": "a", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 2, }, + }, + "range": Array [ + 1, + 28, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { "column": 5, - "line": 1, + "line": 2, }, "start": Object { - "column": 4, - "line": 1, + "column": 0, + "line": 2, }, }, "range": Array [ - 4, - 5, + 1, + 6, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "async", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { "column": 6, - "line": 1, + "line": 2, }, }, "range": Array [ - 6, 7, + 15, ], - "type": "Identifier", - "value": "b", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 7, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 7, - 8, + 16, + 17, ], "type": "Punctuator", - "value": ",", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 9, - 12, + 17, + 20, ], - "type": "Punctuator", - "value": "...", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 20, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 12, - 13, + 20, + 21, ], - "type": "Identifier", - "value": "c", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 21, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 20, + "line": 2, }, }, "range": Array [ - 13, - 14, + 21, + 22, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 15, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 15, - 16, + 23, + 24, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 16, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 16, - 17, + 26, + 27, ], "type": "Punctuator", - "value": ")", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/two-spread.src 1`] = ` +exports[`ecmaFeatures fixtures/generators/async-generator-method.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 7, - ], - "type": "VariableDeclarator", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "get", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 13, - 16, - ], - "type": "VariableDeclarator", - }, - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, }, + "name": "f", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", }, - "name": "set", - "range": Array [ - 22, - 25, - ], - "type": "Identifier", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "range": Array [ - 22, - 25, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { + "kind": "method", "loc": Object { "end": Object { "column": 5, - "line": 5, + "line": 4, }, "start": Object { "column": 4, - "line": 5, + "line": 2, }, }, - "name": "x", "range": Array [ - 32, - 33, + 14, + 63, ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 8, - "line": 5, - }, - }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 42, - 45, - ], - "type": "Identifier", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "method": false, - "range": Array [ - 42, - 50, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 47, - 50, - ], - "type": "Identifier", - }, - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 7, - }, - "start": Object { - "column": 7, - "line": 7, - }, - }, - "name": "get", - "range": Array [ - 59, - 62, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "range": Array [ - 56, - 62, - ], - "type": "ExperimentalSpreadProperty", - }, - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "x", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "init": Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "name": "g", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "CallExpression", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 56, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 56, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, }, + "range": Array [ + 36, + 57, + ], + "type": "VariableDeclaration", }, - "name": "set", - "range": Array [ - 71, - 74, - ], - "type": "Identifier", - }, + ], "loc": Object { "end": Object { - "column": 10, - "line": 8, + "column": 5, + "line": 4, }, "start": Object { - "column": 4, - "line": 8, + "column": 16, + "line": 2, }, }, "range": Array [ - 68, - 74, + 26, + 63, ], - "type": "ExperimentalSpreadProperty", + "type": "BlockStatement", }, - ], - "range": Array [ - 36, - 76, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 4, - "line": 5, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 63, + ], + "type": "FunctionExpression", }, }, - "range": Array [ - 32, - 76, - ], - "type": "VariableDeclarator", + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - ], - "kind": "var", + "range": Array [ + 8, + 65, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 1, + "line": 5, }, "start": Object { "column": 0, - "line": 5, + "line": 1, }, }, "range": Array [ - 28, - 77, + 0, + 65, ], - "type": "VariableDeclaration", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 10, + "line": 6, }, "start": Object { "column": 0, @@ -62976,14 +72986,14 @@ Object { }, "range": Array [ 0, - 78, + 66, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 5, "line": 1, }, "start": Object { @@ -62993,10 +73003,10 @@ Object { }, "range": Array [ 0, - 3, + 5, ], "type": "Keyword", - "value": "var", + "value": "class", }, Object { "loc": Object { @@ -63005,39 +73015,39 @@ Object { "line": 1, }, "start": Object { - "column": 4, + "column": 6, "line": 1, }, }, "range": Array [ - 4, + 6, 7, ], "type": "Identifier", - "value": "foo", + "value": "C", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, 8, + 9, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 2, }, "start": Object { @@ -63046,537 +73056,296 @@ Object { }, }, "range": Array [ - 13, - 16, + 14, + 19, ], "type": "Identifier", - "value": "get", + "value": "async", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 11, "line": 2, }, "start": Object { - "column": 7, + "column": 10, "line": 2, }, }, "range": Array [ - 16, - 17, + 20, + 21, ], "type": "Punctuator", - "value": ",", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 13, + "line": 2, }, "start": Object { - "column": 4, - "line": 3, + "column": 12, + "line": 2, }, }, "range": Array [ 22, - 25, + 23, ], "type": "Identifier", - "value": "set", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 14, + "line": 2, }, "start": Object { - "column": 7, - "line": 3, + "column": 13, + "line": 2, }, }, "range": Array [ - 25, - 26, + 23, + 24, ], "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 5, - }, - "start": Object { - "column": 0, - "line": 5, - }, - }, - "range": Array [ - 28, - 31, - ], - "type": "Keyword", - "value": "var", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 5, + "column": 15, + "line": 2, }, "start": Object { - "column": 4, - "line": 5, + "column": 14, + "line": 2, }, }, "range": Array [ - 32, - 33, + 24, + 25, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 17, + "line": 2, }, "start": Object { - "column": 6, - "line": 5, + "column": 16, + "line": 2, }, }, "range": Array [ - 34, - 35, + 26, + 27, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 5, + "column": 13, + "line": 3, }, "start": Object { "column": 8, - "line": 5, + "line": 3, }, }, "range": Array [ 36, - 37, + 41, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 15, + "line": 3, }, "start": Object { - "column": 4, - "line": 6, + "column": 14, + "line": 3, }, }, "range": Array [ 42, - 45, + 43, ], "type": "Identifier", - "value": "foo", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 6, + "column": 17, + "line": 3, }, "start": Object { - "column": 7, - "line": 6, + "column": 16, + "line": 3, }, }, "range": Array [ + 44, 45, - 46, ], "type": "Punctuator", - "value": ":", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 6, - }, - "start": Object { - "column": 9, - "line": 6, - }, - }, - "range": Array [ - 47, - 50, - ], - "type": "Identifier", - "value": "foo", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 23, + "line": 3, }, "start": Object { - "column": 12, - "line": 6, + "column": 18, + "line": 3, }, }, "range": Array [ - 50, + 46, 51, ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "range": Array [ - 56, - 59, - ], - "type": "Punctuator", - "value": "...", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 7, - }, - "start": Object { - "column": 7, - "line": 7, - }, - }, - "range": Array [ - 59, - 62, - ], - "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 7, - }, - "start": Object { - "column": 10, - "line": 7, - }, - }, - "range": Array [ - 62, - 63, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 68, - 71, - ], - "type": "Punctuator", - "value": "...", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 8, - }, - "start": Object { - "column": 7, - "line": 8, - }, - }, - "range": Array [ - 71, - 74, - ], - "type": "Identifier", - "value": "set", - }, - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 9, - }, - }, - "range": Array [ - 75, - 76, - ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 9, + "column": 24, + "line": 3, }, "start": Object { - "column": 1, - "line": 9, + "column": 23, + "line": 3, }, }, "range": Array [ - 76, - 77, + 51, + 52, ], "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/experimentalOptionalCatchBinding/optional-catch-binding.src 1`] = ` -Object { - "body": Array [ - Object { - "block": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 6, - ], - "type": "BlockStatement", - }, - "finalizer": null, - "handler": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 15, - ], - "type": "BlockStatement", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "param": null, - "range": Array [ - 7, - 15, - ], - "type": "CatchClause", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 15, - ], - "type": "TryStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "value": "*", }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 26, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 25, + "line": 3, }, }, "range": Array [ - 0, - 3, + 53, + 54, ], - "type": "Keyword", - "value": "try", + "type": "Identifier", + "value": "g", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 27, + "line": 3, }, "start": Object { - "column": 4, - "line": 1, + "column": 26, + "line": 3, }, }, "range": Array [ - 4, - 5, + 54, + 55, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 28, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 27, + "line": 3, }, }, "range": Array [ - 5, - 6, + 55, + 56, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 29, + "line": 3, }, "start": Object { - "column": 7, - "line": 1, + "column": 28, + "line": 3, }, }, "range": Array [ - 7, - 12, + 56, + 57, ], - "type": "Keyword", - "value": "catch", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 5, + "line": 4, }, "start": Object { - "column": 13, - "line": 1, + "column": 4, + "line": 4, }, }, "range": Array [ - 13, - 14, + 62, + 63, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 5, }, }, "range": Array [ - 14, - 15, + 64, + 65, ], "type": "Punctuator", "value": "}", @@ -63586,85 +73355,126 @@ Object { } `; -exports[`ecmaFeatures fixtures/experimentalOptionalCatchBinding/optional-catch-binding-finally.src 1`] = ` +exports[`ecmaFeatures fixtures/generators/double-yield.src 1`] = ` Object { "body": Array [ Object { - "block": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 6, - ], - "type": "BlockStatement", - }, - "finalizer": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 26, - ], - "type": "BlockStatement", - }, - "handler": Object { + "expression": Object { + "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "type": "YieldExpression", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "ExpressionStatement", + }, + ], "loc": Object { "end": Object { - "column": 15, + "column": 32, "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, "range": Array [ - 13, - 15, + 14, + 32, ], "type": "BlockStatement", }, + "expression": false, + "generator": true, + "id": null, "loc": Object { "end": Object { - "column": 15, + "column": 32, "line": 1, }, "start": Object { - "column": 7, + "column": 1, "line": 1, }, }, - "param": null, + "params": Array [], "range": Array [ - 7, - 15, + 1, + 32, ], - "type": "CatchClause", + "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 26, + "column": 34, "line": 1, }, "start": Object { @@ -63674,15 +73484,15 @@ Object { }, "range": Array [ 0, - 26, + 34, ], - "type": "TryStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 34, + "line": 1, }, "start": Object { "column": 0, @@ -63691,14 +73501,14 @@ Object { }, "range": Array [ 0, - 27, + 34, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -63708,46 +73518,46 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "try", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 5, + 1, + 9, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 6, + 9, + 10, ], "type": "Punctuator", - "value": "}", + "value": "*", }, Object { "loc": Object { @@ -63756,34 +73566,34 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 11, "line": 1, }, }, "range": Array [ - 7, + 11, 12, ], - "type": "Keyword", - "value": "catch", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 14, ], "type": "Punctuator", - "value": "{", + "value": ")", }, Object { "loc": Object { @@ -63801,12 +73611,12 @@ Object { 15, ], "type": "Punctuator", - "value": "}", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 1, }, "start": Object { @@ -63816,243 +73626,188 @@ Object { }, "range": Array [ 16, - 23, + 21, ], "type": "Keyword", - "value": "finally", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 27, "line": 1, }, "start": Object { - "column": 24, + "column": 22, "line": 1, }, }, "range": Array [ - 24, - 25, + 22, + 27, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 30, "line": 1, }, "start": Object { - "column": 25, + "column": 28, "line": 1, }, }, "range": Array [ - 25, - 26, + 28, + 30, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, ], "type": "Punctuator", "value": "}", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/exponentiationOperators/exponential-operators.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - }, - "init": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "operator": "**", - "range": Array [ - 8, - 14, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "raw": "3", - "type": "Literal", - "value": 3, - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 14, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, ], - "kind": "var", + "type": "Punctuator", + "value": ")", + }, + Object { "loc": Object { "end": Object { - "column": 15, + "column": 34, "line": 1, }, "start": Object { - "column": 0, + "column": 33, "line": 1, }, }, "range": Array [ - 0, - 15, + 33, + 34, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/empty-generator-declaration.src 1`] = ` +Object { + "body": Array [ Object { - "expression": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "name": "x", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 10, + "line": 1, }, }, - "operator": "**=", + "name": "t", "range": Array [ - 16, - 23, + 10, + 11, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "raw": "4", - "type": "Literal", - "value": 4, - }, - "type": "AssignmentExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, + "params": Array [], "range": Array [ + 0, 16, - 24, ], - "type": "ExpressionStatement", + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { "column": 0, @@ -64061,14 +73816,14 @@ Object { }, "range": Array [ 0, - 25, + 17, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 8, "line": 1, }, "start": Object { @@ -64078,64 +73833,46 @@ Object { }, "range": Array [ 0, - 3, + 8, ], "type": "Keyword", - "value": "var", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Identifier", - "value": "x", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 9, "line": 1, }, "start": Object { - "column": 6, + "column": 8, "line": 1, }, }, "range": Array [ - 6, - 7, + 8, + 9, ], "type": "Punctuator", - "value": "=", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "t", }, Object { "loc": Object { @@ -64144,34 +73881,34 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, + 11, 12, ], "type": "Punctuator", - "value": "**", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 13, - 14, ], - "type": "Numeric", - "value": "3", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { @@ -64189,76 +73926,40 @@ Object { 15, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 0, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ + 15, 16, - 17, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 2, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 18, - 21, ], "type": "Punctuator", - "value": "**=", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Numeric", - "value": "4", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 23, - 24, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -64268,254 +73969,106 @@ Object { } `; -exports[`ecmaFeatures fixtures/forOf/for-of-with-function-initializer.src 1`] = ` +exports[`ecmaFeatures fixtures/generators/generator-declaration.src 1`] = ` Object { "body": Array [ Object { - "await": false, + "async": false, "body": Object { - "expression": Object { - "arguments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 61, - 62, - ], - "type": "Identifier", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 60, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "name": "process", - "range": Array [ - 53, - 60, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 63, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "range": Array [ - 53, - 63, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 64, - "line": 1, - }, - "start": Object { - "column": 53, - "line": 1, - }, - }, - "range": Array [ - 53, - 64, - ], - "type": "ExpressionStatement", - }, - "left": Object { - "declarations": Array [ + "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "i", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", - }, - "init": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 35, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "operator": "in", - "range": Array [ - 33, - 41, - ], - "right": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 41, - ], - "type": "ArrayExpression", - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 41, - ], - "type": "ReturnStatement", - }, - ], + "expression": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 43, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 27, "line": 1, }, }, + "name": "v", "range": Array [ - 24, - 43, + 27, + 28, ], - "type": "BlockStatement", + "type": "Identifier", }, - "expression": false, - "generator": false, - "id": null, + "delegate": true, "loc": Object { "end": Object { - "column": 43, + "column": 28, "line": 1, }, "start": Object { - "column": 13, + "column": 20, "line": 1, }, }, - "params": Array [], "range": Array [ - 13, - 43, + 20, + 28, ], - "type": "FunctionExpression", + "type": "YieldExpression", }, "loc": Object { "end": Object { - "column": 43, + "column": 28, "line": 1, }, "start": Object { - "column": 9, + "column": 20, "line": 1, }, }, "range": Array [ - 9, - 43, + 20, + 28, ], - "type": "VariableDeclarator", + "type": "ExpressionStatement", }, ], - "kind": "var", "loc": Object { "end": Object { - "column": 43, + "column": 30, "line": 1, }, "start": Object { - "column": 5, + "column": 18, "line": 1, }, }, "range": Array [ - 5, - 43, + 18, + 30, ], - "type": "VariableDeclaration", + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "range": Array [ + 10, + 14, + ], + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 64, + "column": 30, "line": 1, }, "start": Object { @@ -64523,35 +74076,35 @@ Object { "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 64, + 30, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 51, - "line": 1, - }, - "start": Object { - "column": 47, - "line": 1, - }, + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, }, - "name": "list", - "range": Array [ - 47, - 51, - ], - "type": "Identifier", }, - "type": "ForOfStatement", + "range": Array [ + 30, + 31, + ], + "type": "EmptyStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { "column": 0, @@ -64560,14 +74113,14 @@ Object { }, "range": Array [ 0, - 65, + 31, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 8, "line": 1, }, "start": Object { @@ -64577,385 +74130,521 @@ Object { }, "range": Array [ 0, - 3, + 8, ], "type": "Keyword", - "value": "for", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 8, "line": 1, }, }, "range": Array [ - 4, - 5, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, "line": 1, }, "start": Object { - "column": 5, + "column": 15, "line": 1, }, }, "range": Array [ - 5, - 8, + 15, + 16, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 17, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, "range": Array [ - 9, - 10, + 16, + 17, ], - "type": "Identifier", - "value": "i", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 19, "line": 1, }, "start": Object { - "column": 11, + "column": 18, "line": 1, }, }, "range": Array [ - 11, - 12, + 18, + 19, ], "type": "Punctuator", - "value": "=", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 25, "line": 1, }, "start": Object { - "column": 13, + "column": 20, "line": 1, }, }, "range": Array [ - 13, - 21, + 20, + 25, ], "type": "Keyword", - "value": "function", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 1, }, "start": Object { - "column": 21, + "column": 26, "line": 1, }, }, "range": Array [ - 21, - 22, + 26, + 27, ], "type": "Punctuator", - "value": "(", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 28, "line": 1, }, "start": Object { - "column": 22, + "column": 27, "line": 1, }, }, "range": Array [ - 22, - 23, + 27, + 28, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 30, "line": 1, }, "start": Object { - "column": 24, + "column": 29, "line": 1, }, }, "range": Array [ - 24, - 25, + 29, + 30, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 31, "line": 1, }, "start": Object { - "column": 26, + "column": 30, "line": 1, }, }, "range": Array [ - 26, - 32, + 30, + 31, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/generators/yield-delegation.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 26, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "type": "FunctionExpression", + }, "loc": Object { "end": Object { - "column": 35, + "column": 28, "line": 1, }, "start": Object { - "column": 33, + "column": 0, "line": 1, }, }, "range": Array [ - 33, - 35, + 0, + 28, ], - "type": "Numeric", - "value": "10", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 38, + "column": 1, "line": 1, }, "start": Object { - "column": 36, + "column": 0, "line": 1, }, }, "range": Array [ - 36, - 38, + 0, + 1, ], - "type": "Keyword", - "value": "in", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 40, + "column": 9, "line": 1, }, "start": Object { - "column": 39, + "column": 1, "line": 1, }, }, "range": Array [ - 39, - 40, + 1, + 9, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 10, "line": 1, }, "start": Object { - "column": 40, + "column": 9, "line": 1, }, }, "range": Array [ - 40, - 41, + 9, + 10, ], "type": "Punctuator", - "value": "]", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 43, + "column": 12, "line": 1, }, "start": Object { - "column": 42, + "column": 11, "line": 1, }, }, "range": Array [ - 42, - 43, + 11, + 12, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 46, + "column": 13, "line": 1, }, "start": Object { - "column": 44, + "column": 12, "line": 1, }, }, "range": Array [ - 44, - 46, + 12, + 13, ], - "type": "Identifier", - "value": "of", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 51, + "column": 15, "line": 1, }, "start": Object { - "column": 47, + "column": 14, "line": 1, }, }, "range": Array [ - 47, - 51, + 14, + 15, ], - "type": "Identifier", - "value": "list", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 52, + "column": 21, "line": 1, }, "start": Object { - "column": 51, + "column": 16, "line": 1, }, }, "range": Array [ - 51, - 52, + 16, + 21, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 60, + "column": 23, "line": 1, }, "start": Object { - "column": 53, + "column": 22, "line": 1, }, }, "range": Array [ - 53, - 60, + 22, + 23, ], - "type": "Identifier", - "value": "process", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 61, + "column": 24, "line": 1, }, "start": Object { - "column": 60, + "column": 23, "line": 1, }, }, "range": Array [ - 60, - 61, + 23, + 24, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 62, + "column": 26, "line": 1, }, "start": Object { - "column": 61, + "column": 25, "line": 1, }, }, "range": Array [ - 61, - 62, + 25, + 26, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 63, + "column": 27, "line": 1, }, "start": Object { - "column": 62, + "column": 26, "line": 1, }, }, "range": Array [ - 62, - 63, + 26, + 27, ], "type": "Punctuator", "value": ")", @@ -64963,17 +74652,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 64, + "column": 28, "line": 1, }, "start": Object { - "column": 63, + "column": 27, "line": 1, }, }, "range": Array [ - 63, - 64, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -64983,178 +74672,108 @@ Object { } `; -exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-braces.src 1`] = ` +exports[`ecmaFeatures fixtures/generators/yield-without-value.src 1`] = ` Object { "body": Array [ Object { - "await": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [], - "callee": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "argument": null, + "delegate": false, "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, }, }, - "name": "doSomething", "range": Array [ - 25, - 36, + 16, + 21, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 25, - 38, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "type": "YieldExpression", }, - }, - "range": Array [ - 25, - 39, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 41, - ], - "type": "BlockStatement", - }, - "left": Object { - "declarations": Array [ - Object { - "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 22, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, - "name": "x", "range": Array [ - 9, - 10, + 16, + 22, ], - "type": "Identifier", + "type": "ExpressionStatement", }, - "init": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 9, - 10, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 14, + 24, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 24, "line": 1, }, "start": Object { - "column": 5, + "column": 1, "line": 1, }, }, + "params": Array [], "range": Array [ - 5, - 10, + 1, + 24, ], - "type": "VariableDeclaration", + "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, "line": 1, }, }, - "range": Array [ - 0, - 41, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "type": "ForOfStatement", + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -65163,14 +74782,14 @@ Object { }, "range": Array [ 0, - 42, + 27, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -65180,25 +74799,7 @@ Object { }, "range": Array [ 0, - 3, - ], - "type": "Keyword", - "value": "for", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, + 1, ], "type": "Punctuator", "value": "(", @@ -65206,20 +74807,20 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { - "column": 5, + "column": 1, "line": 1, }, }, "range": Array [ - 5, - 8, + 1, + 9, ], "type": "Keyword", - "value": "var", + "value": "function", }, Object { "loc": Object { @@ -65236,13 +74837,13 @@ Object { 9, 10, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { @@ -65252,43 +74853,25 @@ Object { }, "range": Array [ 11, - 13, - ], - "type": "Identifier", - "value": "of", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 17, + 12, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": ")", @@ -65296,17 +74879,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 20, + "column": 15, "line": 1, }, "start": Object { - "column": 19, + "column": 14, "line": 1, }, }, "range": Array [ - 19, - 20, + 14, + 15, ], "type": "Punctuator", "value": "{", @@ -65314,216 +74897,220 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 25, - 36, + 16, + 21, ], - "type": "Identifier", - "value": "doSomething", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 36, - 37, + 21, + 22, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 37, - 38, + 23, + 24, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 38, - 39, + 24, + 25, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 26, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 25, + "line": 1, }, }, "range": Array [ - 40, - 41, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/forOf/for-of-with-var-and-no-braces.src 1`] = ` +exports[`ecmaFeatures fixtures/generators/yield-without-value-in-call.src 1`] = ` Object { "body": Array [ Object { - "await": false, - "body": Object { - "expression": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "YieldExpression", + }, + ], + "callee": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "fn", + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 25, + ], + "type": "CallExpression", }, - }, - "name": "doSomething", - "range": Array [ - 23, - 34, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 23, - 36, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 23, - 37, - ], - "type": "ExpressionStatement", - }, - "left": Object { - "declarations": Array [ - Object { - "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 26, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, - "name": "x", "range": Array [ - 9, - 10, + 16, + 26, ], - "type": "Identifier", + "type": "ExpressionStatement", }, - "init": null, - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 9, - 10, - ], - "type": "VariableDeclarator", }, - ], - "kind": "var", + "range": Array [ + 14, + 28, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, "loc": Object { "end": Object { - "column": 10, + "column": 28, "line": 1, }, "start": Object { - "column": 5, + "column": 1, "line": 1, }, }, + "params": Array [], "range": Array [ - 5, - 10, + 1, + 28, ], - "type": "VariableDeclaration", + "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { "column": 0, @@ -65532,33 +75119,15 @@ Object { }, "range": Array [ 0, - 37, + 30, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "type": "ForOfStatement", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 3, + "line": 2, }, "start": Object { "column": 0, @@ -65567,14 +75136,14 @@ Object { }, "range": Array [ 0, - 38, + 31, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -65584,64 +75153,64 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "for", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 9, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 5, + 1, + 9, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { - "column": 5, + "column": 9, "line": 1, }, }, "range": Array [ - 5, - 8, + 9, + 10, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 12, "line": 1, }, "start": Object { - "column": 9, + "column": 11, "line": 1, }, }, "range": Array [ - 9, - 10, + 11, + 12, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -65650,21 +75219,21 @@ Object { "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, + 12, 13, ], - "type": "Identifier", - "value": "of", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 15, "line": 1, }, "start": Object { @@ -65674,10 +75243,10 @@ Object { }, "range": Array [ 14, - 17, + 15, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -65686,13 +75255,67 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, "line": 1, }, }, "range": Array [ - 17, 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, ], "type": "Punctuator", "value": ")", @@ -65700,53 +75323,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ - 23, - 34, + 25, + 26, ], - "type": "Identifier", - "value": "doSomething", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ - 34, - 35, + 27, + 28, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 35, - 36, + 28, + 29, ], "type": "Punctuator", "value": ")", @@ -65754,17 +75377,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 17, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ - 36, - 37, + 29, + 30, ], "type": "Punctuator", "value": ";", @@ -65774,7 +75397,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/generators/anonymous-generator.src 1`] = ` +exports[`ecmaFeatures fixtures/generators/yield-without-value-no-semi.src 1`] = ` Object { "body": Array [ Object { @@ -65784,28 +75407,11 @@ Object { "body": Array [ Object { "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "v", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, + "argument": null, "delegate": false, "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 1, }, "start": Object { @@ -65815,13 +75421,13 @@ Object { }, "range": Array [ 16, - 23, + 21, ], "type": "YieldExpression", }, "loc": Object { "end": Object { - "column": 23, + "column": 21, "line": 1, }, "start": Object { @@ -65831,14 +75437,14 @@ Object { }, "range": Array [ 16, - 23, + 21, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 25, + "column": 23, "line": 1, }, "start": Object { @@ -65848,7 +75454,7 @@ Object { }, "range": Array [ 14, - 25, + 23, ], "type": "BlockStatement", }, @@ -65857,7 +75463,7 @@ Object { "id": null, "loc": Object { "end": Object { - "column": 25, + "column": 23, "line": 1, }, "start": Object { @@ -65868,13 +75474,13 @@ Object { "params": Array [], "range": Array [ 1, - 25, + 23, ], "type": "FunctionExpression", }, "loc": Object { "end": Object { - "column": 27, + "column": 25, "line": 1, }, "start": Object { @@ -65884,15 +75490,15 @@ Object { }, "range": Array [ 0, - 27, + 25, ], "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -65901,7 +75507,7 @@ Object { }, "range": Array [ 0, - 27, + 26, ], "sourceType": "script", "tokens": Array [ @@ -66046,41 +75652,23 @@ Object { 22, 23, ], - "type": "Identifier", - "value": "v", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], "type": "Punctuator", "value": "}", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 24, "line": 1, }, "start": Object { - "column": 25, + "column": 23, "line": 1, }, }, "range": Array [ - 25, - 26, + 23, + 24, ], "type": "Punctuator", "value": ")", @@ -66088,17 +75676,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 27, + "column": 25, "line": 1, }, "start": Object { - "column": 26, + "column": 24, "line": 1, }, }, "range": Array [ - 26, - 27, + 24, + 25, ], "type": "Punctuator", "value": ";", @@ -66108,465 +75696,226 @@ Object { } `; -exports[`ecmaFeatures fixtures/generators/async-generator-function.src 1`] = ` +exports[`ecmaFeatures fixtures/globalReturn/return-identifier.src 1`] = ` Object { "body": Array [ Object { - "async": true, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 23, - 27, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { + "argument": Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 7, + "line": 1, }, }, - "name": "foo", + "name": "fooz", "range": Array [ - 17, - 20, + 7, + 11, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 12, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, - "params": Array [], "range": Array [ - 1, - 27, + 0, + 12, ], - "type": "FunctionDeclaration", + "type": "ReturnStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 5, + "line": 2, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 1, - 28, + 0, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 6, + "line": 1, }, "start": Object { "column": 0, - "line": 2, + "line": 1, }, }, "range": Array [ - 1, + 0, 6, ], - "type": "Identifier", - "value": "async", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 6, - "line": 2, - }, - }, - "range": Array [ - 7, - 15, - ], "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 15, - "line": 2, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "*", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 17, - 20, + 7, + 11, ], "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 2, - }, - "start": Object { - "column": 19, - "line": 2, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 2, - }, - "start": Object { - "column": 20, - "line": 2, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": "{", + "value": "fooz", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 4, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/generators/async-generator-method.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "name": "f", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 63, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": true, - "body": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "name": "x", - "range": Array [ - 42, - 43, - ], - "type": "Identifier", - }, - "init": Object { - "argument": Object { - "arguments": Array [], - "callee": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 3, - }, - "start": Object { - "column": 25, - "line": 3, - }, - }, - "name": "g", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 25, - "line": 3, - }, - }, - "range": Array [ - 53, - 56, - ], - "type": "CallExpression", - }, - "delegate": true, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 18, - "line": 3, - }, - }, - "range": Array [ - 46, - 56, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 3, - }, - "start": Object { - "column": 14, - "line": 3, - }, - }, - "range": Array [ - 42, - 56, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", - "loc": Object { - "end": Object { - "column": 29, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, - }, - }, - "range": Array [ - 36, - 57, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 63, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 4, - }, - "start": Object { - "column": 13, - "line": 2, - }, - }, - "params": Array [], - "range": Array [ - 23, - 63, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 5, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, }, - "range": Array [ - 8, - 65, - ], - "type": "ClassBody", }, - "id": Object { + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/globalReturn/return-no-arg.src 1`] = ` +Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/globalReturn/return-true.src 1`] = ` +Object { + "body": Array [ + Object { + "argument": Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, - "name": "C", "range": Array [ - 6, 7, + 11, ], - "type": "Identifier", + "raw": "true", + "type": "Literal", + "value": true, }, "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 12, + "line": 1, }, "start": Object { "column": 0, @@ -66575,16 +75924,15 @@ Object { }, "range": Array [ 0, - 65, + 12, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "ReturnStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 2, }, "start": Object { "column": 0, @@ -66593,14 +75941,14 @@ Object { }, "range": Array [ 0, - 66, + 13, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 6, "line": 1, }, "start": Object { @@ -66610,496 +75958,688 @@ Object { }, "range": Array [ 0, - 5, + 6, ], "type": "Keyword", - "value": "class", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 11, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, 7, + 11, ], - "type": "Identifier", - "value": "C", + "type": "Boolean", + "value": "true", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, "range": Array [ - 8, - 9, + 11, + 12, ], "type": "Punctuator", - "value": "{", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/importMeta/simple-import-meta.src 1`] = ` +Object { + "body": Array [ Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "import", + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "meta", + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 11, + ], + "type": "MetaProperty", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "url", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + }, + "range": Array [ + 0, + 15, + ], + "type": "MemberExpression", + }, "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 14, - 19, + 0, + 16, ], - "type": "Identifier", - "value": "async", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 6, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 0, + "line": 1, }, }, "range": Array [ - 20, - 21, + 0, + 6, ], - "type": "Punctuator", - "value": "*", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 7, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 6, + "line": 1, }, }, "range": Array [ - 22, - 23, + 6, + 7, ], - "type": "Identifier", - "value": "f", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 11, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 23, - 24, + 7, + 11, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "meta", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 24, - 25, + 11, + 12, ], "type": "Punctuator", - "value": ")", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 15, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 26, - 27, + 12, + 15, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "url", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 16, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 15, + "line": 1, }, }, "range": Array [ - 36, - 41, + 15, + 16, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/error-delete.src 1`] = ` +Object { + "body": Array [ Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 14, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 42, - 43, + 0, + 18, ], - "type": "Identifier", - "value": "x", + "source": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 8, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", }, Object { + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "delete", + "prefix": true, + "range": Array [ + 19, + 27, + ], + "type": "UnaryExpression", + }, "loc": Object { "end": Object { - "column": 17, - "line": 3, + "column": 9, + "line": 2, }, "start": Object { - "column": 16, - "line": 3, + "column": 0, + "line": 2, }, }, "range": Array [ - 44, - 45, + 19, + 28, ], - "type": "Punctuator", - "value": "=", + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { - "end": Object { - "column": 23, - "line": 3, + "end": Object { + "column": 6, + "line": 1, }, "start": Object { - "column": 18, - "line": 3, + "column": 0, + "line": 1, }, }, "range": Array [ - 46, - 51, + 0, + 6, ], "type": "Keyword", - "value": "yield", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 24, - "line": 3, + "column": 8, + "line": 1, }, "start": Object { - "column": 23, - "line": 3, + "column": 7, + "line": 1, }, }, "range": Array [ - 51, - 52, + 7, + 8, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 13, + "line": 1, }, "start": Object { - "column": 25, - "line": 3, + "column": 9, + "line": 1, }, }, "range": Array [ - 53, - 54, + 9, + 13, ], "type": "Identifier", - "value": "g", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 3, + "column": 17, + "line": 1, }, "start": Object { - "column": 26, - "line": 3, + "column": 14, + "line": 1, }, }, "range": Array [ - 54, - 55, + 14, + 17, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"x\\"", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 3, + "column": 18, + "line": 1, }, "start": Object { - "column": 27, - "line": 3, + "column": 17, + "line": 1, }, }, "range": Array [ - 55, - 56, + 17, + 18, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 3, + "column": 6, + "line": 2, }, "start": Object { - "column": 28, - "line": 3, + "column": 0, + "line": 2, }, }, "range": Array [ - 56, - 57, + 19, + 25, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "delete", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 8, + "line": 2, }, "start": Object { - "column": 4, - "line": 4, + "column": 7, + "line": 2, }, }, "range": Array [ - 62, - 63, + 26, + 27, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 5, + "column": 9, + "line": 2, }, "start": Object { - "column": 0, - "line": 5, + "column": 8, + "line": 2, }, }, "range": Array [ - 64, - 65, + 27, + 28, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/generators/double-yield.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/error-function.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "range": Array [ - 28, - 30, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - "delegate": false, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 30, - ], - "type": "YieldExpression", - }, - "delegate": false, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 30, - ], - "type": "YieldExpression", - }, + "async": false, + "body": Object { + "body": Array [ + Object { + "declaration": Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { "column": 16, - "line": 1, + "line": 2, }, }, + "name": "friends", "range": Array [ - 16, - 30, + 31, + 38, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 32, - "line": 1, + "type": "Identifier", }, - "start": Object { - "column": 14, - "line": 1, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, }, + "range": Array [ + 16, + 39, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 14, - 32, - ], - "type": "BlockStatement", }, - "expression": false, - "generator": true, - "id": null, + "range": Array [ + 13, + 41, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { "loc": Object { "end": Object { - "column": 32, + "column": 10, "line": 1, }, "start": Object { - "column": 1, + "column": 9, "line": 1, }, }, - "params": Array [], + "name": "x", "range": Array [ - 1, - 32, + 9, + 10, ], - "type": "FunctionExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [], "range": Array [ 0, - 34, + 41, ], - "type": "ExpressionStatement", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 34, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -67108,14 +76648,14 @@ Object { }, "range": Array [ 0, - 34, + 43, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 8, "line": 1, }, "start": Object { @@ -67125,25 +76665,7 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 9, + 8, ], "type": "Keyword", "value": "function", @@ -67163,23 +76685,23 @@ Object { 9, 10, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 1, }, "start": Object { - "column": 11, + "column": 10, "line": 1, }, }, "range": Array [ + 10, 11, - 12, ], "type": "Punctuator", "value": "(", @@ -67187,17 +76709,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 12, - 13, ], "type": "Punctuator", "value": ")", @@ -67205,17 +76727,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { - "column": 14, + "column": 13, "line": 1, }, }, "range": Array [ + 13, 14, - 15, ], "type": "Punctuator", "value": "{", @@ -67223,198 +76745,341 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 7, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 2, }, }, "range": Array [ 16, - 21, + 22, ], "type": "Keyword", - "value": "yield", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 27, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 22, - 27, + 23, + 30, ], "type": "Keyword", - "value": "yield", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 28, - 30, + 31, + 38, ], - "type": "Numeric", - "value": "10", + "type": "Identifier", + "value": "friends", }, Object { "loc": Object { "end": Object { - "column": 32, - "line": 1, + "column": 24, + "line": 2, }, "start": Object { - "column": 31, - "line": 1, + "column": 23, + "line": 2, }, }, "range": Array [ - 31, - 32, + 38, + 39, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 32, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 32, - 33, + 40, + 41, ], "type": "Punctuator", - "value": ")", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/error-strict.src 1`] = ` +Object { + "body": Array [ Object { "loc": Object { "end": Object { - "column": 34, + "column": 26, "line": 1, }, "start": Object { - "column": 33, + "column": 0, "line": 1, }, }, "range": Array [ - 33, - 34, + 0, + 26, ], - "type": "Punctuator", - "value": ";", + "source": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "raw": "\\"house\\"", + "type": "Literal", + "value": "house", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "house", + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + }, + "range": Array [ + 7, + 12, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/generators/empty-generator-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, "body": Object { - "body": Array [], + "body": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "roof", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "console", + "range": Array [ + 44, + 51, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "log", + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + }, + "range": Array [ + 44, + 55, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 44, + 61, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 44, + 62, + ], + "type": "ExpressionStatement", + }, + ], "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 14, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 14, - 16, + 41, + 64, ], "type": "BlockStatement", }, - "expression": false, - "generator": true, - "id": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "object": Object { "loc": Object { "end": Object { "column": 11, - "line": 1, + "line": 3, }, "start": Object { - "column": 10, - "line": 1, + "column": 6, + "line": 3, }, }, - "name": "t", + "name": "house", "range": Array [ - 10, - 11, + 34, + 39, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 0, - 16, - ], - "type": "FunctionDeclaration", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, "range": Array [ - 16, - 17, + 28, + 64, ], - "type": "EmptyStatement", + "type": "WithStatement", }, ], "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 6, }, "start": Object { "column": 0, @@ -67423,14 +77088,14 @@ Object { }, "range": Array [ 0, - 17, + 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 6, "line": 1, }, "start": Object { @@ -67440,358 +77105,241 @@ Object { }, "range": Array [ 0, - 8, + 6, ], "type": "Keyword", - "value": "function", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 12, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ - 8, - 9, + 7, + 12, ], - "type": "Punctuator", - "value": "*", + "type": "Identifier", + "value": "house", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 10, + "column": 13, "line": 1, }, }, "range": Array [ - 10, - 11, + 13, + 17, ], "type": "Identifier", - "value": "t", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 25, "line": 1, }, "start": Object { - "column": 11, + "column": 18, "line": 1, }, }, "range": Array [ - 11, - 12, + 18, + 25, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"house\\"", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 25, "line": 1, }, }, "range": Array [ - 12, - 13, + 25, + 26, ], "type": "Punctuator", - "value": ")", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 4, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 14, - 15, + 28, + 32, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "with", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 3, }, "start": Object { - "column": 15, - "line": 1, + "column": 5, + "line": 3, }, }, "range": Array [ - 15, - 16, + 33, + 34, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 3, }, }, "range": Array [ - 16, - 17, + 34, + 39, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "house", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/generators/generator-declaration.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "name": "v", - "range": Array [ - 27, - 28, - ], - "type": "Identifier", - }, - "delegate": true, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 28, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 28, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 30, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "test", - "range": Array [ - 10, - 14, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 12, + "line": 3, }, "start": Object { - "column": 0, - "line": 1, + "column": 11, + "line": 3, }, }, - "params": Array [], "range": Array [ - 0, - 30, + 39, + 40, ], - "type": "FunctionDeclaration", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 30, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 30, - 31, + 41, + 42, ], - "type": "EmptyStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "{", }, - }, - "range": Array [ - 0, - 31, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { "column": 8, - "line": 1, + "line": 4, }, "start": Object { - "column": 0, - "line": 1, + "column": 1, + "line": 4, }, }, "range": Array [ - 0, - 8, + 44, + 51, ], - "type": "Keyword", - "value": "function", + "type": "Identifier", + "value": "console", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 1, + "line": 4, }, "start": Object { "column": 8, - "line": 1, + "line": 4, }, }, "range": Array [ - 8, - 9, + 51, + 52, ], "type": "Punctuator", - "value": "*", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 12, + "line": 4, }, "start": Object { - "column": 10, - "line": 1, + "column": 9, + "line": 4, }, }, "range": Array [ - 10, - 14, + 52, + 55, ], "type": "Identifier", - "value": "test", + "value": "log", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 13, + "line": 4, }, "start": Object { - "column": 15, - "line": 1, + "column": 12, + "line": 4, }, }, "range": Array [ - 15, - 16, + 55, + 56, ], "type": "Punctuator", "value": "(", @@ -67800,234 +77348,104 @@ Object { "loc": Object { "end": Object { "column": 17, - "line": 1, + "line": 4, }, "start": Object { - "column": 16, - "line": 1, + "column": 13, + "line": 4, }, }, "range": Array [ - 16, - 17, + 56, + 60, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "roof", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 25, - ], - "type": "Keyword", - "value": "yield", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, + "line": 4, }, "start": Object { - "column": 26, - "line": 1, + "column": 17, + "line": 4, }, }, "range": Array [ - 26, - 27, + 60, + 61, ], "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 28, - ], - "type": "Identifier", - "value": "v", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 19, + "line": 4, }, "start": Object { - "column": 29, - "line": 1, + "column": 18, + "line": 4, }, }, "range": Array [ - 29, - 30, + 61, + 62, ], "type": "Punctuator", - "value": "}", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 31, - "line": 1, + "column": 1, + "line": 5, }, "start": Object { - "column": 30, - "line": 1, + "column": 0, + "line": 5, }, }, "range": Array [ - 30, - 31, + 63, + 64, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/generators/yield-delegation.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-default-array.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "v", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "delegate": true, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 24, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 24, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 26, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": true, - "id": null, + "declaration": Object { + "elements": Array [], "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, - "params": Array [], "range": Array [ - 1, - 26, + 15, + 17, ], - "type": "FunctionExpression", + "type": "ArrayExpression", }, "loc": Object { "end": Object { - "column": 28, + "column": 18, "line": 1, }, "start": Object { @@ -68037,15 +77455,15 @@ Object { }, "range": Array [ 0, - 28, + 18, ], - "type": "ExpressionStatement", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 0, + "line": 2, }, "start": Object { "column": 0, @@ -68054,14 +77472,14 @@ Object { }, "range": Array [ 0, - 28, + 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -68071,298 +77489,320 @@ Object { }, "range": Array [ 0, - 1, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { - "column": 1, + "column": 7, "line": 1, }, }, "range": Array [ - 1, - 9, + 7, + 14, ], "type": "Keyword", - "value": "function", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 10, + 15, + 16, ], "type": "Punctuator", - "value": "*", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], "type": "Punctuator", - "value": "(", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 18, "line": 1, }, "start": Object { - "column": 12, + "column": 17, "line": 1, }, }, "range": Array [ - 12, - 13, + 17, + 18, ], "type": "Punctuator", - "value": ")", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-class.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "ClassBody", }, - "start": Object { - "column": 14, - "line": 1, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, + "range": Array [ + 15, + 25, + ], + "superClass": null, + "type": "ClassDeclaration", }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "{", - }, - Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 16, + "column": 0, "line": 1, }, }, "range": Array [ - 16, - 21, + 0, + 25, ], - "type": "Keyword", - "value": "yield", + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, + "column": 6, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 6, ], - "type": "Punctuator", - "value": "*", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 14, "line": 1, }, "start": Object { - "column": 23, + "column": 7, "line": 1, }, }, "range": Array [ - 23, - 24, + 7, + 14, ], - "type": "Identifier", - "value": "v", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 1, }, "start": Object { - "column": 25, + "column": 15, "line": 1, }, }, "range": Array [ - 25, - 26, + 15, + 20, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 22, "line": 1, }, "start": Object { - "column": 26, + "column": 21, "line": 1, }, }, "range": Array [ - 26, - 27, + 21, + 22, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 27, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 27, - 28, + 24, + 25, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/generators/yield-without-value.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-default-expression.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": null, - "delegate": false, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 21, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 22, - ], - "type": "ExpressionStatement", - }, - ], + "declaration": Object { + "left": Object { "loc": Object { "end": Object { - "column": 24, + "column": 17, "line": 1, }, "start": Object { - "column": 14, + "column": 16, "line": 1, }, }, "range": Array [ - 14, - 24, + 16, + 17, ], - "type": "BlockStatement", + "raw": "1", + "type": "Literal", + "value": 1, }, - "expression": false, - "generator": true, - "id": null, "loc": Object { "end": Object { - "column": 24, + "column": 21, "line": 1, }, "start": Object { - "column": 1, + "column": 16, "line": 1, }, }, - "params": Array [], + "operator": "+", "range": Array [ - 1, - 24, + 16, + 21, ], - "type": "FunctionExpression", + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "BinaryExpression", }, "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { @@ -68372,9 +77812,9 @@ Object { }, "range": Array [ 0, - 26, + 23, ], - "type": "ExpressionStatement", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { @@ -68389,14 +77829,14 @@ Object { }, "range": Array [ 0, - 27, + 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -68406,105 +77846,51 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 9, + 6, ], "type": "Keyword", - "value": "function", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "*", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 7, "line": 1, }, }, "range": Array [ - 11, - 12, + 7, + 14, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 16, "line": 1, }, "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { "column": 15, "line": 1, }, - "start": Object { - "column": 14, - "line": 1, - }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { @@ -68514,61 +77900,61 @@ Object { }, "range": Array [ 16, - 21, + 17, ], - "type": "Keyword", - "value": "yield", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 1, }, "start": Object { - "column": 21, + "column": 18, "line": 1, }, }, "range": Array [ - 21, - 22, + 18, + 19, ], "type": "Punctuator", - "value": ";", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 21, "line": 1, }, "start": Object { - "column": 23, + "column": 20, "line": 1, }, }, "range": Array [ - 23, - 24, + 20, + 21, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "2", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 22, "line": 1, }, "start": Object { - "column": 24, + "column": 21, "line": 1, }, }, "range": Array [ - 24, - 25, + 21, + 22, ], "type": "Punctuator", "value": ")", @@ -68576,17 +77962,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { - "column": 25, + "column": 22, "line": 1, }, }, "range": Array [ - 25, - 26, + 22, + 23, ], "type": "Punctuator", "value": ";", @@ -68596,127 +77982,53 @@ Object { } `; -exports[`ecmaFeatures fixtures/generators/yield-without-value-in-call.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-default-function.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { + "declaration": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "arguments": Array [ - Object { - "argument": null, - "delegate": false, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "YieldExpression", - }, - ], - "callee": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "fn", - "range": Array [ - 16, - 18, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 25, - ], - "type": "CallExpression", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 26, - ], - "type": "ExpressionStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 14, + "column": 27, "line": 1, }, }, "range": Array [ - 14, - 28, + 27, + 29, ], "type": "BlockStatement", }, "expression": false, - "generator": true, + "generator": false, "id": null, "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, "params": Array [], "range": Array [ - 1, - 28, + 15, + 29, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 30, + "column": 29, "line": 1, }, "start": Object { @@ -68726,9 +78038,9 @@ Object { }, "range": Array [ 0, - 30, + 29, ], - "type": "ExpressionStatement", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { @@ -68743,14 +78055,14 @@ Object { }, "range": Array [ 0, - 31, + 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 6, "line": 1, }, "start": Object { @@ -68760,61 +78072,61 @@ Object { }, "range": Array [ 0, - 1, + 6, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 14, "line": 1, }, "start": Object { - "column": 1, + "column": 7, "line": 1, }, }, "range": Array [ - 1, - 9, + 7, + 14, ], "type": "Keyword", - "value": "function", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 23, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 10, + 15, + 23, ], - "type": "Punctuator", - "value": "*", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 25, "line": 1, }, "start": Object { - "column": 11, + "column": 24, "line": 1, }, }, "range": Array [ - 11, - 12, + 24, + 25, ], "type": "Punctuator", "value": "(", @@ -68822,17 +78134,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 26, "line": 1, }, "start": Object { - "column": 12, + "column": 25, "line": 1, }, }, "range": Array [ - 12, - 13, + 25, + 26, ], "type": "Punctuator", "value": ")", @@ -68840,17 +78152,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 28, "line": 1, }, "start": Object { - "column": 14, + "column": 27, "line": 1, }, }, "range": Array [ - 14, - 15, + 27, + 28, ], "type": "Punctuator", "value": "{", @@ -68858,138 +78170,216 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 29, "line": 1, }, "start": Object { - "column": 16, + "column": 28, "line": 1, }, }, "range": Array [ - 16, - 18, + 28, + 29, ], - "type": "Identifier", - "value": "fn", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-named-class.src 1`] = ` +Object { + "body": Array [ Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Test", + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 30, + ], + "superClass": null, + "type": "ClassDeclaration", + }, "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 30, ], - "type": "Punctuator", - "value": "(", + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 24, + "column": 6, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 24, + 0, + 6, ], "type": "Keyword", - "value": "yield", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 14, "line": 1, }, "start": Object { - "column": 24, + "column": 7, "line": 1, }, }, "range": Array [ - 24, - 25, + 7, + 14, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 20, "line": 1, }, "start": Object { - "column": 25, + "column": 15, "line": 1, }, }, "range": Array [ - 25, - 26, + 15, + 20, ], - "type": "Punctuator", - "value": ";", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 25, "line": 1, }, "start": Object { - "column": 27, + "column": 21, "line": 1, }, }, "range": Array [ - 27, - 28, + 21, + 25, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "Test", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 27, "line": 1, }, "start": Object { - "column": 28, + "column": 26, "line": 1, }, }, "range": Array [ - 28, - 29, + 26, + 27, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 29, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ @@ -68997,303 +78387,380 @@ Object { 30, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/generators/yield-without-value-no-semi.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-default-named-function.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { + "declaration": Object { "async": false, "body": Object { - "body": Array [ - Object { - "expression": Object { - "argument": null, - "delegate": false, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 21, - ], - "type": "YieldExpression", - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 21, - ], - "type": "ExpressionStatement", - }, - ], + "body": Array [], "loc": Object { "end": Object { - "column": 23, + "column": 32, "line": 1, }, "start": Object { - "column": 14, + "column": 30, "line": 1, }, }, "range": Array [ - 14, - 23, + 30, + 32, ], "type": "BlockStatement", }, "expression": false, - "generator": true, - "id": null, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 23, + "column": 32, "line": 1, }, "start": Object { - "column": 1, + "column": 15, "line": 1, }, }, "params": Array [], "range": Array [ - 1, - 23, + 15, + 32, ], - "type": "FunctionExpression", + "type": "FunctionDeclaration", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { "loc": Object { "end": Object { - "column": 25, + "column": 23, "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, "range": Array [ - 0, - 25, + 15, + 23, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "function", }, - }, - "range": Array [ - 0, - 26, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 27, "line": 1, }, "start": Object { - "column": 0, + "column": 24, "line": 1, }, }, "range": Array [ - 0, - 1, + 24, + 27, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 28, "line": 1, }, "start": Object { - "column": 1, + "column": 27, "line": 1, }, }, "range": Array [ - 1, - 9, + 27, + 28, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 29, "line": 1, }, "start": Object { - "column": 9, + "column": 28, "line": 1, }, }, "range": Array [ - 9, - 10, + 28, + 29, ], "type": "Punctuator", - "value": "*", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 31, "line": 1, }, "start": Object { - "column": 11, + "column": 30, "line": 1, }, }, "range": Array [ - 11, - 12, + 30, + 31, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 32, "line": 1, }, "start": Object { - "column": 12, + "column": 31, "line": 1, }, }, "range": Array [ - 12, - 13, + 31, + 32, ], "type": "Punctuator", - "value": ")", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-default-number.src 1`] = ` +Object { + "body": Array [ Object { + "declaration": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 18, ], - "type": "Punctuator", - "value": "{", + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, + "column": 6, "line": 1, }, "start": Object { - "column": 16, + "column": 0, "line": 1, }, }, "range": Array [ - 16, - 21, + 0, + 6, ], "type": "Keyword", - "value": "yield", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 14, "line": 1, }, "start": Object { - "column": 22, + "column": 7, "line": 1, }, }, "range": Array [ - 22, - 23, + 7, + 14, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 17, "line": 1, }, "start": Object { - "column": 23, + "column": 15, "line": 1, }, }, "range": Array [ - 23, - 24, + 15, + 17, ], - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "42", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 1, }, "start": Object { - "column": 24, + "column": 17, "line": 1, }, }, "range": Array [ - 24, - 25, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -69303,102 +78770,90 @@ Object { } `; -exports[`ecmaFeatures fixtures/importMeta/simple-import-meta.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-default-object.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "computed": false, + "declaration": Object { "loc": Object { "end": Object { - "column": 15, + "column": 25, "line": 1, }, "start": Object { - "column": 0, + "column": 15, "line": 1, }, }, - "object": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "meta": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", }, - "name": "import", - "range": Array [ - 0, - 6, - ], - "type": "Identifier", - }, - "property": Object { + "kind": "init", "loc": Object { "end": Object { - "column": 11, + "column": 23, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, - "name": "meta", + "method": false, "range": Array [ - 7, - 11, + 17, + 23, ], - "type": "Identifier", - }, - "range": Array [ - 0, - 11, - ], - "type": "MetaProperty", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, }, - "name": "url", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, + ], "range": Array [ - 0, 15, + 25, ], - "type": "MemberExpression", + "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 16, + "column": 26, "line": 1, }, "start": Object { @@ -69408,9 +78863,9 @@ Object { }, "range": Array [ 0, - 16, + 26, ], - "type": "ExpressionStatement", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { @@ -69425,7 +78880,7 @@ Object { }, "range": Array [ 0, - 17, + 27, ], "sourceType": "module", "tokens": Array [ @@ -69445,94 +78900,130 @@ Object { 6, ], "type": "Keyword", - "value": "import", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 14, "line": 1, }, "start": Object { - "column": 6, + "column": 7, "line": 1, }, }, "range": Array [ - 6, 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, ], "type": "Punctuator", - "value": ".", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 20, "line": 1, }, "start": Object { - "column": 7, + "column": 17, "line": 1, }, }, "range": Array [ - 7, - 11, + 17, + 20, ], "type": "Identifier", - "value": "meta", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 21, "line": 1, }, "start": Object { - "column": 11, + "column": 20, "line": 1, }, }, "range": Array [ - 11, - 12, + 20, + 21, ], "type": "Punctuator", - "value": ".", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 23, "line": 1, }, "start": Object { - "column": 12, + "column": 22, "line": 1, }, }, "range": Array [ - 12, - 15, + 22, + 23, ], - "type": "Identifier", - "value": "url", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 25, "line": 1, }, "start": Object { - "column": 15, + "column": 24, "line": 1, }, }, "range": Array [ - 15, - 16, + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ";", @@ -69542,15 +79033,14 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-default-array.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-default-value.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "elements": Array [], "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { @@ -69558,15 +79048,16 @@ Object { "line": 1, }, }, + "name": "foo", "range": Array [ 15, - 17, + 18, ], - "type": "ArrayExpression", + "type": "Identifier", }, "loc": Object { "end": Object { - "column": 18, + "column": 19, "line": 1, }, "start": Object { @@ -69576,7 +79067,7 @@ Object { }, "range": Array [ 0, - 18, + 19, ], "type": "ExportDefaultDeclaration", }, @@ -69593,7 +79084,7 @@ Object { }, "range": Array [ 0, - 19, + 20, ], "sourceType": "module", "tokens": Array [ @@ -69636,7 +79127,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 1, }, "start": Object { @@ -69646,43 +79137,25 @@ Object { }, "range": Array [ 15, - 16, + 18, ], - "type": "Punctuator", - "value": "[", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 1, }, "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { "column": 18, "line": 1, }, - "start": Object { - "column": 17, - "line": 1, - }, }, "range": Array [ - 17, 18, + 19, ], "type": "Punctuator", "value": ";", @@ -69692,51 +79165,14 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-default-class.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-from-batch.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 25, - ], - "type": "ClassBody", - }, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 25, - ], - "superClass": null, - "type": "ClassDeclaration", - }, "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 20, + "line": 1, }, "start": Object { "column": 0, @@ -69745,15 +79181,34 @@ Object { }, "range": Array [ 0, - 25, + 20, ], - "type": "ExportDefaultDeclaration", + "source": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "type": "ExportAllDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -69762,7 +79217,7 @@ Object { }, "range": Array [ 0, - 26, + 21, ], "sourceType": "module", "tokens": Array [ @@ -69787,7 +79242,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { @@ -69797,145 +79252,164 @@ Object { }, "range": Array [ 7, - 14, + 8, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 13, "line": 1, }, "start": Object { - "column": 15, + "column": 9, "line": 1, }, }, "range": Array [ - 15, - 20, + 9, + 13, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 1, }, "start": Object { - "column": 21, + "column": 14, "line": 1, }, }, "range": Array [ - 21, - 22, + 14, + 19, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 20, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 19, + "line": 1, }, }, "range": Array [ - 24, - 25, + 19, + 20, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/export-default-expression.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-from-default.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "raw": "1", - "type": "Literal", - "value": 1, + "declaration": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 28, + ], + "source": Object { "loc": Object { "end": Object { - "column": 21, + "column": 27, "line": 1, }, "start": Object { - "column": 16, + "column": 22, "line": 1, }, }, - "operator": "+", "range": Array [ - 16, - 21, + 22, + 27, ], - "right": Object { + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 21, + "column": 15, "line": 1, }, "start": Object { - "column": 20, + "column": 8, "line": 1, }, }, + "local": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + }, "range": Array [ - 20, - 21, + 8, + 15, ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "type": "BinaryExpression", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "ExportSpecifier", }, - }, - "range": Array [ - 0, - 23, ], - "type": "ExportDefaultDeclaration", + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -69950,7 +79424,7 @@ Object { }, "range": Array [ 0, - 24, + 29, ], "sourceType": "module", "tokens": Array [ @@ -69975,7 +79449,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { @@ -69985,64 +79459,46 @@ Object { }, "range": Array [ 7, - 14, + 8, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, "range": Array [ + 8, 15, - 16, ], - "type": "Punctuator", - "value": "(", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { "column": 16, "line": 1, }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, "start": Object { - "column": 18, + "column": 15, "line": 1, }, }, "range": Array [ - 18, - 19, + 15, + 16, ], "type": "Punctuator", - "value": "+", + "value": "}", }, Object { "loc": Object { @@ -70051,49 +79507,49 @@ Object { "line": 1, }, "start": Object { - "column": 20, + "column": 17, "line": 1, }, }, "range": Array [ - 20, + 17, 21, ], - "type": "Numeric", - "value": "2", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 27, "line": 1, }, "start": Object { - "column": 21, + "column": 22, "line": 1, }, }, "range": Array [ - 21, 22, + 27, ], - "type": "Punctuator", - "value": ")", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 28, "line": 1, }, "start": Object { - "column": 22, + "column": 27, "line": 1, }, }, "range": Array [ - 22, - 23, + 27, + 28, ], "type": "Punctuator", "value": ";", @@ -70103,65 +79559,100 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-default-function.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-from-named-as-default.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 29, - ], - "type": "BlockStatement", + "declaration": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, }, - "expression": false, - "generator": false, - "id": null, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "source": Object { "loc": Object { "end": Object { - "column": 29, + "column": 34, "line": 1, }, "start": Object { - "column": 15, + "column": 29, "line": 1, }, }, - "params": Array [], "range": Array [ - 15, 29, + 34, ], - "type": "FunctionDeclaration", + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", }, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", }, - }, - "range": Array [ - 0, - 29, ], - "type": "ExportDefaultDeclaration", + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -70176,7 +79667,7 @@ Object { }, "range": Array [ 0, - 30, + 36, ], "sourceType": "module", "tokens": Array [ @@ -70201,7 +79692,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { @@ -70211,15 +79702,51 @@ Object { }, "range": Array [ 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 14, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 22, "line": 1, }, "start": Object { @@ -70229,167 +79756,188 @@ Object { }, "range": Array [ 15, - 23, + 22, ], "type": "Keyword", - "value": "function", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 23, "line": 1, }, "start": Object { - "column": 24, + "column": 22, "line": 1, }, }, "range": Array [ - 24, - 25, + 22, + 23, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 28, "line": 1, }, "start": Object { - "column": 25, + "column": 24, "line": 1, }, }, "range": Array [ - 25, - 26, + 24, + 28, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 34, "line": 1, }, "start": Object { - "column": 27, + "column": 29, "line": 1, }, }, "range": Array [ - 27, - 28, + 29, + 34, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 35, "line": 1, }, "start": Object { - "column": 28, + "column": 34, "line": 1, }, }, "range": Array [ - 28, - 29, + 34, + 35, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/export-default-named-class.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-from-named-as-specifier.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 26, - "line": 1, + "declaration": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, }, + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", }, - "range": Array [ - 26, - 30, - ], - "type": "ClassBody", - }, - "id": Object { "loc": Object { "end": Object { - "column": 25, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 8, "line": 1, }, }, - "name": "Test", + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, "range": Array [ - 21, - 25, + 8, + 18, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 30, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "ExportSpecifier", }, - }, - "range": Array [ - 0, - 30, ], - "type": "ExportDefaultDeclaration", + "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -70398,7 +79946,7 @@ Object { }, "range": Array [ 0, - 31, + 32, ], "sourceType": "module", "tokens": Array [ @@ -70423,7 +79971,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { @@ -70433,15 +79981,51 @@ Object { }, "range": Array [ 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 14, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 18, "line": 1, }, "start": Object { @@ -70451,97 +80035,199 @@ Object { }, "range": Array [ 15, - 20, + 18, ], - "type": "Keyword", - "value": "class", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 19, "line": 1, }, "start": Object { - "column": 21, + "column": 18, "line": 1, }, }, "range": Array [ - 21, - 25, + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, ], "type": "Identifier", - "value": "Test", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 30, "line": 1, }, "start": Object { - "column": 26, + "column": 25, "line": 1, }, }, "range": Array [ - 26, - 27, + 25, + 30, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 31, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 30, + "line": 1, }, }, "range": Array [ - 29, 30, + 31, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/export-default-named-function.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-from-named-as-specifiers.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "async": false, - "body": Object { - "body": Array [], + "declaration": null, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 39, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 32, + "column": 22, "line": 1, }, "start": Object { - "column": 30, + "column": 8, "line": 1, }, }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, "range": Array [ - 30, - 32, + 8, + 22, ], - "type": "BlockStatement", + "type": "ExportSpecifier", }, - "expression": false, - "generator": false, - "id": Object { + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { "column": 27, @@ -70552,45 +80238,32 @@ Object { "line": 1, }, }, - "name": "foo", + "local": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, "range": Array [ 24, 27, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 15, - 32, - ], - "type": "FunctionDeclaration", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "ExportSpecifier", }, - }, - "range": Array [ - 0, - 32, ], - "type": "ExportDefaultDeclaration", + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -70605,7 +80278,7 @@ Object { }, "range": Array [ 0, - 33, + 41, ], "sourceType": "module", "tokens": Array [ @@ -70630,7 +80303,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { @@ -70640,8 +80313,62 @@ Object { }, "range": Array [ 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, 14, ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], "type": "Keyword", "value": "default", }, @@ -70652,16 +80379,16 @@ Object { "line": 1, }, "start": Object { - "column": 15, + "column": 22, "line": 1, }, }, "range": Array [ - 15, + 22, 23, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { @@ -70679,7 +80406,7 @@ Object { 27, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { @@ -70697,105 +80424,161 @@ Object { 28, ], "type": "Punctuator", - "value": "(", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 33, "line": 1, }, "start": Object { - "column": 28, + "column": 29, "line": 1, }, }, "range": Array [ - 28, 29, + 33, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 39, "line": 1, }, "start": Object { - "column": 30, + "column": 34, "line": 1, }, }, "range": Array [ - 30, - 31, + 34, + 39, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 32, + "column": 40, "line": 1, }, "start": Object { - "column": 31, + "column": 39, "line": 1, }, }, "range": Array [ - 31, - 32, + 39, + 40, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/export-default-number.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-from-specifier.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": Object { "loc": Object { "end": Object { - "column": 17, + "column": 23, "line": 1, }, "start": Object { - "column": 15, + "column": 18, "line": 1, }, }, - "range": Array [ - 15, - 17, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, + "range": Array [ + 18, + 23, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, ], - "type": "ExportDefaultDeclaration", + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -70810,7 +80593,7 @@ Object { }, "range": Array [ 0, - 19, + 25, ], "sourceType": "module", "tokens": Array [ @@ -70835,7 +80618,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { @@ -70845,43 +80628,97 @@ Object { }, "range": Array [ 7, - 14, + 8, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, "range": Array [ - 15, - 17, + 8, + 11, ], - "type": "Numeric", - "value": "42", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 12, "line": 1, }, "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { "column": 17, "line": 1, }, + "start": Object { + "column": 13, + "line": 1, + }, }, "range": Array [ + 13, 17, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ 18, + 23, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -70891,102 +80728,153 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-default-object.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-from-specifiers.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 15, + "column": 23, "line": 1, }, }, - "properties": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, }, - "name": "foo", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", }, - "kind": "init", + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { "loc": Object { "end": Object { - "column": 23, + "column": 11, "line": 1, }, "start": Object { - "column": 17, + "column": 8, "line": 1, }, }, - "method": false, + "name": "foo", "range": Array [ - 17, - 23, + 8, + 11, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 22, - 23, - ], - "raw": "1", - "type": "Literal", - "value": 1, }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", }, - ], - "range": Array [ - 15, - 25, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", }, - }, - "range": Array [ - 0, - 26, ], - "type": "ExportDefaultDeclaration", + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -71001,7 +80889,7 @@ Object { }, "range": Array [ 0, - 27, + 30, ], "sourceType": "module", "tokens": Array [ @@ -71026,7 +80914,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, + "column": 8, "line": 1, }, "start": Object { @@ -71036,115 +80924,133 @@ Object { }, "range": Array [ 7, - 14, + 8, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, "range": Array [ - 15, - 16, + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 16, "line": 1, }, "start": Object { - "column": 17, + "column": 13, "line": 1, }, }, "range": Array [ - 17, - 20, + 13, + 16, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { - "column": 20, + "column": 16, "line": 1, }, }, "range": Array [ - 20, - 21, + 16, + 17, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 22, "line": 1, }, "start": Object { - "column": 22, + "column": 18, "line": 1, }, }, "range": Array [ + 18, 22, - 23, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 28, "line": 1, }, "start": Object { - "column": 24, + "column": 23, "line": 1, }, }, "range": Array [ - 24, - 25, + 23, + 28, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 29, "line": 1, }, "start": Object { - "column": 25, + "column": 28, "line": 1, }, }, "range": Array [ - 25, - 26, + 28, + 29, ], "type": "Punctuator", "value": ";", @@ -71154,31 +81060,70 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-default-value.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-function.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 18, + "column": 25, "line": 1, }, "start": Object { - "column": 15, + "column": 7, "line": 1, }, }, - "name": "foo", + "params": Array [], "range": Array [ - 15, - 18, + 7, + 25, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, "loc": Object { "end": Object { - "column": 19, + "column": 25, "line": 1, }, "start": Object { @@ -71188,9 +81133,11 @@ Object { }, "range": Array [ 0, - 19, + 25, ], - "type": "ExportDefaultDeclaration", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -71202,97 +81149,152 @@ Object { "column": 0, "line": 1, }, - }, - "range": Array [ - 0, - 20, - ], - "sourceType": "module", - "tokens": Array [ + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "foo", + }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 21, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 6, + 20, + 21, ], - "type": "Keyword", - "value": "export", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 22, "line": 1, }, "start": Object { - "column": 7, + "column": 21, "line": 1, }, }, "range": Array [ - 7, - 14, + 21, + 22, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 24, "line": 1, }, "start": Object { - "column": 15, + "column": 23, "line": 1, }, }, "range": Array [ - 15, - 18, + 23, + 24, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 25, "line": 1, }, "start": Object { - "column": 18, + "column": 24, "line": 1, }, }, "range": Array [ - 18, - 19, + 24, + 25, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/export-from-batch.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-named-as-default.src 1`] = ` Object { "body": Array [ Object { + "declaration": null, "loc": Object { "end": Object { - "column": 20, + "column": 24, "line": 1, }, "start": Object { @@ -71302,28 +81304,65 @@ Object { }, "range": Array [ 0, - 20, + 24, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 15, + 22, + ], + "type": "Identifier", }, - "start": Object { - "column": 14, - "line": 1, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", }, - "range": Array [ - 14, - 19, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "type": "ExportAllDeclaration", + ], + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -71338,7 +81377,7 @@ Object { }, "range": Array [ 0, - 21, + 25, ], "sourceType": "module", "tokens": Array [ @@ -71376,58 +81415,94 @@ Object { 8, ], "type": "Punctuator", - "value": "*", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 11, "line": 1, }, "start": Object { - "column": 9, + "column": 8, "line": 1, }, }, "range": Array [ - 9, - 13, + 8, + 11, ], "type": "Identifier", - "value": "from", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 14, "line": 1, }, "start": Object { - "column": 14, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 14, - 19, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 22, "line": 1, }, "start": Object { - "column": 19, + "column": 15, "line": 1, }, }, "range": Array [ - 19, - 20, + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -71437,14 +81512,14 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-from-default.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-named-as-specifier.src 1`] = ` Object { "body": Array [ Object { "declaration": null, "loc": Object { "end": Object { - "column": 28, + "column": 20, "line": 1, }, "start": Object { @@ -71454,50 +81529,32 @@ Object { }, "range": Array [ 0, - 28, + 20, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 27, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, + "source": null, "specifiers": Array [ Object { "exported": Object { "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, - "name": "default", + "name": "bar", "range": Array [ - 8, 15, + 18, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 1, }, "start": Object { @@ -71508,7 +81565,7 @@ Object { "local": Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { @@ -71516,16 +81573,16 @@ Object { "line": 1, }, }, - "name": "default", + "name": "foo", "range": Array [ 8, - 15, + 11, ], "type": "Identifier", }, "range": Array [ 8, - 15, + 18, ], "type": "ExportSpecifier", }, @@ -71545,7 +81602,7 @@ Object { }, "range": Array [ 0, - 29, + 21, ], "sourceType": "module", "tokens": Array [ @@ -71588,7 +81645,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 11, "line": 1, }, "start": Object { @@ -71598,79 +81655,79 @@ Object { }, "range": Array [ 8, - 15, + 11, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 14, "line": 1, }, "start": Object { - "column": 15, + "column": 12, "line": 1, }, }, "range": Array [ - 15, - 16, + 12, + 14, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 18, "line": 1, }, "start": Object { - "column": 17, + "column": 15, "line": 1, }, }, "range": Array [ - 17, - 21, + 15, + 18, ], "type": "Identifier", - "value": "from", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 19, "line": 1, }, "start": Object { - "column": 22, + "column": 18, "line": 1, }, }, "range": Array [ - 22, - 27, + 18, + 19, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 20, "line": 1, }, "start": Object { - "column": 27, + "column": 19, "line": 1, }, }, "range": Array [ - 27, - 28, + 19, + 20, ], "type": "Punctuator", "value": ";", @@ -71680,14 +81737,14 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-from-named-as-default.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-named-as-specifiers.src 1`] = ` Object { "body": Array [ Object { "declaration": null, "loc": Object { "end": Object { - "column": 35, + "column": 29, "line": 1, }, "start": Object { @@ -71697,27 +81754,9 @@ Object { }, "range": Array [ 0, - 35, + 29, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 34, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, + "source": null, "specifiers": Array [ Object { "exported": Object { @@ -71772,6 +81811,59 @@ Object { ], "type": "ExportSpecifier", }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + }, + "range": Array [ + 24, + 27, + ], + "type": "ExportSpecifier", + }, ], "type": "ExportNamedDeclaration", }, @@ -71788,7 +81880,7 @@ Object { }, "range": Array [ 0, - 36, + 30, ], "sourceType": "module", "tokens": Array [ @@ -71898,12 +81990,12 @@ Object { 23, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 27, "line": 1, }, "start": Object { @@ -71913,43 +82005,43 @@ Object { }, "range": Array [ 24, - 28, + 27, ], "type": "Identifier", - "value": "from", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 28, "line": 1, }, "start": Object { - "column": 29, + "column": 27, "line": 1, }, }, "range": Array [ - 29, - 34, + 27, + 28, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 29, "line": 1, }, "start": Object { - "column": 34, + "column": 28, "line": 1, }, }, "range": Array [ - 34, - 35, + 28, + 29, ], "type": "Punctuator", "value": ";", @@ -71959,106 +82051,87 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-from-named-as-specifier.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-named-class.src 1`] = ` Object { "body": Array [ Object { - "declaration": null, - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 31, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 30, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [ - Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, }, - "name": "bar", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", }, + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "id": Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 8, + "column": 13, "line": 1, }, }, - "local": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, }, - "range": Array [ - 8, - 18, - ], - "type": "ExportSpecifier", }, + "range": Array [ + 7, + 22, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, ], + "source": null, + "specifiers": Array [], "type": "ExportNamedDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -72067,7 +82140,7 @@ Object { }, "range": Array [ 0, - 32, + 23, ], "sourceType": "module", "tokens": Array [ @@ -72092,7 +82165,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 12, "line": 1, }, "start": Object { @@ -72102,133 +82175,178 @@ Object { }, "range": Array [ 7, - 8, + 12, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 17, "line": 1, }, "start": Object { - "column": 8, + "column": 13, "line": 1, }, }, "range": Array [ - 8, - 11, + 13, + 17, ], "type": "Identifier", - "value": "foo", + "value": "Test", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 19, "line": 1, }, "start": Object { - "column": 12, + "column": 18, "line": 1, }, }, "range": Array [ - 12, - 14, + 18, + 19, ], - "type": "Identifier", - "value": "as", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-named-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": null, + "loc": Object { + "end": Object { + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 0, "line": 1, }, }, "range": Array [ - 15, - 18, + 0, + 10, ], - "type": "Identifier", - "value": "bar", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 19, + "column": 6, "line": 1, }, "start": Object { - "column": 18, + "column": 0, "line": 1, }, }, "range": Array [ - 18, - 19, + 0, + 6, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 8, "line": 1, }, "start": Object { - "column": 20, + "column": 7, "line": 1, }, }, "range": Array [ - 20, - 24, + 7, + 8, ], - "type": "Identifier", - "value": "from", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 9, "line": 1, }, "start": Object { - "column": 25, + "column": 8, "line": 1, }, }, "range": Array [ - 25, - 30, + 8, + 9, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 10, "line": 1, }, "start": Object { - "column": 30, + "column": 9, "line": 1, }, }, "range": Array [ - 30, - 31, + 9, + 10, ], "type": "Punctuator", "value": ";", @@ -72238,14 +82356,14 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-from-named-as-specifiers.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-named-specifier.src 1`] = ` Object { "body": Array [ Object { "declaration": null, "loc": Object { "end": Object { - "column": 40, + "column": 13, "line": 1, }, "start": Object { @@ -72255,50 +82373,32 @@ Object { }, "range": Array [ 0, - 40, + 13, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 39, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, + "source": null, "specifiers": Array [ Object { "exported": Object { "loc": Object { "end": Object { - "column": 22, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, - "name": "default", + "name": "foo", "range": Array [ - 15, - 22, + 8, + 11, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 11, "line": 1, }, "start": Object { @@ -72326,60 +82426,7 @@ Object { }, "range": Array [ 8, - 22, - ], - "type": "ExportSpecifier", - }, - Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - }, - "range": Array [ - 24, - 27, + 11, ], "type": "ExportSpecifier", }, @@ -72399,7 +82446,7 @@ Object { }, "range": Array [ 0, - 41, + 14, ], "sourceType": "module", "tokens": Array [ @@ -72460,89 +82507,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { "column": 12, "line": 1, }, - }, - "range": Array [ - 12, - 14, - ], - "type": "Identifier", - "value": "as", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 22, - ], - "type": "Keyword", - "value": "default", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 27, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, "start": Object { - "column": 27, + "column": 11, "line": 1, }, }, "range": Array [ - 27, - 28, + 11, + 12, ], "type": "Punctuator", "value": "}", @@ -72550,53 +82525,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 33, - ], - "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 34, - "line": 1, - }, - }, - "range": Array [ - 34, - 39, - ], - "type": "String", - "value": "\\"foo\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 40, + "column": 13, "line": 1, }, "start": Object { - "column": 39, + "column": 12, "line": 1, }, }, "range": Array [ - 39, - 40, + 12, + 13, ], "type": "Punctuator", "value": ";", @@ -72606,14 +82545,14 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-from-specifier.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-named-specifiers.src 1`] = ` Object { "body": Array [ Object { "declaration": null, "loc": Object { "end": Object { - "column": 24, + "column": 18, "line": 1, }, "start": Object { @@ -72623,27 +82562,9 @@ Object { }, "range": Array [ 0, - 24, + 18, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 23, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, + "source": null, "specifiers": Array [ Object { "exported": Object { @@ -72698,6 +82619,59 @@ Object { ], "type": "ExportSpecifier", }, + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", + }, ], "type": "ExportNamedDeclaration", }, @@ -72714,7 +82688,7 @@ Object { }, "range": Array [ 0, - 25, + 19, ], "sourceType": "module", "tokens": Array [ @@ -72788,12 +82762,12 @@ Object { 12, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 1, }, "start": Object { @@ -72803,43 +82777,43 @@ Object { }, "range": Array [ 13, - 17, + 16, ], "type": "Identifier", - "value": "from", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 17, "line": 1, }, "start": Object { - "column": 18, + "column": 16, "line": 1, }, }, "range": Array [ - 18, - 23, + 16, + 17, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 18, "line": 1, }, "start": Object { - "column": 23, + "column": 17, "line": 1, }, }, "range": Array [ - 23, - 24, + 17, + 18, ], "type": "Punctuator", "value": ";", @@ -72849,44 +82823,26 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-from-specifiers.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-named-specifiers-comma.src 1`] = ` Object { "body": Array [ Object { "declaration": null, "loc": Object { "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 0, + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, "line": 1, }, }, - "range": Array [ - 0, - 29, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 28, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, + "range": Array [ + 0, + 19, + ], + "source": null, "specifiers": Array [ Object { "exported": Object { @@ -73010,7 +82966,7 @@ Object { }, "range": Array [ 0, - 30, + 20, ], "sourceType": "module", "tokens": Array [ @@ -73120,12 +83076,30 @@ Object { 17, ], "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", "value": "}", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 1, }, "start": Object { @@ -73135,43 +83109,179 @@ Object { }, "range": Array [ 18, - 22, + 19, ], - "type": "Identifier", - "value": "from", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-var.src 1`] = ` +Object { + "body": Array [ Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "VariableDeclaration", + }, "loc": Object { "end": Object { - "column": 28, + "column": 15, "line": 1, }, "start": Object { - "column": 23, + "column": 0, "line": 1, }, }, "range": Array [ - 23, - 28, + 0, + 15, ], - "type": "String", - "value": "\\"foo\\"", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 29, + "column": 6, "line": 1, }, "start": Object { - "column": 28, + "column": 0, "line": 1, }, }, "range": Array [ - 28, - 29, + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, ], "type": "Punctuator", "value": ";", @@ -73181,53 +83291,92 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-function.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/export-var-anonymous-function.src 1`] = ` Object { "body": Array [ Object { "declaration": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", }, - }, - "range": Array [ - 23, - 25, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 31, + ], + "type": "FunctionExpression", }, - "start": Object { - "column": 16, - "line": 1, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, + "range": Array [ + 11, + 31, + ], + "type": "VariableDeclarator", }, - "name": "foo", - "range": Array [ - 16, - 19, - ], - "type": "Identifier", - }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 25, + "column": 32, "line": 1, }, "start": Object { @@ -73235,16 +83384,15 @@ Object { "line": 1, }, }, - "params": Array [], "range": Array [ 7, - 25, + 32, ], - "type": "FunctionDeclaration", + "type": "VariableDeclaration", }, "loc": Object { "end": Object { - "column": 25, + "column": 32, "line": 1, }, "start": Object { @@ -73254,7 +83402,7 @@ Object { }, "range": Array [ 0, - 25, + 32, ], "source": null, "specifiers": Array [], @@ -73273,7 +83421,7 @@ Object { }, "range": Array [ 0, - 26, + 33, ], "sourceType": "module", "tokens": Array [ @@ -73298,7 +83446,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 10, "line": 1, }, "start": Object { @@ -73308,25 +83456,25 @@ Object { }, "range": Array [ 7, - 15, + 10, ], "type": "Keyword", - "value": "function", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 14, "line": 1, }, "start": Object { - "column": 16, + "column": 11, "line": 1, }, }, "range": Array [ - 16, - 19, + 11, + 14, ], "type": "Identifier", "value": "foo", @@ -73334,17 +83482,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 16, "line": 1, }, "start": Object { - "column": 20, + "column": 15, "line": 1, }, }, "range": Array [ - 20, - 21, + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, ], "type": "Punctuator", "value": "(", @@ -73352,17 +83536,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 28, "line": 1, }, "start": Object { - "column": 21, + "column": 27, "line": 1, }, }, "range": Array [ - 21, - 22, + 27, + 28, ], "type": "Punctuator", "value": ")", @@ -73370,17 +83554,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, + "column": 30, "line": 1, }, "start": Object { - "column": 23, + "column": 29, "line": 1, }, }, "range": Array [ - 23, - 24, + 29, + 30, ], "type": "Punctuator", "value": "{", @@ -73388,101 +83572,138 @@ Object { Object { "loc": Object { "end": Object { - "column": 25, + "column": 31, "line": 1, }, "start": Object { - "column": 24, + "column": 30, "line": 1, }, }, "range": Array [ - 24, - 25, + 30, + 31, ], "type": "Punctuator", "value": "}", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/modules/export-named-as-default.src 1`] = ` -Object { - "body": Array [ Object { - "declaration": null, "loc": Object { "end": Object { - "column": 24, + "column": 32, "line": 1, }, "start": Object { - "column": 0, + "column": 31, "line": 1, }, }, "range": Array [ - 0, - 24, + 31, + 32, ], - "source": null, - "specifiers": Array [ - Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/export-var-number.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "Identifier", }, - "name": "default", - "range": Array [ - 15, - 22, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "1", + "type": "Literal", + "value": 1, }, - }, - "local": Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { - "column": 8, + "column": 11, "line": 1, }, }, - "name": "foo", "range": Array [ - 8, 11, + 18, ], - "type": "Identifier", + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, }, - "range": Array [ - 8, - 22, - ], - "type": "ExportSpecifier", + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 19, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, ], + "source": null, + "specifiers": Array [], "type": "ExportNamedDeclaration", }, ], @@ -73498,7 +83719,7 @@ Object { }, "range": Array [ 0, - 25, + 20, ], "sourceType": "module", "tokens": Array [ @@ -73523,7 +83744,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { @@ -73533,28 +83754,10 @@ Object { }, "range": Array [ 7, - 8, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 11, + 10, ], - "type": "Identifier", - "value": "foo", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { @@ -73563,21 +83766,21 @@ Object { "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ - 12, + 11, 14, ], "type": "Identifier", - "value": "as", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 16, "line": 1, }, "start": Object { @@ -73587,43 +83790,43 @@ Object { }, "range": Array [ 15, - 22, + 16, ], - "type": "Keyword", - "value": "default", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 18, "line": 1, }, "start": Object { - "column": 22, + "column": 17, "line": 1, }, }, "range": Array [ - 22, - 23, + 17, + 18, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "1", }, Object { "loc": Object { "end": Object { - "column": 24, + "column": 19, "line": 1, }, "start": Object { - "column": 23, + "column": 18, "line": 1, }, }, "range": Array [ - 23, - 24, + 18, + 19, ], "type": "Punctuator", "value": ";", @@ -73633,14 +83836,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-named-as-specifier.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-default.src 1`] = ` Object { "body": Array [ Object { - "declaration": null, "loc": Object { "end": Object { - "column": 20, + "column": 22, "line": 1, }, "start": Object { @@ -73650,65 +83852,65 @@ Object { }, "range": Array [ 0, - 20, + 22, ], - "source": null, + "source": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, "specifiers": Array [ Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 18, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "name": "foo", "range": Array [ - 8, - 11, + 7, + 10, ], "type": "Identifier", }, "range": Array [ - 8, - 18, + 7, + 10, ], - "type": "ExportSpecifier", + "type": "ImportDefaultSpecifier", }, ], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { @@ -73723,7 +83925,7 @@ Object { }, "range": Array [ 0, - 21, + 23, ], "sourceType": "module", "tokens": Array [ @@ -73743,12 +83945,12 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { @@ -73758,25 +83960,7 @@ Object { }, "range": Array [ 7, - 8, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 11, + 10, ], "type": "Identifier", "value": "foo", @@ -73784,71 +83968,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 14, - ], - "type": "Identifier", - "value": "as", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 15, - 18, ], "type": "Identifier", - "value": "bar", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 21, "line": 1, }, "start": Object { - "column": 18, + "column": 16, "line": 1, }, }, "range": Array [ - 18, - 19, + 16, + 21, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 22, "line": 1, }, "start": Object { - "column": 19, + "column": 21, "line": 1, }, }, "range": Array [ - 19, - 20, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -73858,11 +84024,10 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-named-as-specifiers.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-default-and-named-specifiers.src 1`] = ` Object { "body": Array [ Object { - "declaration": null, "loc": Object { "end": Object { "column": 29, @@ -73877,116 +84042,116 @@ Object { 0, 29, ], - "source": null, + "source": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, "specifiers": Array [ Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "default", - "range": Array [ - 15, - 22, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 22, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "name": "foo", "range": Array [ - 8, - 11, + 7, + 10, ], "type": "Identifier", }, "range": Array [ - 8, - 22, + 7, + 10, ], - "type": "ExportSpecifier", + "type": "ImportDefaultSpecifier", }, Object { - "exported": Object { + "imported": Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 24, + "column": 13, "line": 1, }, }, "name": "bar", "range": Array [ - 24, - 27, + 13, + 16, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 24, + "column": 13, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 27, + "column": 16, "line": 1, }, "start": Object { - "column": 24, + "column": 13, "line": 1, }, }, "name": "bar", "range": Array [ - 24, - 27, + 13, + 16, ], "type": "Identifier", }, "range": Array [ - 24, - 27, + 13, + 16, ], - "type": "ExportSpecifier", + "type": "ImportSpecifier", }, ], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { @@ -74021,12 +84186,12 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { @@ -74036,10 +84201,10 @@ Object { }, "range": Array [ 7, - 8, + 10, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { @@ -74048,21 +84213,21 @@ Object { "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, + 10, 11, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { @@ -74072,64 +84237,64 @@ Object { }, "range": Array [ 12, - 14, + 13, ], - "type": "Identifier", - "value": "as", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 16, "line": 1, }, "start": Object { - "column": 15, + "column": 13, "line": 1, }, }, "range": Array [ - 15, - 22, + 13, + 16, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 17, "line": 1, }, "start": Object { - "column": 22, + "column": 16, "line": 1, }, }, "range": Array [ - 22, - 23, + 16, + 17, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 22, "line": 1, }, "start": Object { - "column": 24, + "column": 18, "line": 1, }, }, "range": Array [ - 24, - 27, + 18, + 22, ], "type": "Identifier", - "value": "bar", + "value": "from", }, Object { "loc": Object { @@ -74138,16 +84303,16 @@ Object { "line": 1, }, "start": Object { - "column": 27, + "column": 23, "line": 1, }, }, "range": Array [ - 27, + 23, 28, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { @@ -74172,87 +84337,122 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-named-class.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-default-and-namespace-specifiers.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 10, + "line": 1, }, "start": Object { - "column": 18, + "column": 7, "line": 1, }, }, + "local": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, "range": Array [ - 18, - 22, + 7, + 10, ], - "type": "ClassBody", + "type": "ImportDefaultSpecifier", }, - "id": Object { + Object { "loc": Object { "end": Object { - "column": 17, + "column": 20, "line": 1, }, "start": Object { - "column": 13, + "column": 12, "line": 1, }, }, - "name": "Test", - "range": Array [ - 13, - 17, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 22, - ], - "superClass": null, - "type": "ClassDeclaration", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 1, + "local": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + }, + "range": Array [ + 12, + 20, + ], + "type": "ImportNamespaceSpecifier", }, - }, - "range": Array [ - 0, - 22, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -74261,7 +84461,7 @@ Object { }, "range": Array [ 0, - 23, + 33, ], "sourceType": "module", "tokens": Array [ @@ -74281,12 +84481,12 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 10, "line": 1, }, "start": Object { @@ -74296,178 +84496,133 @@ Object { }, "range": Array [ 7, - 12, - ], - "type": "Keyword", - "value": "class", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 17, + 10, ], "type": "Identifier", - "value": "Test", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 11, "line": 1, }, "start": Object { - "column": 18, + "column": 10, "line": 1, }, }, "range": Array [ - 18, - 19, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 13, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 12, + "line": 1, }, }, "range": Array [ - 21, - 22, + 12, + 13, ], "type": "Punctuator", - "value": "}", + "value": "*", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/modules/export-named-empty.src 1`] = ` -Object { - "body": Array [ Object { - "declaration": null, "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 10, + 14, + 16, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "as", }, - }, - "range": Array [ - 0, - 11, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 17, "line": 1, }, }, "range": Array [ - 0, - 6, + 17, + 20, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 25, "line": 1, }, "start": Object { - "column": 7, + "column": 21, "line": 1, }, }, "range": Array [ - 7, - 8, + 21, + 25, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 31, "line": 1, }, "start": Object { - "column": 8, + "column": 26, "line": 1, }, }, "range": Array [ - 8, - 9, + 26, + 31, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 32, "line": 1, }, "start": Object { - "column": 9, + "column": 31, "line": 1, }, }, "range": Array [ - 9, - 10, + 31, + 32, ], "type": "Punctuator", "value": ";", @@ -74477,14 +84632,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-named-specifier.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-default-as.src 1`] = ` Object { "body": Array [ Object { - "declaration": null, "loc": Object { "end": Object { - "column": 13, + "column": 35, "line": 1, }, "start": Object { @@ -74494,15 +84648,33 @@ Object { }, "range": Array [ 0, - 13, + 35, ], - "source": null, + "source": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, "specifiers": Array [ Object { - "exported": Object { + "imported": Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 1, }, "start": Object { @@ -74510,16 +84682,16 @@ Object { "line": 1, }, }, - "name": "foo", + "name": "default", "range": Array [ 8, - 11, + 15, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 11, + "column": 22, "line": 1, }, "start": Object { @@ -74530,29 +84702,29 @@ Object { "local": Object { "loc": Object { "end": Object { - "column": 11, + "column": 22, "line": 1, }, "start": Object { - "column": 8, + "column": 19, "line": 1, }, }, "name": "foo", "range": Array [ - 8, - 11, + 19, + 22, ], "type": "Identifier", }, "range": Array [ 8, - 11, + 22, ], - "type": "ExportSpecifier", + "type": "ImportSpecifier", }, ], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { @@ -74567,7 +84739,7 @@ Object { }, "range": Array [ 0, - 14, + 36, ], "sourceType": "module", "tokens": Array [ @@ -74587,7 +84759,7 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { @@ -74610,7 +84782,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 11, + "column": 15, "line": 1, }, "start": Object { @@ -74620,7 +84792,43 @@ Object { }, "range": Array [ 8, - 11, + 15, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, ], "type": "Identifier", "value": "foo", @@ -74628,17 +84836,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 23, "line": 1, }, "start": Object { - "column": 11, + "column": 22, "line": 1, }, }, "range": Array [ - 11, - 12, + 22, + 23, ], "type": "Punctuator", "value": "}", @@ -74646,17 +84854,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 28, "line": 1, }, "start": Object { - "column": 12, + "column": 24, "line": 1, }, }, "range": Array [ - 12, - 13, + 24, + 28, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, ], "type": "Punctuator", "value": ";", @@ -74666,14 +84910,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-named-specifiers.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-jquery.src 1`] = ` Object { "body": Array [ Object { - "declaration": null, "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { @@ -74683,118 +84926,65 @@ Object { }, "range": Array [ 0, - 18, + 22, ], - "source": null, - "specifiers": Array [ - Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, + "source": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, }, - "local": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", + "start": Object { + "column": 14, + "line": 1, }, - "range": Array [ - 8, - 11, - ], - "type": "ExportSpecifier", }, + "range": Array [ + 14, + 22, + ], + "raw": "\\"jquery\\"", + "type": "Literal", + "value": "jquery", + }, + "specifiers": Array [ Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { - "column": 16, + "column": 8, "line": 1, }, "start": Object { - "column": 13, + "column": 7, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 16, + "column": 8, "line": 1, }, "start": Object { - "column": 13, + "column": 7, "line": 1, }, }, - "name": "bar", + "name": "$", "range": Array [ - 13, - 16, + 7, + 8, ], "type": "Identifier", }, "range": Array [ - 13, - 16, + 7, + 8, ], - "type": "ExportSpecifier", + "type": "ImportDefaultSpecifier", }, ], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { @@ -74809,7 +84999,7 @@ Object { }, "range": Array [ 0, - 19, + 23, ], "sourceType": "module", "tokens": Array [ @@ -74829,7 +85019,7 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { @@ -74846,95 +85036,157 @@ Object { 7, 8, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "$", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "range": Array [ - 8, - 11, + 9, + 13, ], "type": "Identifier", - "value": "foo", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 22, "line": 1, }, "start": Object { - "column": 11, + "column": 14, "line": 1, }, }, "range": Array [ - 11, - 12, + 14, + 22, ], - "type": "Punctuator", - "value": ",", + "type": "String", + "value": "\\"jquery\\"", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-module.src 1`] = ` +Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 16, + "column": 6, "line": 1, }, "start": Object { - "column": 13, + "column": 0, "line": 1, }, }, "range": Array [ - 13, - 16, + 0, + 6, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 12, "line": 1, }, "start": Object { - "column": 16, + "column": 7, "line": 1, }, }, "range": Array [ - 16, - 17, + 7, + 12, ], - "type": "Punctuator", - "value": "}", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 13, "line": 1, }, "start": Object { - "column": 17, + "column": 12, "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", "value": ";", @@ -74944,14 +85196,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-named-specifiers-comma.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-named-as-specifier.src 1`] = ` Object { "body": Array [ Object { - "declaration": null, "loc": Object { "end": Object { - "column": 19, + "column": 31, "line": 1, }, "start": Object { @@ -74961,12 +85212,30 @@ Object { }, "range": Array [ 0, - 19, + 31, ], - "source": null, + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, "specifiers": Array [ Object { - "exported": Object { + "imported": Object { "loc": Object { "end": Object { "column": 11, @@ -74977,7 +85246,7 @@ Object { "line": 1, }, }, - "name": "foo", + "name": "bar", "range": Array [ 8, 11, @@ -74986,7 +85255,7 @@ Object { }, "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { @@ -74997,82 +85266,29 @@ Object { "local": Object { "loc": Object { "end": Object { - "column": 11, + "column": 18, "line": 1, }, "start": Object { - "column": 8, + "column": 15, "line": 1, }, }, - "name": "foo", + "name": "baz", "range": Array [ - 8, - 11, + 15, + 18, ], "type": "Identifier", }, "range": Array [ 8, - 11, - ], - "type": "ExportSpecifier", - }, - Object { - "exported": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, - "range": Array [ - 13, - 16, + 18, ], - "type": "ExportSpecifier", + "type": "ImportSpecifier", }, ], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { @@ -75087,7 +85303,7 @@ Object { }, "range": Array [ 0, - 20, + 32, ], "sourceType": "module", "tokens": Array [ @@ -75107,7 +85323,7 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { @@ -75143,94 +85359,112 @@ Object { 11, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, "range": Array [ - 11, 12, + 14, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 18, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 16, + 15, + 18, ], "type": "Identifier", - "value": "bar", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 19, "line": 1, }, "start": Object { - "column": 16, + "column": 18, "line": 1, }, }, "range": Array [ - 16, - 17, + 18, + 19, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 24, "line": 1, }, "start": Object { - "column": 17, + "column": 20, "line": 1, }, }, "range": Array [ - 17, - 18, + 20, + 24, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 30, "line": 1, }, "start": Object { - "column": 18, + "column": 25, "line": 1, }, }, "range": Array [ - 18, - 19, + 25, + 30, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, ], "type": "Punctuator", "value": ";", @@ -75240,83 +85474,152 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-var.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-named-as-specifiers.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - }, - "init": null, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { "loc": Object { "end": Object { - "column": 14, + "column": 11, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, + "name": "bar", "range": Array [ + 8, 11, - 14, ], - "type": "VariableDeclarator", + "type": "Identifier", }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 15, - "line": 1, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, }, - "start": Object { - "column": 7, - "line": 1, + "local": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", }, + "range": Array [ + 8, + 18, + ], + "type": "ImportSpecifier", }, - "range": Array [ - 7, - 15, - ], - "type": "VariableDeclaration", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "xyz", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "xyz", + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 23, + ], + "type": "ImportSpecifier", }, - }, - "range": Array [ - 0, - 15, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { @@ -75331,7 +85634,7 @@ Object { }, "range": Array [ 0, - 16, + 37, ], "sourceType": "module", "tokens": Array [ @@ -75351,12 +85654,12 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -75366,25 +85669,25 @@ Object { }, "range": Array [ 7, - 10, + 8, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 11, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ + 8, 11, - 14, ], "type": "Identifier", "value": "bar", @@ -75392,300 +85695,241 @@ Object { Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 1, }, "start": Object { - "column": 14, + "column": 12, "line": 1, }, }, "range": Array [ + 12, 14, - 15, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "as", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/modules/export-var-anonymous-function.src 1`] = ` -Object { - "body": Array [ - Object { - "declaration": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - }, - "init": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 31, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 17, - 31, - ], - "type": "FunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 31, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, }, - "range": Array [ - 7, - 32, - ], - "type": "VariableDeclaration", }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { "loc": Object { "end": Object { - "column": 32, + "column": 19, "line": 1, }, "start": Object { - "column": 0, + "column": 18, "line": 1, }, }, "range": Array [ - 0, - 32, + 18, + 19, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": ",", }, - }, - "range": Array [ - 0, - 33, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 23, "line": 1, }, "start": Object { - "column": 0, + "column": 20, "line": 1, }, }, "range": Array [ - 0, - 6, + 20, + 23, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "xyz", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 24, "line": 1, }, "start": Object { - "column": 7, + "column": 23, "line": 1, }, }, "range": Array [ - 7, - 10, + 23, + 24, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 29, "line": 1, }, "start": Object { - "column": 11, + "column": 25, "line": 1, }, }, "range": Array [ - 11, - 14, + 25, + 29, ], "type": "Identifier", - "value": "foo", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 35, "line": 1, }, "start": Object { - "column": 15, + "column": 30, "line": 1, }, }, "range": Array [ - 15, - 16, + 30, + 35, ], - "type": "Punctuator", - "value": "=", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 36, "line": 1, }, "start": Object { - "column": 17, + "column": 35, "line": 1, }, }, "range": Array [ - 17, - 25, + 35, + 36, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ";", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/import-named-empty.src 1`] = ` +Object { + "body": Array [ Object { "loc": Object { "end": Object { - "column": 27, + "column": 21, "line": 1, }, "start": Object { - "column": 26, + "column": 0, "line": 1, }, }, "range": Array [ - 26, - 27, + 0, + 21, ], - "type": "Punctuator", - "value": "(", + "source": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 27, + "column": 0, "line": 1, }, }, "range": Array [ - 27, - 28, + 0, + 6, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 8, "line": 1, }, "start": Object { - "column": 29, + "column": 7, "line": 1, }, }, "range": Array [ - 29, - 30, + 7, + 8, ], "type": "Punctuator", "value": "{", @@ -75693,17 +85937,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 9, "line": 1, }, "start": Object { - "column": 30, + "column": 8, "line": 1, }, }, "range": Array [ - 30, - 31, + 8, + 9, ], "type": "Punctuator", "value": "}", @@ -75711,17 +85955,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 14, "line": 1, }, "start": Object { - "column": 31, + "column": 10, "line": 1, }, }, "range": Array [ - 31, - 32, + 10, + 14, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, ], "type": "Punctuator", "value": ";", @@ -75731,101 +86011,99 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/export-var-number.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-named-specifier.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - "name": "foo", - "range": Array [ - 11, - 14, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "start": Object { + "column": 8, + "line": 1, }, - "range": Array [ - 17, - 18, - ], - "raw": "1", - "type": "Literal", - "value": 1, }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, + "name": "bar", "range": Array [ + 8, 11, - 18, ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "type": "Identifier", }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", }, - "range": Array [ - 7, - 19, - ], - "type": "VariableDeclaration", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ImportDeclaration", }, ], "loc": Object { @@ -75840,7 +86118,7 @@ Object { }, "range": Array [ 0, - 20, + 25, ], "sourceType": "module", "tokens": Array [ @@ -75860,12 +86138,12 @@ Object { 6, ], "type": "Keyword", - "value": "export", + "value": "import", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -75875,69 +86153,69 @@ Object { }, "range": Array [ 7, - 10, + 8, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 11, "line": 1, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, "range": Array [ + 8, 11, - 14, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 12, "line": 1, }, "start": Object { - "column": 15, + "column": 11, "line": 1, }, }, "range": Array [ - 15, - 16, + 11, + 12, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 17, "line": 1, }, "start": Object { - "column": 17, + "column": 13, "line": 1, }, }, "range": Array [ + 13, 17, - 18, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 1, }, "start": Object { @@ -75947,7 +86225,25 @@ Object { }, "range": Array [ 18, - 19, + 23, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, ], "type": "Punctuator", "value": ";", @@ -75957,13 +86253,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-default.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-named-specifiers.src 1`] = ` Object { "body": Array [ Object { "loc": Object { "end": Object { - "column": 22, + "column": 29, "line": 1, }, "start": Object { @@ -75973,22 +86269,22 @@ Object { }, "range": Array [ 0, - 22, + 29, ], "source": Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { - "column": 16, + "column": 23, "line": 1, }, }, "range": Array [ - 16, - 21, + 23, + 28, ], "raw": "\\"foo\\"", "type": "Literal", @@ -75996,39 +86292,110 @@ Object { }, "specifiers": Array [ Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 10, + "column": 16, "line": 1, }, "start": Object { - "column": 7, + "column": 13, "line": 1, }, }, - "name": "foo", + "name": "baz", "range": Array [ - 7, - 10, + 13, + 16, ], "type": "Identifier", }, "range": Array [ - 7, - 10, + 13, + 16, ], - "type": "ImportDefaultSpecifier", + "type": "ImportSpecifier", }, ], "type": "ImportDeclaration", @@ -76046,7 +86413,7 @@ Object { }, "range": Array [ 0, - 23, + 30, ], "sourceType": "module", "tokens": Array [ @@ -76071,7 +86438,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -76081,15 +86448,33 @@ Object { }, "range": Array [ 7, - 10, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, ], "type": "Identifier", - "value": "foo", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 12, "line": 1, }, "start": Object { @@ -76099,15 +86484,33 @@ Object { }, "range": Array [ 11, - 15, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, ], "type": "Identifier", - "value": "from", + "value": "baz", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 17, "line": 1, }, "start": Object { @@ -76117,10 +86520,10 @@ Object { }, "range": Array [ 16, - 21, + 17, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { @@ -76129,14 +86532,50 @@ Object { "line": 1, }, "start": Object { - "column": 21, + "column": 18, "line": 1, }, }, "range": Array [ - 21, + 18, 22, ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], "type": "Punctuator", "value": ";", }, @@ -76145,13 +86584,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-default-and-named-specifiers.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-named-specifiers-comma.src 1`] = ` Object { "body": Array [ Object { "loc": Object { "end": Object { - "column": 29, + "column": 30, "line": 1, }, "start": Object { @@ -76161,22 +86600,22 @@ Object { }, "range": Array [ 0, - 29, + 30, ], "source": Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 24, "line": 1, }, }, "range": Array [ - 23, - 28, + 24, + 29, ], "raw": "\\"foo\\"", "type": "Literal", @@ -76184,39 +86623,57 @@ Object { }, "specifiers": Array [ Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 10, + "column": 11, "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, - "name": "foo", + "name": "bar", "range": Array [ - 7, - 10, + 8, + 11, ], "type": "Identifier", }, "range": Array [ - 7, - 10, + 8, + 11, ], - "type": "ImportDefaultSpecifier", + "type": "ImportSpecifier", }, Object { "imported": Object { @@ -76230,7 +86687,7 @@ Object { "line": 1, }, }, - "name": "bar", + "name": "baz", "range": Array [ 13, 16, @@ -76258,7 +86715,7 @@ Object { "line": 1, }, }, - "name": "bar", + "name": "baz", "range": Array [ 13, 16, @@ -76287,7 +86744,7 @@ Object { }, "range": Array [ 0, - 30, + 31, ], "sourceType": "module", "tokens": Array [ @@ -76312,7 +86769,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -76322,10 +86779,10 @@ Object { }, "range": Array [ 7, - 10, + 8, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -76334,34 +86791,34 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, + 8, 11, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 12, - 13, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { @@ -76379,7 +86836,7 @@ Object { 16, ], "type": "Identifier", - "value": "bar", + "value": "baz", }, Object { "loc": Object { @@ -76397,22 +86854,40 @@ Object { 17, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 18, "line": 1, }, "start": Object { - "column": 18, + "column": 17, "line": 1, }, }, "range": Array [ + 17, 18, - 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, ], "type": "Identifier", "value": "from", @@ -76420,17 +86895,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 28, + "column": 29, "line": 1, }, "start": Object { - "column": 23, + "column": 24, "line": 1, }, }, "range": Array [ - 23, - 28, + 24, + 29, ], "type": "String", "value": "\\"foo\\"", @@ -76438,17 +86913,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 30, "line": 1, }, "start": Object { - "column": 28, + "column": 29, "line": 1, }, }, "range": Array [ - 28, 29, + 30, ], "type": "Punctuator", "value": ";", @@ -76458,13 +86933,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-default-and-namespace-specifiers.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-namespace-specifier.src 1`] = ` Object { "body": Array [ Object { "loc": Object { "end": Object { - "column": 32, + "column": 27, "line": 1, }, "start": Object { @@ -76474,22 +86949,22 @@ Object { }, "range": Array [ 0, - 32, + 27, ], "source": Object { "loc": Object { "end": Object { - "column": 31, + "column": 26, "line": 1, }, "start": Object { - "column": 26, + "column": 21, "line": 1, }, }, "range": Array [ + 21, 26, - 31, ], "raw": "\\"foo\\"", "type": "Literal", @@ -76499,7 +86974,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { @@ -76510,59 +86985,24 @@ Object { "local": Object { "loc": Object { "end": Object { - "column": 10, + "column": 15, "line": 1, }, "start": Object { - "column": 7, + "column": 12, "line": 1, }, }, "name": "foo", "range": Array [ - 7, - 10, + 12, + 15, ], "type": "Identifier", }, "range": Array [ 7, - 10, - ], - "type": "ImportDefaultSpecifier", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 17, - 20, - ], - "type": "Identifier", - }, - "range": Array [ - 12, - 20, + 15, ], "type": "ImportNamespaceSpecifier", }, @@ -76582,7 +87022,7 @@ Object { }, "range": Array [ 0, - 33, + 28, ], "sourceType": "module", "tokens": Array [ @@ -76607,7 +87047,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 10, + "column": 8, "line": 1, }, "start": Object { @@ -76617,10 +87057,10 @@ Object { }, "range": Array [ 7, - 10, + 8, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "*", }, Object { "loc": Object { @@ -76629,21 +87069,21 @@ Object { "line": 1, }, "start": Object { - "column": 10, + "column": 9, "line": 1, }, }, "range": Array [ - 10, + 9, 11, ], - "type": "Punctuator", - "value": ",", + "type": "Identifier", + "value": "as", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { @@ -76653,28 +87093,10 @@ Object { }, "range": Array [ 12, - 13, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 16, + 15, ], "type": "Identifier", - "value": "as", + "value": "foo", }, Object { "loc": Object { @@ -76683,21 +87105,21 @@ Object { "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, "range": Array [ - 17, + 16, 20, ], "type": "Identifier", - "value": "bar", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 25, + "column": 26, "line": 1, }, "start": Object { @@ -76707,25 +87129,7 @@ Object { }, "range": Array [ 21, - 25, - ], - "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ 26, - 31, ], "type": "String", "value": "\\"foo\\"", @@ -76733,17 +87137,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 27, "line": 1, }, "start": Object { - "column": 31, + "column": 26, "line": 1, }, }, "range": Array [ - 31, - 32, + 26, + 27, ], "type": "Punctuator", "value": ";", @@ -76753,13 +87157,13 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-default-as.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/import-null-as-nil.src 1`] = ` Object { "body": Array [ Object { "loc": Object { "end": Object { - "column": 35, + "column": 33, "line": 1, }, "start": Object { @@ -76769,78 +87173,78 @@ Object { }, "range": Array [ 0, - 35, + 33, ], "source": Object { "loc": Object { "end": Object { - "column": 34, + "column": 33, "line": 1, }, "start": Object { - "column": 29, + "column": 28, "line": 1, }, }, "range": Array [ - 29, - 34, + 28, + 33, ], - "raw": "\\"foo\\"", + "raw": "\\"bar\\"", "type": "Literal", - "value": "foo", + "value": "bar", }, "specifiers": Array [ Object { "imported": Object { "loc": Object { "end": Object { - "column": 15, + "column": 13, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, - "name": "default", + "name": "null", "range": Array [ - 8, - 15, + 9, + 13, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 1, }, "start": Object { - "column": 8, + "column": 9, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 22, + "column": 20, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, - "name": "foo", + "name": "nil", "range": Array [ - 19, - 22, + 17, + 20, ], "type": "Identifier", }, "range": Array [ - 8, - 22, + 9, + 20, ], "type": "ImportSpecifier", }, @@ -76857,171 +87261,325 @@ Object { "column": 0, "line": 1, }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "module", - "tokens": Array [ + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Null", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Identifier", + "value": "as", + }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 20, "line": 1, }, "start": Object { - "column": 0, + "column": 17, "line": 1, }, }, "range": Array [ - 0, - 6, + 17, + 20, ], - "type": "Keyword", - "value": "import", + "type": "Identifier", + "value": "nil", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 22, "line": 1, }, "start": Object { - "column": 7, + "column": 21, "line": 1, }, }, "range": Array [ - 7, - 8, + 21, + 22, ], "type": "Punctuator", - "value": "{", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 27, "line": 1, }, "start": Object { - "column": 8, + "column": 23, "line": 1, }, }, "range": Array [ - 8, - 15, + 23, + 27, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 33, "line": 1, }, "start": Object { - "column": 16, + "column": 28, "line": 1, }, }, "range": Array [ - 16, - 18, + 28, + 33, ], - "type": "Identifier", - "value": "as", + "type": "String", + "value": "\\"bar\\"", }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/modules/invalid-await.src 1`] = ` +Object { + "body": Array [ Object { + "declaration": Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "await", + "range": Array [ + 11, + 16, + ], + "type": "Identifier", + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "VariableDeclaration", + }, "loc": Object { "end": Object { - "column": 22, + "column": 17, "line": 1, }, "start": Object { - "column": 19, + "column": 0, "line": 1, }, }, "range": Array [ - 19, - 22, + 0, + 17, ], - "type": "Identifier", - "value": "foo", + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 23, + "column": 6, "line": 1, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 6, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 28, + "column": 10, "line": 1, }, "start": Object { - "column": 24, + "column": 7, "line": 1, }, }, "range": Array [ - 24, - 28, + 7, + 10, ], - "type": "Identifier", - "value": "from", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 34, + "column": 16, "line": 1, }, "start": Object { - "column": 29, + "column": 11, "line": 1, }, }, "range": Array [ - 29, - 34, + 11, + 16, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Keyword", + "value": "await", }, Object { "loc": Object { "end": Object { - "column": 35, + "column": 17, "line": 1, }, "start": Object { - "column": 34, + "column": 16, "line": 1, }, }, "range": Array [ - 34, - 35, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -77031,81 +87589,62 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-jquery.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/invalid-class.src 1`] = ` Object { "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "ClassBody", }, - }, - "range": Array [ - 0, - 22, - ], - "source": Object { + "id": null, "loc": Object { "end": Object { - "column": 22, + "column": 23, "line": 1, }, "start": Object { - "column": 14, + "column": 15, "line": 1, }, }, "range": Array [ - 14, - 22, + 15, + 23, ], - "raw": "\\"jquery\\"", - "type": "Literal", - "value": "jquery", + "superClass": null, + "type": "ClassDeclaration", }, - "specifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "name": "$", - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - }, - "range": Array [ - 7, - 8, - ], - "type": "ImportDefaultSpecifier", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 23, ], - "type": "ImportDeclaration", + "type": "ExportDefaultDeclaration", }, ], "loc": Object { @@ -77120,7 +87659,7 @@ Object { }, "range": Array [ 0, - 23, + 24, ], "sourceType": "module", "tokens": Array [ @@ -77140,12 +87679,12 @@ Object { 6, ], "type": "Keyword", - "value": "import", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 14, "line": 1, }, "start": Object { @@ -77155,28 +87694,28 @@ Object { }, "range": Array [ 7, - 8, + 14, ], - "type": "Identifier", - "value": "$", + "type": "Keyword", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 20, "line": 1, }, "start": Object { - "column": 9, + "column": 15, "line": 1, }, }, "range": Array [ - 9, - 13, + 15, + 20, ], - "type": "Identifier", - "value": "from", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { @@ -77185,29 +87724,58 @@ Object { "line": 1, }, "start": Object { - "column": 14, + "column": 21, "line": 1, }, }, "range": Array [ - 14, + 21, 22, ], - "type": "String", - "value": "\\"jquery\\"", + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/import-module.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/invalid-export-batch-missing-from-clause.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-export-batch-token.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-export-default.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-export-default-equal.src 1`] = `"Expression expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-export-default-token.src 1`] = `"';' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-export-named-default.src 1`] = ` Object { "body": Array [ Object { + "declaration": null, "loc": Object { "end": Object { - "column": 13, + "column": 16, "line": 1, }, "start": Object { @@ -77217,29 +87785,65 @@ Object { }, "range": Array [ 0, - 13, + 16, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, + "source": null, + "specifiers": Array [ + Object { + "exported": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 8, + 15, + ], + "type": "Identifier", }, - "start": Object { - "column": 7, - "line": 1, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "range": Array [ + 8, + 15, + ], + "type": "Identifier", }, + "range": Array [ + 8, + 15, + ], + "type": "ExportSpecifier", }, - "range": Array [ - 7, - 12, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [], - "type": "ImportDeclaration", + ], + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -77254,7 +87858,7 @@ Object { }, "range": Array [ 0, - 14, + 17, ], "sourceType": "module", "tokens": Array [ @@ -77274,12 +87878,12 @@ Object { 6, ], "type": "Keyword", - "value": "import", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 8, "line": 1, }, "start": Object { @@ -77289,41 +87893,71 @@ Object { }, "range": Array [ 7, - 12, + 8, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 13, + "column": 15, "line": 1, }, "start": Object { - "column": 12, + "column": 8, "line": 1, }, }, "range": Array [ - 12, - 13, + 8, + 15, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/import-named-as-specifier.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/invalid-export-named-extra-comma.src 1`] = `"Identifier expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-export-named-middle-comma.src 1`] = `"Identifier expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-default.src 1`] = `"Expression expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-default-after-named.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-default-after-named-after-default.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-default-missing-module-specifier.src 1`] = `"'=' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-default-module-specifier.src 1`] = ` Object { "body": Array [ Object { "loc": Object { "end": Object { - "column": 31, + "column": 20, "line": 1, }, "start": Object { @@ -77333,80 +87967,61 @@ Object { }, "range": Array [ 0, - 31, + 20, ], "source": Object { "loc": Object { "end": Object { - "column": 30, + "column": 19, "line": 1, }, "start": Object { - "column": 25, + "column": 16, "line": 1, }, }, + "name": "bar", "range": Array [ - 25, - 30, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [ - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - }, + 16, + 19, + ], + "type": "Identifier", + }, + "specifiers": Array [ + Object { "loc": Object { "end": Object { - "column": 18, + "column": 10, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "local": Object { "loc": Object { "end": Object { - "column": 18, + "column": 10, "line": 1, }, "start": Object { - "column": 15, + "column": 7, "line": 1, }, }, - "name": "baz", + "name": "foo", "range": Array [ - 15, - 18, + 7, + 10, ], "type": "Identifier", }, "range": Array [ - 8, - 18, + 7, + 10, ], - "type": "ImportSpecifier", + "type": "ImportDefaultSpecifier", }, ], "type": "ImportDeclaration", @@ -77424,7 +88039,7 @@ Object { }, "range": Array [ 0, - 32, + 21, ], "sourceType": "module", "tokens": Array [ @@ -77449,7 +88064,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { @@ -77459,64 +88074,28 @@ Object { }, "range": Array [ 7, - 8, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 14, + 10, ], "type": "Identifier", - "value": "as", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 15, "line": 1, }, "start": Object { - "column": 15, + "column": 11, "line": 1, }, }, "range": Array [ + 11, 15, - 18, ], "type": "Identifier", - "value": "baz", + "value": "from", }, Object { "loc": Object { @@ -77525,67 +88104,31 @@ Object { "line": 1, }, "start": Object { - "column": 18, + "column": 16, "line": 1, }, }, "range": Array [ - 18, + 16, 19, ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 24, - ], "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 30, - ], - "type": "String", - "value": "\\"foo\\"", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 31, + "column": 20, "line": 1, }, "start": Object { - "column": 30, + "column": 19, "line": 1, }, }, "range": Array [ - 30, - 31, + 19, + 20, ], "type": "Punctuator", "value": ";", @@ -77595,13 +88138,16 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-named-as-specifiers.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/invalid-import-missing-module-specifier.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-module-specifier.src 1`] = ` Object { "body": Array [ Object { + "declaration": null, "loc": Object { "end": Object { - "column": 36, + "column": 21, "line": 1, }, "start": Object { @@ -77611,30 +88157,29 @@ Object { }, "range": Array [ 0, - 36, + 21, ], "source": Object { "loc": Object { "end": Object { - "column": 35, + "column": 21, "line": 1, }, "start": Object { - "column": 30, + "column": 18, "line": 1, }, }, + "name": "bar", "range": Array [ - 30, - 35, + 18, + 21, ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", + "type": "Identifier", }, "specifiers": Array [ Object { - "imported": Object { + "exported": Object { "loc": Object { "end": Object { "column": 11, @@ -77645,7 +88190,7 @@ Object { "line": 1, }, }, - "name": "bar", + "name": "foo", "range": Array [ 8, 11, @@ -77654,7 +88199,7 @@ Object { }, "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 1, }, "start": Object { @@ -77665,82 +88210,29 @@ Object { "local": Object { "loc": Object { "end": Object { - "column": 18, + "column": 11, "line": 1, }, "start": Object { - "column": 15, + "column": 8, "line": 1, }, }, - "name": "baz", + "name": "foo", "range": Array [ - 15, - 18, + 8, + 11, ], "type": "Identifier", }, "range": Array [ 8, - 18, - ], - "type": "ImportSpecifier", - }, - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "xyz", - "range": Array [ - 20, - 23, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "name": "xyz", - "range": Array [ - 20, - 23, - ], - "type": "Identifier", - }, - "range": Array [ - 20, - 23, + 11, ], - "type": "ImportSpecifier", + "type": "ExportSpecifier", }, ], - "type": "ImportDeclaration", + "type": "ExportNamedDeclaration", }, ], "loc": Object { @@ -77755,7 +88247,7 @@ Object { }, "range": Array [ 0, - 37, + 22, ], "sourceType": "module", "tokens": Array [ @@ -77775,7 +88267,7 @@ Object { 6, ], "type": "Keyword", - "value": "import", + "value": "export", }, Object { "loc": Object { @@ -77811,94 +88303,22 @@ Object { 11, ], "type": "Identifier", - "value": "bar", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { "column": 12, "line": 1, }, - }, - "range": Array [ - 12, - 14, - ], - "type": "Identifier", - "value": "as", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - "value": "baz", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": ",", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 23, - ], - "type": "Identifier", - "value": "xyz", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, "start": Object { - "column": 23, + "column": 11, "line": 1, }, }, "range": Array [ - 23, - 24, + 11, + 12, ], "type": "Punctuator", "value": "}", @@ -77906,17 +88326,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 29, + "column": 17, "line": 1, }, "start": Object { - "column": 25, + "column": 13, "line": 1, }, }, "range": Array [ - 25, - 29, + 13, + 17, ], "type": "Identifier", "value": "from", @@ -77924,51 +88344,138 @@ Object { Object { "loc": Object { "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "range": Array [ - 30, - 35, - ], - "type": "String", - "value": "\\"foo\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 36, + "column": 21, "line": 1, }, "start": Object { - "column": 35, + "column": 18, "line": 1, }, }, "range": Array [ - 35, - 36, + 18, + 21, ], - "type": "Punctuator", - "value": ";", + "type": "Identifier", + "value": "bar", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/modules/import-named-empty.src 1`] = ` +exports[`ecmaFeatures fixtures/modules/invalid-import-named-after-named.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-named-after-namespace.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-named-as-missing-from.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-named-extra-comma.src 1`] = `"Identifier expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-named-middle-comma.src 1`] = `"Identifier expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-namespace-after-named.src 1`] = `"'from' expected."`; + +exports[`ecmaFeatures fixtures/modules/invalid-import-namespace-missing-as.src 1`] = `"'as' expected."`; + +exports[`ecmaFeatures fixtures/newTarget/invalid-new-target.src 1`] = ` Object { "body": Array [ Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "new", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "target", + "range": Array [ + 12, + 18, + ], + "type": "Identifier", + }, + "range": Array [ + 8, + 18, + ], + "type": "MetaProperty", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 1, }, "start": Object { @@ -77978,29 +88485,9 @@ Object { }, "range": Array [ 0, - 21, + 19, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 20, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [], - "type": "ImportDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { @@ -78015,14 +88502,14 @@ Object { }, "range": Array [ 0, - 22, + 20, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 1, }, "start": Object { @@ -78032,33 +88519,51 @@ Object { }, "range": Array [ 0, - 6, + 3, ], "type": "Keyword", - "value": "import", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 5, "line": 1, }, "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { "column": 7, "line": 1, }, + "start": Object { + "column": 6, + "line": 1, + }, }, "range": Array [ + 6, 7, - 8, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { @@ -78068,61 +88573,61 @@ Object { }, "range": Array [ 8, - 9, + 11, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 12, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, "range": Array [ - 10, - 14, + 11, + 12, ], - "type": "Identifier", - "value": "from", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 18, "line": 1, }, "start": Object { - "column": 15, + "column": 12, "line": 1, }, }, "range": Array [ - 15, - 20, + 12, + 18, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Identifier", + "value": "target", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 19, "line": 1, }, "start": Object { - "column": 20, + "column": 18, "line": 1, }, }, "range": Array [ - 20, - 21, + 18, + 19, ], "type": "Punctuator", "value": ";", @@ -78132,77 +88637,127 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-named-specifier.src 1`] = ` +exports[`ecmaFeatures fixtures/newTarget/invalid-unknown-property.src 1`] = ` Object { "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 24, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 23, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [ + "declarations": Array [ Object { - "imported": Object { + "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 5, "line": 1, }, "start": Object { - "column": 8, + "column": 4, "line": 1, }, }, - "name": "bar", + "name": "f", "range": Array [ - 8, - 11, + 4, + 5, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "new", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "unknown_property", + "range": Array [ + 25, + 41, + ], + "type": "Identifier", + }, + "range": Array [ + 21, + 41, + ], + "type": "MetaProperty", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 42, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 44, + ], + "type": "BlockStatement", }, - }, - "local": Object { + "expression": false, + "generator": false, + "id": null, "loc": Object { "end": Object { - "column": 11, + "column": 44, "line": 1, }, "start": Object { @@ -78210,21 +88765,46 @@ Object { "line": 1, }, }, - "name": "bar", + "params": Array [], "range": Array [ 8, - 11, + 44, ], - "type": "Identifier", + "type": "FunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, }, "range": Array [ - 8, - 11, + 4, + 44, ], - "type": "ImportSpecifier", + "type": "VariableDeclarator", }, ], - "type": "ImportDeclaration", + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", }, ], "loc": Object { @@ -78239,14 +88819,14 @@ Object { }, "range": Array [ 0, - 25, + 45, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 1, }, "start": Object { @@ -78256,33 +88836,51 @@ Object { }, "range": Array [ 0, - 6, + 3, ], "type": "Keyword", - "value": "import", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 5, "line": 1, }, "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { "column": 7, "line": 1, }, + "start": Object { + "column": 6, + "line": 1, + }, }, "range": Array [ + 6, 7, - 8, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 16, "line": 1, }, "start": Object { @@ -78292,64 +88890,64 @@ Object { }, "range": Array [ 8, - 11, + 16, ], - "type": "Identifier", - "value": "bar", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 17, "line": 1, }, "start": Object { - "column": 11, + "column": 16, "line": 1, }, }, "range": Array [ - 11, - 12, + 16, + 17, ], "type": "Punctuator", - "value": "}", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 18, "line": 1, }, "start": Object { - "column": 13, + "column": 17, "line": 1, }, }, "range": Array [ - 13, 17, + 18, ], - "type": "Identifier", - "value": "from", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 23, + "column": 20, "line": 1, }, "start": Object { - "column": 18, + "column": 19, "line": 1, }, }, "range": Array [ - 18, - 23, + 19, + 20, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { @@ -78358,174 +88956,268 @@ Object { "line": 1, }, "start": Object { - "column": 23, + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, "line": 1, }, }, "range": Array [ - 23, 24, + 25, ], "type": "Punctuator", - "value": ";", + "value": ".", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/modules/import-named-specifiers.src 1`] = ` -Object { - "body": Array [ Object { "loc": Object { "end": Object { - "column": 29, + "column": 41, "line": 1, }, "start": Object { - "column": 0, + "column": 25, "line": 1, }, }, "range": Array [ - 0, - 29, + 25, + 41, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, + "type": "Identifier", + "value": "unknown_property", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, }, - "range": Array [ - 23, - 28, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", }, - "specifiers": Array [ - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/newTarget/simple-new-target.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "x", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "meta": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "new", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "target", + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + }, + "range": Array [ + 27, + 37, + ], + "type": "MetaProperty", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "VariableDeclarator", }, - }, - "name": "bar", - "range": Array [ - 8, - 11, ], - "type": "Identifier", - }, - "range": Array [ - 8, - 11, - ], - "type": "ImportSpecifier", - }, - Object { - "imported": Object { + "kind": "var", "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 4, + "line": 2, }, }, - "name": "baz", "range": Array [ - 13, - 16, + 19, + 38, ], - "type": "Identifier", + "type": "VariableDeclaration", }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, }, - "local": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", + "start": Object { + "column": 13, + "line": 1, }, - "range": Array [ - 13, - 16, - ], - "type": "ImportSpecifier", }, + "range": Array [ + 13, + 40, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 40, ], - "type": "ImportDeclaration", + "type": "FunctionDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -78534,14 +89226,14 @@ Object { }, "range": Array [ 0, - 30, + 41, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 8, "line": 1, }, "start": Object { @@ -78551,28 +89243,28 @@ Object { }, "range": Array [ 0, - 6, + 8, ], "type": "Keyword", - "value": "import", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 10, "line": 1, }, "start": Object { - "column": 7, + "column": 9, "line": 1, }, }, "range": Array [ - 7, - 8, + 9, + 10, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "f", }, Object { "loc": Object { @@ -78581,16 +89273,16 @@ Object { "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, + 10, 11, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { @@ -78608,12 +89300,12 @@ Object { 12, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 14, "line": 1, }, "start": Object { @@ -78623,240 +89315,337 @@ Object { }, "range": Array [ 13, - 16, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, ], "type": "Identifier", - "value": "baz", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 11, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 2, }, }, "range": Array [ - 16, - 17, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 12, + "line": 2, }, }, "range": Array [ - 18, - 22, + 27, + 30, ], - "type": "Identifier", - "value": "from", + "type": "Keyword", + "value": "new", }, Object { "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 23, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 23, - 28, + 30, + 31, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": ".", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 28, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 28, - 29, + 31, + 37, + ], + "type": "Identifier", + "value": "target", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, ], "type": "Punctuator", "value": ";", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/modules/import-named-specifiers-comma.src 1`] = ` -Object { - "body": Array [ Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 0, - "line": 1, + "line": 3, }, }, "range": Array [ - 0, - 30, + 39, + 40, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 29, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [ + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-addition-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ Object { - "imported": Object { + "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 5, "line": 1, }, "start": Object { - "column": 8, + "column": 4, "line": 1, }, }, - "name": "bar", + "name": "x", "range": Array [ - 8, - 11, + 4, + 5, ], "type": "Identifier", }, - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "local": Object { + "init": Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { "column": 8, "line": 1, }, }, - "name": "bar", - "range": Array [ - 8, - 11, - ], - "type": "Identifier", - }, - "range": Array [ - 8, - 11, - ], - "type": "ImportSpecifier", - }, - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "operator": "+", + "range": Array [ + 15, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 14, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + }, }, - }, - "name": "baz", + ], "range": Array [ - 13, - 16, + 8, + 28, ], - "type": "Identifier", + "type": "ObjectExpression", }, "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 13, + "column": 4, "line": 1, }, }, - "local": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, "range": Array [ - 13, - 16, + 4, + 28, ], - "type": "ImportSpecifier", + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 29, ], - "type": "ImportDeclaration", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { "column": 0, - "line": 2, + "line": 4, }, "start": Object { "column": 0, @@ -78865,14 +89654,14 @@ Object { }, "range": Array [ 0, - 31, + 30, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 3, "line": 1, }, "start": Object { @@ -78882,33 +89671,51 @@ Object { }, "range": Array [ 0, - 6, + 3, ], "type": "Keyword", - "value": "import", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 5, "line": 1, }, "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { "column": 7, "line": 1, }, + "start": Object { + "column": 6, + "line": 1, + }, }, "range": Array [ + 6, 7, - 8, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { @@ -78918,133 +89725,169 @@ Object { }, "range": Array [ 8, - 11, + 9, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 11, - 12, + 14, + 15, ], "type": "Punctuator", - "value": ",", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 2, }, "start": Object { - "column": 13, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 13, + 15, 16, ], - "type": "Identifier", - "value": "baz", + "type": "Numeric", + "value": "5", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 7, + "line": 2, }, }, "range": Array [ - 16, 17, + 18, ], "type": "Punctuator", - "value": ",", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 17, - 18, + 19, + 20, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 12, + "line": 2, }, "start": Object { - "column": 19, - "line": 1, + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, }, }, "range": Array [ - 19, 23, + 26, ], "type": "Identifier", - "value": "from", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 29, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 24, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 24, - 29, + 27, + 28, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 30, - "line": 1, + "column": 2, + "line": 3, }, "start": Object { - "column": 29, - "line": 1, + "column": 1, + "line": 3, }, }, "range": Array [ + 28, 29, - 30, ], "type": "Punctuator", "value": ";", @@ -79054,87 +89897,166 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-namespace-specifier.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-and-identifier.src 1`] = ` Object { "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 27, - ], - "source": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 26, + "column": 17, "line": 1, }, "start": Object { - "column": 21, + "column": 1, "line": 1, }, }, - "range": Array [ - 21, - 26, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", }, - "start": Object { - "column": 7, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 2, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "10", + "type": "Literal", + "value": 10, }, }, - "local": Object { + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 15, + "column": 16, "line": 1, }, "start": Object { - "column": 12, + "column": 11, "line": 1, }, }, - "name": "foo", + "method": false, "range": Array [ - 12, - 15, + 11, + 16, ], - "type": "Identifier", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, }, - "range": Array [ - 7, - 15, - ], - "type": "ImportNamespaceSpecifier", + ], + "range": Array [ + 1, + 17, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 19, ], - "type": "ImportDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { "column": 0, @@ -79143,14 +90065,14 @@ Object { }, "range": Array [ 0, - 28, + 19, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 1, "line": 1, }, "start": Object { @@ -79160,15 +90082,105 @@ Object { }, "range": Array [ 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, 6, ], - "type": "Keyword", - "value": "import", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 9, "line": 1, }, "start": Object { @@ -79178,15 +90190,15 @@ Object { }, "range": Array [ 7, - 8, + 9, ], - "type": "Punctuator", - "value": "*", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 1, }, "start": Object { @@ -79196,15 +90208,33 @@ Object { }, "range": Array [ 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ 11, + 12, ], "type": "Identifier", - "value": "as", + "value": "y", }, Object { "loc": Object { "end": Object { - "column": 15, + "column": 13, "line": 1, }, "start": Object { @@ -79214,15 +90244,33 @@ Object { }, "range": Array [ 12, - 15, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, ], - "type": "Identifier", - "value": "foo", + "type": "Numeric", + "value": "20", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 17, "line": 1, }, "start": Object { @@ -79232,43 +90280,43 @@ Object { }, "range": Array [ 16, - 20, + 17, ], - "type": "Identifier", - "value": "from", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 26, + "column": 18, "line": 1, }, "start": Object { - "column": 21, + "column": 17, "line": 1, }, }, "range": Array [ - 21, - 26, + 17, + 18, ], - "type": "String", - "value": "\\"foo\\"", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 19, "line": 1, }, "start": Object { - "column": 26, + "column": 18, "line": 1, }, }, "range": Array [ - 26, - 27, + 18, + 19, ], "type": "Punctuator", "value": ";", @@ -79278,105 +90326,227 @@ Object { } `; -exports[`ecmaFeatures fixtures/modules/import-null-as-nil.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-getter-and-setter.src 1`] = ` Object { "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 33, - ], - "source": Object { + "expression": Object { "loc": Object { "end": Object { - "column": 33, + "column": 30, "line": 1, }, "start": Object { - "column": 28, + "column": 1, "line": 1, }, }, - "range": Array [ - 28, - 33, - ], - "raw": "\\"bar\\"", - "type": "Literal", - "value": "bar", - }, - "specifiers": Array [ - Object { - "imported": Object { + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + }, + "kind": "get", "loc": Object { "end": Object { - "column": 13, + "column": 14, "line": 1, }, "start": Object { - "column": 9, + "column": 2, "line": 1, }, }, - "name": "null", + "method": false, "range": Array [ - 9, - 13, + 2, + 14, ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 9, + 14, + ], + "type": "FunctionExpression", }, }, - "local": Object { + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "kind": "set", "loc": Object { "end": Object { - "column": 20, + "column": 29, "line": 1, }, "start": Object { - "column": 17, + "column": 16, "line": 1, }, }, - "name": "nil", + "method": false, "range": Array [ - 17, - 20, + 16, + 29, ], - "type": "Identifier", + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, + ], + "range": Array [ + 23, + 29, + ], + "type": "FunctionExpression", + }, }, - "range": Array [ - 9, - 20, - ], - "type": "ImportSpecifier", + ], + "range": Array [ + 1, + 30, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 32, ], - "type": "ImportDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 32, + "line": 1, }, "start": Object { "column": 0, @@ -79385,14 +90555,14 @@ Object { }, "range": Array [ 0, - 34, + 32, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 1, "line": 1, }, "start": Object { @@ -79402,25 +90572,25 @@ Object { }, "range": Array [ 0, - 6, + 1, ], - "type": "Keyword", - "value": "import", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, + "column": 2, "line": 1, }, "start": Object { - "column": 7, + "column": 1, "line": 1, }, }, "range": Array [ - 7, - 8, + 1, + 2, ], "type": "Punctuator", "value": "{", @@ -79428,437 +90598,282 @@ Object { Object { "loc": Object { "end": Object { - "column": 13, + "column": 5, "line": 1, }, "start": Object { - "column": 9, + "column": 2, "line": 1, }, }, "range": Array [ - 9, - 13, + 2, + 5, ], - "type": "Null", - "value": "null", + "type": "Identifier", + "value": "get", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 7, "line": 1, }, "start": Object { - "column": 14, + "column": 6, "line": 1, }, }, "range": Array [ - 14, - 16, + 6, + 7, ], - "type": "Identifier", - "value": "as", + "type": "Punctuator", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 8, "line": 1, }, "start": Object { - "column": 17, + "column": 7, "line": 1, }, }, "range": Array [ - 17, - 20, + 7, + 8, ], "type": "Identifier", - "value": "nil", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 22, + "column": 9, "line": 1, }, "start": Object { - "column": 21, + "column": 8, "line": 1, }, }, "range": Array [ - 21, - 22, + 8, + 9, ], "type": "Punctuator", - "value": "}", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 27, + "column": 10, "line": 1, }, "start": Object { - "column": 23, + "column": 9, "line": 1, }, }, "range": Array [ - 23, - 27, + 9, + 10, ], - "type": "Identifier", - "value": "from", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 33, + "column": 11, "line": 1, }, "start": Object { - "column": 28, + "column": 10, "line": 1, }, }, "range": Array [ - 28, - 33, + 10, + 11, ], - "type": "String", - "value": "\\"bar\\"", + "type": "Punctuator", + "value": ")", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/newTarget/simple-new-target.src 1`] = ` -Object { - "body": Array [ Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "name": "x", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "meta": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "name": "new", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, - "property": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "name": "target", - "range": Array [ - 31, - 37, - ], - "type": "Identifier", - }, - "range": Array [ - 27, - 37, - ], - "type": "MetaProperty", - }, - "loc": Object { - "end": Object { - "column": 22, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 23, - 37, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", - "loc": Object { - "end": Object { - "column": 23, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 19, - 38, - ], - "type": "VariableDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 40, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, }, - "name": "f", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 14, + "line": 1, }, "start": Object { - "column": 0, + "column": 13, "line": 1, }, }, - "params": Array [], "range": Array [ - 0, - 40, + 13, + 14, ], - "type": "FunctionDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "}", }, - }, - "range": Array [ - 0, - 41, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 15, "line": 1, }, "start": Object { - "column": 0, + "column": 14, "line": 1, }, }, "range": Array [ - 0, - 8, + 14, + 15, ], - "type": "Keyword", - "value": "function", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 19, "line": 1, }, "start": Object { - "column": 9, + "column": 16, "line": 1, }, }, "range": Array [ - 9, - 10, + 16, + 19, ], "type": "Identifier", - "value": "f", + "value": "set", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 21, "line": 1, }, "start": Object { - "column": 10, + "column": 20, "line": 1, }, }, "range": Array [ - 10, - 11, + 20, + 21, ], "type": "Punctuator", - "value": "(", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 22, "line": 1, }, "start": Object { - "column": 11, + "column": 21, "line": 1, }, }, "range": Array [ - 11, - 12, + 21, + 22, ], - "type": "Punctuator", - "value": ")", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 14, + "column": 23, "line": 1, }, "start": Object { - "column": 13, + "column": 22, "line": 1, }, }, "range": Array [ - 13, - 14, + 22, + 23, ], "type": "Punctuator", - "value": "{", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 24, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 23, + "line": 1, }, }, "range": Array [ - 19, - 22, + 23, + 24, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 25, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 24, + "line": 1, }, }, "range": Array [ - 23, 24, + 25, ], "type": "Identifier", - "value": "x", + "value": "v", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 26, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 25, + "line": 1, }, }, "range": Array [ @@ -79866,104 +90881,104 @@ Object { 26, ], "type": "Punctuator", - "value": "=", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 28, + "line": 1, }, "start": Object { - "column": 12, - "line": 2, + "column": 27, + "line": 1, }, }, "range": Array [ 27, - 30, + 28, ], - "type": "Keyword", - "value": "new", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 29, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 28, + "line": 1, }, }, "range": Array [ - 30, - 31, + 28, + 29, ], "type": "Punctuator", - "value": ".", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 30, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 29, + "line": 1, }, }, "range": Array [ - 31, - 37, + 29, + 30, ], - "type": "Identifier", - "value": "target", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 31, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 30, + "line": 1, }, }, "range": Array [ - 37, - 38, + 30, + 31, ], "type": "Punctuator", - "value": ";", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 32, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 31, + "line": 1, }, }, "range": Array [ - 39, - 40, + 31, + 32, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-addition-property.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-string-property.src 1`] = ` Object { "body": Array [ Object { @@ -80002,25 +91017,6 @@ Object { Object { "computed": true, "key": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 16, - ], - "raw": "5", - "type": "Literal", - "value": 5, - }, "loc": Object { "end": Object { "column": 10, @@ -80031,31 +91027,13 @@ Object { "line": 2, }, }, - "operator": "+", "range": Array [ 15, 20, ], - "right": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, - 20, - ], - "raw": "5", - "type": "Literal", - "value": 5, - }, - "type": "BinaryExpression", + "raw": "\\"hey\\"", + "type": "Literal", + "value": "hey", }, "kind": "init", "loc": Object { @@ -80245,7 +91223,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 10, "line": 2, }, "start": Object { @@ -80255,46 +91233,10 @@ Object { }, "range": Array [ 15, - 16, - ], - "type": "Numeric", - "value": "5", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 19, 20, ], - "type": "Numeric", - "value": "5", + "type": "String", + "value": "\\"hey\\"", }, Object { "loc": Object { @@ -80391,149 +91333,128 @@ Object { } `; -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-and-identifier.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-variable-property.src 1`] = ` Object { "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 3, - 4, - ], - "type": "Identifier", - }, - "kind": "init", + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 9, + "column": 5, "line": 1, }, "start": Object { - "column": 2, + "column": 4, "line": 1, }, }, - "method": false, + "name": "x", "range": Array [ - 2, - 9, + 4, + 5, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 9, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, + "type": "Identifier", }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "name": "y", - "range": Array [ - 11, - 12, - ], - "type": "Identifier", - }, - "kind": "init", + "init": Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 11, + "column": 8, "line": 1, }, }, - "method": false, - "range": Array [ - 11, - 16, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", }, - "start": Object { - "column": 14, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "range": Array [ + 14, + 24, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 21, + 24, + ], + "type": "Identifier", }, }, - "range": Array [ - 14, - 16, - ], - "raw": "20", - "type": "Literal", - "value": 20, + ], + "range": Array [ + 8, + 26, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, }, }, - ], - "range": Array [ - 1, - 17, - ], - "type": "ObjectExpression", - }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 2, + "line": 3, }, "start": Object { "column": 0, @@ -80542,15 +91463,15 @@ Object { }, "range": Array [ 0, - 19, + 27, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 0, + "line": 4, }, "start": Object { "column": 0, @@ -80559,14 +91480,14 @@ Object { }, "range": Array [ 0, - 19, + 28, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 3, "line": 1, }, "start": Object { @@ -80576,64 +91497,10 @@ Object { }, "range": Array [ 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 2, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 3, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ 3, - 4, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { @@ -80650,26 +91517,26 @@ Object { 4, 5, ], - "type": "Punctuator", - "value": "]", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 1, }, "start": Object { - "column": 5, + "column": 6, "line": 1, }, }, "range": Array [ - 5, 6, + 7, ], "type": "Punctuator", - "value": ":", + "value": "=", }, Object { "loc": Object { @@ -80678,139 +91545,139 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, + 8, 9, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 2, }, "start": Object { - "column": 9, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 9, - 10, + 14, + 15, ], "type": "Punctuator", - "value": ",", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 8, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 2, }, }, "range": Array [ - 11, - 12, + 15, + 18, ], "type": "Identifier", - "value": "y", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 9, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 8, + "line": 2, }, }, "range": Array [ - 12, - 13, + 18, + 19, ], "type": "Punctuator", - "value": ":", + "value": "]", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 9, + "line": 2, }, }, "range": Array [ - 14, - 16, + 19, + 20, ], - "type": "Numeric", - "value": "20", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 14, + "line": 2, }, "start": Object { - "column": 16, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 16, - 17, + 21, + 24, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 1, + "line": 3, }, "start": Object { - "column": 17, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 17, - 18, + 25, + 26, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 2, + "line": 3, }, "start": Object { - "column": 18, - "line": 1, + "column": 1, + "line": 3, }, }, "range": Array [ - 18, - 19, + 26, + 27, ], "type": "Punctuator", "value": ";", @@ -80820,14 +91687,18 @@ Object { } `; -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-getter-and-setter.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/invalid-computed-variable-property.src 1`] = `"':' expected."`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src 1`] = `"':' expected."`; + +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "loc": Object { "end": Object { - "column": 30, + "column": 10, "line": 1, }, "start": Object { @@ -80841,25 +91712,25 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 8, + "column": 4, "line": 1, }, "start": Object { - "column": 7, + "column": 3, "line": 1, }, }, "name": "x", "range": Array [ - 7, - 8, + 3, + 4, ], "type": "Identifier", }, - "kind": "get", + "kind": "init", "loc": Object { "end": Object { - "column": 14, + "column": 9, "line": 1, }, "start": Object { @@ -80870,419 +91741,120 @@ Object { "method": false, "range": Array [ 2, - 14, + 9, ], "shorthand": false, "type": "Property", "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 14, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { "column": 9, "line": 1, }, - }, - "params": Array [], - "range": Array [ - 9, - 14, - ], - "type": "FunctionExpression", - }, - }, - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 21, - 22, - ], - "type": "Identifier", - }, - "kind": "set", - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 16, - 29, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 29, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, "start": Object { - "column": 23, + "column": 7, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "name": "v", - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - }, - ], "range": Array [ - 23, - 29, + 7, + 9, ], - "type": "FunctionExpression", + "raw": "10", + "type": "Literal", + "value": 10, }, }, ], "range": Array [ 1, - 30, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 32, - ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 32, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 32, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 1, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 2, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "range": Array [ - 1, - 2, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 5, - ], - "type": "Identifier", - "value": "get", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Identifier", - "value": "x", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, + 10, + ], + "type": "ObjectExpression", }, - "range": Array [ - 10, - 11, - ], - "type": "Punctuator", - "value": ")", - }, - Object { "loc": Object { "end": Object { - "column": 13, + "column": 12, "line": 1, }, "start": Object { - "column": 12, + "column": 0, "line": 1, }, }, "range": Array [ + 0, 12, - 13, ], - "type": "Punctuator", - "value": "{", + "type": "ExpressionStatement", }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": "}", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, + "column": 1, "line": 1, }, "start": Object { - "column": 14, + "column": 0, "line": 1, }, }, "range": Array [ - 14, - 15, + 0, + 1, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 19, + "column": 2, "line": 1, }, "start": Object { - "column": 16, + "column": 1, "line": 1, }, }, "range": Array [ - 16, - 19, + 1, + 2, ], - "type": "Identifier", - "value": "set", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 3, "line": 1, }, "start": Object { - "column": 20, + "column": 2, "line": 1, }, }, "range": Array [ - 20, - 21, + 2, + 3, ], "type": "Punctuator", "value": "[", @@ -81290,17 +91862,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 4, "line": 1, }, "start": Object { - "column": 21, + "column": 3, "line": 1, }, }, "range": Array [ - 21, - 22, + 3, + 4, ], "type": "Identifier", "value": "x", @@ -81308,17 +91880,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, + "column": 5, "line": 1, }, "start": Object { - "column": 22, + "column": 4, "line": 1, }, }, "range": Array [ - 22, - 23, + 4, + 5, ], "type": "Punctuator", "value": "]", @@ -81326,107 +91898,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Identifier", - "value": "v", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, + "column": 6, "line": 1, }, "start": Object { - "column": 27, + "column": 5, "line": 1, }, }, "range": Array [ - 27, - 28, + 5, + 6, ], "type": "Punctuator", - "value": "{", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 29, + "column": 9, "line": 1, }, "start": Object { - "column": 28, + "column": 7, "line": 1, }, }, "range": Array [ - 28, - 29, + 7, + 9, ], - "type": "Punctuator", - "value": "}", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 30, + "column": 10, "line": 1, }, "start": Object { - "column": 29, + "column": 9, "line": 1, }, }, "range": Array [ - 29, - 30, + 9, + 10, ], "type": "Punctuator", "value": "}", @@ -81434,17 +91952,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 31, + "column": 11, "line": 1, }, "start": Object { - "column": 30, + "column": 10, "line": 1, }, }, "range": Array [ - 30, - 31, + 10, + 11, ], "type": "Punctuator", "value": ")", @@ -81452,17 +91970,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 32, + "column": 12, "line": 1, }, "start": Object { - "column": 31, + "column": 11, "line": 1, }, }, "range": Array [ - 31, - 32, + 11, + 12, ], "type": "Punctuator", "value": ";", @@ -81472,129 +91990,129 @@ Object { } `; -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-string-property.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression-with-addition.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 4, - 5, - ], - "type": "Identifier", + "expression": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "range": Array [ - 15, - 20, - ], - "raw": "\\"hey\\"", - "type": "Literal", - "value": "hey", - }, - "kind": "init", + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "left": Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 6, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 3, + "line": 1, }, }, - "method": false, "range": Array [ - 14, - 26, + 3, + 6, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 2, - }, - "start": Object { - "column": 13, - "line": 2, - }, + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 3, + 12, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, }, - "name": "foo", - "range": Array [ - 23, - 26, - ], - "type": "Identifier", }, + "range": Array [ + 9, + 12, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", }, - ], + "type": "BinaryExpression", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, "range": Array [ - 8, - 28, + 2, + 17, ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 1, + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "10", + "type": "Literal", + "value": 10, }, }, - "range": Array [ - 4, - 28, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", + ], + "range": Array [ + 1, + 18, + ], + "type": "ObjectExpression", + }, "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 20, + "line": 1, }, "start": Object { "column": 0, @@ -81603,15 +92121,15 @@ Object { }, "range": Array [ 0, - 29, + 20, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -81620,14 +92138,14 @@ Object { }, "range": Array [ 0, - 30, + 21, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -81637,115 +92155,115 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 2, "line": 1, }, "start": Object { - "column": 4, + "column": 1, "line": 1, }, }, "range": Array [ - 4, - 5, + 1, + 2, ], - "type": "Identifier", - "value": "x", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 3, "line": 1, }, "start": Object { - "column": 6, + "column": 2, "line": 1, }, }, "range": Array [ - 6, - 7, + 2, + 3, ], "type": "Punctuator", - "value": "=", + "value": "[", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 6, "line": 1, }, "start": Object { - "column": 8, + "column": 3, "line": 1, }, }, "range": Array [ - 8, - 9, + 3, + 6, ], - "type": "Punctuator", - "value": "{", + "type": "String", + "value": "\\"x\\"", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 8, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 7, + "line": 1, }, }, "range": Array [ - 14, - 15, + 7, + 8, ], "type": "Punctuator", - "value": "[", + "value": "+", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 9, + "line": 1, }, }, "range": Array [ - 15, - 20, + 9, + 12, ], "type": "String", - "value": "\\"hey\\"", + "value": "\\"y\\"", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 10, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 20, - 21, + 12, + 13, ], "type": "Punctuator", "value": "]", @@ -81753,71 +92271,89 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 21, - 22, + 15, + 17, ], - "type": "Punctuator", - "value": ":", + "type": "Numeric", + "value": "10", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 13, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 23, - 26, + 17, + 18, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 19, + "line": 1, }, "start": Object { - "column": 0, - "line": 3, + "column": 18, + "line": 1, }, }, "range": Array [ - 27, - 28, + 18, + 19, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 20, + "line": 1, }, "start": Object { - "column": 1, - "line": 3, + "column": 19, + "line": 1, }, }, "range": Array [ - 28, - 29, + 19, + 20, ], "type": "Punctuator", "value": ";", @@ -81827,128 +92363,112 @@ Object { } `; -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/computed-variable-property.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression-with-method.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 5, + "column": 20, "line": 1, }, "start": Object { - "column": 4, + "column": 2, "line": 1, }, }, - "name": "x", + "method": false, "range": Array [ - 4, - 5, + 2, + 20, ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - "kind": "init", + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 18, + "line": 1, }, }, - "method": false, "range": Array [ - 14, - 24, + 18, + 20, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, }, }, - ], - "range": Array [ - 8, - 26, - ], - "type": "ObjectExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 1, + "params": Array [], + "range": Array [ + 7, + 20, + ], + "type": "FunctionExpression", }, }, - "range": Array [ - 4, - 26, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "var", + ], + "range": Array [ + 1, + 21, + ], + "type": "ObjectExpression", + }, "loc": Object { "end": Object { - "column": 2, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { "column": 0, @@ -81957,15 +92477,15 @@ Object { }, "range": Array [ 0, - 27, + 23, ], - "type": "VariableDeclaration", + "type": "ExpressionStatement", }, ], "loc": Object { "end": Object { "column": 0, - "line": 4, + "line": 2, }, "start": Object { "column": 0, @@ -81974,14 +92494,14 @@ Object { }, "range": Array [ 0, - 28, + 24, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 3, + "column": 1, "line": 1, }, "start": Object { @@ -81991,25 +92511,61 @@ Object { }, "range": Array [ 0, - 3, + 1, ], - "type": "Keyword", - "value": "var", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, "line": 1, }, "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { "column": 4, "line": 1, }, + "start": Object { + "column": 3, + "line": 1, + }, }, "range": Array [ + 3, 4, - 5, ], "type": "Identifier", "value": "x", @@ -82017,84 +92573,102 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { "column": 6, "line": 1, }, + "start": Object { + "column": 5, + "line": 1, + }, }, "range": Array [ + 5, 6, - 7, ], "type": "Punctuator", - "value": "=", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 15, "line": 1, }, "start": Object { - "column": 8, + "column": 7, "line": 1, }, }, "range": Array [ - 8, - 9, + 7, + 15, ], - "type": "Punctuator", - "value": "{", + "type": "Keyword", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 2, + "column": 16, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 15, + "line": 1, }, }, "range": Array [ - 14, 15, + 16, ], "type": "Punctuator", - "value": "[", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 5, - "line": 2, + "column": 16, + "line": 1, }, }, "range": Array [ - 15, - 18, + 16, + 17, ], - "type": "Identifier", - "value": "bar", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ @@ -82102,17 +92676,17 @@ Object { 19, ], "type": "Punctuator", - "value": "]", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 9, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ @@ -82120,169 +92694,372 @@ Object { 20, ], "type": "Punctuator", - "value": ":", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ + 20, 21, - 24, ], - "type": "Identifier", - "value": "foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 3, + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/error-proto-property.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, }, "start": Object { "column": 0, - "line": 3, + "line": 1, }, }, "range": Array [ - 25, - 26, + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "proto", + "range": Array [ + 19, + 24, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "properties": Array [], + "range": Array [ + 27, + 29, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 29, + ], + "type": "VariableDeclarator", + }, ], - "type": "Punctuator", - "value": "}", - }, - Object { + "kind": "var", "loc": Object { "end": Object { - "column": 2, + "column": 15, "line": 3, }, "start": Object { - "column": 1, + "column": 0, "line": 3, }, }, "range": Array [ - 26, - 27, + 15, + 30, ], - "type": "Punctuator", - "value": ";", + "type": "VariableDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 3, - 4, - ], - "type": "Identifier", - }, - "kind": "init", + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 2, - "line": 1, + "column": 4, + "line": 5, }, }, - "method": false, + "name": "x", "range": Array [ - 2, - 9, + 36, + 37, ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "name": "__proto__", + "range": Array [ + 43, + 52, + ], + "type": "Identifier", }, - "start": Object { - "column": 7, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "method": false, + "range": Array [ + 43, + 59, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "name": "proto", + "range": Array [ + 54, + 59, + ], + "type": "Identifier", }, }, - "range": Array [ - 7, - 9, - ], - "raw": "10", - "type": "Literal", - "value": 10, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "name": "__proto__", + "range": Array [ + 62, + 71, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 62, + 78, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "proto", + "range": Array [ + 73, + 78, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 40, + 80, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 5, }, }, - ], - "range": Array [ - 1, - 10, - ], - "type": "ObjectExpression", - }, + "range": Array [ + 36, + 80, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 2, + "line": 8, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 12, + 32, + 81, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 2, + "line": 8, }, "start": Object { "column": 0, @@ -82291,14 +93068,14 @@ Object { }, "range": Array [ 0, - 13, + 81, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -82308,542 +93085,367 @@ Object { }, "range": Array [ 0, - 1, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, "range": Array [ - 1, - 2, + 12, + 13, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 3, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "range": Array [ - 2, - 3, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, + "line": 3, }, "start": Object { - "column": 3, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 3, - 4, + 15, + 18, ], - "type": "Identifier", - "value": "x", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "line": 3, }, }, "range": Array [ - 5, - 6, + 19, + 24, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "proto", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 9, - ], - "type": "Numeric", - "value": "10", - }, - Object { - "loc": Object { - "end": Object { "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, + "line": 3, }, }, "range": Array [ - 9, - 10, + 25, + 26, ], "type": "Punctuator", - "value": "}", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 10, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 10, - 11, + 27, + 28, ], "type": "Punctuator", - "value": ")", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 13, + "line": 3, }, }, "range": Array [ - 11, - 12, + 28, + 29, ], "type": "Punctuator", - "value": ";", + "value": "}", }, - ], - "type": "Program", -} -`; - -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression-with-addition.src 1`] = ` -Object { - "body": Array [ Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 1, - "line": 1, - }, - }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "range": Array [ - 3, - 6, - ], - "raw": "\\"x\\"", - "type": "Literal", - "value": "x", - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, - }, - "operator": "+", - "range": Array [ - 3, - 12, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 12, - ], - "raw": "\\"y\\"", - "type": "Literal", - "value": "y", - }, - "type": "BinaryExpression", - }, - "kind": "init", - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 2, - "line": 1, - }, - }, - "method": false, - "range": Array [ - 2, - 17, - ], - "shorthand": false, - "type": "Property", - "value": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 17, - ], - "raw": "10", - "type": "Literal", - "value": 10, - }, - }, - ], - "range": Array [ - 1, - 18, - ], - "type": "ObjectExpression", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 3, + "line": 5, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 20, + 32, + 35, ], - "type": "ExpressionStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Keyword", + "value": "var", }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 0, - 1, + 36, + 37, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 2, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { - "column": 1, - "line": 1, + "column": 6, + "line": 5, }, }, "range": Array [ - 1, - 2, + 38, + 39, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 2, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 2, - 3, + 40, + 41, ], "type": "Punctuator", - "value": "[", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 10, + "line": 6, }, "start": Object { - "column": 3, - "line": 1, + "column": 1, + "line": 6, }, }, "range": Array [ - 3, - 6, + 43, + 52, ], - "type": "String", - "value": "\\"x\\"", + "type": "Identifier", + "value": "__proto__", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 1, + "column": 11, + "line": 6, }, "start": Object { - "column": 7, - "line": 1, + "column": 10, + "line": 6, }, }, "range": Array [ - 7, - 8, + 52, + 53, ], "type": "Punctuator", - "value": "+", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 17, + "line": 6, }, "start": Object { - "column": 9, - "line": 1, + "column": 12, + "line": 6, }, }, "range": Array [ - 9, - 12, + 54, + 59, ], - "type": "String", - "value": "\\"y\\"", + "type": "Identifier", + "value": "proto", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 18, + "line": 6, }, "start": Object { - "column": 12, - "line": 1, + "column": 17, + "line": 6, }, }, "range": Array [ - 12, - 13, + 59, + 60, ], "type": "Punctuator", - "value": "]", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 10, + "line": 7, }, "start": Object { - "column": 13, - "line": 1, + "column": 1, + "line": 7, }, }, "range": Array [ - 13, - 14, + 62, + 71, ], - "type": "Punctuator", - "value": ":", + "type": "Identifier", + "value": "__proto__", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 11, + "line": 7, }, "start": Object { - "column": 15, - "line": 1, + "column": 10, + "line": 7, }, }, "range": Array [ - 15, - 17, + 71, + 72, ], - "type": "Numeric", - "value": "10", + "type": "Punctuator", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 17, + "line": 7, }, "start": Object { - "column": 17, - "line": 1, + "column": 12, + "line": 7, }, }, "range": Array [ - 17, - 18, + 73, + 78, ], - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "proto", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 1, + "line": 8, }, "start": Object { - "column": 18, - "line": 1, + "column": 0, + "line": 8, }, }, "range": Array [ - 18, - 19, + 79, + 80, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 2, + "line": 8, }, "start": Object { - "column": 19, - "line": 1, + "column": 1, + "line": 8, }, }, "range": Array [ - 19, - 20, + 80, + 81, ], "type": "Punctuator", "value": ";", @@ -82853,129 +93455,313 @@ Object { } `; -exports[`ecmaFeatures fixtures/objectLiteralComputedProperties/standalone-expression-with-method.src 1`] = ` +exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/error-proto-string-property.src 1`] = ` Object { "body": Array [ Object { "expression": Object { "loc": Object { "end": Object { - "column": 21, + "column": 12, "line": 1, }, "start": Object { - "column": 1, + "column": 0, "line": 1, }, }, - "properties": Array [ - Object { - "computed": true, - "key": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 1, - }, - "start": Object { - "column": 3, - "line": 1, - }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, }, - "name": "x", - "range": Array [ - 3, - 4, - ], - "type": "Identifier", }, - "kind": "init", + "name": "proto", + "range": Array [ + 19, + 24, + ], + "type": "Identifier", + }, + "init": Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 14, + "line": 3, }, "start": Object { - "column": 2, - "line": 1, + "column": 12, + "line": 3, }, }, - "method": false, + "properties": Array [], "range": Array [ - 2, - 20, + 27, + 29, ], - "shorthand": false, - "type": "Property", - "value": Object { - "async": false, - "body": Object { - "body": Array [], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 30, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 43, + 54, + ], + "raw": "\\"__proto__\\"", + "type": "Literal", + "value": "__proto__", + }, + "kind": "init", "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 19, + "line": 6, }, "start": Object { - "column": 18, - "line": 1, + "column": 1, + "line": 6, }, }, + "method": false, "range": Array [ - 18, - 20, + 43, + 61, ], - "type": "BlockStatement", + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "name": "proto", + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + }, }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 64, + 75, + ], + "raw": "\\"__proto__\\"", + "type": "Literal", + "value": "__proto__", }, - "start": Object { - "column": 7, - "line": 1, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "method": false, + "range": Array [ + 64, + 82, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "name": "proto", + "range": Array [ + 77, + 82, + ], + "type": "Identifier", }, }, - "params": Array [], - "range": Array [ - 7, - 20, - ], - "type": "FunctionExpression", + ], + "range": Array [ + 40, + 84, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 5, }, }, - ], - "range": Array [ - 1, - 21, - ], - "type": "ObjectExpression", - }, + "range": Array [ + 36, + 84, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 2, + "line": 8, }, "start": Object { "column": 0, - "line": 1, + "line": 5, }, }, "range": Array [ - 0, - 23, + 32, + 85, ], - "type": "ExpressionStatement", + "type": "VariableDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 2, + "column": 2, + "line": 8, }, "start": Object { "column": 0, @@ -82984,14 +93770,14 @@ Object { }, "range": Array [ 0, - 24, + 85, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, + "column": 12, "line": 1, }, "start": Object { @@ -83001,241 +93787,367 @@ Object { }, "range": Array [ 0, - 1, + 12, ], - "type": "Punctuator", - "value": "(", + "type": "String", + "value": "\\"use strict\\"", }, Object { "loc": Object { "end": Object { - "column": 2, + "column": 13, "line": 1, }, "start": Object { - "column": 1, + "column": 12, "line": 1, }, }, "range": Array [ - 1, - 2, + 12, + 13, ], "type": "Punctuator", - "value": "{", + "value": ";", }, Object { "loc": Object { "end": Object { "column": 3, - "line": 1, + "line": 3, }, "start": Object { - "column": 2, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 2, - 3, + 15, + 18, ], - "type": "Punctuator", - "value": "[", + "type": "Keyword", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 1, + "column": 9, + "line": 3, }, "start": Object { - "column": 3, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 3, - 4, + 19, + 24, ], "type": "Identifier", - "value": "x", + "value": "proto", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 11, + "line": 3, }, "start": Object { - "column": 4, - "line": 1, + "column": 10, + "line": 3, }, }, "range": Array [ - 4, - 5, + 25, + 26, ], "type": "Punctuator", - "value": "]", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 1, + "column": 13, + "line": 3, }, "start": Object { - "column": 5, - "line": 1, + "column": 12, + "line": 3, }, }, "range": Array [ - 5, - 6, + 27, + 28, ], "type": "Punctuator", - "value": ":", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { "column": 15, - "line": 1, + "line": 3, }, "start": Object { - "column": 7, - "line": 1, + "column": 14, + "line": 3, }, }, "range": Array [ - 7, - 15, + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 35, ], "type": "Keyword", - "value": "function", + "value": "var", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 5, + "line": 5, }, "start": Object { - "column": 15, - "line": 1, + "column": 4, + "line": 5, }, }, "range": Array [ - 15, - 16, + 36, + 37, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 7, + "line": 5, }, "start": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 5, }, }, "range": Array [ - 16, - 17, + 38, + 39, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 9, + "line": 5, }, "start": Object { - "column": 18, - "line": 1, + "column": 8, + "line": 5, }, }, "range": Array [ - 18, - 19, + 40, + 41, ], "type": "Punctuator", "value": "{", }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 43, + 54, + ], + "type": "String", + "value": "\\"__proto__\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "proto", + }, Object { "loc": Object { "end": Object { "column": 20, - "line": 1, + "line": 6, }, "start": Object { "column": 19, - "line": 1, + "line": 6, }, }, "range": Array [ - 19, - 20, + 61, + 62, ], "type": "Punctuator", - "value": "}", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 12, + "line": 7, }, "start": Object { - "column": 20, - "line": 1, + "column": 1, + "line": 7, }, }, "range": Array [ - 20, - 21, + 64, + 75, + ], + "type": "String", + "value": "\\"__proto__\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 75, + 76, ], "type": "Punctuator", - "value": "}", + "value": ":", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 19, + "line": 7, }, "start": Object { - "column": 21, - "line": 1, + "column": 14, + "line": 7, }, }, "range": Array [ - 21, - 22, + 77, + 82, + ], + "type": "Identifier", + "value": "proto", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 83, + 84, ], "type": "Punctuator", - "value": ")", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 2, + "line": 8, }, "start": Object { - "column": 22, - "line": 1, + "column": 1, + "line": 8, }, }, "range": Array [ - 22, - 23, + 84, + 85, ], "type": "Punctuator", "value": ";", @@ -84289,6 +95201,8 @@ Object { } `; +exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/invalid-method-no-braces.src 1`] = `"'{' expected."`; + exports[`ecmaFeatures fixtures/objectLiteralShorthandMethods/method-property.src 1`] = ` Object { "body": Array [ @@ -88264,35 +99178,232 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0O717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/regex/regexp-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo./", + "regex": Object { + "flags": "", + "pattern": "foo.", + }, + "type": "Literal", + "value": Object {}, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, "line": 1, }, "start": Object { - "column": 0, + "column": 10, "line": 1, }, }, "range": Array [ - 0, - 5, + 10, + 16, ], - "type": "Numeric", - "value": "0O717", + "regex": Object { + "flags": "", + "pattern": "foo.", + }, + "type": "RegularExpression", + "value": "/foo./", }, Object { "loc": Object { "end": Object { - "column": 6, + "column": 17, "line": 1, }, "start": Object { - "column": 5, + "column": 16, "line": 1, }, }, "range": Array [ - 5, - 6, + 16, + 17, ], "type": "Punctuator", "value": ";", @@ -88302,7 +99413,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/regex/regexp-simple.src 1`] = ` +exports[`ecmaFeatures fixtures/regexUFlag/regex-u-extended-escape.src 1`] = ` Object { "body": Array [ Object { @@ -88311,7 +99422,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -88319,39 +99430,39 @@ Object { "line": 1, }, }, - "name": "foo", + "name": "x", "range": Array [ 4, - 7, + 5, ], "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 16, + "column": 40, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 16, + 8, + 40, ], - "raw": "/foo./", + "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", "regex": Object { - "flags": "", - "pattern": "foo.", + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", }, "type": "Literal", "value": Object {}, }, "loc": Object { "end": Object { - "column": 16, + "column": 40, "line": 1, }, "start": Object { @@ -88361,7 +99472,7 @@ Object { }, "range": Array [ 4, - 16, + 40, ], "type": "VariableDeclarator", }, @@ -88369,7 +99480,7 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 17, + "column": 41, "line": 1, }, "start": Object { @@ -88379,7 +99490,7 @@ Object { }, "range": Array [ 0, - 17, + 41, ], "type": "VariableDeclaration", }, @@ -88396,7 +99507,7 @@ Object { }, "range": Array [ 0, - 18, + 42, ], "sourceType": "script", "tokens": Array [ @@ -88421,7 +99532,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, + "column": 5, "line": 1, }, "start": Object { @@ -88431,25 +99542,25 @@ Object { }, "range": Array [ 4, - 7, + 5, ], "type": "Identifier", - "value": "foo", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 7, "line": 1, }, "start": Object { - "column": 8, + "column": 6, "line": 1, }, }, "range": Array [ - 8, - 9, + 6, + 7, ], "type": "Punctuator", "value": "=", @@ -88457,39 +99568,39 @@ Object { Object { "loc": Object { "end": Object { - "column": 16, + "column": 40, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 16, + 8, + 40, ], "regex": Object { - "flags": "", - "pattern": "foo.", + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", }, "type": "RegularExpression", - "value": "/foo./", + "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 41, "line": 1, }, "start": Object { - "column": 16, + "column": 40, "line": 1, }, }, "range": Array [ - 16, - 17, + 40, + 41, ], "type": "Punctuator", "value": ";", @@ -88499,7 +99610,7 @@ Object { } `; -exports[`ecmaFeatures fixtures/regexUFlag/regex-u-extended-escape.src 1`] = ` +exports[`ecmaFeatures fixtures/regexUFlag/regex-u-invalid-extended-escape.src 1`] = ` Object { "body": Array [ Object { @@ -88526,7 +99637,7 @@ Object { "init": Object { "loc": Object { "end": Object { - "column": 40, + "column": 21, "line": 1, }, "start": Object { @@ -88536,19 +99647,19 @@ Object { }, "range": Array [ 8, - 40, + 21, ], - "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "raw": "/\\\\u{110000}/u", "regex": Object { "flags": "u", - "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + "pattern": "\\\\u{110000}", }, "type": "Literal", - "value": Object {}, + "value": null, }, "loc": Object { "end": Object { - "column": 40, + "column": 21, "line": 1, }, "start": Object { @@ -88558,7 +99669,7 @@ Object { }, "range": Array [ 4, - 40, + 21, ], "type": "VariableDeclarator", }, @@ -88566,7 +99677,7 @@ Object { "kind": "var", "loc": Object { "end": Object { - "column": 41, + "column": 22, "line": 1, }, "start": Object { @@ -88576,7 +99687,7 @@ Object { }, "range": Array [ 0, - 41, + 22, ], "type": "VariableDeclaration", }, @@ -88593,7 +99704,7 @@ Object { }, "range": Array [ 0, - 42, + 23, ], "sourceType": "script", "tokens": Array [ @@ -88654,7 +99765,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, + "column": 21, "line": 1, }, "start": Object { @@ -88664,29 +99775,29 @@ Object { }, "range": Array [ 8, - 40, + 21, ], "regex": Object { "flags": "u", - "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + "pattern": "\\\\u{110000}", }, "type": "RegularExpression", - "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "value": "/\\\\u{110000}/u", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 22, "line": 1, }, "start": Object { - "column": 40, + "column": 21, "line": 1, }, }, "range": Array [ - 40, - 41, + 21, + 22, ], "type": "Punctuator", "value": ";", @@ -89207,25 +100318,417 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/class-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 25, + 41, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, }, "start": Object { - "column": 22, + "column": 0, "line": 1, }, }, "range": Array [ - 22, - 23, + 0, + 43, ], - "type": "EmptyStatement", + "superClass": null, + "type": "ClassDeclaration", }, ], "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 0, + "line": 5, }, "start": Object { "column": 0, @@ -89234,14 +100737,14 @@ Object { }, "range": Array [ 0, - 23, + 44, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 8, + "column": 5, "line": 1, }, "start": Object { @@ -89251,97 +100754,97 @@ Object { }, "range": Array [ 0, - 8, + 5, ], "type": "Keyword", - "value": "function", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 7, "line": 1, }, "start": Object { - "column": 9, + "column": 6, "line": 1, }, }, "range": Array [ - 9, - 10, + 6, + 7, ], "type": "Identifier", - "value": "f", + "value": "A", }, Object { "loc": Object { "end": Object { - "column": 11, + "column": 9, "line": 1, }, "start": Object { - "column": 10, + "column": 8, "line": 1, }, }, "range": Array [ - 10, - 11, + 8, + 9, ], "type": "Punctuator", - "value": "(", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 15, + "line": 2, }, "start": Object { - "column": 11, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 11, - 12, + 14, + 25, ], "type": "Identifier", - "value": "a", + "value": "constructor", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 1, + "column": 16, + "line": 2, }, "start": Object { - "column": 12, - "line": 1, + "column": 15, + "line": 2, }, }, "range": Array [ - 12, - 13, + 25, + 26, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 1, + "column": 19, + "line": 2, }, "start": Object { - "column": 14, - "line": 1, + "column": 16, + "line": 2, }, }, "range": Array [ - 14, - 17, + 26, + 29, ], "type": "Punctuator", "value": "...", @@ -89349,35 +100852,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 22, + "line": 2, }, "start": Object { - "column": 17, - "line": 1, + "column": 19, + "line": 2, }, }, "range": Array [ - 17, - 18, + 29, + 32, ], "type": "Identifier", - "value": "b", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 1, + "column": 23, + "line": 2, }, "start": Object { - "column": 18, - "line": 1, + "column": 22, + "line": 2, }, }, "range": Array [ - 18, - 19, + 32, + 33, ], "type": "Punctuator", "value": ")", @@ -89385,17 +100888,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 25, + "line": 2, }, "start": Object { - "column": 20, - "line": 1, + "column": 24, + "line": 2, }, }, "range": Array [ - 20, - 21, + 34, + 35, ], "type": "Punctuator", "value": "{", @@ -89403,17 +100906,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 21, - "line": 1, + "column": 4, + "line": 3, }, }, "range": Array [ - 21, - 22, + 40, + 41, ], "type": "Punctuator", "value": "}", @@ -89421,27 +100924,27 @@ Object { Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 1, + "line": 4, }, "start": Object { - "column": 22, - "line": 1, + "column": 0, + "line": 4, }, }, "range": Array [ - 22, - 23, + 42, + 43, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/restParams/class-constructor.src 1`] = ` +exports[`ecmaFeatures fixtures/restParams/class-method.src 1`] = ` Object { "body": Array [ Object { @@ -89452,7 +100955,7 @@ Object { "key": Object { "loc": Object { "end": Object { - "column": 15, + "column": 7, "line": 2, }, "start": Object { @@ -89460,14 +100963,14 @@ Object { "line": 2, }, }, - "name": "constructor", + "name": "foo", "range": Array [ 14, - 25, + 17, ], "type": "Identifier", }, - "kind": "constructor", + "kind": "method", "loc": Object { "end": Object { "column": 5, @@ -89480,7 +100983,7 @@ Object { }, "range": Array [ 14, - 41, + 33, ], "static": false, "type": "MethodDefinition", @@ -89494,13 +100997,13 @@ Object { "line": 3, }, "start": Object { - "column": 24, + "column": 16, "line": 2, }, }, "range": Array [ - 34, - 41, + 26, + 33, ], "type": "BlockStatement", }, @@ -89513,7 +101016,7 @@ Object { "line": 3, }, "start": Object { - "column": 15, + "column": 7, "line": 2, }, }, @@ -89522,41 +101025,41 @@ Object { "argument": Object { "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 2, }, "start": Object { - "column": 19, + "column": 11, "line": 2, }, }, - "name": "foo", + "name": "bar", "range": Array [ - 29, - 32, + 21, + 24, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 22, + "column": 14, "line": 2, }, "start": Object { - "column": 16, + "column": 8, "line": 2, }, }, "range": Array [ - 26, - 32, + 18, + 24, ], "type": "RestElement", }, ], "range": Array [ - 25, - 41, + 17, + 33, ], "type": "FunctionExpression", }, @@ -89574,7 +101077,7 @@ Object { }, "range": Array [ 8, - 43, + 35, ], "type": "ClassBody", }, @@ -89608,7 +101111,7 @@ Object { }, "range": Array [ 0, - 43, + 35, ], "superClass": null, "type": "ClassDeclaration", @@ -89626,14 +101129,331 @@ Object { }, "range": Array [ 0, - 44, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/restParams/error-no-default.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": null, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 0, + 24, + ], + "type": "TSEmptyBodyFunctionDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -89643,97 +101463,97 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "class", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 7, + 9, + 10, ], "type": "Identifier", - "value": "A", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 14, - 25, + 11, + 12, ], "type": "Identifier", - "value": "constructor", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 15, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 25, - 26, + 12, + 13, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 26, - 29, + 14, + 17, ], "type": "Punctuator", "value": "...", @@ -89741,275 +101561,218 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 19, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 29, - 32, + 17, + 18, ], "type": "Identifier", - "value": "foo", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 2, + "column": 20, + "line": 1, }, "start": Object { - "column": 22, - "line": 2, + "column": 19, + "line": 1, }, }, "range": Array [ - 32, - 33, + 19, + 20, ], "type": "Punctuator", - "value": ")", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 24, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 34, - 35, + 21, + 22, ], - "type": "Punctuator", - "value": "{", + "type": "Numeric", + "value": "0", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 23, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 22, + "line": 1, }, }, "range": Array [ - 40, - 41, + 22, + 23, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 24, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 23, + "line": 1, }, }, "range": Array [ - 42, - 43, + 23, + 24, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", } `; -exports[`ecmaFeatures fixtures/restParams/class-method.src 1`] = ` +exports[`ecmaFeatures fixtures/restParams/error-not-last.src 1`] = ` Object { "body": Array [ Object { - "body": Object { - "body": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "foo", - "range": Array [ - 14, - 17, - ], - "type": "Identifier", - }, - "kind": "method", - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 14, - 33, - ], - "static": false, - "type": "MethodDefinition", - "value": Object { - "async": false, - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 26, - 33, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 5, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 2, - }, - }, - "params": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "name": "bar", - "range": Array [ - 21, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 14, - "line": 2, - }, - "start": Object { - "column": 8, - "line": 2, - }, - }, - "range": Array [ - 18, - 24, - ], - "type": "RestElement", - }, - ], - "range": Array [ - 17, - 33, - ], - "type": "FunctionExpression", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 35, - ], - "type": "ClassBody", - }, + "async": false, + "body": null, + "expression": false, + "generator": false, "id": Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, - "name": "A", + "name": "f", "range": Array [ - 6, - 7, + 9, + 10, ], "type": "Identifier", }, "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 23, + "line": 1, }, "start": Object { "column": 0, "line": 1, }, }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "RestElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + ], "range": Array [ 0, - 35, + 23, ], - "superClass": null, - "type": "ClassDeclaration", + "type": "TSEmptyBodyFunctionDeclaration", }, ], "loc": Object { "end": Object { - "column": 0, - "line": 5, + "column": 23, + "line": 1, }, "start": Object { "column": 0, @@ -90018,14 +101781,14 @@ Object { }, "range": Array [ 0, - 36, + 23, ], "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 8, "line": 1, }, "start": Object { @@ -90035,97 +101798,97 @@ Object { }, "range": Array [ 0, - 5, + 8, ], "type": "Keyword", - "value": "class", + "value": "function", }, Object { "loc": Object { "end": Object { - "column": 7, + "column": 10, "line": 1, }, "start": Object { - "column": 6, + "column": 9, "line": 1, }, }, "range": Array [ - 6, - 7, + 9, + 10, ], "type": "Identifier", - "value": "A", + "value": "f", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 11, "line": 1, }, "start": Object { - "column": 8, + "column": 10, "line": 1, }, }, "range": Array [ - 8, - 9, + 10, + 11, ], "type": "Punctuator", - "value": "{", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 11, + "line": 1, }, }, "range": Array [ - 14, - 17, + 11, + 12, ], "type": "Identifier", - "value": "foo", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 13, + "line": 1, }, "start": Object { - "column": 7, - "line": 2, + "column": 12, + "line": 1, }, }, "range": Array [ - 17, - 18, + 12, + 13, ], "type": "Punctuator", - "value": "(", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 17, + "line": 1, }, "start": Object { - "column": 8, - "line": 2, + "column": 14, + "line": 1, }, }, "range": Array [ - 18, - 21, + 14, + 17, ], "type": "Punctuator", "value": "...", @@ -90133,92 +101896,92 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 2, + "column": 18, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 17, + "line": 1, }, }, "range": Array [ - 21, - 24, + 17, + 18, ], "type": "Identifier", - "value": "bar", + "value": "b", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 19, + "line": 1, }, "start": Object { - "column": 14, - "line": 2, + "column": 18, + "line": 1, }, }, "range": Array [ - 24, - 25, + 18, + 19, ], "type": "Punctuator", - "value": ")", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 2, + "column": 21, + "line": 1, }, "start": Object { - "column": 16, - "line": 2, + "column": 20, + "line": 1, }, }, "range": Array [ - 26, - 27, + 20, + 21, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 3, + "column": 21, + "line": 1, }, }, "range": Array [ - 32, - 33, + 21, + 22, ], "type": "Punctuator", - "value": "}", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 23, + "line": 1, }, "start": Object { - "column": 0, - "line": 4, + "column": 22, + "line": 1, }, }, "range": Array [ - 34, - 35, + 22, + 23, ], "type": "Punctuator", - "value": "}", + "value": ";", }, ], "type": "Program", @@ -90987,6 +102750,397 @@ Object { } `; +exports[`ecmaFeatures fixtures/restParams/invalid-rest-param.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 14, + 19, + ], + "type": "ObjectPattern", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "RestElement", + }, + ], + "range": Array [ + 0, + 22, + ], + "type": "FunctionDeclaration", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`ecmaFeatures fixtures/restParams/single-rest.src 1`] = ` Object { "body": Array [ @@ -91284,6 +103438,10 @@ Object { } `; +exports[`ecmaFeatures fixtures/spread/error-invalid-if.src 1`] = `"Expression expected."`; + +exports[`ecmaFeatures fixtures/spread/error-invalid-sequence.src 1`] = `"Expression expected."`; + exports[`ecmaFeatures fixtures/spread/multi-function-call.src 1`] = ` Object { "body": Array [ @@ -92523,6 +104681,126 @@ Object { } `; +exports[`ecmaFeatures fixtures/templateStrings/error-octal-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "7", + "raw": "\\\\07", + }, + }, + ], + "range": Array [ + 0, + 5, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Template", + "value": "\`\\\\07\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`ecmaFeatures fixtures/templateStrings/escape-characters.src 1`] = ` Object { "body": Array [ @@ -94970,3 +107248,7 @@ Object { "type": "Program", } `; + +exports[`ecmaFeatures fixtures/unicodeCodePointEscapes/invalid-empty-escape.src 1`] = `"Hexadecimal digit expected."`; + +exports[`ecmaFeatures fixtures/unicodeCodePointEscapes/invalid-too-large-escape.src 1`] = `"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."`; diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 8b128845fa7d..40b619f2e1f9 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -25,8 +25,7 @@ const FIXTURES_DIR = "./tests/fixtures/ecma-features"; const testFiles = shelljs.find(FIXTURES_DIR) .filter(filename => filename.indexOf(".src.js") > -1) // strip off ".src.js" - .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)) - .filter(filename => !(/error-|invalid-|globalReturn/.test(filename))); + .map(filename => filename.substring(FIXTURES_DIR.length - 1, filename.length - 7)); //------------------------------------------------------------------------------ // Tests From 92bd65c367632b5e14e0e375013a56053a61cfc3 Mon Sep 17 00:00:00 2001 From: James Henry Date: Wed, 27 Jun 2018 09:38:25 -0400 Subject: [PATCH 261/326] Chore: Do not run integration tests within npm test --- packages/typescript-eslint-parser/.travis.yml | 2 ++ packages/typescript-eslint-parser/package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index c3bda60d54e6..e50d8a52d043 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -11,5 +11,7 @@ node_js: - "9" - "10" +script: npm test && npm run integration-tests + after_success: - npm run coveralls diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 34192bfbd7e1..4511183dc678 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -42,7 +42,7 @@ "eslint" ], "scripts": { - "test": "node Makefile.js test && npm run integration-tests && npm run ast-alignment-tests", + "test": "node Makefile.js test && npm run ast-alignment-tests", "jest": "jest", "ast-alignment-tests": "jest --config=./tests/ast-alignment/jest.config.js", "integration-tests": "docker-compose -f tests/integration/docker-compose.yml up", From 13ff2ef99cb56442cba520ac38b9053315442134 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 27 Jun 2018 09:47:48 -0400 Subject: [PATCH 262/326] Build: changelog update for 16.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 3d2dea0989b8..4fdbdcc4ac49 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,11 @@ +v16.0.1 - June 27, 2018 + +* bc83c6a Chore: Do not run integration tests within npm test (James Henry) +* db62d63 Fix: Snapshot all ecma-features fixtures (#495) (James Henry) +* 3c1fab0 Fix: support ImportMeta (fixes #489) (#490) (Ika) +* 6611535 Chore: Loosen node version requirement in package.json (fixes #482) (#484) (James Henry) +* 27f39cc Chore: Powerful integration tests and improved README (#483) (James Henry) + v16.0.0 - June 3, 2018 * 009336d Breaking: Set minimum node version to 6 (#481) (James Henry) From 071d1f4cb2b6273efc823654d1a099952e9e4f79 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 27 Jun 2018 09:47:48 -0400 Subject: [PATCH 263/326] 16.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 4511183dc678..89e705fd750b 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "16.0.0", + "version": "16.0.1", "files": [ "lib", "parser.js" From 6165cf9da5ed587bf14d8c0a8ad096d8fd733b2b Mon Sep 17 00:00:00 2001 From: Ika Date: Wed, 27 Jun 2018 21:50:51 +0800 Subject: [PATCH 264/326] Breaking: always set optional on ClassProperty (fixes #472) (#491) --- packages/typescript-eslint-parser/lib/convert.js | 2 +- .../tests/ast-alignment/fixtures-to-test.js | 2 -- .../tests/lib/__snapshots__/typescript.js.snap | 8 ++++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index f24a91da7484..58057078b9a7 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -860,7 +860,7 @@ module.exports = function convert(config) { } if (node.name.kind === SyntaxKind.Identifier && node.questionToken) { - result.key.optional = true; + result.optional = true; } if (node.exclamationToken) { diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index c4ba689343d4..9af8d167fc3b 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -399,8 +399,6 @@ let fixturePatternConfigsToTest = [ "type-alias-declaration", "type-alias-object-without-annotation", "typed-this", - "class-with-optional-properties", - "class-with-optional-property-undefined", "export-type-function-declaration", "export-type-class-declaration", "abstract-interface", diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 176b601c54fd..9424f52b8339 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -13337,7 +13337,6 @@ Object { }, }, "name": "foo", - "optional": true, "range": Array [ 14, 17, @@ -13354,6 +13353,7 @@ Object { "line": 2, }, }, + "optional": true, "range": Array [ 14, 19, @@ -13376,7 +13376,6 @@ Object { }, }, "name": "bar", - "optional": true, "range": Array [ 22, 25, @@ -13393,6 +13392,7 @@ Object { "line": 3, }, }, + "optional": true, "range": Array [ 22, 36, @@ -13450,7 +13450,6 @@ Object { }, }, "name": "baz", - "optional": true, "range": Array [ 47, 50, @@ -13467,6 +13466,7 @@ Object { "line": 4, }, }, + "optional": true, "range": Array [ 39, 61, @@ -13928,7 +13928,6 @@ Object { }, }, "name": "foo", - "optional": true, "range": Array [ 20, 23, @@ -13945,6 +13944,7 @@ Object { "line": 2, }, }, + "optional": true, "range": Array [ 12, 37, From da70f19a3aa49d27a9de9adc8248da3b7fa98c73 Mon Sep 17 00:00:00 2001 From: Ika Date: Wed, 27 Jun 2018 22:23:49 +0800 Subject: [PATCH 265/326] Fix: error on multiple super classes (fixes #493) (#494) --- .../lib/ast-converter.js | 8 +------- .../typescript-eslint-parser/lib/convert.js | 10 ++++++++-- .../lib/node-utils.js | 19 ++++++++++++++++++- .../invalid-class-two-super-classes.src.js | 1 + .../lib/__snapshots__/ecma-features.js.snap | 2 ++ 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-two-super-classes.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js index d99e09b0ee79..779c15483fc2 100644 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ b/packages/typescript-eslint-parser/lib/ast-converter.js @@ -26,13 +26,7 @@ const convert = require("./convert"), * @returns {Object} converted error object */ function convertError(error) { - const loc = error.file.getLineAndCharacterOfPosition(error.start); - return { - index: error.start, - lineNumber: loc.line + 1, - column: loc.character, - message: error.message || error.messageText - }; + return nodeUtils.createError(error.file, error.start, error.message || error.messageText); } //------------------------------------------------------------------------------ diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 58057078b9a7..2fa5d349d9ab 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1397,8 +1397,14 @@ module.exports = function convert(config) { const openBrace = nodeUtils.findNextToken(lastClassToken, ast); const superClass = heritageClauses.find(clause => clause.token === SyntaxKind.ExtendsKeyword); - if (superClass && superClass.types[0] && superClass.types[0].typeArguments) { - result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); + if (superClass) { + if (superClass.types.length > 1) { + throw nodeUtils.createError(ast, superClass.types[1].pos, "Classes can only extend a single class."); + } + + if (superClass.types[0] && superClass.types[0].typeArguments) { + result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); + } } const implementsClause = heritageClauses.find(clause => clause.token === SyntaxKind.ImplementsKeyword); diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index ac22ce44c01c..5c4ba9eab3ab 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -191,7 +191,8 @@ module.exports = { isWithinTypeAnnotation, isTypeKeyword, isComment, - isJSDocComment + isJSDocComment, + createError }; /* eslint-enable no-use-before-define */ @@ -767,3 +768,19 @@ function getNodeContainer(ast, start, end) { return container; } + +/** + * @param {Object} ast the AST object + * @param {int} start the index at which the error starts + * @param {string} message the error message + * @returns {Object} converted error object + */ +function createError(ast, start, message) { + const loc = ast.getLineAndCharacterOfPosition(start); + return { + index: start, + lineNumber: loc.line + 1, + column: loc.character, + message + }; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-two-super-classes.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-two-super-classes.src.js new file mode 100644 index 000000000000..dbac127c0814 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/classes/invalid-class-two-super-classes.src.js @@ -0,0 +1 @@ +class A extends B, C {} \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 599c24613eed..150dd17609e5 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -22287,6 +22287,8 @@ Object { } `; +exports[`ecmaFeatures fixtures/classes/invalid-class-two-super-classes.src 1`] = `"Classes can only extend a single class."`; + exports[`ecmaFeatures fixtures/classes/named-class-expression.src 1`] = ` Object { "body": Array [ From 10a43328d4a1e4a6630c04bbc76ee2887016ac3f Mon Sep 17 00:00:00 2001 From: Lucas Duailibe Date: Wed, 27 Jun 2018 13:12:47 -0300 Subject: [PATCH 266/326] Breaking: Remove "Experimental" from rest and spread (fixes #428) (#429) --- .../lib/ast-node-types.js | 2 - .../typescript-eslint-parser/lib/convert.js | 12 +++--- .../tests/ast-alignment/fixtures-to-test.js | 5 +-- .../lib/__snapshots__/ecma-features.js.snap | 40 +++++++------------ 4 files changed, 21 insertions(+), 38 deletions(-) diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 809404d76f67..5839455c4578 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -42,8 +42,6 @@ module.exports = { Decorator: "Decorator", DoWhileStatement: "DoWhileStatement", EmptyStatement: "EmptyStatement", - ExperimentalRestProperty: "ExperimentalRestProperty", - ExperimentalSpreadProperty: "ExperimentalSpreadProperty", ExportAllDeclaration: "ExportAllDeclaration", ExportDefaultDeclaration: "ExportDefaultDeclaration", ExportNamedDeclaration: "ExportNamedDeclaration", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 2fa5d349d9ab..f178aa75938e 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1133,10 +1133,8 @@ module.exports = function convert(config) { if (node.dotDotDotToken) { Object.assign(result, { - type: AST_NODE_TYPES.ExperimentalRestProperty, - argument: convertChild(node.propertyName || node.name), - computed: Boolean(node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName), - shorthand: !node.propertyName + type: AST_NODE_TYPES.RestElement, + argument: convertChild(node.propertyName || node.name) }); } else { Object.assign(result, { @@ -1283,16 +1281,16 @@ module.exports = function convert(config) { break; } case SyntaxKind.SpreadAssignment: { - let type = AST_NODE_TYPES.ExperimentalSpreadProperty; + let type = AST_NODE_TYPES.SpreadElement; if (node.parent && node.parent.parent && node.parent.parent.kind === SyntaxKind.BinaryExpression ) { if (node.parent.parent.right === node.parent) { - type = AST_NODE_TYPES.ExperimentalSpreadProperty; + type = AST_NODE_TYPES.SpreadElement; } else if (node.parent.parent.left === node.parent) { - type = AST_NODE_TYPES.ExperimentalRestProperty; + type = AST_NODE_TYPES.RestElement; } } diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index 9af8d167fc3b..f9af598219f3 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -105,10 +105,9 @@ let fixturePatternConfigsToTest = [ createFixturePatternConfigFor("ecma-features/experimentalObjectRestSpread", { ignore: [ /** - * "ExperimentalSpreadProperty" in espree/typescript-eslint-parser vs "SpreadElement" in Babylon - * comes up a lot in this section + * Trailing comma is not permitted after a "RestElement" in Babylon */ - "**/*" + "invalid-rest-trailing-comma" ] }), diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 150dd17609e5..694c8b4ead09 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -61572,7 +61572,6 @@ Object { ], "type": "Identifier", }, - "computed": false, "loc": Object { "end": Object { "column": 19, @@ -61587,8 +61586,7 @@ Object { 15, 19, ], - "shorthand": true, - "type": "ExperimentalRestProperty", + "type": "RestElement", }, ], "range": Array [ @@ -61949,7 +61947,7 @@ Object { 5, 9, ], - "type": "ExperimentalRestProperty", + "type": "RestElement", }, ], "range": Array [ @@ -62075,7 +62073,7 @@ Object { 17, 21, ], - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", }, ], "range": Array [ @@ -62479,7 +62477,6 @@ Object { ], "type": "Identifier", }, - "computed": false, "loc": Object { "end": Object { "column": 20, @@ -62494,8 +62491,7 @@ Object { 14, 20, ], - "shorthand": true, - "type": "ExperimentalRestProperty", + "type": "RestElement", }, ], "range": Array [ @@ -62866,7 +62862,6 @@ Object { ], "type": "Identifier", }, - "computed": false, "loc": Object { "end": Object { "column": 16, @@ -62881,8 +62876,7 @@ Object { 12, 16, ], - "shorthand": true, - "type": "ExperimentalRestProperty", + "type": "RestElement", }, ], "range": Array [ @@ -63350,7 +63344,6 @@ Object { ], "type": "Identifier", }, - "computed": false, "loc": Object { "end": Object { "column": 16, @@ -63365,8 +63358,7 @@ Object { 12, 16, ], - "shorthand": true, - "type": "ExperimentalRestProperty", + "type": "RestElement", }, ], "range": Array [ @@ -64533,7 +64525,7 @@ Object { 70, 80, ], - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", }, ], "range": Array [ @@ -65281,7 +65273,6 @@ Object { ], "type": "Identifier", }, - "computed": false, "loc": Object { "end": Object { "column": 45, @@ -65296,8 +65287,7 @@ Object { 38, 48, ], - "shorthand": true, - "type": "ExperimentalRestProperty", + "type": "RestElement", }, ], "range": Array [ @@ -65936,7 +65926,6 @@ Object { ], "type": "Identifier", }, - "computed": false, "loc": Object { "end": Object { "column": 45, @@ -65951,8 +65940,7 @@ Object { 45, 55, ], - "shorthand": true, - "type": "ExperimentalRestProperty", + "type": "RestElement", }, ], "range": Array [ @@ -66685,7 +66673,7 @@ Object { 60, 66, ], - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", }, ], "range": Array [ @@ -67403,7 +67391,7 @@ Object { 70, 76, ], - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", }, ], "range": Array [ @@ -68045,7 +68033,7 @@ Object { 9, 13, ], - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", }, ], "range": Array [ @@ -68544,7 +68532,7 @@ Object { 56, 62, ], - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", }, Object { "argument": Object { @@ -68579,7 +68567,7 @@ Object { 68, 74, ], - "type": "ExperimentalSpreadProperty", + "type": "SpreadElement", }, ], "range": Array [ From 0ccf3b2966f141cd668d3359c1758bf8eda4f952 Mon Sep 17 00:00:00 2001 From: Ika Date: Thu, 26 Jul 2018 21:14:30 +0800 Subject: [PATCH 267/326] Fix: support JSXSpreadChild (fixes #500) (#501) --- .../lib/ast-node-types.js | 1 + .../typescript-eslint-parser/lib/convert.js | 4 +- .../tests/fixtures/jsx/spread-child.src.js | 1 + .../tests/lib/__snapshots__/jsx.js.snap | 422 ++++++++++++++++++ 4 files changed, 427 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/jsx/spread-child.src.js diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 5839455c4578..3826a530b139 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -70,6 +70,7 @@ module.exports = { JSXNamespacedName: "JSXNamespacedName", JSXOpeningElement: "JSXOpeningElement", JSXSpreadAttribute: "JSXSpreadAttribute", + JSXSpreadChild: "JSXSpreadChild", JSXText: "JSXText", LabeledStatement: "LabeledStatement", Literal: "Literal", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index f178aa75938e..8365a2bf4a87 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -1897,7 +1897,9 @@ module.exports = function convert(config) { }; Object.assign(result, { - type: AST_NODE_TYPES.JSXExpressionContainer, + type: node.dotDotDotToken + ? AST_NODE_TYPES.JSXSpreadChild + : AST_NODE_TYPES.JSXExpressionContainer, expression }); diff --git a/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-child.src.js b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-child.src.js new file mode 100644 index 000000000000..48ce23c9bd02 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/jsx/spread-child.src.js @@ -0,0 +1 @@ +
{...[0]}
diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap index 663ef27155fd..0be9fe0b5b7b 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -6824,6 +6824,428 @@ Object { exports[`JSX useJSXTextNode: false fixtures/self-closing-tag-with-newline.src 1`] = `"Invalid character."`; +exports[`JSX useJSXTextNode: false fixtures/spread-child.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "children": Array [ + Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "JSXSpreadChild", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 13, + 19, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 0, + 19, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; + exports[`JSX useJSXTextNode: false fixtures/spread-operator-attribute-and-regular-attribute.src 1`] = ` Object { "body": Array [ From c3860b34f5b363156022347eefdf2ca57fb863e0 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 26 Jul 2018 09:34:14 -0400 Subject: [PATCH 268/326] Build: changelog update for 17.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 4fdbdcc4ac49..4397016a2c31 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,10 @@ +v17.0.0 - July 26, 2018 + +* 117800d Fix: support JSXSpreadChild (fixes #500) (#501) (Ika) +* 6eec85b Breaking: Remove "Experimental" from rest and spread (fixes #428) (#429) (Lucas Duailibe) +* 42f29a1 Fix: error on multiple super classes (fixes #493) (#494) (Ika) +* 11d9169 Breaking: always set optional on ClassProperty (fixes #472) (#491) (Ika) + v16.0.1 - June 27, 2018 * bc83c6a Chore: Do not run integration tests within npm test (James Henry) From 114ed7cfc2e756a290e14ccbc7d9391738fe16c3 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 26 Jul 2018 09:34:14 -0400 Subject: [PATCH 269/326] 17.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 89e705fd750b..4bf7eb1a93b5 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "16.0.1", + "version": "17.0.0", "files": [ "lib", "parser.js" From e67219efecef02efaeb09509d78a325d9dc3eb0b Mon Sep 17 00:00:00 2001 From: Texas Toland <48431+texastoland@users.noreply.github.com> Date: Thu, 26 Jul 2018 17:40:20 -0500 Subject: [PATCH 270/326] Chore: Replace removed API with public flags (fixes #498) (#505) --- packages/typescript-eslint-parser/.gitignore | 3 +- .../typescript-eslint-parser/lib/convert.js | 6 +-- .../lib/node-utils.js | 52 +++---------------- 3 files changed, 12 insertions(+), 49 deletions(-) diff --git a/packages/typescript-eslint-parser/.gitignore b/packages/typescript-eslint-parser/.gitignore index 2ff496493963..256e4f32d3b5 100644 --- a/packages/typescript-eslint-parser/.gitignore +++ b/packages/typescript-eslint-parser/.gitignore @@ -4,4 +4,5 @@ node_modules npm-debug.log _test.js .DS_Store -.vscode \ No newline at end of file +.vscode +yarn.lock diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 8365a2bf4a87..7b561fc73cbd 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -189,7 +189,7 @@ module.exports = function convert(config) { ], loc: nodeUtils.getLocFor(firstTypeParameter.pos - 1, greaterThanToken.end, ast), params: typeParameters.map(typeParameter => { - const name = nodeUtils.unescapeIdentifier(typeParameter.name.text); + const name = typeParameter.name.text; const constraint = typeParameter.constraint ? convert({ node: typeParameter.constraint, parent: typeParameter, ast, additionalOptions }) @@ -473,7 +473,7 @@ module.exports = function convert(config) { case SyntaxKind.Identifier: Object.assign(result, { type: AST_NODE_TYPES.Identifier, - name: nodeUtils.unescapeIdentifier(node.text) + name: node.text }); break; @@ -1748,7 +1748,7 @@ module.exports = function convert(config) { raw: ast.text.slice(result.range[0], result.range[1]) }); if (parent.name && parent.name === node) { - result.value = nodeUtils.unescapeIdentifier(node.text); + result.value = node.text; } else { result.value = nodeUtils.unescapeStringLiteralText(node.text); } diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js index 5c4ba9eab3ab..bd0bee0548dc 100644 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ b/packages/typescript-eslint-parser/lib/node-utils.js @@ -125,30 +125,6 @@ function findFirstMatchingChild(node, sourceFile, predicate) { return undefined; } -/** - * Returns true if the given TSNode is a let variable declaration - * @param {TSNode} node The TSNode - * @returns {boolean} whether or not the given node is a let variable declaration - */ -function isLet(node) { - /** - * TODO: Remove dependency on private TypeScript method - */ - return ts.isLet(node); -} - -/** - * Returns true if the given TSNode is a const variable declaration - * @param {TSNode} node The TSNode - * @returns {boolean} whether or not the given node is a const variable declaration - */ -function isConst(node) { - /** - * TODO: Remove dependency on private TypeScript method - */ - return ts.isConst(node); -} - //------------------------------------------------------------------------------ // Public //------------------------------------------------------------------------------ @@ -179,7 +155,6 @@ module.exports = { findFirstMatchingAncestor, findAncestorOfKind, hasJSXAncestor, - unescapeIdentifier, unescapeStringLiteralText, isComputedProperty, isOptional, @@ -366,24 +341,20 @@ function isTypeKeyword(kind) { * @returns {string} declaration kind */ function getDeclarationKind(node) { - let varDeclarationKind; switch (node.kind) { case SyntaxKind.TypeAliasDeclaration: - varDeclarationKind = "type"; - break; + return "type"; case SyntaxKind.VariableDeclarationList: - if (isLet(node)) { - varDeclarationKind = "let"; - } else if (isConst(node)) { - varDeclarationKind = "const"; - } else { - varDeclarationKind = "var"; + if (node.flags & ts.NodeFlags.Let) { + return "let"; } - break; + if (node.flags & ts.NodeFlags.Const) { + return "const"; + } + return "var"; default: throw "Unable to determine declaration kind."; } - return varDeclarationKind; } /** @@ -502,15 +473,6 @@ function hasJSXAncestor(node) { return !!findFirstMatchingAncestor(node, isJSXToken); } -/** - * Remove extra underscore from escaped identifier text content. - * @param {string} identifier The escaped identifier text. - * @returns {string} The unescaped identifier text. - */ -function unescapeIdentifier(identifier) { - return ts.unescapeIdentifier(identifier); -} - /** * Unescape the text content of string literals, e.g. & -> & * @param {string} text The escaped string literal text. From ce03ad7109b7965048654a15b0169b287e3616f8 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 26 Jul 2018 18:42:54 -0400 Subject: [PATCH 271/326] Build: changelog update for 17.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 4397016a2c31..159a10ebfd7b 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v17.0.1 - July 26, 2018 + +* f1d7de3 Chore: Replace removed API with public flags (fixes #498) (#505) (Texas Toland) + v17.0.0 - July 26, 2018 * 117800d Fix: support JSXSpreadChild (fixes #500) (#501) (Ika) From d0aaa7f139243507a93a0710bc1fb9eecc1b0047 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 26 Jul 2018 18:42:54 -0400 Subject: [PATCH 272/326] 17.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 4bf7eb1a93b5..31863b27d3a2 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "17.0.0", + "version": "17.0.1", "files": [ "lib", "parser.js" From 2c1709baec34905fd4d8c7a4df389a8b6dcf13b5 Mon Sep 17 00:00:00 2001 From: Ika Date: Tue, 7 Aug 2018 03:19:19 +0800 Subject: [PATCH 273/326] Fix: remove unnecessary TypeRef wrapper for ImportType (fixes #507) (#508) --- .../lib/ast-node-types.js | 2 + .../typescript-eslint-parser/lib/convert.js | 13 + .../typescript-eslint-parser/package.json | 1 + .../tests/ast-alignment/fixtures-to-test.js | 7 +- .../tests/ast-alignment/jest.config.js | 1 + ...h-type-parameters-in-type-reference.src.ts | 1 + .../typescript/basics/import-type.src.ts | 2 + .../lib/__snapshots__/typescript.js.snap | 1243 +++++++++++++++++ 8 files changed, 1269 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type.src.ts diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js index 3826a530b139..155abac19973 100644 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ b/packages/typescript-eslint-parser/lib/ast-node-types.js @@ -113,6 +113,8 @@ module.exports = { TSEnumMember: "TSEnumMember", TSExportAssignment: "TSExportAssignment", TSExportKeyword: "TSExportKeyword", + TSImportType: "TSImportType", + TSLiteralType: "TSLiteralType", TSIndexSignature: "TSIndexSignature", TSInterfaceBody: "TSInterfaceBody", TSInterfaceDeclaration: "TSInterfaceDeclaration", diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js index 7b561fc73cbd..ac295ebaa6af 100644 --- a/packages/typescript-eslint-parser/lib/convert.js +++ b/packages/typescript-eslint-parser/lib/convert.js @@ -154,6 +154,9 @@ module.exports = function convert(config) { loc: nodeUtils.getLoc(typeArgument, ast) }; } + if (typeArgument.kind === SyntaxKind.ImportType) { + return convert({ node: typeArgument, parent: null, ast, additionalOptions }); + } return { type: AST_NODE_TYPES.TSTypeReference, range: [ @@ -2141,6 +2144,16 @@ module.exports = function convert(config) { result.typeAnnotation.range = result.typeAnnotation.typeAnnotation.range; break; + case SyntaxKind.ImportType: + Object.assign(result, { + type: AST_NODE_TYPES.TSImportType, + isTypeOf: !!node.isTypeOf, + parameter: convertChild(node.argument), + qualifier: convertChild(node.qualifier), + typeParameters: node.typeArguments ? convertTypeArgumentsToTypeParameters(node.typeArguments) : null + }); + break; + case SyntaxKind.EnumDeclaration: { Object.assign(result, { type: AST_NODE_TYPES.TSEnumDeclaration, diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 31863b27d3a2..6aa6243402b2 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -62,6 +62,7 @@ "typescript": "*" }, "jest": { + "testEnvironment": "node", "testRegex": "tests/lib/.+\\.js$", "testPathIgnorePatterns": [], "collectCoverage": true, diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js index f9af598219f3..338dd159b60b 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js @@ -422,7 +422,12 @@ let fixturePatternConfigsToTest = [ "class-with-private-parameter-properties", "class-with-protected-parameter-properties", "class-with-public-parameter-properties", - "class-with-readonly-parameter-properties" + "class-with-readonly-parameter-properties", + /** + * Not yet supported in Babylon https://github.com/babel/babel/issues/7749 + */ + "import-type", + "import-type-with-type-parameters-in-type-reference" ], parseWithSourceTypeModule: [ "export-named-enum", diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js b/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js index 0ac0625483b4..2a310d0ddf36 100644 --- a/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js +++ b/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js @@ -1,5 +1,6 @@ "use strict"; module.exports = { + testEnvironment: "node", testRegex: "spec\\.js$" }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts new file mode 100644 index 000000000000..2c8acc12d369 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type-with-type-parameters-in-type-reference.src.ts @@ -0,0 +1 @@ +type X = A>; diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type.src.ts new file mode 100644 index 000000000000..00e3ba6afc1e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/import-type.src.ts @@ -0,0 +1,2 @@ +type A = typeof import('A'); +type B = import("B").X; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 9424f52b8339..8beb3200938f 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -28774,6 +28774,1249 @@ Object { } `; +exports[`typescript fixtures/basics/import-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "init": Object { + "isTypeOf": true, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "parameter": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "raw": "'A'", + "type": "Literal", + "value": "A", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "TSLiteralType", + }, + "qualifier": null, + "range": Array [ + 9, + 27, + ], + "type": "TSImportType", + "typeParameters": null, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "B", + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + }, + "init": Object { + "isTypeOf": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "parameter": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "raw": "\\"B\\"", + "type": "Literal", + "value": "B", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "TSLiteralType", + }, + "qualifier": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "X", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "range": Array [ + 38, + 54, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "Y", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 34, + 55, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 29, + 55, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "String", + "value": "'A'", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "String", + "value": "\\"B\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "Y", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/import-type-with-type-parameters-in-type-reference.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "isTypeOf": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "parameter": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "TSLiteralType", + }, + "qualifier": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "range": Array [ + 11, + 28, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 23, + 28, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 10, + 29, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "type", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`typescript fixtures/basics/interface-extends.src 1`] = ` Object { "body": Array [ From a9faa38373f0e404fa73a78dad2862cd8cd456b3 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 6 Aug 2018 15:49:46 -0400 Subject: [PATCH 274/326] Breaking: Support TypeScript 3.0 (#504) --- packages/typescript-eslint-parser/README.md | 19 ++++++++++--------- .../typescript-eslint-parser/package.json | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index e4dce3c3a704..2f76d80fc43f 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -40,7 +40,7 @@ And in your ESLint configuration file: We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~2.9.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~3.0.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. @@ -57,10 +57,11 @@ The vast majority of issues which are submitted here are not actually parsing bu This is not ideal, but users need a place to be able to report those things, so it has become accepted that that will also be done in this repo. Please check the current list of open and known issues and ensure the issue has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes: - - ESLint Version - - TypeScript version - - The `typescript-eslint-parser` version - - ESLint config or rules and plugins currently enabled + +- ESLint Version +- TypeScript version +- The `typescript-eslint-parser` version +- ESLint config or rules and plugins currently enabled ## Integration Tests @@ -90,10 +91,10 @@ Issues and pull requests will be triaged and responded to as quickly as possible ## Build Commands -* `npm test` - run all linting and tests -* `npm run lint` - run all linting -* `npm run ast-alignment-tests` - run only Babylon AST alignment tests -* `npm run integration-tests` - run only integration tests +- `npm test` - run all linting and tests +- `npm run lint` - run all linting +- `npm run ast-alignment-tests` - run only Babylon AST alignment tests +- `npm run integration-tests` - run only integration tests ## License diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 6aa6243402b2..79887ffb3933 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -30,7 +30,7 @@ "npm-license": "0.3.3", "shelljs": "0.8.2", "shelljs-nodecli": "0.1.1", - "typescript": "~2.9.1" + "typescript": "~3.0.1" }, "keywords": [ "ast", From 1739f92788a0d2f6d4008f41673519395dca3a49 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 6 Aug 2018 15:49:29 -0400 Subject: [PATCH 275/326] Build: changelog update for 18.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 159a10ebfd7b..a2ae68653990 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v18.0.0 - August 6, 2018 + +* 16d1a78 Breaking: Support TypeScript 3.0 (#504) (James Henry) +* 7461462 Fix: remove unnecessary TypeRef wrapper for ImportType (fixes #507) (#508) (Ika) + v17.0.1 - July 26, 2018 * f1d7de3 Chore: Replace removed API with public flags (fixes #498) (#505) (Texas Toland) From 4d85cf8c12b846fc2c1b6694b293b5650e118408 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 6 Aug 2018 15:49:30 -0400 Subject: [PATCH 276/326] 18.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 79887ffb3933..0a2d52a39c1a 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "17.0.1", + "version": "18.0.0", "files": [ "lib", "parser.js" From 25f1dc71fef0e0cadba1ea3a5f6223a709492bd8 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 25 Sep 2018 09:34:03 -0400 Subject: [PATCH 277/326] Breaking: Use typescript-estree for parsing (#515) --- packages/typescript-eslint-parser/Makefile.js | 2 +- packages/typescript-eslint-parser/README.md | 38 +- .../lib/ast-converter.js | 76 - .../lib/ast-node-types.js | 161 -- .../lib/convert-comments.js | 147 -- .../typescript-eslint-parser/lib/convert.js | 2217 ----------------- .../lib/node-utils.js | 748 ------ .../typescript-eslint-parser/package.json | 12 +- packages/typescript-eslint-parser/parser.js | 188 +- .../tests/ast-alignment/.eslintrc.yml | 2 - .../tests/ast-alignment/fixtures-to-test.js | 523 ---- .../tests/ast-alignment/jest.config.js | 6 - .../tests/ast-alignment/parse.js | 96 - .../tests/ast-alignment/spec.js | 80 - .../tests/ast-alignment/utils.js | 154 -- .../tests/lib/__snapshots__/parse.js.snap | 190 -- .../tests/lib/parse.js | 64 - 17 files changed, 30 insertions(+), 4674 deletions(-) delete mode 100644 packages/typescript-eslint-parser/lib/ast-converter.js delete mode 100644 packages/typescript-eslint-parser/lib/ast-node-types.js delete mode 100644 packages/typescript-eslint-parser/lib/convert-comments.js delete mode 100644 packages/typescript-eslint-parser/lib/convert.js delete mode 100644 packages/typescript-eslint-parser/lib/node-utils.js delete mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml delete mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js delete mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js delete mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/parse.js delete mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/spec.js delete mode 100644 packages/typescript-eslint-parser/tests/ast-alignment/utils.js delete mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap delete mode 100644 packages/typescript-eslint-parser/tests/lib/parse.js diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index a1cf6cdb8bae..2cd8c66c523c 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -38,7 +38,7 @@ const NODE_MODULES = "./node_modules/", // Files MAKEFILE = "./Makefile.js", /* eslint-disable no-use-before-define */ - JS_FILES = `${find("lib/").filter(fileType("js")).join(" ")} parser.js`, + JS_FILES = "parser.js", TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); /* eslint-enable no-use-before-define */ diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 2f76d80fc43f..60a3cbbe86e1 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -1,18 +1,21 @@ # TypeScript ESLint Parser -A parser that converts TypeScript source code into an [ESTree](https://github.com/estree/estree)-compatible form. +An ESLint custom parser which leverages [TypeScript ESTree](https://github.com/JamesHenry/typescript-estree) to allow for ESLint to lint TypeScript source code. -## Usage -This parser is actually somewhat generic and robust - it could be used to power any use-case which requires taking TypeScript source code and producing an ESTree-compatiable AST. +## Installation: -In fact, that is exactly what it is used for in the popular open-source code formatter, [Prettier](https://prettier.io), to power its TypeScript support. +```sh +npm install --save-dev typescript-eslint-parser +``` -Nevertheless, the parser does have a special appreciation for ESLint-specific use-cases built in, and can even produce a slightly different AST for ESLint if needed (using the special `parseForESLint()` method). +## Usage -The majority of users of this parser use it to enable them to use ESLint on their TypeScript source files, so they will not actually be interacting with the parser directly. Instead they will configure ESLint to use it instead of its default parser, [espree](https://github.com/eslint/espree), which does not understand TypeScript. +In your ESLint configuration file, set the `parser` property: -## Usage with ESLint +```json +"parser": "typescript-eslint-parser" +``` There is sometimes an incorrect assumption that the parser itself is what does everything necessary to facilitate the use of ESLint with TypeScript. In actuality, it is the combination of the parser _and_ one or more plugins which allow you to maximize your usage of ESLint with TypeScript. @@ -24,18 +27,6 @@ Instead, you also need to make use of one more plugins which will add or extend By far the most common case will be installing the [eslint-plugin-typescript](https://github.com/nzakas/eslint-plugin-typescript) plugin, but there are also other relevant options available such a [eslint-plugin-tslint](https://github.com/JamesHenry/eslint-plugin-tslint). -Install: - -```sh -npm install --save-dev typescript-eslint-parser -``` - -And in your ESLint configuration file: - -```json -"parser": "typescript-eslint-parser" -``` - ## Supported TypeScript Version We will always endeavor to support the latest stable version of TypeScript. @@ -52,9 +43,7 @@ If you're familiar with TypeScript and ESLint, and you'd like to see this projec ## Reporting Issues -The vast majority of issues which are submitted here are not actually parsing bugs at all. They are integration issues with the ESLint ecosystem. - -This is not ideal, but users need a place to be able to report those things, so it has become accepted that that will also be done in this repo. +Please **do not report parsing/AST issues in this repo**, report them directly to [TypeScript ESTree](https://github.com/JamesHenry/typescript-estree). Please check the current list of open and known issues and ensure the issue has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes: @@ -69,9 +58,9 @@ We have a very flexible way of running integration tests which connects all of t We run each test within its own docker container, and so each one has complete autonomy over what dependencies/plugins are installed and what versions are used. This also has the benefit of not bloating the `package.json` and `node_modules` of the parser project itself. -> If you are going to submit an issue related to the usage of this parser with ESLint, please consider creating a failing integration which clearly demonstrates the behavior. It's honestly super quick! +> If you are going to submit an issue related to the usage of this parser with ESLint, please consider creating a failing integration test which clearly demonstrates the behavior. It's honestly super quick! -You just need to duplicate on of the existing test sub-directories found in `tests/integration/`, tweak the dependencies and ESLint config to match what you need, and add a new entry to the docker-compose.yml file which matches the format of the existing ones. +You just need to duplicate one of the existing test sub-directories found in `tests/integration/`, tweak the dependencies and ESLint config to match what you need, and add a new entry to the docker-compose.yml file which matches the format of the existing ones. Then run: @@ -93,7 +82,6 @@ Issues and pull requests will be triaged and responded to as quickly as possible - `npm test` - run all linting and tests - `npm run lint` - run all linting -- `npm run ast-alignment-tests` - run only Babylon AST alignment tests - `npm run integration-tests` - run only integration tests ## License diff --git a/packages/typescript-eslint-parser/lib/ast-converter.js b/packages/typescript-eslint-parser/lib/ast-converter.js deleted file mode 100644 index 779c15483fc2..000000000000 --- a/packages/typescript-eslint-parser/lib/ast-converter.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @fileoverview Converts TypeScript AST into ESTree format. - * @author Nicholas C. Zakas - * @author James Henry - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const convert = require("./convert"), - convertComments = require("./convert-comments").convertComments, - nodeUtils = require("./node-utils"); - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -/** - * Extends and formats a given error object - * @param {Object} error the error object - * @returns {Object} converted error object - */ -function convertError(error) { - return nodeUtils.createError(error.file, error.start, error.message || error.messageText); -} - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -module.exports = (ast, extra) => { - - /** - * The TypeScript compiler produced fundamental parse errors when parsing the - * source. - */ - if (ast.parseDiagnostics.length) { - throw convertError(ast.parseDiagnostics[0]); - } - - /** - * Recursively convert the TypeScript AST into an ESTree-compatible AST - */ - const estree = convert({ - node: ast, - parent: null, - ast, - additionalOptions: { - errorOnUnknownASTType: extra.errorOnUnknownASTType || false, - useJSXTextNode: extra.useJSXTextNode || false, - parseForESLint: extra.parseForESLint - } - }); - - /** - * Optionally convert and include all tokens in the AST - */ - if (extra.tokens) { - estree.tokens = nodeUtils.convertTokens(ast); - } - - /** - * Optionally convert and include all comments in the AST - */ - if (extra.comment) { - estree.comments = convertComments(ast, extra.code); - } - - return estree; - -}; diff --git a/packages/typescript-eslint-parser/lib/ast-node-types.js b/packages/typescript-eslint-parser/lib/ast-node-types.js deleted file mode 100644 index 155abac19973..000000000000 --- a/packages/typescript-eslint-parser/lib/ast-node-types.js +++ /dev/null @@ -1,161 +0,0 @@ -/** - * @fileoverview The AST node types produced by the parser. - * @author Nicholas C. Zakas - * @author James Henry - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -// None! - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -module.exports = { - ArrayExpression: "ArrayExpression", - ArrayPattern: "ArrayPattern", - ArrowFunctionExpression: "ArrowFunctionExpression", - AssignmentExpression: "AssignmentExpression", - AssignmentPattern: "AssignmentPattern", - AwaitExpression: "AwaitExpression", - BinaryExpression: "BinaryExpression", - BlockStatement: "BlockStatement", - BreakStatement: "BreakStatement", - CallExpression: "CallExpression", - CatchClause: "CatchClause", - ClassBody: "ClassBody", - ClassDeclaration: "ClassDeclaration", - ClassExpression: "ClassExpression", - ClassImplements: "ClassImplements", - ClassProperty: "ClassProperty", - ConditionalExpression: "ConditionalExpression", - ContinueStatement: "ContinueStatement", - DebuggerStatement: "DebuggerStatement", - DeclareFunction: "DeclareFunction", - Decorator: "Decorator", - DoWhileStatement: "DoWhileStatement", - EmptyStatement: "EmptyStatement", - ExportAllDeclaration: "ExportAllDeclaration", - ExportDefaultDeclaration: "ExportDefaultDeclaration", - ExportNamedDeclaration: "ExportNamedDeclaration", - ExportSpecifier: "ExportSpecifier", - ExpressionStatement: "ExpressionStatement", - ForInStatement: "ForInStatement", - ForOfStatement: "ForOfStatement", - ForStatement: "ForStatement", - FunctionDeclaration: "FunctionDeclaration", - FunctionExpression: "FunctionExpression", - GenericTypeAnnotation: "GenericTypeAnnotation", - Identifier: "Identifier", - IfStatement: "IfStatement", - Import: "Import", - ImportDeclaration: "ImportDeclaration", - ImportDefaultSpecifier: "ImportDefaultSpecifier", - ImportNamespaceSpecifier: "ImportNamespaceSpecifier", - ImportSpecifier: "ImportSpecifier", - JSXAttribute: "JSXAttribute", - JSXClosingElement: "JSXClosingElement", - JSXElement: "JSXElement", - JSXEmptyExpression: "JSXEmptyExpression", - JSXExpressionContainer: "JSXExpressionContainer", - JSXIdentifier: "JSXIdentifier", - JSXMemberExpression: "JSXMemberExpression", - JSXNamespacedName: "JSXNamespacedName", - JSXOpeningElement: "JSXOpeningElement", - JSXSpreadAttribute: "JSXSpreadAttribute", - JSXSpreadChild: "JSXSpreadChild", - JSXText: "JSXText", - LabeledStatement: "LabeledStatement", - Literal: "Literal", - LogicalExpression: "LogicalExpression", - MemberExpression: "MemberExpression", - MetaProperty: "MetaProperty", - MethodDefinition: "MethodDefinition", - NewExpression: "NewExpression", - ObjectExpression: "ObjectExpression", - ObjectPattern: "ObjectPattern", - Program: "Program", - Property: "Property", - RestElement: "RestElement", - ReturnStatement: "ReturnStatement", - SequenceExpression: "SequenceExpression", - SpreadElement: "SpreadElement", - Super: "Super", - SwitchCase: "SwitchCase", - SwitchStatement: "SwitchStatement", - TaggedTemplateExpression: "TaggedTemplateExpression", - TemplateElement: "TemplateElement", - TemplateLiteral: "TemplateLiteral", - ThisExpression: "ThisExpression", - ThrowStatement: "ThrowStatement", - TryStatement: "TryStatement", - /** - * TS-prefixed nodes - */ - TSAbstractClassProperty: "TSAbstractClassProperty", - TSAbstractKeyword: "TSAbstractKeyword", - TSAbstractMethodDefinition: "TSAbstractMethodDefinition", - TSAnyKeyword: "TSAnyKeyword", - TSArrayType: "TSArrayType", - TSAsyncKeyword: "TSAsyncKeyword", - TSBooleanKeyword: "TSBooleanKeyword", - TSConstructorType: "TSConstructorType", - TSConstructSignature: "TSConstructSignature", - TSDeclareKeyword: "TSDeclareKeyword", - TSEnumDeclaration: "TSEnumDeclaration", - TSEnumMember: "TSEnumMember", - TSExportAssignment: "TSExportAssignment", - TSExportKeyword: "TSExportKeyword", - TSImportType: "TSImportType", - TSLiteralType: "TSLiteralType", - TSIndexSignature: "TSIndexSignature", - TSInterfaceBody: "TSInterfaceBody", - TSInterfaceDeclaration: "TSInterfaceDeclaration", - TSInterfaceHeritage: "TSInterfaceHeritage", - TSFunctionType: "TSFunctionType", - TSMethodSignature: "TSMethodSignature", - TSModuleBlock: "TSModuleBlock", - TSModuleDeclaration: "TSModuleDeclaration", - TSNamespaceFunctionDeclaration: "TSNamespaceFunctionDeclaration", - TSNonNullExpression: "TSNonNullExpression", - TSNeverKeyword: "TSNeverKeyword", - TSNullKeyword: "TSNullKeyword", - TSNumberKeyword: "TSNumberKeyword", - TSObjectKeyword: "TSObjectKeyword", - TSParameterProperty: "TSParameterProperty", - TSPrivateKeyword: "TSPrivateKeyword", - TSPropertySignature: "TSPropertySignature", - TSProtectedKeyword: "TSProtectedKeyword", - TSPublicKeyword: "TSPublicKeyword", - TSQualifiedName: "TSQualifiedName", - TSQuestionToken: "TSQuestionToken", - TSReadonlyKeyword: "TSReadonlyKeyword", - TSStaticKeyword: "TSStaticKeyword", - TSStringKeyword: "TSStringKeyword", - TSSymbolKeyword: "TSSymbolKeyword", - TSTypeAnnotation: "TSTypeAnnotation", - TSTypeLiteral: "TSTypeLiteral", - TSTypeOperator: "TSTypeOperator", - TSTypeParameter: "TSTypeParameter", - TSTypeParameterDeclaration: "TSTypeParameterDeclaration", - TSTypeParameterInstantiation: "TSTypeParameterInstantiation", - TSTypePredicate: "TSTypePredicate", - TSTypeReference: "TSTypeReference", - TSUnionType: "TSUnionType", - TSUndefinedKeyword: "TSUndefinedKeyword", - TSVoidKeyword: "TSVoidKeyword", - UnaryExpression: "UnaryExpression", - UpdateExpression: "UpdateExpression", - VariableDeclaration: "VariableDeclaration", - VariableDeclarator: "VariableDeclarator", - WhileStatement: "WhileStatement", - WithStatement: "WithStatement", - YieldExpression: "YieldExpression" -}; diff --git a/packages/typescript-eslint-parser/lib/convert-comments.js b/packages/typescript-eslint-parser/lib/convert-comments.js deleted file mode 100644 index 866aa4435674..000000000000 --- a/packages/typescript-eslint-parser/lib/convert-comments.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * @fileoverview Convert comment using TypeScript token scanner - * @author James Henry - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const ts = require("typescript"), - nodeUtils = require("./node-utils"); - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -/** - * Converts a TypeScript comment to an Esprima comment. - * @param {boolean} block True if it's a block comment, false if not. - * @param {string} text The text of the comment. - * @param {int} start The index at which the comment starts. - * @param {int} end The index at which the comment ends. - * @param {Location} startLoc The location at which the comment starts. - * @param {Location} endLoc The location at which the comment ends. - * @returns {Object} The comment object. - * @private - */ -function convertTypeScriptCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { - const comment = { - type: block ? "Block" : "Line", - value: text - }; - - if (typeof start === "number") { - comment.range = [start, end]; - } - - if (typeof startLoc === "object") { - comment.loc = { - start: startLoc, - end: endLoc - }; - } - - return comment; -} - -/** - * Convert comment from TypeScript Triva Scanner. - * @param {Object} triviaScanner TS Scanner - * @param {Object} ast the AST object - * @param {string} code TypeScript code - * @returns {ESTreeComment} the converted ESTreeComment - * @private - */ -function getCommentFromTriviaScanner(triviaScanner, ast, code) { - const kind = triviaScanner.getToken(); - const isBlock = (kind === ts.SyntaxKind.MultiLineCommentTrivia); - const range = { - pos: triviaScanner.getTokenPos(), - end: triviaScanner.getTextPos(), - kind: triviaScanner.getToken() - }; - - const comment = code.substring(range.pos, range.end); - const text = (isBlock) ? comment.replace(/^\/\*/, "").replace(/\*\/$/, "") : comment.replace(/^\/\//, ""); - const loc = nodeUtils.getLocFor(range.pos, range.end, ast); - - const esprimaComment = convertTypeScriptCommentToEsprimaComment(isBlock, text, range.pos, range.end, loc.start, loc.end); - - return esprimaComment; -} - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -/* eslint-disable no-use-before-define */ -module.exports = { - convertComments -}; - - -/** - * Convert all comments for the given AST. - * @param {Object} ast the AST object - * @param {string} code the TypeScript code - * @returns {ESTreeComment[]} the converted ESTreeComment - * @private - */ -function convertComments(ast, code) { - const comments = []; - - /** - * Create a TypeScript Scanner, with skipTrivia set to false so that - * we can parse the comments - */ - const triviaScanner = ts.createScanner(ast.languageVersion, false, 0, code); - - let kind = triviaScanner.scan(); - while (kind !== ts.SyntaxKind.EndOfFileToken) { - const start = triviaScanner.getTokenPos(); - const end = triviaScanner.getTextPos(); - - let container = null; - switch (kind) { - case ts.SyntaxKind.SingleLineCommentTrivia: - case ts.SyntaxKind.MultiLineCommentTrivia: { - const comment = getCommentFromTriviaScanner(triviaScanner, ast, code); - - comments.push(comment); - break; - } - case ts.SyntaxKind.CloseBraceToken: - container = nodeUtils.getNodeContainer(ast, start, end); - - if ( - container.kind === ts.SyntaxKind.TemplateMiddle || - container.kind === ts.SyntaxKind.TemplateTail - ) { - kind = triviaScanner.reScanTemplateToken(); - continue; - } - break; - case ts.SyntaxKind.SlashToken: - case ts.SyntaxKind.SlashEqualsToken: - container = nodeUtils.getNodeContainer(ast, start, end); - - if ( - container.kind === ts.SyntaxKind.RegularExpressionLiteral - ) { - kind = triviaScanner.reScanSlashToken(); - continue; - } - break; - default: - break; - } - kind = triviaScanner.scan(); - } - - return comments; -} diff --git a/packages/typescript-eslint-parser/lib/convert.js b/packages/typescript-eslint-parser/lib/convert.js deleted file mode 100644 index ac295ebaa6af..000000000000 --- a/packages/typescript-eslint-parser/lib/convert.js +++ /dev/null @@ -1,2217 +0,0 @@ -/** - * @fileoverview Converts TypeScript AST into ESTree format. - * @author Nicholas C. Zakas - * @author James Henry - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const nodeUtils = require("./node-utils"), - AST_NODE_TYPES = require("./ast-node-types"); - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -const SyntaxKind = nodeUtils.SyntaxKind; - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -/** - * Converts a TypeScript node into an ESTree node - * @param {Object} config configuration options for the conversion - * @param {TSNode} config.node the TSNode - * @param {TSNode} config.parent the parent TSNode - * @param {TSNode} config.ast the full TypeScript AST - * @param {Object} config.additionalOptions additional options for the conversion - * @param {Object} config.additionalOptions.errorOnUnknownASTType whether whether or not to throw an error if an unknown AST Node Type is encountered - * @returns {ESTreeNode} the converted ESTreeNode - */ -module.exports = function convert(config) { - - const node = config.node; - const parent = config.parent; - const ast = config.ast; - const additionalOptions = config.additionalOptions || {}; - - /** - * Exit early for null and undefined - */ - if (!node) { - return null; - } - - /** - * Create a new ESTree node - */ - let result = { - type: "", - range: [node.getStart(), node.end], - loc: nodeUtils.getLoc(node, ast) - }; - - /** - * Copies the result object into an ESTree node with just a type property. - * This is used only for leaf nodes that have no other properties. - * @returns {void} - */ - function simplyCopy() { - Object.assign(result, { - type: SyntaxKind[node.kind] - }); - } - - /** - * If we are parsing for ESLint we need to perform a custom namespacing step - * on functions which have no body so that we do not break any ESLint rules which - * rely on them to have one. - * - * @param {ESTreeNode} functionNode the converted ESTreeNode - * @returns {void} - */ - function namespaceEmptyBodyFunctionForESLint(functionNode) { - if (!config.additionalOptions.parseForESLint || functionNode.body) { - return; - } - functionNode.type = `TSEmptyBody${functionNode.type}`; - } - - /** - * Converts a TypeScript node into an ESTree node. - * @param {TSNode} child the child TSNode - * @returns {ESTreeNode} the converted ESTree node - */ - function convertChild(child) { - return convert({ node: child, parent: node, ast, additionalOptions }); - } - - /** - * Converts a child into a type annotation. This creates an intermediary - * TypeAnnotation node to match what Flow does. - * @param {TSNode} child The TypeScript AST node to convert. - * @returns {ESTreeNode} The type annotation node. - */ - function convertTypeAnnotation(child) { - const annotation = convertChild(child); - const annotationStartCol = child.getFullStart() - 1; - const loc = nodeUtils.getLocFor(annotationStartCol, child.end, ast); - return { - type: AST_NODE_TYPES.TSTypeAnnotation, - loc, - range: [annotationStartCol, child.end], - typeAnnotation: annotation - }; - } - - /** - * Converts a TSNode's typeArguments array to a flow-like typeParameters node - * @param {TSNode[]} typeArguments TSNode typeArguments - * @returns {TypeParameterInstantiation} TypeParameterInstantiation node - */ - function convertTypeArgumentsToTypeParameters(typeArguments) { - /** - * Even if typeArguments is an empty array, TypeScript sets a `pos` and `end` - * property on the array object so we can safely read the values here - */ - const start = typeArguments.pos - 1; - let end = typeArguments.end + 1; - if (typeArguments && typeArguments.length) { - const firstTypeArgument = typeArguments[0]; - const typeArgumentsParent = firstTypeArgument.parent; - /** - * In the case of the parent being a CallExpression or a TypeReference we have to use - * slightly different logic to calculate the correct end position - */ - if (typeArgumentsParent && (typeArgumentsParent.kind === SyntaxKind.CallExpression || typeArgumentsParent.kind === SyntaxKind.TypeReference)) { - const lastTypeArgument = typeArguments[typeArguments.length - 1]; - const greaterThanToken = nodeUtils.findNextToken(lastTypeArgument, ast); - end = greaterThanToken.end; - } - } - return { - type: AST_NODE_TYPES.TSTypeParameterInstantiation, - range: [ - start, - end - ], - loc: nodeUtils.getLocFor(start, end, ast), - params: typeArguments.map(typeArgument => { - if (nodeUtils.isTypeKeyword(typeArgument.kind)) { - return { - type: AST_NODE_TYPES[`TS${SyntaxKind[typeArgument.kind]}`], - range: [ - typeArgument.getStart(), - typeArgument.getEnd() - ], - loc: nodeUtils.getLoc(typeArgument, ast) - }; - } - if (typeArgument.kind === SyntaxKind.ImportType) { - return convert({ node: typeArgument, parent: null, ast, additionalOptions }); - } - return { - type: AST_NODE_TYPES.TSTypeReference, - range: [ - typeArgument.getStart(), - typeArgument.getEnd() - ], - loc: nodeUtils.getLoc(typeArgument, ast), - typeName: convertChild(typeArgument.typeName || typeArgument), - typeParameters: (typeArgument.typeArguments) - ? convertTypeArgumentsToTypeParameters(typeArgument.typeArguments) - : undefined - }; - }) - }; - } - - /** - * Converts a TSNode's typeParameters array to a flow-like TypeParameterDeclaration node - * @param {TSNode[]} typeParameters TSNode typeParameters - * @returns {TypeParameterDeclaration} TypeParameterDeclaration node - */ - function convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { - const firstTypeParameter = typeParameters[0]; - const lastTypeParameter = typeParameters[typeParameters.length - 1]; - - const greaterThanToken = nodeUtils.findNextToken(lastTypeParameter, ast); - - return { - type: AST_NODE_TYPES.TSTypeParameterDeclaration, - range: [ - firstTypeParameter.pos - 1, - greaterThanToken.end - ], - loc: nodeUtils.getLocFor(firstTypeParameter.pos - 1, greaterThanToken.end, ast), - params: typeParameters.map(typeParameter => { - const name = typeParameter.name.text; - - const constraint = typeParameter.constraint - ? convert({ node: typeParameter.constraint, parent: typeParameter, ast, additionalOptions }) - : undefined; - - const defaultParameter = typeParameter.default - ? convert({ node: typeParameter.default, parent: typeParameter, ast, additionalOptions }) - : typeParameter.default; - - return { - type: AST_NODE_TYPES.TSTypeParameter, - range: [ - typeParameter.getStart(), - typeParameter.getEnd() - ], - loc: nodeUtils.getLoc(typeParameter, ast), - name, - constraint, - default: defaultParameter - }; - }) - }; - } - - /** - * Converts a child into a class implements node. This creates an intermediary - * ClassImplements node to match what Flow does. - * @param {TSNode} child The TypeScript AST node to convert. - * @returns {ESTreeNode} The type annotation node. - */ - function convertClassImplements(child) { - const id = convertChild(child.expression); - const classImplementsNode = { - type: AST_NODE_TYPES.ClassImplements, - loc: id.loc, - range: id.range, - id - }; - if (child.typeArguments && child.typeArguments.length) { - classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); - } - return classImplementsNode; - } - - /** - * Converts a child into a interface heritage node. - * @param {TSNode} child The TypeScript AST node to convert. - * @returns {ESTreeNode} The type annotation node. - */ - function convertInterfaceHeritageClause(child) { - const id = convertChild(child.expression); - const classImplementsNode = { - type: AST_NODE_TYPES.TSInterfaceHeritage, - loc: id.loc, - range: id.range, - id - }; - - if (child.typeArguments && child.typeArguments.length) { - classImplementsNode.typeParameters = convertTypeArgumentsToTypeParameters(child.typeArguments); - } - return classImplementsNode; - } - - /** - * Converts an array of TSNode decorators into an array of ESTreeNode decorators - * @param {TSNode[]} decorators An array of TSNode decorators to be converted - * @returns {ESTreeNode[]} an array of converted ESTreeNode decorators - */ - function convertDecorators(decorators) { - if (!decorators || !decorators.length) { - return []; - } - return decorators.map(decorator => { - const expression = convertChild(decorator.expression); - return { - type: AST_NODE_TYPES.Decorator, - range: [decorator.getStart(), decorator.end], - loc: nodeUtils.getLoc(decorator, ast), - expression - }; - }); - } - - /** - * Converts an array of TSNode parameters into an array of ESTreeNode params - * @param {TSNode[]} parameters An array of TSNode params to be converted - * @returns {ESTreeNode[]} an array of converted ESTreeNode params - */ - function convertParameters(parameters) { - if (!parameters || !parameters.length) { - return []; - } - return parameters.map(param => { - const convertedParam = convertChild(param); - if (!param.decorators || !param.decorators.length) { - return convertedParam; - } - return Object.assign(convertedParam, { - decorators: convertDecorators(param.decorators) - }); - }); - } - - /** - * For nodes that are copied directly from the TypeScript AST into - * ESTree mostly as-is. The only difference is the addition of a type - * property instead of a kind property. Recursively copies all children. - * @returns {void} - */ - function deeplyCopy() { - const customType = `TS${SyntaxKind[node.kind]}`; - /** - * If the "errorOnUnknownASTType" option is set to true, throw an error, - * otherwise fallback to just inlcuding the unknown type as-is. - */ - if (additionalOptions.errorOnUnknownASTType && !AST_NODE_TYPES[customType]) { - throw new Error(`Unknown AST_NODE_TYPE: "${customType}"`); - } - result.type = customType; - Object - .keys(node) - .filter(key => !(/^(?:_children|kind|parent|pos|end|flags|modifierFlagsCache|jsDoc)$/.test(key))) - .forEach(key => { - if (key === "type") { - result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null; - } else if (key === "typeArguments") { - result.typeParameters = (node.typeArguments) - ? convertTypeArgumentsToTypeParameters(node.typeArguments) - : null; - } else if (key === "typeParameters") { - result.typeParameters = (node.typeParameters) - ? convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters) - : null; - } else if (key === "decorators") { - const decorators = convertDecorators(node.decorators); - if (decorators && decorators.length) { - result.decorators = decorators; - } - } else { - if (Array.isArray(node[key])) { - result[key] = node[key].map(convertChild); - } else if (node[key] && typeof node[key] === "object") { - result[key] = convertChild(node[key]); - } else { - result[key] = node[key]; - } - } - }); - } - - /** - * Converts a TypeScript JSX node.tagName into an ESTree node.name - * @param {Object} tagName the tagName object from a JSX TSNode - * @param {Object} ast the AST object - * @returns {Object} the converted ESTree name object - */ - function convertTypeScriptJSXTagNameToESTreeName(tagName) { - const tagNameToken = nodeUtils.convertToken(tagName, ast); - - if (tagNameToken.type === AST_NODE_TYPES.JSXMemberExpression) { - - const isNestedMemberExpression = (node.tagName.expression.kind === SyntaxKind.PropertyAccessExpression); - - // Convert TSNode left and right objects into ESTreeNode object - // and property objects - tagNameToken.object = convertChild(node.tagName.expression); - tagNameToken.property = convertChild(node.tagName.name); - - // Assign the appropriate types - tagNameToken.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.JSXMemberExpression : AST_NODE_TYPES.JSXIdentifier; - tagNameToken.property.type = AST_NODE_TYPES.JSXIdentifier; - if (tagName.expression.kind === SyntaxKind.ThisKeyword) { - tagNameToken.object.name = "this"; - } - } else { - tagNameToken.type = AST_NODE_TYPES.JSXIdentifier; - tagNameToken.name = tagNameToken.value; - } - - delete tagNameToken.value; - - return tagNameToken; - } - - /** - * Applies the given TS modifiers to the given result object. - * @param {TSNode[]} modifiers original TSNodes from the node.modifiers array - * @returns {void} (the current result object will be mutated) - */ - function applyModifiersToResult(modifiers) { - if (!modifiers || !modifiers.length) { - return; - } - /** - * Some modifiers are explicitly handled by applying them as - * boolean values on the result node. As well as adding them - * to the result, we remove them from the array, so that they - * are not handled twice. - */ - const handledModifierIndices = {}; - for (let i = 0; i < modifiers.length; i++) { - const modifier = modifiers[i]; - switch (modifier.kind) { - /** - * Ignore ExportKeyword and DefaultKeyword, they are handled - * via the fixExports utility function - */ - case SyntaxKind.ExportKeyword: - case SyntaxKind.DefaultKeyword: - handledModifierIndices[i] = true; - break; - case SyntaxKind.ConstKeyword: - result.const = true; - handledModifierIndices[i] = true; - break; - case SyntaxKind.DeclareKeyword: - result.declare = true; - handledModifierIndices[i] = true; - break; - default: - } - } - /** - * If there are still valid modifiers available which have - * not been explicitly handled above, we just convert and - * add the modifiers array to the result node. - */ - const remainingModifiers = modifiers.filter((_, i) => !handledModifierIndices[i]); - if (!remainingModifiers || !remainingModifiers.length) { - return; - } - result.modifiers = remainingModifiers.map(convertChild); - } - - /** - * Uses the current TSNode's end location for its `type` to adjust the location data of the given - * ESTreeNode, which should be the parent of the final typeAnnotation node - * @param {ESTreeNode} typeAnnotationParent The node that will have its location data mutated - * @returns {void} - */ - function fixTypeAnnotationParentLocation(typeAnnotationParent) { - const end = node.type.getEnd(); - typeAnnotationParent.range[1] = end; - const loc = nodeUtils.getLocFor(typeAnnotationParent.range[0], typeAnnotationParent.range[1], ast); - typeAnnotationParent.loc = loc; - } - - /** - * The core of the conversion logic: - * Identify and convert each relevant TypeScript SyntaxKind - */ - switch (node.kind) { - - case SyntaxKind.SourceFile: - Object.assign(result, { - type: AST_NODE_TYPES.Program, - body: [], - sourceType: node.externalModuleIndicator ? "module" : "script" - }); - - // filter out unknown nodes for now - node.statements.forEach(statement => { - const convertedStatement = convertChild(statement); - if (convertedStatement) { - result.body.push(convertedStatement); - } - }); - - result.range[1] = node.endOfFileToken.end; - result.loc = nodeUtils.getLocFor(node.getStart(), result.range[1], ast); - break; - - case SyntaxKind.Block: - Object.assign(result, { - type: AST_NODE_TYPES.BlockStatement, - body: node.statements.map(convertChild) - }); - break; - - case SyntaxKind.Identifier: - Object.assign(result, { - type: AST_NODE_TYPES.Identifier, - name: node.text - }); - break; - - case SyntaxKind.WithStatement: - Object.assign(result, { - type: AST_NODE_TYPES.WithStatement, - object: convertChild(node.expression), - body: convertChild(node.statement) - }); - break; - - // Control Flow - - case SyntaxKind.ReturnStatement: - Object.assign(result, { - type: AST_NODE_TYPES.ReturnStatement, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.LabeledStatement: - Object.assign(result, { - type: AST_NODE_TYPES.LabeledStatement, - label: convertChild(node.label), - body: convertChild(node.statement) - }); - break; - - case SyntaxKind.BreakStatement: - case SyntaxKind.ContinueStatement: - Object.assign(result, { - type: SyntaxKind[node.kind], - label: convertChild(node.label) - }); - break; - - // Choice - - case SyntaxKind.IfStatement: - Object.assign(result, { - type: AST_NODE_TYPES.IfStatement, - test: convertChild(node.expression), - consequent: convertChild(node.thenStatement), - alternate: convertChild(node.elseStatement) - }); - break; - - case SyntaxKind.SwitchStatement: - Object.assign(result, { - type: AST_NODE_TYPES.SwitchStatement, - discriminant: convertChild(node.expression), - cases: node.caseBlock.clauses.map(convertChild) - }); - break; - - case SyntaxKind.CaseClause: - case SyntaxKind.DefaultClause: - Object.assign(result, { - type: AST_NODE_TYPES.SwitchCase, - test: convertChild(node.expression), - consequent: node.statements.map(convertChild) - }); - break; - - // Exceptions - - case SyntaxKind.ThrowStatement: - Object.assign(result, { - type: AST_NODE_TYPES.ThrowStatement, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.TryStatement: - Object.assign(result, { - type: AST_NODE_TYPES.TryStatement, - block: convert({ node: node.tryBlock, parent: null, ast, additionalOptions }), - handler: convertChild(node.catchClause), - finalizer: convertChild(node.finallyBlock) - }); - break; - - case SyntaxKind.CatchClause: - Object.assign(result, { - type: AST_NODE_TYPES.CatchClause, - param: node.variableDeclaration ? convertChild(node.variableDeclaration.name) : null, - body: convertChild(node.block) - }); - break; - - // Loops - - case SyntaxKind.WhileStatement: - Object.assign(result, { - type: AST_NODE_TYPES.WhileStatement, - test: convertChild(node.expression), - body: convertChild(node.statement) - }); - break; - - /** - * Unlike other parsers, TypeScript calls a "DoWhileStatement" - * a "DoStatement" - */ - case SyntaxKind.DoStatement: - Object.assign(result, { - type: AST_NODE_TYPES.DoWhileStatement, - test: convertChild(node.expression), - body: convertChild(node.statement) - }); - break; - - case SyntaxKind.ForStatement: - Object.assign(result, { - type: AST_NODE_TYPES.ForStatement, - init: convertChild(node.initializer), - test: convertChild(node.condition), - update: convertChild(node.incrementor), - body: convertChild(node.statement) - }); - break; - - case SyntaxKind.ForInStatement: - case SyntaxKind.ForOfStatement: { - const isAwait = !!(node.awaitModifier && node.awaitModifier.kind === SyntaxKind.AwaitKeyword); - Object.assign(result, { - type: SyntaxKind[node.kind], - left: convertChild(node.initializer), - right: convertChild(node.expression), - body: convertChild(node.statement), - await: isAwait - }); - break; - } - - // Declarations - - case SyntaxKind.FunctionDeclaration: { - - let functionDeclarationType = AST_NODE_TYPES.FunctionDeclaration; - - if (node.modifiers && node.modifiers.length) { - const isDeclareFunction = nodeUtils.hasModifier(SyntaxKind.DeclareKeyword, node); - if (isDeclareFunction) { - functionDeclarationType = AST_NODE_TYPES.DeclareFunction; - } - } - - Object.assign(result, { - type: functionDeclarationType, - id: convertChild(node.name), - generator: !!node.asteriskToken, - expression: false, - async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), - params: convertParameters(node.parameters), - body: convertChild(node.body) - }); - - // Process returnType - if (node.type) { - result.returnType = convertTypeAnnotation(node.type); - } - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - namespaceEmptyBodyFunctionForESLint(result); - - // check for exports - result = nodeUtils.fixExports(node, result, ast); - - break; - - } - - case SyntaxKind.VariableDeclaration: { - Object.assign(result, { - type: AST_NODE_TYPES.VariableDeclarator, - id: convertChild(node.name), - init: convertChild(node.initializer) - }); - - if (node.exclamationToken) { - result.definite = true; - } - - if (node.type) { - result.id.typeAnnotation = convertTypeAnnotation(node.type); - fixTypeAnnotationParentLocation(result.id); - } - break; - } - - case SyntaxKind.VariableStatement: - Object.assign(result, { - type: AST_NODE_TYPES.VariableDeclaration, - declarations: node.declarationList.declarations.map(convertChild), - kind: nodeUtils.getDeclarationKind(node.declarationList) - }); - - // check for exports - result = nodeUtils.fixExports(node, result, ast); - break; - - // mostly for for-of, for-in - case SyntaxKind.VariableDeclarationList: - Object.assign(result, { - type: AST_NODE_TYPES.VariableDeclaration, - declarations: node.declarations.map(convertChild), - kind: nodeUtils.getDeclarationKind(node) - }); - break; - - // Expressions - - case SyntaxKind.ExpressionStatement: - Object.assign(result, { - type: AST_NODE_TYPES.ExpressionStatement, - expression: convertChild(node.expression) - }); - break; - - case SyntaxKind.ThisKeyword: - Object.assign(result, { - type: AST_NODE_TYPES.ThisExpression - }); - break; - - case SyntaxKind.ArrayLiteralExpression: { - - const arrayAssignNode = nodeUtils.findAncestorOfKind(node, SyntaxKind.BinaryExpression); - const arrayIsInForOf = node.parent && node.parent.kind === SyntaxKind.ForOfStatement; - const arrayIsInForIn = node.parent && node.parent.kind === SyntaxKind.ForInStatement; - let arrayIsInAssignment; - - if (arrayAssignNode) { - if (arrayAssignNode.left === node) { - arrayIsInAssignment = true; - } else { - arrayIsInAssignment = (nodeUtils.findChildOfKind(arrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === node); - } - } - - // TypeScript uses ArrayLiteralExpression in destructuring assignment, too - if (arrayIsInAssignment || arrayIsInForOf || arrayIsInForIn) { - Object.assign(result, { - type: AST_NODE_TYPES.ArrayPattern, - elements: node.elements.map(convertChild) - }); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.ArrayExpression, - elements: node.elements.map(convertChild) - }); - } - break; - - } - - case SyntaxKind.ObjectLiteralExpression: { - - const ancestorNode = nodeUtils.findFirstMatchingAncestor( - node, - parentNode => - (parentNode.kind === SyntaxKind.BinaryExpression || parentNode.kind === SyntaxKind.ArrowFunction) - ); - const objectAssignNode = ( - ancestorNode && - ancestorNode.kind === SyntaxKind.BinaryExpression && - ancestorNode.operatorToken.kind === SyntaxKind.FirstAssignment - ) ? ancestorNode : null; - - let objectIsInAssignment = false; - - if (objectAssignNode) { - if (objectAssignNode.left === node) { - objectIsInAssignment = true; - } else { - objectIsInAssignment = (nodeUtils.findChildOfKind(objectAssignNode.left, SyntaxKind.ObjectLiteralExpression, ast) === node); - } - } - - // TypeScript uses ObjectLiteralExpression in destructuring assignment, too - if (objectIsInAssignment) { - Object.assign(result, { - type: AST_NODE_TYPES.ObjectPattern, - properties: node.properties.map(convertChild) - }); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.ObjectExpression, - properties: node.properties.map(convertChild) - }); - } - - break; - - } - - case SyntaxKind.PropertyAssignment: - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.name), - value: convertChild(node.initializer), - computed: nodeUtils.isComputedProperty(node.name), - method: false, - shorthand: false, - kind: "init" - }); - break; - - case SyntaxKind.ShorthandPropertyAssignment: { - if (node.objectAssignmentInitializer) { - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.name), - value: { - type: AST_NODE_TYPES.AssignmentPattern, - left: convertChild(node.name), - right: convertChild(node.objectAssignmentInitializer), - loc: result.loc, - range: result.range - }, - computed: false, - method: false, - shorthand: true, - kind: "init" - }); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.name), - value: convertChild(node.initializer || node.name), - computed: false, - method: false, - shorthand: true, - kind: "init" - }); - } - break; - } - - case SyntaxKind.ComputedPropertyName: - - if (parent.kind === SyntaxKind.ObjectLiteralExpression) { - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.name), - value: convertChild(node.name), - computed: false, - method: false, - shorthand: true, - kind: "init" - }); - } else { - return convertChild(node.expression); - } - break; - - case SyntaxKind.PropertyDeclaration: { - const isAbstract = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node); - Object.assign(result, { - type: (isAbstract) ? AST_NODE_TYPES.TSAbstractClassProperty : AST_NODE_TYPES.ClassProperty, - key: convertChild(node.name), - value: convertChild(node.initializer), - computed: nodeUtils.isComputedProperty(node.name), - static: nodeUtils.hasStaticModifierFlag(node), - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined - }); - - if (node.type) { - result.typeAnnotation = convertTypeAnnotation(node.type); - } - - if (node.decorators) { - result.decorators = convertDecorators(node.decorators); - } - - const accessibility = nodeUtils.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - if (node.name.kind === SyntaxKind.Identifier && node.questionToken) { - result.optional = true; - } - - if (node.exclamationToken) { - result.definite = true; - } - - if (result.key.type === AST_NODE_TYPES.Literal && node.questionToken) { - result.optional = true; - } - break; - } - - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.MethodDeclaration: { - - const openingParen = nodeUtils.findFirstMatchingToken(node.name, ast, token => { - if (!token || !token.kind) { - return false; - } - return nodeUtils.getTextForTokenKind(token.kind) === "("; - }); - - const methodLoc = ast.getLineAndCharacterOfPosition(openingParen.getStart()), - nodeIsMethod = (node.kind === SyntaxKind.MethodDeclaration), - method = { - type: AST_NODE_TYPES.FunctionExpression, - id: null, - generator: !!node.asteriskToken, - expression: false, - async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), - body: convertChild(node.body), - range: [node.parameters.pos - 1, result.range[1]], - loc: { - start: { - line: methodLoc.line + 1, - column: methodLoc.character - }, - end: result.loc.end - } - }; - - if (node.type) { - method.returnType = convertTypeAnnotation(node.type); - } - - if (parent.kind === SyntaxKind.ObjectLiteralExpression) { - - method.params = node.parameters.map(convertChild); - - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.name), - value: method, - computed: nodeUtils.isComputedProperty(node.name), - method: nodeIsMethod, - shorthand: false, - kind: "init" - }); - - } else { // class - - /** - * Unlike in object literal methods, class method params can have decorators - */ - method.params = convertParameters(node.parameters); - - /** - * TypeScript class methods can be defined as "abstract" - */ - const methodDefinitionType = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node) - ? AST_NODE_TYPES.TSAbstractMethodDefinition - : AST_NODE_TYPES.MethodDefinition; - - Object.assign(result, { - type: methodDefinitionType, - key: convertChild(node.name), - value: method, - computed: nodeUtils.isComputedProperty(node.name), - static: nodeUtils.hasStaticModifierFlag(node), - kind: "method" - }); - - if (node.decorators) { - result.decorators = convertDecorators(node.decorators); - } - - const accessibility = nodeUtils.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - } - - if (result.key.type === AST_NODE_TYPES.Identifier && node.questionToken) { - result.key.optional = true; - } - - if (node.kind === SyntaxKind.GetAccessor) { - result.kind = "get"; - } else if (node.kind === SyntaxKind.SetAccessor) { - result.kind = "set"; - } else if (!result.static && node.name.kind === SyntaxKind.StringLiteral && node.name.text === "constructor") { - result.kind = "constructor"; - } - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - method.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - namespaceEmptyBodyFunctionForESLint(result.value); - - break; - - } - - // TypeScript uses this even for static methods named "constructor" - case SyntaxKind.Constructor: { - - const constructorIsStatic = nodeUtils.hasStaticModifierFlag(node), - constructorIsAbstract = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node), - firstConstructorToken = constructorIsStatic ? nodeUtils.findNextToken(node.getFirstToken(), ast) : node.getFirstToken(), - constructorLoc = ast.getLineAndCharacterOfPosition(node.parameters.pos - 1), - constructor = { - type: AST_NODE_TYPES.FunctionExpression, - id: null, - params: convertParameters(node.parameters), - generator: false, - expression: false, - async: false, - body: convertChild(node.body), - range: [node.parameters.pos - 1, result.range[1]], - loc: { - start: { - line: constructorLoc.line + 1, - column: constructorLoc.character - }, - end: result.loc.end - } - }; - - const constructorIdentifierLocStart = ast.getLineAndCharacterOfPosition(firstConstructorToken.getStart()), - constructorIdentifierLocEnd = ast.getLineAndCharacterOfPosition(firstConstructorToken.getEnd()), - constructorIsComputed = !!node.name && nodeUtils.isComputedProperty(node.name); - - let constructorKey; - - if (constructorIsComputed) { - constructorKey = { - type: AST_NODE_TYPES.Literal, - value: "constructor", - raw: node.name.getText(), - range: [firstConstructorToken.getStart(), firstConstructorToken.end], - loc: { - start: { - line: constructorIdentifierLocStart.line + 1, - column: constructorIdentifierLocStart.character - }, - end: { - line: constructorIdentifierLocEnd.line + 1, - column: constructorIdentifierLocEnd.character - } - } - }; - } else { - constructorKey = { - type: AST_NODE_TYPES.Identifier, - name: "constructor", - range: [firstConstructorToken.getStart(), firstConstructorToken.end], - loc: { - start: { - line: constructorIdentifierLocStart.line + 1, - column: constructorIdentifierLocStart.character - }, - end: { - line: constructorIdentifierLocEnd.line + 1, - column: constructorIdentifierLocEnd.character - } - } - }; - } - - Object.assign(result, { - type: constructorIsAbstract ? AST_NODE_TYPES.TSAbstractMethodDefinition : AST_NODE_TYPES.MethodDefinition, - key: constructorKey, - value: constructor, - computed: constructorIsComputed, - static: constructorIsStatic, - kind: (constructorIsStatic || constructorIsComputed) ? "method" : "constructor" - }); - - const accessibility = nodeUtils.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - namespaceEmptyBodyFunctionForESLint(result.value); - - break; - - } - - case SyntaxKind.FunctionExpression: - Object.assign(result, { - type: AST_NODE_TYPES.FunctionExpression, - id: convertChild(node.name), - generator: !!node.asteriskToken, - params: convertParameters(node.parameters), - body: convertChild(node.body), - async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), - expression: false - }); - - // Process returnType - if (node.type) { - result.returnType = convertTypeAnnotation(node.type); - } - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - break; - - case SyntaxKind.SuperKeyword: - Object.assign(result, { - type: AST_NODE_TYPES.Super - }); - break; - - case SyntaxKind.ArrayBindingPattern: - Object.assign(result, { - type: AST_NODE_TYPES.ArrayPattern, - elements: node.elements.map(convertChild) - }); - break; - - // occurs with missing array elements like [,] - case SyntaxKind.OmittedExpression: - return null; - - case SyntaxKind.ObjectBindingPattern: - Object.assign(result, { - type: AST_NODE_TYPES.ObjectPattern, - properties: node.elements.map(convertChild) - }); - break; - - case SyntaxKind.BindingElement: - - if (parent.kind === SyntaxKind.ArrayBindingPattern) { - const arrayItem = convert({ node: node.name, parent, ast, additionalOptions }); - - if (node.initializer) { - Object.assign(result, { - type: AST_NODE_TYPES.AssignmentPattern, - left: arrayItem, - right: convertChild(node.initializer) - }); - } else if (node.dotDotDotToken) { - Object.assign(result, { - type: AST_NODE_TYPES.RestElement, - argument: arrayItem - }); - } else { - return arrayItem; - } - } else if (parent.kind === SyntaxKind.ObjectBindingPattern) { - - if (node.dotDotDotToken) { - Object.assign(result, { - type: AST_NODE_TYPES.RestElement, - argument: convertChild(node.propertyName || node.name) - }); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.Property, - key: convertChild(node.propertyName || node.name), - value: convertChild(node.name), - computed: Boolean(node.propertyName && node.propertyName.kind === SyntaxKind.ComputedPropertyName), - method: false, - shorthand: !node.propertyName, - kind: "init" - }); - } - - if (node.initializer) { - result.value = { - type: AST_NODE_TYPES.AssignmentPattern, - left: convertChild(node.name), - right: convertChild(node.initializer), - range: [node.name.getStart(), node.initializer.end], - loc: nodeUtils.getLocFor(node.name.getStart(), node.initializer.end, ast) - }; - } - } - break; - - - case SyntaxKind.ArrowFunction: - Object.assign(result, { - type: AST_NODE_TYPES.ArrowFunctionExpression, - generator: false, - id: null, - params: convertParameters(node.parameters), - body: convertChild(node.body), - async: nodeUtils.hasModifier(SyntaxKind.AsyncKeyword, node), - expression: node.body.kind !== SyntaxKind.Block - }); - - // Process returnType - if (node.type) { - result.returnType = convertTypeAnnotation(node.type); - } - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - break; - - case SyntaxKind.YieldExpression: - Object.assign(result, { - type: AST_NODE_TYPES.YieldExpression, - delegate: !!node.asteriskToken, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.AwaitExpression: - Object.assign(result, { - type: AST_NODE_TYPES.AwaitExpression, - argument: convertChild(node.expression) - }); - break; - - // Template Literals - - case SyntaxKind.NoSubstitutionTemplateLiteral: - Object.assign(result, { - type: AST_NODE_TYPES.TemplateLiteral, - quasis: [ - { - type: AST_NODE_TYPES.TemplateElement, - value: { - raw: ast.text.slice(node.getStart() + 1, node.end - 1), - cooked: node.text - }, - tail: true, - range: result.range, - loc: result.loc - } - ], - expressions: [] - }); - break; - - case SyntaxKind.TemplateExpression: - Object.assign(result, { - type: AST_NODE_TYPES.TemplateLiteral, - quasis: [convertChild(node.head)], - expressions: [] - }); - - node.templateSpans.forEach(templateSpan => { - result.expressions.push(convertChild(templateSpan.expression)); - result.quasis.push(convertChild(templateSpan.literal)); - }); - break; - - case SyntaxKind.TaggedTemplateExpression: - Object.assign(result, { - type: AST_NODE_TYPES.TaggedTemplateExpression, - typeParameters: (node.typeArguments) - ? convertTypeArgumentsToTypeParameters(node.typeArguments) - : undefined, - tag: convertChild(node.tag), - quasi: convertChild(node.template) - }); - break; - - case SyntaxKind.TemplateHead: - case SyntaxKind.TemplateMiddle: - case SyntaxKind.TemplateTail: { - const tail = (node.kind === SyntaxKind.TemplateTail); - Object.assign(result, { - type: AST_NODE_TYPES.TemplateElement, - value: { - raw: ast.text.slice(node.getStart() + 1, node.end - (tail ? 1 : 2)), - cooked: node.text - }, - tail - }); - break; - } - - // Patterns - - case SyntaxKind.SpreadElement: { - let type = AST_NODE_TYPES.SpreadElement; - - if (node.parent && - node.parent.parent && - node.parent.parent.kind === SyntaxKind.BinaryExpression - ) { - if (node.parent.parent.left === node.parent) { - type = AST_NODE_TYPES.RestElement; - } else if (node.parent.parent.right === node.parent) { - type = AST_NODE_TYPES.SpreadElement; - } - } - - Object.assign(result, { - type, - argument: convertChild(node.expression) - }); - break; - } - case SyntaxKind.SpreadAssignment: { - let type = AST_NODE_TYPES.SpreadElement; - - if (node.parent && - node.parent.parent && - node.parent.parent.kind === SyntaxKind.BinaryExpression - ) { - if (node.parent.parent.right === node.parent) { - type = AST_NODE_TYPES.SpreadElement; - } else if (node.parent.parent.left === node.parent) { - type = AST_NODE_TYPES.RestElement; - } - } - - Object.assign(result, { - type, - argument: convertChild(node.expression) - }); - break; - } - - case SyntaxKind.Parameter: { - let parameter; - - if (node.dotDotDotToken) { - parameter = convertChild(node.name); - Object.assign(result, { - type: AST_NODE_TYPES.RestElement, - argument: parameter - }); - } else if (node.initializer) { - parameter = convertChild(node.name); - Object.assign(result, { - type: AST_NODE_TYPES.AssignmentPattern, - left: parameter, - right: convertChild(node.initializer) - }); - } else { - parameter = convert({ node: node.name, parent, ast, additionalOptions }); - result = parameter; - } - - if (node.type) { - parameter.typeAnnotation = convertTypeAnnotation(node.type); - fixTypeAnnotationParentLocation(parameter); - } - - if (node.questionToken) { - parameter.optional = true; - } - - if (node.modifiers) { - return { - type: AST_NODE_TYPES.TSParameterProperty, - range: [node.getStart(), node.end], - loc: nodeUtils.getLoc(node, ast), - accessibility: nodeUtils.getTSNodeAccessibility(node) || undefined, - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined, - parameter: result - }; - } - - break; - - } - - // Classes - - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: { - - const heritageClauses = node.heritageClauses || []; - - let classNodeType = SyntaxKind[node.kind]; - let lastClassToken = heritageClauses.length ? heritageClauses[heritageClauses.length - 1] : node.name; - - if (node.typeParameters && node.typeParameters.length) { - const lastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; - - if (!lastClassToken || lastTypeParameter.pos > lastClassToken.pos) { - lastClassToken = nodeUtils.findNextToken(lastTypeParameter, ast); - } - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - if (node.modifiers && node.modifiers.length) { - - /** - * TypeScript class declarations can be defined as "abstract" - */ - if (node.kind === SyntaxKind.ClassDeclaration) { - if (nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node)) { - classNodeType = `TSAbstract${classNodeType}`; - } - } - - /** - * We need check for modifiers, and use the last one, as there - * could be multiple before the open brace - */ - const lastModifier = node.modifiers[node.modifiers.length - 1]; - - if (!lastClassToken || lastModifier.pos > lastClassToken.pos) { - lastClassToken = nodeUtils.findNextToken(lastModifier, ast); - } - - } else if (!lastClassToken) { // no name - lastClassToken = node.getFirstToken(); - } - - const openBrace = nodeUtils.findNextToken(lastClassToken, ast); - const superClass = heritageClauses.find(clause => clause.token === SyntaxKind.ExtendsKeyword); - - if (superClass) { - if (superClass.types.length > 1) { - throw nodeUtils.createError(ast, superClass.types[1].pos, "Classes can only extend a single class."); - } - - if (superClass.types[0] && superClass.types[0].typeArguments) { - result.superTypeParameters = convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments); - } - } - - const implementsClause = heritageClauses.find(clause => clause.token === SyntaxKind.ImplementsKeyword); - - Object.assign(result, { - type: classNodeType, - id: convertChild(node.name), - body: { - type: AST_NODE_TYPES.ClassBody, - body: [], - - // TODO: Fix location info - range: [openBrace.getStart(), result.range[1]], - loc: nodeUtils.getLocFor(openBrace.getStart(), node.end, ast) - }, - superClass: (superClass && superClass.types[0] ? convertChild(superClass.types[0].expression) : null) - }); - - if (implementsClause) { - result.implements = implementsClause.types.map(convertClassImplements); - } - - if (node.decorators) { - result.decorators = convertDecorators(node.decorators); - } - - const filteredMembers = node.members.filter(nodeUtils.isESTreeClassMember); - - if (filteredMembers.length) { - result.body.body = filteredMembers.map(convertChild); - } - - // check for exports - result = nodeUtils.fixExports(node, result, ast); - - break; - - } - - // Modules - case SyntaxKind.ModuleBlock: - Object.assign(result, { - type: AST_NODE_TYPES.TSModuleBlock, - body: node.statements.map(convertChild) - }); - break; - - case SyntaxKind.ImportDeclaration: - Object.assign(result, { - type: AST_NODE_TYPES.ImportDeclaration, - source: convertChild(node.moduleSpecifier), - specifiers: [] - }); - - if (node.importClause) { - if (node.importClause.name) { - result.specifiers.push(convertChild(node.importClause)); - } - - if (node.importClause.namedBindings) { - if (node.importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { - result.specifiers.push(convertChild(node.importClause.namedBindings)); - } else { - result.specifiers = result.specifiers.concat(node.importClause.namedBindings.elements.map(convertChild)); - } - } - } - - break; - - case SyntaxKind.NamespaceImport: - Object.assign(result, { - type: AST_NODE_TYPES.ImportNamespaceSpecifier, - local: convertChild(node.name) - }); - break; - - case SyntaxKind.ImportSpecifier: - Object.assign(result, { - type: AST_NODE_TYPES.ImportSpecifier, - local: convertChild(node.name), - imported: convertChild(node.propertyName || node.name) - }); - break; - - case SyntaxKind.ImportClause: - Object.assign(result, { - type: AST_NODE_TYPES.ImportDefaultSpecifier, - local: convertChild(node.name) - }); - - // have to adjust location information due to tree differences - result.range[1] = node.name.end; - result.loc = nodeUtils.getLocFor(result.range[0], result.range[1], ast); - break; - - case SyntaxKind.NamedImports: - Object.assign(result, { - type: AST_NODE_TYPES.ImportDefaultSpecifier, - local: convertChild(node.name) - }); - break; - - case SyntaxKind.ExportDeclaration: - if (node.exportClause) { - Object.assign(result, { - type: AST_NODE_TYPES.ExportNamedDeclaration, - source: convertChild(node.moduleSpecifier), - specifiers: node.exportClause.elements.map(convertChild), - declaration: null - }); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.ExportAllDeclaration, - source: convertChild(node.moduleSpecifier) - }); - } - break; - - case SyntaxKind.ExportSpecifier: - Object.assign(result, { - type: AST_NODE_TYPES.ExportSpecifier, - local: convertChild(node.propertyName || node.name), - exported: convertChild(node.name) - }); - break; - - case SyntaxKind.ExportAssignment: - if (node.isExportEquals) { - Object.assign(result, { - type: AST_NODE_TYPES.TSExportAssignment, - expression: convertChild(node.expression) - }); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.ExportDefaultDeclaration, - declaration: convertChild(node.expression) - }); - } - break; - - // Unary Operations - - case SyntaxKind.PrefixUnaryExpression: - case SyntaxKind.PostfixUnaryExpression: { - const operator = nodeUtils.getTextForTokenKind(node.operator); - Object.assign(result, { - /** - * ESTree uses UpdateExpression for ++/-- - */ - type: /^(?:\+\+|--)$/.test(operator) ? AST_NODE_TYPES.UpdateExpression : AST_NODE_TYPES.UnaryExpression, - operator, - prefix: node.kind === SyntaxKind.PrefixUnaryExpression, - argument: convertChild(node.operand) - }); - break; - } - - case SyntaxKind.DeleteExpression: - Object.assign(result, { - type: AST_NODE_TYPES.UnaryExpression, - operator: "delete", - prefix: true, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.VoidExpression: - Object.assign(result, { - type: AST_NODE_TYPES.UnaryExpression, - operator: "void", - prefix: true, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.TypeOfExpression: - Object.assign(result, { - type: AST_NODE_TYPES.UnaryExpression, - operator: "typeof", - prefix: true, - argument: convertChild(node.expression) - }); - break; - - case SyntaxKind.TypeOperator: - Object.assign(result, { - type: AST_NODE_TYPES.TSTypeOperator, - operator: nodeUtils.getTextForTokenKind(node.operator), - typeAnnotation: convertChild(node.type) - }); - break; - - // Binary Operations - - case SyntaxKind.BinaryExpression: - - // TypeScript uses BinaryExpression for sequences as well - if (nodeUtils.isComma(node.operatorToken)) { - Object.assign(result, { - type: AST_NODE_TYPES.SequenceExpression, - expressions: [] - }); - - const left = convertChild(node.left), - right = convertChild(node.right); - - if (left.type === AST_NODE_TYPES.SequenceExpression) { - result.expressions = result.expressions.concat(left.expressions); - } else { - result.expressions.push(left); - } - - if (right.type === AST_NODE_TYPES.SequenceExpression) { - result.expressions = result.expressions.concat(right.expressions); - } else { - result.expressions.push(right); - } - - } else if (node.operatorToken && node.operatorToken.kind === SyntaxKind.AsteriskAsteriskEqualsToken) { - Object.assign(result, { - type: AST_NODE_TYPES.AssignmentExpression, - operator: nodeUtils.getTextForTokenKind(node.operatorToken.kind), - left: convertChild(node.left), - right: convertChild(node.right) - }); - } else { - Object.assign(result, { - type: nodeUtils.getBinaryExpressionType(node.operatorToken), - operator: nodeUtils.getTextForTokenKind(node.operatorToken.kind), - left: convertChild(node.left), - right: convertChild(node.right) - }); - - // if the binary expression is in a destructured array, switch it - if (result.type === AST_NODE_TYPES.AssignmentExpression) { - const upperArrayNode = nodeUtils.findAncestorOfKind(node, SyntaxKind.ArrayLiteralExpression), - upperArrayAssignNode = upperArrayNode && nodeUtils.findAncestorOfKind(upperArrayNode, SyntaxKind.BinaryExpression); - - let upperArrayIsInAssignment; - - if (upperArrayAssignNode) { - if (upperArrayAssignNode.left === upperArrayNode) { - upperArrayIsInAssignment = true; - } else { - upperArrayIsInAssignment = (nodeUtils.findChildOfKind(upperArrayAssignNode.left, SyntaxKind.ArrayLiteralExpression, ast) === upperArrayNode); - } - } - - if (upperArrayIsInAssignment) { - delete result.operator; - result.type = AST_NODE_TYPES.AssignmentPattern; - } - } - } - break; - - case SyntaxKind.PropertyAccessExpression: - if (nodeUtils.isJSXToken(parent)) { - const jsxMemberExpression = { - type: AST_NODE_TYPES.MemberExpression, - object: convertChild(node.expression), - property: convertChild(node.name) - }; - const isNestedMemberExpression = (node.expression.kind === SyntaxKind.PropertyAccessExpression); - if (node.expression.kind === SyntaxKind.ThisKeyword) { - jsxMemberExpression.object.name = "this"; - } - - jsxMemberExpression.object.type = (isNestedMemberExpression) ? AST_NODE_TYPES.MemberExpression : AST_NODE_TYPES.JSXIdentifier; - jsxMemberExpression.property.type = AST_NODE_TYPES.JSXIdentifier; - Object.assign(result, jsxMemberExpression); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.MemberExpression, - object: convertChild(node.expression), - property: convertChild(node.name), - computed: false - }); - } - break; - - case SyntaxKind.ElementAccessExpression: - Object.assign(result, { - type: AST_NODE_TYPES.MemberExpression, - object: convertChild(node.expression), - property: convertChild(node.argumentExpression), - computed: true - }); - break; - - case SyntaxKind.ConditionalExpression: - Object.assign(result, { - type: AST_NODE_TYPES.ConditionalExpression, - test: convertChild(node.condition), - consequent: convertChild(node.whenTrue), - alternate: convertChild(node.whenFalse) - }); - break; - - case SyntaxKind.CallExpression: - Object.assign(result, { - type: AST_NODE_TYPES.CallExpression, - callee: convertChild(node.expression), - arguments: node.arguments.map(convertChild) - }); - if (node.typeArguments && node.typeArguments.length) { - result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); - } - break; - - case SyntaxKind.NewExpression: - Object.assign(result, { - type: AST_NODE_TYPES.NewExpression, - callee: convertChild(node.expression), - arguments: (node.arguments) ? node.arguments.map(convertChild) : [] - }); - if (node.typeArguments && node.typeArguments.length) { - result.typeParameters = convertTypeArgumentsToTypeParameters(node.typeArguments); - } - break; - - case SyntaxKind.MetaProperty: { - const newToken = nodeUtils.convertToken(node.getFirstToken(), ast); - Object.assign(result, { - type: AST_NODE_TYPES.MetaProperty, - meta: { - type: AST_NODE_TYPES.Identifier, - range: newToken.range, - loc: newToken.loc, - name: nodeUtils.getTextForTokenKind(node.keywordToken) - }, - property: convertChild(node.name) - }); - break; - } - - // Literals - - case SyntaxKind.StringLiteral: - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - raw: ast.text.slice(result.range[0], result.range[1]) - }); - if (parent.name && parent.name === node) { - result.value = node.text; - } else { - result.value = nodeUtils.unescapeStringLiteralText(node.text); - } - break; - - case SyntaxKind.NumericLiteral: - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - value: Number(node.text), - raw: ast.text.slice(result.range[0], result.range[1]) - }); - break; - - case SyntaxKind.RegularExpressionLiteral: { - const pattern = node.text.slice(1, node.text.lastIndexOf("/")); - const flags = node.text.slice(node.text.lastIndexOf("/") + 1); - - let regex = null; - try { - regex = new RegExp(pattern, flags); - } catch (exception) { - regex = null; - } - - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - value: regex, - raw: node.text, - regex: { - pattern, - flags - } - }); - break; - } - - case SyntaxKind.TrueKeyword: - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - value: true, - raw: "true" - }); - break; - - case SyntaxKind.FalseKeyword: - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - value: false, - raw: "false" - }); - break; - - case SyntaxKind.NullKeyword: { - if (nodeUtils.isWithinTypeAnnotation(node)) { - Object.assign(result, { - type: AST_NODE_TYPES.TSNullKeyword - }); - } else { - Object.assign(result, { - type: AST_NODE_TYPES.Literal, - value: null, - raw: "null" - }); - } - break; - } - - case SyntaxKind.ImportKeyword: - Object.assign(result, { - type: AST_NODE_TYPES.Import - }); - break; - - case SyntaxKind.EmptyStatement: - case SyntaxKind.DebuggerStatement: - simplyCopy(); - break; - - // JSX - - case SyntaxKind.JsxElement: - Object.assign(result, { - type: AST_NODE_TYPES.JSXElement, - openingElement: convertChild(node.openingElement), - closingElement: convertChild(node.closingElement), - children: node.children.map(convertChild) - }); - - break; - - case SyntaxKind.JsxSelfClosingElement: { - /** - * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, - * TypeScript does not seem to have the idea of openingElement when tag is self-closing - */ - node.kind = SyntaxKind.JsxOpeningElement; - - const openingElement = convertChild(node); - openingElement.selfClosing = true; - - Object.assign(result, { - type: AST_NODE_TYPES.JSXElement, - openingElement, - closingElement: null, - children: [] - }); - - break; - - } - - case SyntaxKind.JsxOpeningElement: - Object.assign(result, { - type: AST_NODE_TYPES.JSXOpeningElement, - typeParameters: (node.typeArguments) - ? convertTypeArgumentsToTypeParameters(node.typeArguments) - : undefined, - selfClosing: false, - name: convertTypeScriptJSXTagNameToESTreeName(node.tagName), - attributes: node.attributes.properties.map(convertChild) - }); - break; - - case SyntaxKind.JsxClosingElement: - Object.assign(result, { - type: AST_NODE_TYPES.JSXClosingElement, - name: convertTypeScriptJSXTagNameToESTreeName(node.tagName) - }); - break; - - case SyntaxKind.JsxExpression: { - const eloc = ast.getLineAndCharacterOfPosition(result.range[0] + 1); - const expression = (node.expression) ? convertChild(node.expression) : { - type: AST_NODE_TYPES.JSXEmptyExpression, - loc: { - start: { - line: eloc.line + 1, - column: eloc.character - }, - end: { - line: result.loc.end.line, - column: result.loc.end.column - 1 - } - }, - range: [result.range[0] + 1, result.range[1] - 1] - }; - - Object.assign(result, { - type: node.dotDotDotToken - ? AST_NODE_TYPES.JSXSpreadChild - : AST_NODE_TYPES.JSXExpressionContainer, - expression - }); - - break; - - } - - case SyntaxKind.JsxAttribute: { - const attributeName = nodeUtils.convertToken(node.name, ast); - attributeName.type = AST_NODE_TYPES.JSXIdentifier; - attributeName.name = attributeName.value; - delete attributeName.value; - - Object.assign(result, { - type: AST_NODE_TYPES.JSXAttribute, - name: attributeName, - value: convertChild(node.initializer) - }); - - break; - - } - - /** - * The JSX AST changed the node type for string literals - * inside a JSX Element from `Literal` to `JSXText`. We - * provide a flag to support both types until `Literal` - * node type is deprecated in ESLint v5. - */ - case SyntaxKind.JsxText: { - const start = node.getFullStart(); - const end = node.getEnd(); - - const type = (additionalOptions.useJSXTextNode) - ? AST_NODE_TYPES.JSXText : AST_NODE_TYPES.Literal; - - Object.assign(result, { - type, - value: ast.text.slice(start, end), - raw: ast.text.slice(start, end) - }); - - result.loc = nodeUtils.getLocFor(start, end, ast); - result.range = [start, end]; - - break; - } - - case SyntaxKind.JsxSpreadAttribute: - Object.assign(result, { - type: AST_NODE_TYPES.JSXSpreadAttribute, - argument: convertChild(node.expression) - }); - - break; - - case SyntaxKind.FirstNode: { - Object.assign(result, { - type: AST_NODE_TYPES.TSQualifiedName, - left: convertChild(node.left), - right: convertChild(node.right) - }); - - break; - } - - // TypeScript specific - - case SyntaxKind.ParenthesizedExpression: - return convert({ node: node.expression, parent, ast, additionalOptions }); - - /** - * Convert TypeAliasDeclaration node into VariableDeclaration - * to allow core rules such as "semi" to work automatically - */ - case SyntaxKind.TypeAliasDeclaration: { - const typeAliasDeclarator = { - type: AST_NODE_TYPES.VariableDeclarator, - id: convertChild(node.name), - init: convertChild(node.type), - range: [node.name.getStart(), node.end] - }; - - typeAliasDeclarator.loc = nodeUtils.getLocFor(typeAliasDeclarator.range[0], typeAliasDeclarator.range[1], ast); - - // Process typeParameters - if (node.typeParameters && node.typeParameters.length) { - typeAliasDeclarator.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - Object.assign(result, { - type: AST_NODE_TYPES.VariableDeclaration, - kind: nodeUtils.getDeclarationKind(node), - declarations: [typeAliasDeclarator] - }); - - // check for exports - result = nodeUtils.fixExports(node, result, ast); - - break; - - } - - case SyntaxKind.MethodSignature: { - Object.assign(result, { - type: AST_NODE_TYPES.TSMethodSignature, - optional: nodeUtils.isOptional(node), - computed: nodeUtils.isComputedProperty(node.name), - key: convertChild(node.name), - params: convertParameters(node.parameters), - typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined - }); - - const accessibility = nodeUtils.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - if (node.typeParameters) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - break; - } - - case SyntaxKind.PropertySignature: { - Object.assign(result, { - type: AST_NODE_TYPES.TSPropertySignature, - optional: nodeUtils.isOptional(node) || undefined, - computed: nodeUtils.isComputedProperty(node.name), - key: convertChild(node.name), - typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : undefined, - initializer: convertChild(node.initializer) || undefined, - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined - }); - - const accessibility = nodeUtils.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - break; - } - - case SyntaxKind.IndexSignature: { - Object.assign(result, { - type: AST_NODE_TYPES.TSIndexSignature, - index: convertChild(node.parameters[0]), - typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null, - readonly: nodeUtils.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: nodeUtils.hasModifier(SyntaxKind.StaticKeyword, node), - export: nodeUtils.hasModifier(SyntaxKind.ExportKeyword, node) || undefined - }); - - const accessibility = nodeUtils.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - break; - } - - case SyntaxKind.ConstructSignature: { - Object.assign(result, { - type: AST_NODE_TYPES.TSConstructSignature, - params: convertParameters(node.parameters), - typeAnnotation: (node.type) ? convertTypeAnnotation(node.type) : null - }); - - if (node.typeParameters) { - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - break; - } - - case SyntaxKind.InterfaceDeclaration: { - const interfaceHeritageClauses = node.heritageClauses || []; - - let interfaceLastClassToken = interfaceHeritageClauses.length ? interfaceHeritageClauses[interfaceHeritageClauses.length - 1] : node.name; - - if (node.typeParameters && node.typeParameters.length) { - const interfaceLastTypeParameter = node.typeParameters[node.typeParameters.length - 1]; - - if (!interfaceLastClassToken || interfaceLastTypeParameter.pos > interfaceLastClassToken.pos) { - interfaceLastClassToken = nodeUtils.findNextToken(interfaceLastTypeParameter, ast); - } - result.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - - const hasImplementsClause = interfaceHeritageClauses.length > 0; - const hasAbstractKeyword = nodeUtils.hasModifier(SyntaxKind.AbstractKeyword, node); - const interfaceOpenBrace = nodeUtils.findNextToken(interfaceLastClassToken, ast); - - const interfaceBody = { - type: AST_NODE_TYPES.TSInterfaceBody, - body: node.members.map(member => convertChild(member)), - range: [interfaceOpenBrace.getStart(), result.range[1]], - loc: nodeUtils.getLocFor(interfaceOpenBrace.getStart(), node.end, ast) - }; - - Object.assign(result, { - abstract: hasAbstractKeyword, - type: AST_NODE_TYPES.TSInterfaceDeclaration, - body: interfaceBody, - id: convertChild(node.name), - heritage: hasImplementsClause ? interfaceHeritageClauses[0].types.map(convertInterfaceHeritageClause) : [] - }); - /** - * Semantically, decorators are not allowed on interface declarations, - * but the TypeScript compiler will parse them and produce a valid AST, - * so we handle them here too. - */ - if (node.decorators) { - result.decorators = convertDecorators(node.decorators); - } - // check for exports - result = nodeUtils.fixExports(node, result, ast); - - break; - - } - - case SyntaxKind.FirstTypeNode: - Object.assign(result, { - type: AST_NODE_TYPES.TSTypePredicate, - parameterName: convertChild(node.parameterName), - typeAnnotation: convertTypeAnnotation(node.type) - }); - /** - * Specific fix for type-guard location data - */ - result.typeAnnotation.loc = result.typeAnnotation.typeAnnotation.loc; - result.typeAnnotation.range = result.typeAnnotation.typeAnnotation.range; - break; - - case SyntaxKind.ImportType: - Object.assign(result, { - type: AST_NODE_TYPES.TSImportType, - isTypeOf: !!node.isTypeOf, - parameter: convertChild(node.argument), - qualifier: convertChild(node.qualifier), - typeParameters: node.typeArguments ? convertTypeArgumentsToTypeParameters(node.typeArguments) : null - }); - break; - - case SyntaxKind.EnumDeclaration: { - Object.assign(result, { - type: AST_NODE_TYPES.TSEnumDeclaration, - id: convertChild(node.name), - members: node.members.map(convertChild) - }); - // apply modifiers first... - applyModifiersToResult(node.modifiers); - // ...then check for exports - result = nodeUtils.fixExports(node, result, ast); - /** - * Semantically, decorators are not allowed on enum declarations, - * but the TypeScript compiler will parse them and produce a valid AST, - * so we handle them here too. - */ - if (node.decorators) { - result.decorators = convertDecorators(node.decorators); - } - break; - } - - case SyntaxKind.EnumMember: { - Object.assign(result, { - type: AST_NODE_TYPES.TSEnumMember, - id: convertChild(node.name) - }); - if (node.initializer) { - result.initializer = convertChild(node.initializer); - } - break; - } - - case SyntaxKind.AbstractKeyword: { - Object.assign(result, { - type: AST_NODE_TYPES.TSAbstractKeyword - }); - break; - } - - case SyntaxKind.ModuleDeclaration: { - Object.assign(result, { - type: AST_NODE_TYPES.TSModuleDeclaration, - id: convertChild(node.name) - }); - if (node.body) { - result.body = convertChild(node.body); - } - // apply modifiers first... - applyModifiersToResult(node.modifiers); - // ...then check for exports - result = nodeUtils.fixExports(node, result, ast); - break; - } - - default: - deeplyCopy(); - } - - return result; - -}; diff --git a/packages/typescript-eslint-parser/lib/node-utils.js b/packages/typescript-eslint-parser/lib/node-utils.js deleted file mode 100644 index bd0bee0548dc..000000000000 --- a/packages/typescript-eslint-parser/lib/node-utils.js +++ /dev/null @@ -1,748 +0,0 @@ -/** - * @fileoverview Utilities for finding and converting TSNodes into ESTreeNodes - * @author James Henry - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const ts = require("typescript"), - unescape = require("lodash.unescape"); - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -const SyntaxKind = ts.SyntaxKind; - -const ASSIGNMENT_OPERATORS = [ - SyntaxKind.EqualsToken, - SyntaxKind.PlusEqualsToken, - SyntaxKind.MinusEqualsToken, - SyntaxKind.AsteriskEqualsToken, - SyntaxKind.SlashEqualsToken, - SyntaxKind.PercentEqualsToken, - SyntaxKind.LessThanLessThanEqualsToken, - SyntaxKind.GreaterThanGreaterThanEqualsToken, - SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, - SyntaxKind.AmpersandEqualsToken, - SyntaxKind.BarEqualsToken, - SyntaxKind.CaretEqualsToken -]; - -const LOGICAL_OPERATORS = [ - SyntaxKind.BarBarToken, - SyntaxKind.AmpersandAmpersandToken -]; - -const TOKEN_TO_TEXT = {}; -TOKEN_TO_TEXT[SyntaxKind.OpenBraceToken] = "{"; -TOKEN_TO_TEXT[SyntaxKind.CloseBraceToken] = "}"; -TOKEN_TO_TEXT[SyntaxKind.OpenParenToken] = "("; -TOKEN_TO_TEXT[SyntaxKind.CloseParenToken] = ")"; -TOKEN_TO_TEXT[SyntaxKind.OpenBracketToken] = "["; -TOKEN_TO_TEXT[SyntaxKind.CloseBracketToken] = "]"; -TOKEN_TO_TEXT[SyntaxKind.DotToken] = "."; -TOKEN_TO_TEXT[SyntaxKind.DotDotDotToken] = "..."; -TOKEN_TO_TEXT[SyntaxKind.SemicolonToken] = ";"; -TOKEN_TO_TEXT[SyntaxKind.CommaToken] = ","; -TOKEN_TO_TEXT[SyntaxKind.LessThanToken] = "<"; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanToken] = ">"; -TOKEN_TO_TEXT[SyntaxKind.LessThanEqualsToken] = "<="; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanEqualsToken] = ">="; -TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsToken] = "=="; -TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsToken] = "!="; -TOKEN_TO_TEXT[SyntaxKind.EqualsEqualsEqualsToken] = "==="; -TOKEN_TO_TEXT[SyntaxKind.InstanceOfKeyword] = "instanceof"; -TOKEN_TO_TEXT[SyntaxKind.ExclamationEqualsEqualsToken] = "!=="; -TOKEN_TO_TEXT[SyntaxKind.EqualsGreaterThanToken] = "=>"; -TOKEN_TO_TEXT[SyntaxKind.PlusToken] = "+"; -TOKEN_TO_TEXT[SyntaxKind.MinusToken] = "-"; -TOKEN_TO_TEXT[SyntaxKind.AsteriskToken] = "*"; -TOKEN_TO_TEXT[SyntaxKind.AsteriskAsteriskToken] = "**"; -TOKEN_TO_TEXT[SyntaxKind.SlashToken] = "/"; -TOKEN_TO_TEXT[SyntaxKind.PercentToken] = "%"; -TOKEN_TO_TEXT[SyntaxKind.PlusPlusToken] = "++"; -TOKEN_TO_TEXT[SyntaxKind.MinusMinusToken] = "--"; -TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanToken] = "<<"; -TOKEN_TO_TEXT[SyntaxKind.LessThanSlashToken] = ">"; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanToken] = ">>>"; -TOKEN_TO_TEXT[SyntaxKind.AmpersandToken] = "&"; -TOKEN_TO_TEXT[SyntaxKind.BarToken] = "|"; -TOKEN_TO_TEXT[SyntaxKind.CaretToken] = "^"; -TOKEN_TO_TEXT[SyntaxKind.ExclamationToken] = "!"; -TOKEN_TO_TEXT[SyntaxKind.TildeToken] = "~"; -TOKEN_TO_TEXT[SyntaxKind.AmpersandAmpersandToken] = "&&"; -TOKEN_TO_TEXT[SyntaxKind.BarBarToken] = "||"; -TOKEN_TO_TEXT[SyntaxKind.QuestionToken] = "?"; -TOKEN_TO_TEXT[SyntaxKind.ColonToken] = ":"; -TOKEN_TO_TEXT[SyntaxKind.EqualsToken] = "="; -TOKEN_TO_TEXT[SyntaxKind.PlusEqualsToken] = "+="; -TOKEN_TO_TEXT[SyntaxKind.MinusEqualsToken] = "-="; -TOKEN_TO_TEXT[SyntaxKind.AsteriskEqualsToken] = "*="; -TOKEN_TO_TEXT[SyntaxKind.AsteriskAsteriskEqualsToken] = "**="; -TOKEN_TO_TEXT[SyntaxKind.SlashEqualsToken] = "/="; -TOKEN_TO_TEXT[SyntaxKind.PercentEqualsToken] = "%="; -TOKEN_TO_TEXT[SyntaxKind.LessThanLessThanEqualsToken] = "<<="; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanEqualsToken] = ">>="; -TOKEN_TO_TEXT[SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken] = ">>>="; -TOKEN_TO_TEXT[SyntaxKind.AmpersandEqualsToken] = "&="; -TOKEN_TO_TEXT[SyntaxKind.BarEqualsToken] = "|="; -TOKEN_TO_TEXT[SyntaxKind.CaretEqualsToken] = "^="; -TOKEN_TO_TEXT[SyntaxKind.AtToken] = "@"; -TOKEN_TO_TEXT[SyntaxKind.InKeyword] = "in"; -TOKEN_TO_TEXT[SyntaxKind.UniqueKeyword] = "unique"; -TOKEN_TO_TEXT[SyntaxKind.KeyOfKeyword] = "keyof"; -TOKEN_TO_TEXT[SyntaxKind.NewKeyword] = "new"; -TOKEN_TO_TEXT[SyntaxKind.ImportKeyword] = "import"; - -/** - * Find the first matching child based on the given sourceFile and predicate function. - * @param {TSNode} node The current TSNode - * @param {Object} sourceFile The full AST source file - * @param {Function} predicate The predicate function to apply to each checked child - * @returns {TSNode|undefined} a matching child TSNode - */ -function findFirstMatchingChild(node, sourceFile, predicate) { - const children = node.getChildren(sourceFile); - for (let i = 0; i < children.length; i++) { - const child = children[i]; - if (child && predicate(child)) { - return child; - } - - const grandChild = findFirstMatchingChild(child, sourceFile, predicate); - if (grandChild) { - return grandChild; - } - } - return undefined; -} - -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -/* eslint-disable no-use-before-define */ -module.exports = { - /** - * Expose the enum of possible TSNode `kind`s. - */ - SyntaxKind, - isAssignmentOperator, - isLogicalOperator, - getTextForTokenKind, - isESTreeClassMember, - hasModifier, - isComma, - getBinaryExpressionType, - getLocFor, - getLoc, - isToken, - isJSXToken, - getDeclarationKind, - getTSNodeAccessibility, - hasStaticModifierFlag, - findNextToken, - findFirstMatchingToken, - findChildOfKind, - findFirstMatchingAncestor, - findAncestorOfKind, - hasJSXAncestor, - unescapeStringLiteralText, - isComputedProperty, - isOptional, - fixExports, - getTokenType, - convertToken, - convertTokens, - getNodeContainer, - isWithinTypeAnnotation, - isTypeKeyword, - isComment, - isJSDocComment, - createError -}; -/* eslint-enable no-use-before-define */ - -/** - * Returns true if the given TSToken is the assignment operator - * @param {TSToken} operator the operator token - * @returns {boolean} is assignment - */ -function isAssignmentOperator(operator) { - return ASSIGNMENT_OPERATORS.indexOf(operator.kind) > -1; -} - -/** - * Returns true if the given TSToken is a logical operator - * @param {TSToken} operator the operator token - * @returns {boolean} is a logical operator - */ -function isLogicalOperator(operator) { - return LOGICAL_OPERATORS.indexOf(operator.kind) > -1; -} - -/** - * Returns the string form of the given TSToken SyntaxKind - * @param {number} kind the token's SyntaxKind - * @returns {string} the token applicable token as a string - */ -function getTextForTokenKind(kind) { - return TOKEN_TO_TEXT[kind]; -} - -/** - * Returns true if the given TSNode is a valid ESTree class member - * @param {TSNode} node TypeScript AST node - * @returns {boolean} is valid ESTree class member - */ -function isESTreeClassMember(node) { - return node.kind !== SyntaxKind.SemicolonClassElement; -} - -/** - * Checks if a TSNode has a modifier - * @param {SyntaxKind} modifierKind TypeScript SyntaxKind modifier - * @param {TSNode} node TypeScript AST node - * @returns {boolean} has the modifier specified - */ -function hasModifier(modifierKind, node) { - return !!node.modifiers && !!node.modifiers.length && node.modifiers.some(modifier => modifier.kind === modifierKind); -} - -/** - * Returns true if the given TSToken is a comma - * @param {TSToken} token the TypeScript token - * @returns {boolean} is comma - */ -function isComma(token) { - return token.kind === SyntaxKind.CommaToken; -} - -/** - * Returns true if the given TSNode is a comment - * @param {TSNode} node the TypeScript node - * @returns {boolean} is commment - */ -function isComment(node) { - return node.kind === SyntaxKind.SingleLineCommentTrivia || node.kind === SyntaxKind.MultiLineCommentTrivia; -} - -/** - * Returns true if the given TSNode is a JSDoc comment - * @param {TSNode} node the TypeScript node - * @returns {boolean} is JSDoc comment - */ -function isJSDocComment(node) { - return node.kind === SyntaxKind.JSDocComment; -} - -/** - * Returns the binary expression type of the given TSToken - * @param {TSToken} operator the operator token - * @returns {string} the binary expression type - */ -function getBinaryExpressionType(operator) { - if (isAssignmentOperator(operator)) { - return "AssignmentExpression"; - } else if (isLogicalOperator(operator)) { - return "LogicalExpression"; - } - return "BinaryExpression"; -} - -/** - * Returns line and column data for the given start and end positions, - * for the given AST - * @param {Object} start start data - * @param {Object} end end data - * @param {Object} ast the AST object - * @returns {Object} the loc data - */ -function getLocFor(start, end, ast) { - const startLoc = ast.getLineAndCharacterOfPosition(start), - endLoc = ast.getLineAndCharacterOfPosition(end); - - return { - start: { - line: startLoc.line + 1, - column: startLoc.character - }, - end: { - line: endLoc.line + 1, - column: endLoc.character - } - }; -} - -/** - * Returns line and column data for the given ESTreeNode or ESTreeToken, - * for the given AST - * @param {ESTreeToken|ESTreeNode} nodeOrToken the ESTreeNode or ESTreeToken - * @param {Object} ast the AST object - * @returns {Object} the loc data - */ -function getLoc(nodeOrToken, ast) { - return getLocFor(nodeOrToken.getStart(), nodeOrToken.end, ast); -} - -/** - * Returns true if a given TSNode is a token - * @param {TSNode} node the TSNode - * @returns {boolean} is a token - */ -function isToken(node) { - return node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken; -} - -/** - * Returns true if a given TSNode is a JSX token - * @param {TSNode} node TSNode to be checked - * @returns {boolean} is a JSX token - */ -function isJSXToken(node) { - return ( - node.kind >= SyntaxKind.JsxElement && - node.kind <= SyntaxKind.JsxAttribute - ); -} - -/** - * Returns true if the given TSNode.kind value corresponds to a type keyword - * @param {number} kind TypeScript SyntaxKind - * @returns {boolean} is a type keyword - */ -function isTypeKeyword(kind) { - switch (kind) { - case SyntaxKind.AnyKeyword: - case SyntaxKind.BooleanKeyword: - case SyntaxKind.NeverKeyword: - case SyntaxKind.NumberKeyword: - case SyntaxKind.ObjectKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.SymbolKeyword: - case SyntaxKind.VoidKeyword: - return true; - default: - return false; - } -} - -/** - * Returns the declaration kind of the given TSNode - * @param {TSNode} node TypeScript AST node - * @returns {string} declaration kind - */ -function getDeclarationKind(node) { - switch (node.kind) { - case SyntaxKind.TypeAliasDeclaration: - return "type"; - case SyntaxKind.VariableDeclarationList: - if (node.flags & ts.NodeFlags.Let) { - return "let"; - } - if (node.flags & ts.NodeFlags.Const) { - return "const"; - } - return "var"; - default: - throw "Unable to determine declaration kind."; - } -} - -/** - * Gets a TSNode's accessibility level - * @param {TSNode} node The TSNode - * @returns {string | null} accessibility "public", "protected", "private", or null - */ -function getTSNodeAccessibility(node) { - const modifiers = node.modifiers; - if (!modifiers) { - return null; - } - for (let i = 0; i < modifiers.length; i++) { - const modifier = modifiers[i]; - switch (modifier.kind) { - case SyntaxKind.PublicKeyword: - return "public"; - case SyntaxKind.ProtectedKeyword: - return "protected"; - case SyntaxKind.PrivateKeyword: - return "private"; - default: - continue; - } - } - return null; -} - -/** - * Returns true if the given TSNode has the modifier flag set which corresponds - * to the static keyword. - * @param {TSNode} node The TSNode - * @returns {boolean} whether or not the static modifier flag is set - */ -function hasStaticModifierFlag(node) { - /** - * TODO: Remove dependency on private TypeScript method - */ - return Boolean(ts.getModifierFlags(node) & ts.ModifierFlags.Static); -} - -/** - * Finds the next token based on the previous one and its parent - * @param {TSToken} previousToken The previous TSToken - * @param {TSNode} parent The parent TSNode - * @returns {TSToken} the next TSToken - */ -function findNextToken(previousToken, parent) { - /** - * TODO: Remove dependency on private TypeScript method - */ - return ts.findNextToken(previousToken, parent); -} - -/** - * Find the first matching token based on the given predicate function. - * @param {TSToken} previousToken The previous TSToken - * @param {TSNode} parent The parent TSNode - * @param {Function} predicate The predicate function to apply to each checked token - * @returns {TSToken|undefined} a matching TSToken - */ -function findFirstMatchingToken(previousToken, parent, predicate) { - while (previousToken) { - if (predicate(previousToken)) { - return previousToken; - } - previousToken = findNextToken(previousToken, parent); - } - return undefined; -} - -/** - * Finds the first child TSNode which matches the given kind - * @param {TSNode} node The parent TSNode - * @param {number} kind The TSNode kind to match against - * @param {Object} sourceFile The full AST source file - * @returns {TSNode|undefined} a matching TSNode - */ -function findChildOfKind(node, kind, sourceFile) { - return findFirstMatchingChild(node, sourceFile, child => child.kind === kind); -} - -/** - * Find the first matching ancestor based on the given predicate function. - * @param {TSNode} node The current TSNode - * @param {Function} predicate The predicate function to apply to each checked ancestor - * @returns {TSNode|undefined} a matching parent TSNode - */ -function findFirstMatchingAncestor(node, predicate) { - while (node) { - if (predicate(node)) { - return node; - } - node = node.parent; - } - return undefined; -} - -/** - * Finds the first parent TSNode which mastches the given kind - * @param {TSNode} node The current TSNode - * @param {number} kind The TSNode kind to match against - * @returns {TSNode|undefined} a matching parent TSNode - */ -function findAncestorOfKind(node, kind) { - return findFirstMatchingAncestor(node, parent => parent.kind === kind); -} - - -/** - * Returns true if a given TSNode has a JSX token within its hierarchy - * @param {TSNode} node TSNode to be checked - * @returns {boolean} has JSX ancestor - */ -function hasJSXAncestor(node) { - return !!findFirstMatchingAncestor(node, isJSXToken); -} - -/** - * Unescape the text content of string literals, e.g. & -> & - * @param {string} text The escaped string literal text. - * @returns {string} The unescaped string literal text. - */ -function unescapeStringLiteralText(text) { - return unescape(text); -} - -/** - * Returns true if a given TSNode is a computed property - * @param {TSNode} node TSNode to be checked - * @returns {boolean} is Computed Property - */ -function isComputedProperty(node) { - return node.kind === SyntaxKind.ComputedPropertyName; -} - -/** - * Returns true if a given TSNode is optional (has QuestionToken) - * @param {TSNode} node TSNode to be checked - * @returns {boolean} is Optional - */ -function isOptional(node) { - return (node.questionToken) - ? (node.questionToken.kind === SyntaxKind.QuestionToken) : false; -} - -/** - * Returns true if the given TSNode is within the context of a "typeAnnotation", - * which effectively means - is it coming from its parent's `type` or `types` property - * @param {TSNode} node TSNode to be checked - * @returns {boolean} is within "typeAnnotation context" - */ -function isWithinTypeAnnotation(node) { - return node.parent.type === node || (node.parent.types && node.parent.types.indexOf(node) > -1); -} - -/** - * Fixes the exports of the given TSNode - * @param {TSNode} node the TSNode - * @param {Object} result result - * @param {Object} ast the AST - * @returns {TSNode} the TSNode with fixed exports - */ -function fixExports(node, result, ast) { - // check for exports - if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { - const exportKeyword = node.modifiers[0], - nextModifier = node.modifiers[1], - lastModifier = node.modifiers[node.modifiers.length - 1], - declarationIsDefault = nextModifier && (nextModifier.kind === SyntaxKind.DefaultKeyword), - varToken = findNextToken(lastModifier, ast); - - result.range[0] = varToken.getStart(); - result.loc = getLocFor(result.range[0], result.range[1], ast); - - const declarationType = declarationIsDefault ? "ExportDefaultDeclaration" : "ExportNamedDeclaration"; - - const newResult = { - type: declarationType, - declaration: result, - range: [exportKeyword.getStart(), result.range[1]], - loc: getLocFor(exportKeyword.getStart(), result.range[1], ast) - }; - - if (!declarationIsDefault) { - newResult.specifiers = []; - newResult.source = null; - } - - return newResult; - - } - - return result; -} - -/** - * Returns the type of a given ESTreeToken - * @param {ESTreeToken} token the ESTreeToken - * @returns {string} the token type - */ -function getTokenType(token) { - // Need two checks for keywords since some are also identifiers - if (token.originalKeywordKind) { - - switch (token.originalKeywordKind) { - case SyntaxKind.NullKeyword: - return "Null"; - - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.TypeKeyword: - case SyntaxKind.ModuleKeyword: - return "Identifier"; - - default: - return "Keyword"; - } - } - - if (token.kind >= SyntaxKind.FirstKeyword && token.kind <= SyntaxKind.LastFutureReservedWord) { - if (token.kind === SyntaxKind.FalseKeyword || token.kind === SyntaxKind.TrueKeyword) { - return "Boolean"; - } - - return "Keyword"; - } - - if (token.kind >= SyntaxKind.FirstPunctuation && token.kind <= SyntaxKind.LastBinaryOperator) { - return "Punctuator"; - } - - if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && token.kind <= SyntaxKind.TemplateTail) { - return "Template"; - } - - switch (token.kind) { - case SyntaxKind.NumericLiteral: - return "Numeric"; - - case SyntaxKind.JsxText: - return "JSXText"; - - case SyntaxKind.StringLiteral: - - // A TypeScript-StringLiteral token with a TypeScript-JsxAttribute or TypeScript-JsxElement parent, - // must actually be an ESTree-JSXText token - if (token.parent && (token.parent.kind === SyntaxKind.JsxAttribute || token.parent.kind === SyntaxKind.JsxElement)) { - return "JSXText"; - } - - return "String"; - - case SyntaxKind.RegularExpressionLiteral: - return "RegularExpression"; - - case SyntaxKind.Identifier: - case SyntaxKind.ConstructorKeyword: - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - - // falls through - default: - } - - // Some JSX tokens have to be determined based on their parent - if (token.parent) { - if (token.kind === SyntaxKind.Identifier && token.parent.kind === SyntaxKind.PropertyAccessExpression && hasJSXAncestor(token)) { - return "JSXIdentifier"; - } - - if (isJSXToken(token.parent)) { - if (token.kind === SyntaxKind.PropertyAccessExpression) { - return "JSXMemberExpression"; - } - - if (token.kind === SyntaxKind.Identifier) { - return "JSXIdentifier"; - } - } - } - - return "Identifier"; -} - -/** - * Extends and formats a given ESTreeToken, for a given AST - * @param {ESTreeToken} token the ESTreeToken - * @param {Object} ast the AST object - * @returns {ESTreeToken} the converted ESTreeToken - */ -function convertToken(token, ast) { - const start = (token.kind === SyntaxKind.JsxText) ? token.getFullStart() : token.getStart(), - end = token.getEnd(), - value = ast.text.slice(start, end), - newToken = { - type: getTokenType(token), - value, - range: [start, end], - loc: getLocFor(start, end, ast) - }; - - if (newToken.type === "RegularExpression") { - newToken.regex = { - pattern: value.slice(1, value.lastIndexOf("/")), - flags: value.slice(value.lastIndexOf("/") + 1) - }; - } - - return newToken; -} - -/** - * Converts all tokens for the given AST - * @param {Object} ast the AST object - * @returns {ESTreeToken[]} the converted ESTreeTokens - */ -function convertTokens(ast) { - const result = []; - /** - * @param {TSNode} node the TSNode - * @returns {undefined} - */ - function walk(node) { - // TypeScript generates tokens for types in JSDoc blocks. Comment tokens - // and their children should not be walked or added to the resulting tokens list. - if (isComment(node) || isJSDocComment(node)) { - return; - } - - if (isToken(node) && node.kind !== SyntaxKind.EndOfFileToken) { - const converted = convertToken(node, ast); - - if (converted) { - result.push(converted); - } - } else { - node.getChildren().forEach(walk); - } - } - walk(ast); - return result; -} - -/** - * Get container token node between range - * @param {Object} ast the AST object - * @param {int} start The index at which the comment starts. - * @param {int} end The index at which the comment ends. - * @returns {TSToken} typescript container token - * @private - */ -function getNodeContainer(ast, start, end) { - let container = null; - - /** - * @param {TSNode} node the TSNode - * @returns {undefined} - */ - function walk(node) { - const nodeStart = node.pos; - const nodeEnd = node.end; - - if (start >= nodeStart && end <= nodeEnd) { - if (isToken(node)) { - container = node; - } else { - node.getChildren().forEach(walk); - } - } - } - walk(ast); - - return container; -} - -/** - * @param {Object} ast the AST object - * @param {int} start the index at which the error starts - * @param {string} message the error message - * @returns {Object} converted error object - */ -function createError(ast, start, message) { - const loc = ast.getLineAndCharacterOfPosition(start); - return { - index: start, - lineNumber: loc.line + 1, - column: loc.character, - message - }; -} diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 0a2d52a39c1a..a86fc47e3f8b 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -18,15 +18,10 @@ }, "license": "BSD-2-Clause", "devDependencies": { - "babel-code-frame": "6.26.0", - "babylon": "7.0.0-beta.39", - "eslint": "4.19.1", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "6.0.1", "eslint-release": "0.11.1", - "glob": "7.1.2", "jest": "23.1.0", - "lodash.isplainobject": "4.0.6", "npm-license": "0.3.3", "shelljs": "0.8.2", "shelljs-nodecli": "0.1.1", @@ -42,9 +37,8 @@ "eslint" ], "scripts": { - "test": "node Makefile.js test && npm run ast-alignment-tests", + "test": "node Makefile.js test", "jest": "jest", - "ast-alignment-tests": "jest --config=./tests/ast-alignment/jest.config.js", "integration-tests": "docker-compose -f tests/integration/docker-compose.yml up", "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", "lint": "node Makefile.js lint", @@ -55,8 +49,8 @@ "betarelease": "eslint-prerelease beta" }, "dependencies": { - "lodash.unescape": "4.0.1", - "semver": "5.5.0" + "eslint": "4.19.1", + "typescript-estree": "1.0.0" }, "peerDependencies": { "typescript": "*" diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index da4e0c5ae5bc..9f12905d2f9a 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -8,176 +8,9 @@ "use strict"; -const astNodeTypes = require("./lib/ast-node-types"), - ts = require("typescript"), - convert = require("./lib/ast-converter"), - semver = require("semver"); - -const SUPPORTED_TYPESCRIPT_VERSIONS = require("./package.json").devDependencies.typescript; -const ACTIVE_TYPESCRIPT_VERSION = ts.version; -const isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS); - -let extra; -let warnedAboutTSVersion = false; - -/** - * Resets the extra config object - * @returns {void} - */ -function resetExtra() { - extra = { - tokens: null, - range: false, - loc: false, - comment: false, - comments: [], - tolerant: false, - errors: [], - strict: false, - ecmaFeatures: {}, - useJSXTextNode: false, - log: console.log // eslint-disable-line no-console - }; -} - -//------------------------------------------------------------------------------ -// Parser -//------------------------------------------------------------------------------ - -/** - * Parses the given source code to produce a valid AST - * @param {mixed} code TypeScript code - * @param {Object} options configuration object for the parser - * @param {Object} additionalParsingContext additional internal configuration - * @returns {Object} the AST - */ -function generateAST(code, options, additionalParsingContext) { - additionalParsingContext = additionalParsingContext || {}; - - const toString = String; - - if (typeof code !== "string" && !(code instanceof String)) { - code = toString(code); - } - - resetExtra(); - - if (typeof options !== "undefined") { - extra.range = (typeof options.range === "boolean") && options.range; - extra.loc = (typeof options.loc === "boolean") && options.loc; - - if (extra.loc && options.source !== null && options.source !== undefined) { - extra.source = toString(options.source); - } - - if (typeof options.tokens === "boolean" && options.tokens) { - extra.tokens = []; - } - if (typeof options.comment === "boolean" && options.comment) { - extra.comment = true; - extra.comments = []; - } - if (typeof options.tolerant === "boolean" && options.tolerant) { - extra.errors = []; - } - - if (options.ecmaFeatures && typeof options.ecmaFeatures === "object") { - // pass through jsx option - extra.ecmaFeatures.jsx = options.ecmaFeatures.jsx; - } - - /** - * Allow the user to cause the parser to error if it encounters an unknown AST Node Type - * (used in testing). - */ - if (options.errorOnUnknownASTType) { - extra.errorOnUnknownASTType = true; - } - - if (typeof options.useJSXTextNode === "boolean" && options.useJSXTextNode) { - extra.useJSXTextNode = true; - } - - /** - * Allow the user to override the function used for logging - */ - if (typeof options.loggerFn === "function") { - extra.log = options.loggerFn; - } else if (options.loggerFn === false) { - extra.log = Function.prototype; - } - - /** - * Provide the context as to whether or not we are parsing for ESLint, - * specifically - */ - if (additionalParsingContext.isParseForESLint) { - extra.parseForESLint = true; - } - } - - if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { - const border = "============="; - const versionWarning = [ - border, - "WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser.", - "You may find that it works just fine, or you may not.", - `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, - `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, - "Please only submit bug reports when using the officially supported version.", - border - ]; - extra.log(versionWarning.join("\n\n")); - warnedAboutTSVersion = true; - } - - // Even if jsx option is set in typescript compiler, filename still has to - // contain .tsx file extension - const FILENAME = (extra.ecmaFeatures.jsx) ? "eslint.tsx" : "eslint.ts"; - - const compilerHost = { - fileExists() { - return true; - }, - getCanonicalFileName() { - return FILENAME; - }, - getCurrentDirectory() { - return ""; - }, - getDefaultLibFileName() { - return "lib.d.ts"; - }, - - // TODO: Support Windows CRLF - getNewLine() { - return "\n"; - }, - getSourceFile(filename) { - return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true); - }, - readFile() { - return null; - }, - useCaseSensitiveFileNames() { - return true; - }, - writeFile() { - return null; - } - }; - - const program = ts.createProgram([FILENAME], { - noResolve: true, - target: ts.ScriptTarget.Latest, - jsx: extra.ecmaFeatures.jsx ? "preserve" : undefined - }, compilerHost); - - const ast = program.getSourceFile(FILENAME); - - extra.code = code; - return convert(ast, extra); -} +const parse = require("typescript-estree").parse; +const astNodeTypes = require("typescript-estree").AST_NODE_TYPES; +const traverser = require("eslint/lib/util/traverser"); //------------------------------------------------------------------------------ // Public @@ -185,12 +18,17 @@ function generateAST(code, options, additionalParsingContext) { exports.version = require("./package.json").version; -exports.parse = function parse(code, options) { - return generateAST(code, options, { isParseForESLint: false }); -}; - exports.parseForESLint = function parseForESLint(code, options) { - const ast = generateAST(code, options, { isParseForESLint: true }); + const ast = parse(code, options); + traverser.traverse(ast, { + enter: node => { + if (node.type === "DeclareFunction" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration") { + if (!node.body) { + node.type = `TSEmptyBody${node.type}`; + } + } + } + }); return { ast }; }; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml b/packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml deleted file mode 100644 index e19b2cfa824a..000000000000 --- a/packages/typescript-eslint-parser/tests/ast-alignment/.eslintrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -env: - jest: true diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js b/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js deleted file mode 100644 index 338dd159b60b..000000000000 --- a/packages/typescript-eslint-parser/tests/ast-alignment/fixtures-to-test.js +++ /dev/null @@ -1,523 +0,0 @@ -"use strict"; - -const path = require("path"); -const glob = require("glob"); - -/** - * JSX fixtures which have known issues for typescript-eslint-parser - */ -const jsxFilesWithKnownIssues = require("../jsx-known-issues").map(f => f.replace("jsx/", "")); - -/** - * Current random error difference on jsx/invalid-no-tag-name.src.js - * TSEP - SyntaxError - * Babylon - RangeError - * - * Reported here: https://github.com/babel/babylon/issues/674 - */ -jsxFilesWithKnownIssues.push("invalid-no-tag-name"); - -/** - * Custom constructs/concepts used in this file: - * - * type Pattern = string; // used for node-glob matching - * - * interface FixturePatternConfig { - * pattern: Pattern, - * config?: { - * babylonParserOptions: any, - * typeScriptESLintParserOptions: any - * } - * } - */ - -/** - * Globally track which fixtures need to be parsed with sourceType: "module" - * so that they can be added with the correct FixturePatternConfig - */ -let fixturesRequiringSourceTypeModule = []; - -/** - * Utility to generate a FixturePatternConfig object containing the glob pattern for specific subsections of the fixtures/ directory, - * including the capability to ignore specific nested patterns. - * - * @param {string} fixturesSubPath the sub-path within the fixtures/ directory - * @param {Object?} config an optional configuration object with optional sub-paths to ignore and/or parse with sourceType: module - * @returns {FixturePatternConfig} an object containing the glob pattern and optional additional config - */ -function createFixturePatternConfigFor(fixturesSubPath, config) { - if (!fixturesSubPath) { - return ""; - } - config = config || {}; - config.ignore = config.ignore || []; - config.fileType = config.fileType || "js"; - config.parseWithSourceTypeModule = config.parseWithSourceTypeModule || []; - /** - * The TypeScript compiler gives us the "externalModuleIndicator" to allow typescript-eslint-parser do dynamically detect the "sourceType". - * Babylon does not have an equivalent feature (although perhaps it might come in the future https://github.com/babel/babylon/issues/440), - * so we have to specify the "sourceType" we want to use. - * - * By default we have configured babylon to use "script", but for any fixtures specified in the parseWithSourceTypeModule array we need "module". - * - * First merge the fixtures which need to be parsed with sourceType: "module" into the - * ignore list, and then add their full config into the global array. - */ - if (config.parseWithSourceTypeModule.length) { - config.ignore = [].concat(config.ignore, config.parseWithSourceTypeModule); - fixturesRequiringSourceTypeModule = [].concat(fixturesRequiringSourceTypeModule, config.parseWithSourceTypeModule.map( - fixture => ({ - // It needs to be the full path from within fixtures/ for the pattern - pattern: `${fixturesSubPath}/${fixture}.src.${config.fileType}`, - config: { babylonParserOptions: { sourceType: "module" } } - }) - )); - } - return { - pattern: `${fixturesSubPath}/!(${config.ignore.join("|")}).src.${config.fileType}` - }; -} - -/** - * An array of FixturePatternConfigs - */ -let fixturePatternConfigsToTest = [ - createFixturePatternConfigFor("basics"), - - createFixturePatternConfigFor("comments", { - ignore: [ - "export-default-anonymous-class", // needs to be parsed with `sourceType: "module"` - /** - * Template strings seem to also be affected by the difference in opinion between different parsers in: - * https://github.com/babel/babylon/issues/673 - */ - "no-comment-template", // Purely AST diffs - "template-string-block" // Purely AST diffs - ] - }), - - createFixturePatternConfigFor("ecma-features/templateStrings", { - ignore: [ - "**/*" - ] - }), - - createFixturePatternConfigFor("ecma-features/experimentalObjectRestSpread", { - ignore: [ - /** - * Trailing comma is not permitted after a "RestElement" in Babylon - */ - "invalid-rest-trailing-comma" - ] - }), - - createFixturePatternConfigFor("ecma-features/arrowFunctions", { - ignore: [ - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "error-dup-params", // babylon parse errors - "error-dup-params", // babylon parse errors - "error-strict-dup-params", // babylon parse errors - "error-strict-octal", // babylon parse errors - "error-two-lines" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/binaryLiterals"), - createFixturePatternConfigFor("ecma-features/blockBindings"), - - createFixturePatternConfigFor("ecma-features/classes", { - ignore: [ - /** - * super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this. - */ - "class-one-method-super", // babylon parse errors - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "invalid-class-declaration", // babylon parse errors - "invalid-class-setter-declaration" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/defaultParams"), - - createFixturePatternConfigFor("ecma-features/destructuring", { - ignore: [ - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "invalid-defaults-object-assign" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/destructuring-and-arrowFunctions"), - createFixturePatternConfigFor("ecma-features/destructuring-and-blockBindings"), - createFixturePatternConfigFor("ecma-features/destructuring-and-defaultParams"), - createFixturePatternConfigFor("ecma-features/destructuring-and-forOf"), - - createFixturePatternConfigFor("ecma-features/destructuring-and-spread", { - ignore: [ - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "error-complex-destructured-spread-first" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/experimentalAsyncIteration"), - createFixturePatternConfigFor("ecma-features/experimentalDynamicImport"), - createFixturePatternConfigFor("ecma-features/exponentiationOperators"), - - createFixturePatternConfigFor("ecma-features/forOf", { - ignore: [ - /** - * TypeScript, espree and acorn parse this fine - esprima, flow and babylon do not... - */ - "for-of-with-function-initializer" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/generators"), - createFixturePatternConfigFor("ecma-features/globalReturn"), - - createFixturePatternConfigFor("ecma-features/modules", { - ignore: [ - /** - * TypeScript, flow and babylon parse this fine - esprima, espree and acorn do not... - */ - "invalid-export-default", // typescript-eslint-parser parse errors - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "invalid-export-named-default", // babylon parse errors - "invalid-import-default-module-specifier", // babylon parse errors - "invalid-import-module-specifier", // babylon parse errors - /** - * Deleting local variable in strict mode - */ - "error-delete", // babylon parse errors - /** - * 'with' in strict mode - */ - "error-strict" // babylon parse errors - ], - parseWithSourceTypeModule: [ - "export-default-array", - "export-default-class", - "export-default-expression", - "export-default-function", - "export-default-named-class", - "export-default-named-function", - "export-default-number", - "export-default-object", - "export-default-value", - "export-from-batch", - "export-from-default", - "export-from-named-as-default", - "export-from-named-as-specifier", - "export-from-named-as-specifiers", - "export-from-specifier", - "export-from-specifiers", - "export-function", - "export-named-as-default", - "export-named-as-specifier", - "export-named-as-specifiers", - "export-named-class", - "export-named-empty", - "export-named-specifier", - "export-named-specifiers-comma", - "export-named-specifiers", - "export-var-anonymous-function", - "export-var-number", - "export-var", - "import-default-and-named-specifiers", - "import-default-and-namespace-specifiers", - "import-default-as", - "import-default", - "import-jquery", - "import-module", - "import-named-as-specifier", - "import-named-as-specifiers", - "import-named-empty", - "import-named-specifier", - "import-named-specifiers-comma", - "import-named-specifiers", - "import-namespace-specifier", - "import-null-as-nil", - "invalid-await", - "invalid-class" - ] - }), - - createFixturePatternConfigFor("ecma-features/newTarget", { - ignore: [ - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "invalid-new-target", // babylon parse errors - "invalid-unknown-property" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/objectLiteralComputedProperties"), - - createFixturePatternConfigFor("ecma-features/objectLiteralDuplicateProperties", { - ignore: [ - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "error-proto-property", // babylon parse errors - "error-proto-string-property" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/objectLiteralShorthandMethods"), - createFixturePatternConfigFor("ecma-features/objectLiteralShorthandProperties"), - createFixturePatternConfigFor("ecma-features/octalLiterals"), - createFixturePatternConfigFor("ecma-features/regex"), - createFixturePatternConfigFor("ecma-features/regexUFlag"), - createFixturePatternConfigFor("ecma-features/regexYFlag"), - - createFixturePatternConfigFor("ecma-features/restParams", { - ignore: [ - /** - * Expected babylon parse errors - all of these files below produce parse errors in espree - * as well, but the TypeScript compiler is so forgiving during parsing that typescript-eslint-parser - * does not actually error on them and will produce an AST. - */ - "error-no-default", // babylon parse errors - "error-not-last" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("ecma-features/spread"), - createFixturePatternConfigFor("ecma-features/unicodeCodePointEscapes"), - createFixturePatternConfigFor("jsx", { ignore: jsxFilesWithKnownIssues }), - createFixturePatternConfigFor("jsx-useJSXTextNode"), - - /* ================================================== */ - - /** - * TSX-SPECIFIC FILES - */ - - createFixturePatternConfigFor("tsx", { - fileType: "tsx", - ignore: [ - /** - * AST difference - */ - "react-typed-props", - /** - * currently babylon not supported - */ - "generic-jsx-element" - ] - }), - - /* ================================================== */ - - /** - * TYPESCRIPT-SPECIFIC FILES - */ - - createFixturePatternConfigFor("typescript/babylon-convergence", { fileType: "ts" }), - - createFixturePatternConfigFor("typescript/basics", { - fileType: "ts", - ignore: [ - /** - * Other babylon parse errors relating to invalid syntax. - */ - "abstract-class-with-abstract-constructor", // babylon parse errors - "class-with-export-parameter-properties", // babylon parse errors - "class-with-optional-methods", // babylon parse errors - "class-with-static-parameter-properties", // babylon parse errors - "interface-with-all-property-types", // babylon parse errors - "interface-with-construct-signature-with-parameter-accessibility", // babylon parse errors - "class-with-implements-and-extends", // babylon parse errors - "var-with-definite-assignment", // babylon parse errors - "class-with-definite-assignment", // babylon parse errors - /** - * typescript-eslint-parser erroring, but babylon not. - */ - "arrow-function-with-type-parameters", // typescript-eslint-parser parse errors - /** - * Babylon: ClassDeclaration + abstract: true - * tsep: TSAbstractClassDeclaration - */ - "abstract-class-with-abstract-properties", - /** - * Babylon: ClassProperty + abstract: true - * tsep: TSAbstractClassProperty - */ - "abstract-class-with-abstract-readonly-property", - /** - * Babylon: TSExpressionWithTypeArguments - * tsep: ClassImplements - */ - "class-with-implements-generic-multiple", - "class-with-implements-generic", - "class-with-implements", - "class-with-extends-and-implements", - /** - * Babylon: TSDeclareFunction + declare: true - * tsep: DeclareFunction - */ - "declare-function", - /** - * Other major AST differences (e.g. fundamentally different node types) - */ - "class-with-mixin", - "function-with-types-assignation", - "interface-extends-multiple", - "interface-extends", - "interface-type-parameters", - "interface-with-extends-type-parameters", - "interface-with-generic", - "interface-with-jsdoc", - "interface-with-optional-properties", - "interface-without-type-annotation", - "type-alias-declaration-with-constrained-type-parameter", - "type-alias-declaration", - "type-alias-object-without-annotation", - "typed-this", - "export-type-function-declaration", - "export-type-class-declaration", - "abstract-interface", - "export-type-alias-declaration", - "unique-symbol", - "keyof-operator", - /** - * tsep bug - Program.body[0].expression.left.properties[0].value.right is currently showing up - * as `ArrayPattern`, babylon, acorn and espree say it should be `ArrayExpression` - * TODO: Fix this - */ - "destructuring-assignment", - /** - * Babylon bug for optional or abstract methods? - */ - "abstract-class-with-abstract-method", // babylon parse errors - "abstract-class-with-optional-method", // babylon parse errors - "declare-class-with-optional-method", // babylon parse errors - /** - * Awaiting feedback on Babylon issue https://github.com/babel/babylon/issues/700 - */ - "class-with-private-parameter-properties", - "class-with-protected-parameter-properties", - "class-with-public-parameter-properties", - "class-with-readonly-parameter-properties", - /** - * Not yet supported in Babylon https://github.com/babel/babel/issues/7749 - */ - "import-type", - "import-type-with-type-parameters-in-type-reference" - ], - parseWithSourceTypeModule: [ - "export-named-enum", - "export-assignment", - "export-default-class-with-generic", - "export-default-class-with-multiple-generics", - "export-named-class-with-generic", - "export-named-class-with-multiple-generics" - ] - }), - - createFixturePatternConfigFor("typescript/decorators/accessor-decorators", { fileType: "ts" }), - createFixturePatternConfigFor("typescript/decorators/class-decorators", { fileType: "ts" }), - createFixturePatternConfigFor("typescript/decorators/method-decorators", { fileType: "ts" }), - createFixturePatternConfigFor("typescript/decorators/parameter-decorators", { fileType: "ts" }), - createFixturePatternConfigFor("typescript/decorators/property-decorators", { fileType: "ts" }), - - createFixturePatternConfigFor("typescript/expressions", { - fileType: "ts", - ignore: [ - /** - * currently babylon not supported - */ - "tagged-template-expression-type-arguments" - ] - }), - - createFixturePatternConfigFor("typescript/errorRecovery", { - fileType: "ts", - ignore: [ - /** - * AST difference - */ - "interface-empty-extends", - /** - * TypeScript-specific tests taken from "errorRecovery". Babylon is not being as forgiving as the TypeScript compiler here. - */ - "class-empty-extends-implements", // babylon parse errors - "class-empty-extends", // babylon parse errors - "decorator-on-enum-declaration", // babylon parse errors - "decorator-on-interface-declaration", // babylon parse errors - "interface-property-modifiers", // babylon parse errors - "enum-with-keywords" // babylon parse errors - ] - }), - - createFixturePatternConfigFor("typescript/namespaces-and-modules", { - fileType: "ts", - ignore: [ - /** - * Minor AST difference - */ - "nested-internal-module", - /** - * Babylon: TSDeclareFunction - * tsep: TSNamespaceFunctionDeclaration - */ - "declare-namespace-with-exported-function" - ] - }) -]; - -/** - * Add in all the fixtures which need to be parsed with sourceType: "module" - */ -fixturePatternConfigsToTest = [].concat(fixturePatternConfigsToTest, fixturesRequiringSourceTypeModule); - -/** - * interface Fixture { - * filename: string, - * config?: any - * } - */ -const fixturesToTest = []; -const fixturesDirPath = path.join(__dirname, "../fixtures"); - -/** - * Resolve the glob patterns into actual Fixture files that we can run assertions for... - */ -fixturePatternConfigsToTest.forEach(fixturePatternConfig => { - /** - * Find the fixture files which match the given pattern - */ - const matchingFixtures = glob.sync(`${fixturesDirPath}/${fixturePatternConfig.pattern}`, {}); - matchingFixtures.forEach(filename => { - fixturesToTest.push({ - filename, - config: fixturePatternConfig.config - }); - }); -}); - -module.exports = fixturesToTest; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js b/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js deleted file mode 100644 index 2a310d0ddf36..000000000000 --- a/packages/typescript-eslint-parser/tests/ast-alignment/jest.config.js +++ /dev/null @@ -1,6 +0,0 @@ -"use strict"; - -module.exports = { - testEnvironment: "node", - testRegex: "spec\\.js$" -}; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js b/packages/typescript-eslint-parser/tests/ast-alignment/parse.js deleted file mode 100644 index 11614f60c11d..000000000000 --- a/packages/typescript-eslint-parser/tests/ast-alignment/parse.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; - -const codeFrame = require("babel-code-frame"); -const parseUtils = require("./utils"); - -function createError(message, line, column) { // eslint-disable-line - // Construct an error similar to the ones thrown by Babylon. - const error = new SyntaxError(`${message} (${line}:${column})`); - error.loc = { - line, - column - }; - return error; -} - -function parseWithBabylonPluginTypescript(text, parserOptions) { // eslint-disable-line - parserOptions = parserOptions || {}; - const babylon = require("babylon"); - return babylon.parse(text, Object.assign({ - sourceType: "script", - allowImportExportEverywhere: true, - allowReturnOutsideFunction: true, - ranges: true, - plugins: [ - "jsx", - "typescript", - "objectRestSpread", - "decorators", - "classProperties", - "asyncGenerators", - "dynamicImport", - "estree" - ] - }, parserOptions)); -} - -function parseWithTypeScriptESLintParser(text, parserOptions) { // eslint-disable-line - parserOptions = parserOptions || {}; - const parser = require("../../parser"); - try { - return parser.parse(text, Object.assign({ - loc: true, - range: true, - tokens: false, - comment: false, - useJSXTextNode: true, - errorOnUnknownASTType: true, - ecmaFeatures: { - jsx: true - } - }, parserOptions)); - } catch (e) { - throw createError( - e.message, - e.lineNumber, - e.column - ); - } -} - -module.exports = function parse(text, opts) { - - /** - * Always return a consistent interface, there will be times when we expect both - * parsers to fail to parse the invalid source. - */ - const result = { - parseError: null, - ast: null - }; - - try { - switch (opts.parser) { - case "typescript-eslint-parser": - result.ast = parseUtils.normalizeNodeTypes(parseWithTypeScriptESLintParser(text, opts.typeScriptESLintParserOptions)); - break; - case "babylon-plugin-typescript": - result.ast = parseUtils.normalizeNodeTypes(parseWithBabylonPluginTypescript(text, opts.babylonParserOptions)); - break; - default: - throw new Error("Please provide a valid parser: either \"typescript-eslint-parser\" or \"babylon-plugin-typescript\""); - } - } catch (error) { - const loc = error.loc; - if (loc) { - error.codeFrame = codeFrame(text, loc.line, loc.column + 1, { - highlightCode: true - }); - error.message += `\n${error.codeFrame}`; - } - result.parseError = error; - } - - return result; - -}; diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js b/packages/typescript-eslint-parser/tests/ast-alignment/spec.js deleted file mode 100644 index 3c9114a784db..000000000000 --- a/packages/typescript-eslint-parser/tests/ast-alignment/spec.js +++ /dev/null @@ -1,80 +0,0 @@ -"use strict"; - -const fs = require("fs"); - -const parse = require("./parse"); -const parseUtils = require("./utils"); -const fixturesToTest = require("./fixtures-to-test"); - -fixturesToTest.forEach(fixture => { - - const filename = fixture.filename; - const source = fs.readFileSync(filename, "utf8").replace(/\r\n/g, "\n"); - - /** - * Parse with typescript-eslint-parser - */ - const typeScriptESLintParserResult = parse(source, { - parser: "typescript-eslint-parser", - typeScriptESLintParserOptions: (fixture.config && fixture.config.typeScriptESLintParserOptions) ? fixture.config.typeScriptESLintParserOptions : null - }); - - /** - * Parse the source with babylon typescript-plugin - */ - const babylonTypeScriptPluginResult = parse(source, { - parser: "babylon-plugin-typescript", - babylonParserOptions: (fixture.config && fixture.config.babylonParserOptions) ? fixture.config.babylonParserOptions : null - }); - - /** - * If babylon fails to parse the source, ensure that typescript-eslint-parser has the same fundamental issue - */ - if (babylonTypeScriptPluginResult.parseError) { - /** - * FAIL: babylon errored but typescript-eslint-parser did not - */ - if (!typeScriptESLintParserResult.parseError) { - test(`TEST FAIL [BABYLON ERRORED, BUT TSEP DID NOT] - ${filename}`, () => { - expect(typeScriptESLintParserResult.parseError).toEqual(babylonTypeScriptPluginResult.parseError); - }); - return; - } - /** - * Both parsers errored - this is OK as long as the errors are of the same "type" - */ - test(`[Both parsers error as expected] - ${filename}`, () => { - expect(babylonTypeScriptPluginResult.parseError.name).toEqual(typeScriptESLintParserResult.parseError.name); - }); - return; - } - - /** - * FAIL: typescript-eslint-parser errored but babylon did not - */ - if (typeScriptESLintParserResult.parseError) { - test(`TEST FAIL [TSEP ERRORED, BUT BABYLON DID NOT] - ${filename}`, () => { - expect(babylonTypeScriptPluginResult.parseError).toEqual(typeScriptESLintParserResult.parseError); - }); - return; - } - - /** - * No errors, assert the two ASTs match - */ - test(`${filename}`, () => { - expect(babylonTypeScriptPluginResult.ast).toBeTruthy(); - expect(typeScriptESLintParserResult.ast).toBeTruthy(); - /** - * Perform some extra formatting steps on the babylon AST before comparing - */ - expect( - parseUtils.removeLocationDataFromProgramNode( - parseUtils.preprocessBabylonAST(babylonTypeScriptPluginResult.ast) - ) - ).toEqual( - parseUtils.removeLocationDataFromProgramNode(typeScriptESLintParserResult.ast) - ); - }); - -}); diff --git a/packages/typescript-eslint-parser/tests/ast-alignment/utils.js b/packages/typescript-eslint-parser/tests/ast-alignment/utils.js deleted file mode 100644 index 22cca72545b7..000000000000 --- a/packages/typescript-eslint-parser/tests/ast-alignment/utils.js +++ /dev/null @@ -1,154 +0,0 @@ -"use strict"; - -const isPlainObject = require("lodash.isplainobject"); - -/** - * By default, pretty-format (within Jest matchers) retains the names/types of nodes from the babylon AST, - * quick and dirty way to avoid that is to JSON.stringify and then JSON.parser the - * ASTs before comparing them with pretty-format - * - * @param {Object} ast raw AST - * @returns {Object} normalized AST - */ -function normalizeNodeTypes(ast) { - return JSON.parse(JSON.stringify(ast)); -} - -/** - * Removes the given keys from the given AST object recursively - * @param {Object} obj A JavaScript object to remove keys from - * @param {Object[]} keysToOmit Names and predicate functions use to determine what keys to omit from the final object - * @returns {Object} formatted object - */ -function omitDeep(obj, keysToOmit) { - keysToOmit = keysToOmit || []; - function shouldOmit(keyName, val) { // eslint-disable-line - if (!keysToOmit || !keysToOmit.length) { - return false; - } - for (const keyConfig of keysToOmit) { - if (keyConfig.key !== keyName) { - continue; - } - return keyConfig.predicate(val); - } - return false; - } - - for (const key in obj) { - if (!obj.hasOwnProperty(key)) { - continue; - } - const val = obj[key]; - if (isPlainObject(val)) { - if (shouldOmit(key, val)) { - delete obj[key]; - // re-run with the same arguments - // in case the object has multiple keys to omit - return omitDeep(obj, keysToOmit); - } - omitDeep(val, keysToOmit); - } else if (Array.isArray(val)) { - if (shouldOmit(key, val)) { - delete obj[key]; - // re-run with the same arguments - // in case the object has multiple keys to omit - return omitDeep(obj, keysToOmit); - } - for (const i of val) { - omitDeep(i, keysToOmit); - } - } else if (shouldOmit(key, val)) { - delete obj[key]; - // re-run with the same arguments - // in case the object has multiple keys to omit - return omitDeep(obj, keysToOmit); - } - } - return obj; -} - -/* eslint-disable */ -/** - * Common predicates for Babylon AST preprocessing - */ -const always = () => true; -const ifNumber = (val) => typeof val === "number"; -/* eslint-enable */ - -/** - * - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now... - * - Remove "start" and "end" values from Babylon nodes to reduce unimportant noise in diffs ("loc" data will still be in - * each final AST and compared). - * - * @param {Object} ast raw babylon AST - * @returns {Object} processed babylon AST - */ -function preprocessBabylonAST(ast) { - return omitDeep(ast.program, [ - { - key: "start", - // only remove the "start" number (not the "start" object within loc) - predicate: ifNumber - }, - { - key: "end", - // only remove the "end" number (not the "end" object within loc) - predicate: ifNumber - }, - { - key: "identifierName", - predicate: always - }, - { - key: "extra", - predicate: always - }, - { - key: "directives", - predicate: always - }, - { - key: "directive", - predicate: always - }, - { - key: "innerComments", - predicate: always - }, - { - key: "leadingComments", - predicate: always - }, - { - key: "trailingComments", - predicate: always - }, - { - key: "guardedHandlers", - predicate: always - } - ]); -} - -/** - * There is currently a really awkward difference in location data for Program nodes - * between different parsers in the ecosystem. Hack around this by removing the data - * before comparing the ASTs. - * - * See: https://github.com/babel/babylon/issues/673 - * - * @param {Object} ast the raw AST with a Program node at its top level - * @returns {Object} the ast with the location data removed from the Program node - */ -function removeLocationDataFromProgramNode(ast) { - delete ast.loc; - delete ast.range; - return ast; -} - -module.exports = { - normalizeNodeTypes, - preprocessBabylonAST, - removeLocationDataFromProgramNode -}; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap deleted file mode 100644 index ae6a9a339e17..000000000000 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/parse.js.snap +++ /dev/null @@ -1,190 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`parse() general output tokens, comments, locs, and ranges when called with those options 1`] = ` -Object { - "body": Array [ - Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 13, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 14, - ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 14, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 3, - ], - "type": "Keyword", - "value": "let", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 7, - ], - "type": "Identifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "=", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-eslint-parser/tests/lib/parse.js b/packages/typescript-eslint-parser/tests/lib/parse.js deleted file mode 100644 index c84499233819..000000000000 --- a/packages/typescript-eslint-parser/tests/lib/parse.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @fileoverview Tests for tokenize(). - * @author Nicholas C. Zakas - * @author James Henry - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const parser = require("../../parser"), - testUtils = require("../../tools/test-utils"); - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ - -describe("parse()", () => { - - - describe("basic functionality", () => { - - it("should parse an empty string", () => { - expect(parser.parse("").body).toEqual([]); - expect(parser.parse("", {}).body).toEqual([]); - }); - - }); - - describe("modules", () => { - - it("should have correct column number when strict mode error occurs", () => { - try { - parser.parse("function fn(a, a) {\n}", { sourceType: "module" }); - } catch (err) { - expect(err.column).toEqual(16); - } - }); - - }); - - describe("general", () => { - - const code = "let foo = bar;"; - const config = { - ecmaFeatures: { - blockBindings: true - }, - comment: true, - tokens: true, - range: true, - loc: true - }; - - test("output tokens, comments, locs, and ranges when called with those options", testUtils.createSnapshotTestBlock(code, config)); - - }); - - -}); From 9e4afd93f697f735d5cdbf6b5bf53c74cac1b6dc Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 25 Sep 2018 10:50:50 -0400 Subject: [PATCH 278/326] Build: changelog update for 19.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index a2ae68653990..850248f3adee 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v19.0.0 - September 25, 2018 + +* 3d3ab2f Breaking: Use typescript-estree for parsing (#515) (James Henry) + v18.0.0 - August 6, 2018 * 16d1a78 Breaking: Support TypeScript 3.0 (#504) (James Henry) From 8fb1a7e066b90b79710c943ea9d2ff57c18683f7 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 25 Sep 2018 10:50:50 -0400 Subject: [PATCH 279/326] 19.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index a86fc47e3f8b..09ec81c34f4d 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "18.0.0", + "version": "19.0.0", "files": [ "lib", "parser.js" From 76174c09ac5a970fe83c03d7a9c1ee77806fbeef Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 25 Sep 2018 11:12:40 -0400 Subject: [PATCH 280/326] Fix: Remove lib from package.json files (#518) --- packages/typescript-eslint-parser/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 09ec81c34f4d..309e11a19dab 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -6,7 +6,6 @@ "main": "parser.js", "version": "19.0.0", "files": [ - "lib", "parser.js" ], "engines": { From 9ea56f69706631d01dd1588cba1ea07005b3a2f1 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 25 Sep 2018 11:13:41 -0400 Subject: [PATCH 281/326] Build: changelog update for 19.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 850248f3adee..1be50f4bfb24 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v19.0.1 - September 25, 2018 + +* 7a367c7 Fix: Remove lib from package.json files (#518) (James Henry) + v19.0.0 - September 25, 2018 * 3d3ab2f Breaking: Use typescript-estree for parsing (#515) (James Henry) From ed1bb65b5a11497a211b6f0d70a75c1fe10b77e0 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 25 Sep 2018 11:13:41 -0400 Subject: [PATCH 282/326] 19.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 309e11a19dab..2f8d92cfc621 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "19.0.0", + "version": "19.0.1", "files": [ "parser.js" ], From 872e07be8239820fbbdb32c70e29beb15baadcf8 Mon Sep 17 00:00:00 2001 From: Kevin Partington Date: Sat, 29 Sep 2018 22:00:47 -0500 Subject: [PATCH 283/326] Chore: Makefile tweaks (#522) Simplify Jest calls, reorder some code to avoid lint disabling, and add check for unused disable comments --- packages/typescript-eslint-parser/Makefile.js | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index 2cd8c66c523c..ed73020373c5 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -26,23 +26,6 @@ const OPEN_SOURCE_LICENSES = [ /MIT/, /BSD/, /Apache/, /ISC/, /WTF/, /Public Domain/ ]; -//------------------------------------------------------------------------------ -// Data -//------------------------------------------------------------------------------ - -const NODE_MODULES = "./node_modules/", - - // Utilities - intentional extra space at the end of each string - JEST = `${NODE_MODULES}jest/bin/jest.js`, - - // Files - MAKEFILE = "./Makefile.js", - /* eslint-disable no-use-before-define */ - JS_FILES = "parser.js", - TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), - TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); - /* eslint-enable no-use-before-define */ - //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -59,6 +42,19 @@ function fileType(extension) { }; } +//------------------------------------------------------------------------------ +// Data +//------------------------------------------------------------------------------ + +const JEST = "jest", + LINT_OPTIONS = "--report-unused-disable-directives", + + // Files + MAKEFILE = "./Makefile.js", + JS_FILES = "parser.js", + TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), + TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); + //------------------------------------------------------------------------------ // Tasks //------------------------------------------------------------------------------ @@ -72,25 +68,25 @@ target.lint = function() { lastReturn; echo("Validating Makefile.js"); - lastReturn = nodeCLI.exec("eslint", MAKEFILE); + lastReturn = nodeCLI.exec("eslint", MAKEFILE, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; } echo("Validating JavaScript files"); - lastReturn = nodeCLI.exec("eslint", JS_FILES); + lastReturn = nodeCLI.exec("eslint", JS_FILES, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; } echo("Validating JavaScript test files"); - lastReturn = nodeCLI.exec("eslint", TEST_FILES); + lastReturn = nodeCLI.exec("eslint", TEST_FILES, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; } echo("Validating JavaScript tools files"); - lastReturn = nodeCLI.exec("eslint", TOOLS_FILES); + lastReturn = nodeCLI.exec("eslint", TOOLS_FILES, LINT_OPTIONS); if (lastReturn.code !== 0) { errors++; } From 622188bab71e4b678955ed55c68819a52ceb195a Mon Sep 17 00:00:00 2001 From: Kevin Partington Date: Sat, 29 Sep 2018 22:01:17 -0500 Subject: [PATCH 284/326] Fix: Re-expose parse method (fixes #519) (#521) --- packages/typescript-eslint-parser/parser.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 9f12905d2f9a..c5ed51424646 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -32,6 +32,10 @@ exports.parseForESLint = function parseForESLint(code, options) { return { ast }; }; +exports.parse = function(code, options) { + return this.parseForESLint(code, options).ast; +}; + // Deep copy. /* istanbul ignore next */ exports.Syntax = (function() { From bccf1e993591443490312947c2dc77846ffda2dc Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sat, 29 Sep 2018 23:02:57 -0400 Subject: [PATCH 285/326] Build: changelog update for 19.0.2 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 1be50f4bfb24..2dd097488cac 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v19.0.2 - September 29, 2018 + +* aa0fe13 Fix: Re-expose parse method (fixes #519) (#521) (Kevin Partington) +* 655359f Chore: Makefile tweaks (#522) (Kevin Partington) + v19.0.1 - September 25, 2018 * 7a367c7 Fix: Remove lib from package.json files (#518) (James Henry) From ded2b809eac8022a286cb6900a6419db2f603eb0 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Sat, 29 Sep 2018 23:02:57 -0400 Subject: [PATCH 286/326] 19.0.2 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 2f8d92cfc621..7ff827c8af33 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "19.0.1", + "version": "19.0.2", "files": [ "parser.js" ], From f1a3432abd626043f4c173b32ebae324462ef50a Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 8 Oct 2018 13:12:34 -0400 Subject: [PATCH 287/326] Breaking: Support TypeScript 3.1 (fixes #524) (#525) --- packages/typescript-eslint-parser/README.md | 7 +++---- packages/typescript-eslint-parser/package.json | 6 +++--- .../declared-empty-body-functions-issue-162/package.json | 2 +- .../integration/jsdoc-indent-issues-344-422/package.json | 2 +- .../integration/method-overloads-issue-389/package.json | 2 +- .../package.json | 2 +- .../integration/range-error-indent-issue-333/package.json | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 60a3cbbe86e1..f7027ecf317f 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -1,3 +1,6 @@ +>

Help Wanted!

+> If you're familiar with TypeScript and ESLint, and you'd like to see this project progress, please consider contributing. We need people with a good knowledge of TypeScript to ensure that the integration with the ESLint ecosystem is useful. + # TypeScript ESLint Parser An ESLint custom parser which leverages [TypeScript ESTree](https://github.com/JamesHenry/typescript-estree) to allow for ESLint to lint TypeScript source code. @@ -37,10 +40,6 @@ If you use a non-supported version of TypeScript, the parser will log a warning **Please ensure that you are using a supported version before submitting any issues/bug reports.** -## Help Wanted! - -If you're familiar with TypeScript and ESLint, and you'd like to see this project progress, please consider contributing. We need people with a good knowledge of TypeScript to ensure this parser is useful. - ## Reporting Issues Please **do not report parsing/AST issues in this repo**, report them directly to [TypeScript ESTree](https://github.com/JamesHenry/typescript-estree). diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 7ff827c8af33..9ce420a275e6 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -1,6 +1,6 @@ { "name": "typescript-eslint-parser", - "description": "An Esprima-style parser for TypeScript", + "description": "An ESLint custom parser which leverages TypeScript ESTree", "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", @@ -24,7 +24,7 @@ "npm-license": "0.3.3", "shelljs": "0.8.2", "shelljs-nodecli": "0.1.1", - "typescript": "~3.0.1" + "typescript": "~3.1.1" }, "keywords": [ "ast", @@ -49,7 +49,7 @@ }, "dependencies": { "eslint": "4.19.1", - "typescript-estree": "1.0.0" + "typescript-estree": "2.1.0" }, "peerDependencies": { "typescript": "*" diff --git a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json index 6881c7361e35..90295710207e 100644 --- a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json +++ b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~2.9.1" + "typescript": "~3.1.1" } } \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json index 6881c7361e35..90295710207e 100644 --- a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json +++ b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~2.9.1" + "typescript": "~3.1.1" } } \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json index 6881c7361e35..90295710207e 100644 --- a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json +++ b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~2.9.1" + "typescript": "~3.1.1" } } \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json index 6881c7361e35..90295710207e 100644 --- a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json +++ b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~2.9.1" + "typescript": "~3.1.1" } } \ No newline at end of file diff --git a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json index 6881c7361e35..90295710207e 100644 --- a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json +++ b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~2.9.1" + "typescript": "~3.1.1" } } \ No newline at end of file From bd6b4d57ff93c5c03d035da54950c02883350ea5 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 8 Oct 2018 13:13:31 -0400 Subject: [PATCH 288/326] Build: changelog update for 20.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 2dd097488cac..f4b1215a6ce2 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v20.0.0 - October 8, 2018 + +* f4b9893 Breaking: Support TypeScript 3.1 (fixes #524) (#525) (James Henry) + v19.0.2 - September 29, 2018 * aa0fe13 Fix: Re-expose parse method (fixes #519) (#521) (Kevin Partington) From 027acaa2bef5a6deab6187d2cf20d67cd7d17af5 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 8 Oct 2018 13:13:31 -0400 Subject: [PATCH 289/326] 20.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 9ce420a275e6..8ffc5ecc4654 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "19.0.2", + "version": "20.0.0", "files": [ "parser.js" ], From e4a9317b3cc77f79e789631b4e4c4f4036fbbf5d Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Wed, 17 Oct 2018 21:19:42 -0400 Subject: [PATCH 290/326] Upgrade: eslint-release@1.0.0 (#527) (refs https://github.com/eslint/eslint/issues/10631) This updates `eslint-release` to allow the package to still be published from the Jenkins server now that we have 2FA enabled on the bot account. Some changes are also needed on the Jenkins server -- I plan to make those changes after this is merged. --- packages/typescript-eslint-parser/.gitignore | 1 + packages/typescript-eslint-parser/package.json | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/typescript-eslint-parser/.gitignore b/packages/typescript-eslint-parser/.gitignore index 256e4f32d3b5..5f017910cbc6 100644 --- a/packages/typescript-eslint-parser/.gitignore +++ b/packages/typescript-eslint-parser/.gitignore @@ -6,3 +6,4 @@ _test.js .DS_Store .vscode yarn.lock +.eslint-release-info.json diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 8ffc5ecc4654..94ee32637ff2 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -19,7 +19,7 @@ "devDependencies": { "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "6.0.1", - "eslint-release": "0.11.1", + "eslint-release": "1.1.0", "jest": "23.1.0", "npm-license": "0.3.3", "shelljs": "0.8.2", @@ -41,11 +41,11 @@ "integration-tests": "docker-compose -f tests/integration/docker-compose.yml up", "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", "lint": "node Makefile.js lint", - "release": "eslint-release", - "ci-release": "eslint-ci-release", - "gh-release": "eslint-gh-release", - "alpharelease": "eslint-prerelease alpha", - "betarelease": "eslint-prerelease beta" + "generate-release": "eslint-generate-release", + "generate-alpharelease": "eslint-generate-prerelease alpha", + "generate-betarelease": "eslint-generate-prerelease beta", + "generate-rcrelease": "eslint-generate-prerelease rc", + "publish-release": "eslint-publish-release" }, "dependencies": { "eslint": "4.19.1", From 6160a4db0d1ead26825504bfdb866647376ad205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sajn=C3=B3g?= Date: Wed, 31 Oct 2018 01:52:21 +0100 Subject: [PATCH 291/326] New: Add visitor keys (#516) --- packages/typescript-eslint-parser/Makefile.js | 2 +- .../typescript-eslint-parser/package.json | 4 +- packages/typescript-eslint-parser/parser.js | 3 +- .../typescript-eslint-parser/visitor-keys.js | 87 +++++++++++++++++++ 4 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 packages/typescript-eslint-parser/visitor-keys.js diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js index ed73020373c5..3cf9d1fdc452 100644 --- a/packages/typescript-eslint-parser/Makefile.js +++ b/packages/typescript-eslint-parser/Makefile.js @@ -51,7 +51,7 @@ const JEST = "jest", // Files MAKEFILE = "./Makefile.js", - JS_FILES = "parser.js", + JS_FILES = "parser.js visitor-keys.js", TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 94ee32637ff2..81130e63e3a7 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -6,7 +6,8 @@ "main": "parser.js", "version": "20.0.0", "files": [ - "parser.js" + "parser.js", + "visitor-keys.js" ], "engines": { "node": ">=6.14.0" @@ -49,6 +50,7 @@ }, "dependencies": { "eslint": "4.19.1", + "eslint-visitor-keys": "^1.0.0", "typescript-estree": "2.1.0" }, "peerDependencies": { diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index c5ed51424646..32b4e7cf245a 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -11,6 +11,7 @@ const parse = require("typescript-estree").parse; const astNodeTypes = require("typescript-estree").AST_NODE_TYPES; const traverser = require("eslint/lib/util/traverser"); +const visitorKeys = require("./visitor-keys"); //------------------------------------------------------------------------------ // Public @@ -29,7 +30,7 @@ exports.parseForESLint = function parseForESLint(code, options) { } } }); - return { ast }; + return { ast, visitorKeys }; }; exports.parse = function(code, options) { diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js new file mode 100644 index 000000000000..18cf5920f70c --- /dev/null +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -0,0 +1,87 @@ +/** + * @fileoverview The visitor keys for the new and updated node types + * @author Michał Sajnóg + * MIT License + */ + +"use strict"; + +const Evk = require("eslint-visitor-keys"); + +module.exports = Evk.unionWith({ + ArrayPattern: ["typeAnnotation"], + ArrowFunctionExpression: ["returnType", "typeParameters"], + AssignmentPattern: ["typeAnnotation"], + CallExpression: ["typeParameters"], + ClassDeclaration: ["superTypeParameters", "typeParameters"], + ClassExpression: ["superTypeParameters", "typeParameters"], + ClassImplements: ["typeParameters"], + ClassProperty: ["typeAnnotation"], + FunctionDeclaration: ["returnType", "typeParameters"], + FunctionExpression: ["returnType", "typeParameters"], + Identifier: ["typeAnnotation"], + InterfaceDeclaration: ["typeParameters"], + NewExpression: ["typeParameters"], + ObjectPattern: ["typeAnnotation"], + /** + * According to https://github.com/estree/estree/blob/master/extensions/type-annotations.md + * RestElement should have "typeAnnotation", but has not. Annotation is added on the "parameter" node + */ + RestElement: [], + TaggedTemplateExpression: ["typeParameters"], + VariableDeclarator: ["typeParameters"], + + TSAbstractClassProperty: ["typeAnnotation", "key", "value"], + TSAbstractClassDeclaration: ["id", "body", "superClass", "implements"], + TSAbstractKeyword: [], + TSAbstractMethodDefinition: ["key", "value"], + TSAnyKeyword: [], + TSArrayType: ["elementType"], + TSAsyncKeyword: [], + TSBooleanKeyword: [], + TSConstructorType: ["typeAnnotation", "parameters"], + TSConstructSignature: ["typeAnnotation", "typeParameters"], + TSDeclareKeyword: [], + TSEnumDeclaration: ["members"], + TSEnumMember: ["initializer"], + TSExportAssignment: ["expression"], + TSExportKeyword: [], + TSImportType: ["parameter", "qualifier", "typeParameters"], + TSLiteralType: ["literal"], + TSIndexSignature: ["typeAnnotation", "index"], + TSInterfaceBody: ["body"], + TSInterfaceDeclaration: ["body", "id", "heritage"], + TSInterfaceHeritage: ["id", "typeParameters"], + TSFunctionType: ["typeAnnotation"], + TSMethodSignature: ["typeAnnotation", "typeParameters", "key", "params"], + TSModuleBlock: ["body"], + TSModuleDeclaration: ["id", "body"], + TSNamespaceFunctionDeclaration: [], + TSNonNullExpression: ["expression"], + TSNeverKeyword: [], + TSNullKeyword: [], + TSNumberKeyword: [], + TSObjectKeyword: [], + TSParameterProperty: ["parameter"], + TSPrivateKeyword: [], + TSPropertySignature: ["typeAnnotation", "key", "initializer"], + TSProtectedKeyword: [], + TSPublicKeyword: [], + TSQualifiedName: ["left", "right"], + TSQuestionToken: [], + TSReadonlyKeyword: [], + TSStaticKeyword: [], + TSStringKeyword: [], + TSSymbolKeyword: [], + TSTypeAnnotation: ["typeAnnotation"], + TSTypeLiteral: ["members"], + TSTypeOperator: ["typeAnnotation"], + TSTypeParameter: ["constraint", "default"], + TSTypeParameterDeclaration: ["params"], + TSTypeParameterInstantiation: ["params"], + TSTypePredicate: ["typeAnnotation", "parameterName"], + TSTypeReference: ["typeName", "typeParameters"], + TSUnionType: ["types"], + TSUndefinedKeyword: [], + TSVoidKeyword: [] +}); From 0e340e5f5663017b661ef99216ac479477464084 Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Tue, 30 Oct 2018 17:52:55 -0700 Subject: [PATCH 292/326] Chore: Force LF for tsx files (#520) --- packages/typescript-eslint-parser/.gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typescript-eslint-parser/.gitattributes b/packages/typescript-eslint-parser/.gitattributes index b9aad4d12c4d..8db1f2632df7 100644 --- a/packages/typescript-eslint-parser/.gitattributes +++ b/packages/typescript-eslint-parser/.gitattributes @@ -1,4 +1,5 @@ * text=auto *.js eol=lf *.ts eol=lf +*.tsx eol=lf *.yml eol=lf From bc7bbf8e1fe14c58e8c60b7ed7d70a3557e836b4 Mon Sep 17 00:00:00 2001 From: Kevin Partington Date: Tue, 30 Oct 2018 20:02:43 -0500 Subject: [PATCH 293/326] Chore: Make ESLint a devDependency/peerDependency (fixes #523) (#526) * Chore: Make ESLint a devDependency/peerDependency (fixes #523) * Chore: Open eslint peerDependency range to allow 5.x --- packages/typescript-eslint-parser/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 81130e63e3a7..1861c3870dfa 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -18,6 +18,7 @@ }, "license": "BSD-2-Clause", "devDependencies": { + "eslint": "^4.19.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "6.0.1", "eslint-release": "1.1.0", @@ -49,11 +50,11 @@ "publish-release": "eslint-publish-release" }, "dependencies": { - "eslint": "4.19.1", "eslint-visitor-keys": "^1.0.0", "typescript-estree": "2.1.0" }, "peerDependencies": { + "eslint": ">=4.19.0 <6.0.0", "typescript": "*" }, "jest": { From 9a4e1bf637ed7ba1614ec4c73beff75d2c494dcb Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 30 Oct 2018 21:05:33 -0400 Subject: [PATCH 294/326] Build: changelog update for 20.1.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index f4b1215a6ce2..0d1cb381369b 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,10 @@ +v20.1.0 - October 30, 2018 + +* 075d243 Chore: Make ESLint a devDependency/peerDependency (fixes #523) (#526) (Kevin Partington) +* 4310aac Chore: Force LF for tsx files (#520) (Benjamin Lichtman) +* bacac5f New: Add visitor keys (#516) (Michał Sajnóg) +* 4172933 Upgrade: eslint-release@1.0.0 (#527) (Teddy Katz) + v20.0.0 - October 8, 2018 * f4b9893 Breaking: Support TypeScript 3.1 (fixes #524) (#525) (James Henry) From c83b6d4931d562edd084f1655b7f6d5e5fa3d37e Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 30 Oct 2018 21:05:33 -0400 Subject: [PATCH 295/326] 20.1.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 1861c3870dfa..2a582b99fdae 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "20.0.0", + "version": "20.1.0", "files": [ "parser.js", "visitor-keys.js" From 570b8ad685b605cca28778b6d34d542dd54efad5 Mon Sep 17 00:00:00 2001 From: Kevin Partington Date: Wed, 31 Oct 2018 12:49:47 -0500 Subject: [PATCH 296/326] Revert "Chore: Make ESLint a devDependency/peerDependency (fixes #523)" (#537) * Revert "20.1.0" This reverts commit de1f5149614a8aa18dc85fe603d96f1310f8b89c. * Revert "Build: changelog update for 20.1.0" This reverts commit edbe70e70d307020172ce715888259f9052ca4fa. * Revert "Chore: Make ESLint a devDependency/peerDependency (fixes #523) (#526)" This reverts commit 075d24300ee715534f36d0779cf0222a6ac78831. --- packages/typescript-eslint-parser/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 2a582b99fdae..4f37f3f3ec2f 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -18,7 +18,6 @@ }, "license": "BSD-2-Clause", "devDependencies": { - "eslint": "^4.19.0", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "6.0.1", "eslint-release": "1.1.0", @@ -50,11 +49,11 @@ "publish-release": "eslint-publish-release" }, "dependencies": { + "eslint": "4.19.1", "eslint-visitor-keys": "^1.0.0", "typescript-estree": "2.1.0" }, "peerDependencies": { - "eslint": ">=4.19.0 <6.0.0", "typescript": "*" }, "jest": { From 42a2c34b91b1a09f45fdadaf2162bcf60eb15887 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 31 Oct 2018 14:00:03 -0400 Subject: [PATCH 297/326] Build: changelog update for 20.1.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 0d1cb381369b..05f923658bdd 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +v20.1.1 - October 31, 2018 + +* 1683169 Revert "Chore: Make ESLint a devDependency/peerDependency (fixes #523)" (#537) (Kevin Partington) + v20.1.0 - October 30, 2018 * 075d243 Chore: Make ESLint a devDependency/peerDependency (fixes #523) (#526) (Kevin Partington) From b7df04fd94b9545c55c4a48258ba8f02a9defa18 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Wed, 31 Oct 2018 14:00:04 -0400 Subject: [PATCH 298/326] 20.1.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 4f37f3f3ec2f..2eb62bc716fb 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "20.1.0", + "version": "20.1.1", "files": [ "parser.js", "visitor-keys.js" From abb224fac0c42aef08fe259d9352cdbc6d3d98b1 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Mon, 5 Nov 2018 15:34:26 -0800 Subject: [PATCH 299/326] Docs: add options to README (#530) * add options to README * Link to full options --- packages/typescript-eslint-parser/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index f7027ecf317f..c34e0ec919f1 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -30,6 +30,18 @@ Instead, you also need to make use of one more plugins which will add or extend By far the most common case will be installing the [eslint-plugin-typescript](https://github.com/nzakas/eslint-plugin-typescript) plugin, but there are also other relevant options available such a [eslint-plugin-tslint](https://github.com/JamesHenry/eslint-plugin-tslint). +## Options + +The full list of options can be found in the [typescript-estree README](https://github.com/JamesHenry/typescript-estree#parsecode-options). Use them like this in your eslintrc: + +```js +parserOptions: { + ecmaFeatures: { + jsx: true, + } +} +``` + ## Supported TypeScript Version We will always endeavor to support the latest stable version of TypeScript. From 6d7baf6105f2f8404a3df46499b57ce78821f1f2 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Wed, 7 Nov 2018 13:51:59 -0500 Subject: [PATCH 300/326] Breaking: typescript-estree v5 (#538) * Upgrade: typescript-estree v5 * Simplify options * Update tests * Update documentation * Remove outdated comments in tests --- packages/typescript-eslint-parser/README.md | 26 +- .../typescript-eslint-parser/package.json | 2 +- .../tests/lib/__snapshots__/basics.js.snap | 9 + .../lib/__snapshots__/ecma-features.js.snap | 326 ++++++++++++++++++ .../tests/lib/__snapshots__/jsx.js.snap | 43 +++ .../tests/lib/__snapshots__/tsx.js.snap | 2 + .../lib/__snapshots__/typescript.js.snap | 294 ++++++++++++++++ .../tests/lib/basics.js | 13 +- .../tests/lib/comments.js | 10 +- .../tests/lib/ecma-features.js | 20 +- .../typescript-eslint-parser/tests/lib/jsx.js | 12 +- .../typescript-eslint-parser/tests/lib/tsx.js | 10 +- .../tests/lib/typescript.js | 11 +- .../tools/test-utils.js | 11 +- 14 files changed, 710 insertions(+), 79 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index c34e0ec919f1..68c8deee7bd2 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -17,7 +17,9 @@ npm install --save-dev typescript-eslint-parser In your ESLint configuration file, set the `parser` property: ```json -"parser": "typescript-eslint-parser" +{ + "parser": "typescript-eslint-parser" +} ``` There is sometimes an incorrect assumption that the parser itself is what does everything necessary to facilitate the use of ESLint with TypeScript. In actuality, it is the combination of the parser _and_ one or more plugins which allow you to maximize your usage of ESLint with TypeScript. @@ -30,15 +32,23 @@ Instead, you also need to make use of one more plugins which will add or extend By far the most common case will be installing the [eslint-plugin-typescript](https://github.com/nzakas/eslint-plugin-typescript) plugin, but there are also other relevant options available such a [eslint-plugin-tslint](https://github.com/JamesHenry/eslint-plugin-tslint). -## Options +## Configuration + +The following additional configuration options are available by specifying them in [`parserOptions`](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) in your ESLint configuration file. + +**`jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html). -The full list of options can be found in the [typescript-estree README](https://github.com/JamesHenry/typescript-estree#parsecode-options). Use them like this in your eslintrc: +**`useJSXTextNode`** - default `false`. The JSX AST changed the node type for string literals inside a JSX Element from `Literal` to `JSXText`. When value is `true`, these nodes will be parsed as type `JSXText`. When value is `false`, these nodes will be parsed as type `Literal`. -```js -parserOptions: { - ecmaFeatures: { - jsx: true, - } +### .eslintrc.json + +```json +{ + "parser": "typescript-eslint-parser", + "parserOptions": { + "jsx": true, + "useJSXTextNode": true + } } ``` diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 2eb62bc716fb..efa7b8b43717 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -51,7 +51,7 @@ "dependencies": { "eslint": "4.19.1", "eslint-visitor-keys": "^1.0.0", - "typescript-estree": "2.1.0" + "typescript-estree": "5.0.0" }, "peerDependencies": { "typescript": "*" diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap index 68590ebf8bfe..d952c5af516e 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap @@ -94,6 +94,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -499,6 +500,7 @@ Object { "type": "DoWhileStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -1177,6 +1179,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -1544,6 +1547,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 17, @@ -1712,6 +1716,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -1973,6 +1978,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 6, @@ -2215,6 +2221,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -2515,6 +2522,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 4, @@ -2974,6 +2982,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 694c8b4ead09..00a985dcd472 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -98,6 +98,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -416,6 +417,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 18, @@ -715,6 +717,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -1056,6 +1059,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -1626,6 +1630,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -1925,6 +1930,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 19, @@ -2189,6 +2195,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -2517,6 +2524,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 32, @@ -2853,6 +2861,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 27, @@ -3207,6 +3216,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 30, @@ -3507,6 +3517,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 26, @@ -3771,6 +3782,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -4071,6 +4083,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 35, @@ -4407,6 +4420,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 30, @@ -4743,6 +4757,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 30, @@ -5061,6 +5076,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 30, @@ -5307,6 +5323,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 25, @@ -5536,6 +5553,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 6, @@ -5783,6 +5801,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 9, @@ -6051,6 +6070,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -6351,6 +6371,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 17, @@ -6651,6 +6672,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 18, @@ -6951,6 +6973,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 16, @@ -7125,6 +7148,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 11, @@ -7317,6 +7341,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 16, @@ -7563,6 +7588,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 10, @@ -7814,6 +7840,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -8137,6 +8164,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 29, @@ -8599,6 +8627,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 12, @@ -8773,6 +8802,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -8982,6 +9012,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -9153,6 +9184,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9250,6 +9282,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9384,6 +9417,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9572,6 +9606,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9854,6 +9889,7 @@ Object { "type": "SwitchStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -10414,6 +10450,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 32, @@ -10931,6 +10968,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 26, @@ -11262,6 +11300,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 11, @@ -11545,6 +11584,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -11900,6 +11940,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 22, @@ -12256,6 +12297,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -12593,6 +12635,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -13001,6 +13044,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -13428,6 +13472,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -13820,6 +13865,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 35, @@ -14229,6 +14275,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 29, @@ -14795,6 +14842,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 59, @@ -15516,6 +15564,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 39, @@ -16165,6 +16214,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 21, @@ -16690,6 +16740,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 48, @@ -17249,6 +17300,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 22, @@ -17790,6 +17842,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -18367,6 +18420,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -18926,6 +18980,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 56, @@ -19407,6 +19462,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 26, @@ -19782,6 +19838,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -20173,6 +20230,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -20505,6 +20563,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 28, @@ -20782,6 +20841,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 20, @@ -21022,6 +21082,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 11, @@ -21208,6 +21269,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 11, @@ -21394,6 +21456,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 12, @@ -21616,6 +21679,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 21, @@ -21821,6 +21885,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -22068,6 +22133,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -22364,6 +22430,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -22604,6 +22671,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 22, @@ -22979,6 +23047,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -23408,6 +23477,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -23761,6 +23831,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 20, @@ -24096,6 +24167,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 22, @@ -24507,6 +24579,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 27, @@ -24970,6 +25043,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 36, @@ -25410,6 +25484,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 12, @@ -25724,6 +25799,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 16, @@ -26057,6 +26133,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -26415,6 +26492,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -26953,6 +27031,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -27641,6 +27720,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -28257,6 +28337,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -28723,6 +28804,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -29261,6 +29343,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -29949,6 +30032,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -30565,6 +30649,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -30968,6 +31053,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 10, @@ -31355,6 +31441,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -32025,6 +32112,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 39, @@ -32628,6 +32716,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -33088,6 +33177,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 28, @@ -33548,6 +33638,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -33974,6 +34065,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 16, @@ -34496,6 +34588,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -34994,6 +35087,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 22, @@ -35570,6 +35664,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 42, @@ -36290,6 +36385,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 32, @@ -36938,6 +37034,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 26, @@ -37514,6 +37611,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -38091,6 +38189,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -38704,6 +38803,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 27, @@ -39391,6 +39491,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -40351,6 +40452,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -41138,6 +41240,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -41544,6 +41647,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -41976,6 +42080,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -42836,6 +42941,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 53, @@ -43514,6 +43620,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -43850,6 +43957,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -44150,6 +44258,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -44543,6 +44652,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -45104,6 +45214,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 39, @@ -45619,6 +45730,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -45990,6 +46102,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 25, @@ -46436,6 +46549,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -46828,6 +46942,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 28, @@ -47407,6 +47522,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 36, @@ -48000,6 +48116,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -48449,6 +48566,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 25, @@ -48835,6 +48953,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -49117,6 +49236,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 11, @@ -49418,6 +49538,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 16, @@ -49908,6 +50029,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 18, @@ -50434,6 +50556,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 28, @@ -50917,6 +51040,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 11, @@ -51217,6 +51341,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -51574,6 +51699,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -52119,6 +52245,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 35, @@ -52614,6 +52741,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -52875,6 +53003,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -53175,6 +53304,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 17, @@ -53511,6 +53641,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -53811,6 +53942,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -54147,6 +54279,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -54483,6 +54616,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 25, @@ -55024,6 +55158,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -55641,6 +55776,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -56098,6 +56234,7 @@ Object { "type": "ForOfStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -56525,6 +56662,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 21, @@ -56946,6 +57084,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -57389,6 +57528,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -57960,6 +58100,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -58344,6 +58485,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -58638,6 +58780,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 11, @@ -59031,6 +59174,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 25, @@ -59472,6 +59616,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -59876,6 +60021,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 18, @@ -60190,6 +60336,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 15, @@ -60416,6 +60563,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -60753,6 +60901,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -61229,6 +61378,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -61603,6 +61753,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -62101,6 +62252,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -62508,6 +62660,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -62938,6 +63091,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -63653,6 +63807,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -64569,6 +64724,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -65328,6 +65484,26 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 61, + 98, + ], + "type": "Line", + "value": " ... do some stuff with options ...", + }, + ], "loc": Object { "end": Object { "column": 0, @@ -65999,6 +66175,26 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 105, + ], + "type": "Line", + "value": " ... do some stuff with options ...", + }, + ], "loc": Object { "end": Object { "column": 2, @@ -66717,6 +66913,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -67435,6 +67632,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -68059,6 +68257,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -68611,6 +68810,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -69104,6 +69304,7 @@ Object { "type": "TryStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -69326,6 +69527,7 @@ Object { "type": "TryStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -69696,6 +69898,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -70195,6 +70398,7 @@ Object { "type": "ForOfStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -70798,6 +71002,7 @@ Object { "type": "ForOfStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -71202,6 +71407,7 @@ Object { "type": "ForOfStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -71570,6 +71776,7 @@ Object { "type": "ForOfStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -71938,6 +72145,7 @@ Object { "type": "ForOfStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -72272,6 +72480,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 27, @@ -72552,6 +72761,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -72964,6 +73174,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -73479,6 +73690,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 34, @@ -73794,6 +74006,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 17, @@ -74091,6 +74304,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -74425,6 +74639,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 28, @@ -74760,6 +74975,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -75114,6 +75330,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -75485,6 +75702,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -75725,6 +75943,7 @@ Object { "type": "ReturnStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -75822,6 +76041,7 @@ Object { "type": "ReturnStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -75919,6 +76139,7 @@ Object { "type": "ReturnStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -76104,6 +76325,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -76364,6 +76586,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -76626,6 +76849,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -77066,6 +77290,7 @@ Object { "type": "WithStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -77450,6 +77675,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -77619,6 +77845,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -77807,6 +78034,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -78033,6 +78261,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -78255,6 +78484,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -78462,6 +78692,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -78667,6 +78898,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -78858,6 +79090,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -79062,6 +79295,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -79195,6 +79429,7 @@ Object { "type": "ExportAllDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -79402,6 +79637,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -79645,6 +79881,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -79924,6 +80161,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -80256,6 +80494,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -80571,6 +80810,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -80867,6 +81107,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -81130,6 +81371,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -81355,6 +81597,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -81580,6 +81823,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -81858,6 +82102,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -82118,6 +82363,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -82253,6 +82499,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -82424,6 +82671,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -82666,6 +82914,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -82944,6 +83193,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -83188,6 +83438,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -83399,6 +83650,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -83697,6 +83949,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -83903,6 +84156,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -84144,6 +84398,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -84439,6 +84694,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -84717,6 +84973,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -84977,6 +85234,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -85111,6 +85369,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -85281,6 +85540,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -85612,6 +85872,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -85872,6 +86133,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -86096,6 +86358,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -86391,6 +86654,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -86722,6 +86986,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -87000,6 +87265,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -87242,6 +87508,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -87486,6 +87753,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -87637,6 +87905,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -87836,6 +88105,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -88017,6 +88287,7 @@ Object { "type": "ImportDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -88225,6 +88496,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -88480,6 +88752,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -88797,6 +89070,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -89204,6 +89478,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -89632,6 +89907,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -90043,6 +90319,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 19, @@ -90533,6 +90810,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 32, @@ -91104,6 +91382,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -91458,6 +91737,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -91779,6 +92059,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -92116,6 +92397,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -92472,6 +92754,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -93046,6 +93329,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -93748,6 +94032,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -94377,6 +94662,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -94900,6 +95186,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -95386,6 +95673,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -95831,6 +96119,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 3, @@ -96222,6 +96511,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 3, @@ -96613,6 +96903,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 3, @@ -97023,6 +97314,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 3, @@ -97433,6 +97725,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 3, @@ -97846,6 +98139,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -98496,6 +98790,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -98883,6 +99178,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -99016,6 +99312,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -99149,6 +99446,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -99288,6 +99586,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -99485,6 +99784,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -99682,6 +99982,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -99879,6 +100180,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -100076,6 +100378,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -100323,6 +100626,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -100715,6 +101019,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -101107,6 +101412,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -101424,6 +101730,7 @@ Object { "type": "TSEmptyBodyFunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -101759,6 +102066,7 @@ Object { "type": "TSEmptyBodyFunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -102113,6 +102421,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 27, @@ -102485,6 +102794,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 29, @@ -102912,6 +103222,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 23, @@ -103245,6 +103556,7 @@ Object { "type": "EmptyStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 20, @@ -103543,6 +103855,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -103819,6 +104132,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -104077,6 +104391,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 10, @@ -104470,6 +104785,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -104734,6 +105050,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -104894,6 +105211,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 40, @@ -105334,6 +105652,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 31, @@ -105752,6 +106071,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -105877,6 +106197,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 5, @@ -106035,6 +106356,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 13, @@ -106244,6 +106566,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -106664,6 +106987,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 32, @@ -107085,6 +107409,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 19, @@ -107182,6 +107507,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 27, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap index 0be9fe0b5b7b..0f1119402496 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -291,6 +291,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 45, @@ -1036,6 +1037,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -1621,6 +1623,26 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "Block", + "value": " this is a comment ", + }, + ], "loc": Object { "end": Object { "column": 33, @@ -2099,6 +2121,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 28, @@ -2667,6 +2690,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 42, @@ -3068,6 +3092,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 10, @@ -3742,6 +3767,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 84, @@ -4426,6 +4452,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 12, @@ -4704,6 +4731,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -5068,6 +5096,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -5542,6 +5571,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -5982,6 +6012,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 12, @@ -6244,6 +6275,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 6, @@ -6565,6 +6597,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -6991,6 +7024,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -7413,6 +7447,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 36, @@ -7763,6 +7798,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 19, @@ -8127,6 +8163,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 12, @@ -8615,6 +8652,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 16, @@ -9055,6 +9093,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 25, @@ -9493,6 +9532,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 54, @@ -9970,6 +10010,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -10345,6 +10386,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -10733,6 +10775,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 25, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap index d78b679e7e0f..4025e7b4a92e 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap @@ -185,6 +185,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -1010,6 +1011,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index 8beb3200938f..dc2954371e30 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -98,6 +98,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 24, @@ -413,6 +414,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 42, @@ -807,6 +809,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -1253,6 +1256,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -1715,6 +1719,7 @@ Object { "type": "TSAbstractClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -2087,6 +2092,7 @@ Object { "type": "TSAbstractClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -2552,6 +2558,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -2939,6 +2946,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -3325,6 +3333,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -3730,6 +3739,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 5, @@ -4251,6 +4261,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -5262,6 +5273,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -6153,6 +6165,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -6544,6 +6557,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -6911,6 +6925,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -7242,6 +7257,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -7715,6 +7731,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -8198,6 +8215,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -8644,6 +8662,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9012,6 +9031,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9253,6 +9273,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9567,6 +9588,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -9934,6 +9956,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -11023,6 +11046,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -12313,6 +12337,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -12864,6 +12889,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -13562,6 +13588,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -14023,6 +14050,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -14716,6 +14744,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -15841,6 +15870,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -16966,6 +16996,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -17913,6 +17944,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -18411,6 +18443,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -18820,6 +18853,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -19170,6 +19204,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -19447,6 +19482,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -19725,6 +19761,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -20003,6 +20040,7 @@ Object { "type": "TSEnumDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -20359,6 +20397,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -20727,6 +20766,7 @@ Object { "type": "TSEmptyBodyDeclareFunction", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 42, @@ -21114,6 +21154,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 21, @@ -21372,6 +21413,7 @@ Object { "type": "TSExportAssignment", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -21560,6 +21602,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -21838,6 +21881,7 @@ Object { "type": "ExportDefaultDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -22153,6 +22197,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -22450,6 +22495,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -22800,6 +22846,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -23132,6 +23179,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 40, @@ -23464,6 +23512,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 2, @@ -23849,6 +23898,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 47, @@ -24219,6 +24269,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -24777,6 +24828,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -25513,6 +25565,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -26133,6 +26186,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -26558,6 +26612,26 @@ Object { }, }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 28, + ], + "type": "Block", + "value": "comment", + }, + ], "loc": Object { "end": Object { "column": 35, @@ -27016,6 +27090,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -27581,6 +27656,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -28249,6 +28325,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -29070,6 +29147,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -29708,6 +29786,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -30112,6 +30191,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -30371,6 +30451,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -30632,6 +30713,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -32041,6 +32123,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -34230,6 +34313,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -34671,6 +34755,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -35004,6 +35089,7 @@ Object { }, }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -35270,6 +35356,29 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 71, + ], + "type": "Block", + "value": "* + * Comment Line 1 + * @baz bar + ", + }, + ], "loc": Object { "end": Object { "column": 0, @@ -35752,6 +35861,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -36337,6 +36447,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -36578,6 +36689,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -36963,6 +37075,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 44, @@ -37491,6 +37604,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -38150,6 +38264,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -38769,6 +38884,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 17, @@ -39392,6 +39508,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -40228,6 +40345,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 42, @@ -40740,6 +40858,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 37, @@ -41234,6 +41353,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 48, @@ -41709,6 +41829,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -42220,6 +42341,7 @@ Object { "type": "FunctionDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -42899,6 +43021,116 @@ Object { }, }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "Block", + "value": " comment 1 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 38, + ], + "type": "Block", + "value": " comment 2 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 58, + 67, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 70, + 79, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 102, + 111, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 114, + 123, + ], + "type": "Block", + "value": " bbb ", + }, + ], "loc": Object { "end": Object { "column": 0, @@ -43626,6 +43858,26 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 58, + 73, + ], + "type": "Block", + "value": "AudioBuffer", + }, + ], "loc": Object { "end": Object { "column": 0, @@ -44226,6 +44478,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -44755,6 +45008,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -45161,6 +45415,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -45688,6 +45943,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -46091,6 +46347,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -46458,6 +46715,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 22, @@ -46852,6 +47110,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -47574,6 +47833,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -48290,6 +48550,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -48917,6 +49178,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -49393,6 +49655,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 12, @@ -49713,6 +49976,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 21, @@ -50198,6 +50462,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -50683,6 +50948,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -51148,6 +51414,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -51541,6 +51808,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -52203,6 +52471,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -52939,6 +53208,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -53531,6 +53801,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -54213,6 +54484,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -54949,6 +55221,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -55646,6 +55919,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -56330,6 +56604,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -56920,6 +57195,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -57366,6 +57642,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -57697,6 +57974,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -57903,6 +58181,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -58126,6 +58405,7 @@ Object { "type": "ClassDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -58350,6 +58630,7 @@ Object { "type": "TSEnumDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -58593,6 +58874,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -58888,6 +59170,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 16, @@ -59197,6 +59480,7 @@ Object { "type": "ExportNamedDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 72, @@ -59493,6 +59777,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -61569,6 +61854,7 @@ Object { "type": "TSInterfaceDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -64562,6 +64848,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -64984,6 +65271,7 @@ Object { "type": "VariableDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 21, @@ -65355,6 +65643,7 @@ Object { "type": "ExpressionStatement", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 14, @@ -65617,6 +65906,7 @@ Object { "type": "TSModuleDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -66077,6 +66367,7 @@ Object { "type": "TSModuleDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -66775,6 +67066,7 @@ Object { "type": "TSModuleDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, @@ -67926,6 +68218,7 @@ Object { "type": "TSModuleDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 1, @@ -68744,6 +69037,7 @@ Object { "type": "TSModuleDeclaration", }, ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index 8a727e8e8b3b..0217f66839e5 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -32,19 +32,8 @@ const testFiles = shelljs.find(FIXTURES_DIR) //------------------------------------------------------------------------------ describe("basics", () => { - testFiles.forEach(filename => { - // Uncomment and fill in filename to focus on a single file - // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); - const config = { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {}, - errorOnUnknownASTType: true - }; - test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code)); }); - }); diff --git a/packages/typescript-eslint-parser/tests/lib/comments.js b/packages/typescript-eslint-parser/tests/lib/comments.js index ec54992c2b13..008924e7329a 100644 --- a/packages/typescript-eslint-parser/tests/lib/comments.js +++ b/packages/typescript-eslint-parser/tests/lib/comments.js @@ -32,19 +32,11 @@ const testFiles = shelljs.find(FIXTURES_DIR) //------------------------------------------------------------------------------ describe("Comments", () => { - testFiles.forEach(filename => { const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); const config = { - loc: true, - range: true, - tokens: true, - comment: true, - ecmaFeatures: { - jsx: true - } + jsx: true }; test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); - }); diff --git a/packages/typescript-eslint-parser/tests/lib/ecma-features.js b/packages/typescript-eslint-parser/tests/lib/ecma-features.js index 40b619f2e1f9..5fe5821757f4 100644 --- a/packages/typescript-eslint-parser/tests/lib/ecma-features.js +++ b/packages/typescript-eslint-parser/tests/lib/ecma-features.js @@ -32,24 +32,8 @@ const testFiles = shelljs.find(FIXTURES_DIR) //------------------------------------------------------------------------------ describe("ecmaFeatures", () => { - testFiles.forEach(filename => { - - // Uncomment and fill in filename to focus on a single file - // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; - const feature = path.dirname(filename), - code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`), - config = { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {}, - errorOnUnknownASTType: true - }; - - test(`fixtures/${filename}.src`, () => { - config.ecmaFeatures[feature] = true; - testUtils.createSnapshotTestBlock(code, config)(); - }); + const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code)); }); }); diff --git a/packages/typescript-eslint-parser/tests/lib/jsx.js b/packages/typescript-eslint-parser/tests/lib/jsx.js index ba1dce33917a..f1ee7fe575cc 100644 --- a/packages/typescript-eslint-parser/tests/lib/jsx.js +++ b/packages/typescript-eslint-parser/tests/lib/jsx.js @@ -51,21 +51,11 @@ describe("JSX", () => { function testFixture(fixturesDir, useJSXTextNode) { return filename => { - // Uncomment and fill in filename to focus on a single file - // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const code = shelljs.cat(`${path.resolve(fixturesDir, filename)}.src.js`); - const config = { - loc: true, - range: true, - tokens: true, - errorOnUnknownASTType: true, useJSXTextNode, - ecmaFeatures: { - jsx: true - } + jsx: true }; - test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }; } diff --git a/packages/typescript-eslint-parser/tests/lib/tsx.js b/packages/typescript-eslint-parser/tests/lib/tsx.js index a29b57fdb073..4fdf201feee7 100644 --- a/packages/typescript-eslint-parser/tests/lib/tsx.js +++ b/packages/typescript-eslint-parser/tests/lib/tsx.js @@ -32,18 +32,10 @@ const testFiles = shelljs.find(TSX_FIXTURES_DIR) describe("TSX", () => { testFiles.forEach(filename => { - // Uncomment and fill in filename to focus on a single file - // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const code = shelljs.cat(`${path.resolve(TSX_FIXTURES_DIR, filename)}.src.tsx`); const config = { - loc: true, - range: true, - tokens: true, - errorOnUnknownASTType: true, useJSXTextNode: true, - ecmaFeatures: { - jsx: true - } + jsx: true }; test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); diff --git a/packages/typescript-eslint-parser/tests/lib/typescript.js b/packages/typescript-eslint-parser/tests/lib/typescript.js index 8032dac66263..6e9f654c44d4 100644 --- a/packages/typescript-eslint-parser/tests/lib/typescript.js +++ b/packages/typescript-eslint-parser/tests/lib/typescript.js @@ -34,17 +34,8 @@ const testFiles = shelljs.find(FIXTURES_DIR) describe("typescript", () => { testFiles.forEach(filename => { - // Uncomment and fill in filename to focus on a single file - // var filename = "jsx/invalid-matching-placeholder-in-closing-tag"; const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.ts`); - const config = { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {}, - errorOnUnknownASTType: true - }; - test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); + test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code)); }); }); diff --git a/packages/typescript-eslint-parser/tools/test-utils.js b/packages/typescript-eslint-parser/tools/test-utils.js index a00575082981..f8dfdc5cf87f 100644 --- a/packages/typescript-eslint-parser/tools/test-utils.js +++ b/packages/typescript-eslint-parser/tools/test-utils.js @@ -41,7 +41,16 @@ function getRaw(ast) { * @param {*} config the parser configuration * @returns {Function} callback for Jest test() block */ -function createSnapshotTestBlock(code, config) { +function createSnapshotTestBlock(code, config = {}) { + const defaultConfig = { + loc: true, + range: true, + raw: true, + tokens: true, + comment: true, + errorOnUnknownASTType: true + }; + config = Object.assign({}, defaultConfig, config); /** * @returns {Object} the AST object From d7997ee1fd5894003df0db2942cc9687cadb7d96 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Thu, 8 Nov 2018 11:49:36 -0500 Subject: [PATCH 301/326] Chore: test Node v11 in CI (#542) --- packages/typescript-eslint-parser/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml index e50d8a52d043..4077e9b1ad79 100644 --- a/packages/typescript-eslint-parser/.travis.yml +++ b/packages/typescript-eslint-parser/.travis.yml @@ -10,6 +10,7 @@ node_js: - "8" - "9" - "10" + - "11" script: npm test && npm run integration-tests From 85ccea463785b2c264cc3038fcead5a209d67b62 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Thu, 8 Nov 2018 22:01:48 -0500 Subject: [PATCH 302/326] Breaking: make eslint a peerDep/devDep (#541) --- .../typescript-eslint-parser/package.json | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index efa7b8b43717..f9bf461263b9 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -17,16 +17,6 @@ "url": "https://github.com/eslint/typescript-eslint-parser/issues" }, "license": "BSD-2-Clause", - "devDependencies": { - "eslint-config-eslint": "4.0.0", - "eslint-plugin-node": "6.0.1", - "eslint-release": "1.1.0", - "jest": "23.1.0", - "npm-license": "0.3.3", - "shelljs": "0.8.2", - "shelljs-nodecli": "0.1.1", - "typescript": "~3.1.1" - }, "keywords": [ "ast", "ecmascript", @@ -48,13 +38,24 @@ "generate-rcrelease": "eslint-generate-prerelease rc", "publish-release": "eslint-publish-release" }, + "peerDependencies": { + "eslint": ">=4.19.1", + "typescript": "*" + }, "dependencies": { - "eslint": "4.19.1", "eslint-visitor-keys": "^1.0.0", "typescript-estree": "5.0.0" }, - "peerDependencies": { - "typescript": "*" + "devDependencies": { + "eslint": "^4.19.1", + "eslint-config-eslint": "4.0.0", + "eslint-plugin-node": "6.0.1", + "eslint-release": "1.1.0", + "jest": "23.1.0", + "npm-license": "0.3.3", + "shelljs": "0.8.2", + "shelljs-nodecli": "0.1.1", + "typescript": "~3.1.1" }, "jest": { "testEnvironment": "node", From 634384c644f74f83212ca5c005b21afa1b4001c6 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 10 Nov 2018 03:13:45 +0900 Subject: [PATCH 303/326] Breaking: switch 'jsx' option by filename (fixes #517) (#543) * Breaking: switch 'jsx' option by filename (fixes #517) * update README.md * don't modify the option object * update behavior * use expect() instead of assert() --- packages/typescript-eslint-parser/README.md | 7 +- packages/typescript-eslint-parser/parser.js | 7 ++ .../typescript-eslint-parser/tests/lib/tsx.js | 103 +++++++++++++++++- 3 files changed, 114 insertions(+), 3 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 68c8deee7bd2..fd8d6bbf31da 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -36,9 +36,12 @@ By far the most common case will be installing the [eslint-plugin-typescript](ht The following additional configuration options are available by specifying them in [`parserOptions`](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) in your ESLint configuration file. -**`jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html). +- **`jsx`** - default `false`. Enable parsing JSX when `true`. More details can be found [here](https://www.typescriptlang.org/docs/handbook/jsx.html). + - It's `false` on `*.ts` files regardless of this option. + - It's `true` on `*.tsx` files regardless of this option. + - Otherwise, it respects this option. -**`useJSXTextNode`** - default `false`. The JSX AST changed the node type for string literals inside a JSX Element from `Literal` to `JSXText`. When value is `true`, these nodes will be parsed as type `JSXText`. When value is `false`, these nodes will be parsed as type `Literal`. +- **`useJSXTextNode`** - default `false`. The JSX AST changed the node type for string literals inside a JSX Element from `Literal` to `JSXText`. When value is `true`, these nodes will be parsed as type `JSXText`. When value is `false`, these nodes will be parsed as type `Literal`. ### .eslintrc.json diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 32b4e7cf245a..10d3063b9f07 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -20,6 +20,13 @@ const visitorKeys = require("./visitor-keys"); exports.version = require("./package.json").version; exports.parseForESLint = function parseForESLint(code, options) { + if (options && typeof options.filePath === "string") { + const tsx = options.filePath.endsWith(".tsx"); + if (tsx || options.filePath.endsWith(".ts")) { + options = Object.assign({}, options, { jsx: tsx }); + } + } + const ast = parse(code, options); traverser.traverse(ast, { enter: node => { diff --git a/packages/typescript-eslint-parser/tests/lib/tsx.js b/packages/typescript-eslint-parser/tests/lib/tsx.js index 4fdf201feee7..831d5fdad2d0 100644 --- a/packages/typescript-eslint-parser/tests/lib/tsx.js +++ b/packages/typescript-eslint-parser/tests/lib/tsx.js @@ -11,8 +11,11 @@ // Requirements //------------------------------------------------------------------------------ -const path = require("path"), +const + path = require("path"), + { Linter } = require("eslint"), shelljs = require("shelljs"), + parser = require("../../"), testUtils = require("../../tools/test-utils"); //------------------------------------------------------------------------------ @@ -39,4 +42,102 @@ describe("TSX", () => { }; test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); + + describe("if the filename ends with '.tsx', enable jsx option automatically.", () => { + const linter = new Linter(); + linter.defineParser("typescript-eslint-parser", parser); + + test("filePath was not provided", () => { + const code = "const element = "; + const config = { + parser: "typescript-eslint-parser" + }; + const messages = linter.verify(code, config); + + expect(messages).toStrictEqual([{ + column: 18, + fatal: true, + line: 1, + message: "Parsing error: '>' expected.", + ruleId: null, + severity: 2, + source: "const element = " + }]); + }); + + test("filePath was not provided and 'jsx:true' option", () => { + const code = "const element = "; + const config = { + parser: "typescript-eslint-parser", + parserOptions: { + jsx: true + } + }; + const messages = linter.verify(code, config); + + expect(messages).toStrictEqual([]); + }); + + test("test.ts", () => { + const code = "const element = "; + const config = { + parser: "typescript-eslint-parser" + }; + const messages = linter.verify(code, config, { filename: "test.ts" }); + + expect(messages).toStrictEqual([{ + column: 18, + fatal: true, + line: 1, + message: "Parsing error: '>' expected.", + ruleId: null, + severity: 2, + source: "const element = " + }]); + }); + + test("test.ts with 'jsx:true' option", () => { + const code = "const element = "; + const config = { + parser: "typescript-eslint-parser", + parserOptions: { + jsx: true + } + }; + const messages = linter.verify(code, config, { filename: "test.ts" }); + + expect(messages).toStrictEqual([{ + column: 18, + fatal: true, + line: 1, + message: "Parsing error: '>' expected.", + ruleId: null, + severity: 2, + source: "const element = " + }]); + }); + + test("test.tsx", () => { + const code = "const element = "; + const config = { + parser: "typescript-eslint-parser" + }; + const messages = linter.verify(code, config, { filename: "test.tsx" }); + + expect(messages).toStrictEqual([]); + }); + + test("test.tsx with 'jsx:false' option", () => { + const code = "const element = "; + const config = { + parser: "typescript-eslint-parser", + parserOptions: { + jsx: false + } + }; + const messages = linter.verify(code, config, { filename: "test.tsx" }); + + expect(messages).toStrictEqual([]); + }); + }); }); From 5c3ce1af059129767ba4ce03cb9a78463816ce06 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Sat, 10 Nov 2018 20:39:39 +0900 Subject: [PATCH 304/326] Breaking: make 'useJSXTextNode:true' by default (#544) * Breaking: make 'useJSXTextNode:true' by default * update README.md * modify the description of `useJSXTextNode` option --- packages/typescript-eslint-parser/README.md | 2 +- packages/typescript-eslint-parser/parser.js | 7 ++++++- .../tests/lib/__snapshots__/comments.js.snap | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index fd8d6bbf31da..e49bbb07fea1 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -41,7 +41,7 @@ The following additional configuration options are available by specifying them - It's `true` on `*.tsx` files regardless of this option. - Otherwise, it respects this option. -- **`useJSXTextNode`** - default `false`. The JSX AST changed the node type for string literals inside a JSX Element from `Literal` to `JSXText`. When value is `true`, these nodes will be parsed as type `JSXText`. When value is `false`, these nodes will be parsed as type `Literal`. +- **`useJSXTextNode`** - default `true`. Please set `false` if you use this parser on ESLint v4. If this is `false`, the parser creates the AST of JSX texts as the legacy style. ### .eslintrc.json diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 10d3063b9f07..693992e27bf8 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -20,7 +20,12 @@ const visitorKeys = require("./visitor-keys"); exports.version = require("./package.json").version; exports.parseForESLint = function parseForESLint(code, options) { - if (options && typeof options.filePath === "string") { + if (typeof options !== "object" || options === null) { + options = { useJSXTextNode: true }; + } else if (typeof options.useJSXTextNode !== "boolean") { + options = Object.assign({}, options, { useJSXTextNode: true }); + } + if (typeof options.filePath === "string") { const tsx = options.filePath.endsWith(".tsx"); if (tsx || options.filePath.endsWith(".ts")) { options = Object.assign({}, options, { jsx: tsx }); diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap index 41309c3f7edc..5672625c2e4c 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap @@ -1219,7 +1219,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -1274,7 +1274,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, @@ -1960,7 +1960,7 @@ Object { ], "raw": " ", - "type": "Literal", + "type": "JSXText", "value": " ", }, From d4025b5584620d8a4bd0d52dc69afe58b96bfb2c Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 13 Nov 2018 13:38:39 +0900 Subject: [PATCH 305/326] Update: add proper scope analysis (fixes #535) (#540) * Update: add proper scope analysis (fixes #535) * add computed-properties-in-type fixture * add computed-properties-in-interface fixture * add function-overload fixture * add method-overload fixture * add class-properties fixture * add decorators fixture * update visitor-keys * add declare-global fixture * fix typo * add test for typeof in array destructuring * add namespace fixture * add declare-module fixture * fix crash * add declare-function.ts fixture * add abstract-class fixture * add typeof-in-call-signature fixture * add test for #416 * add test for #435 * add test for #437 * add test for #443 * add test for #459 * add test for #466 * add test for #471 * add test for #487 * add test for #535 * add test for #536 * add test for #476 * fix test to use `expect()` --- .../typescript-eslint-parser/analyze-scope.js | 598 ++ .../typescript-eslint-parser/package.json | 3 + packages/typescript-eslint-parser/parser.js | 40 +- .../tests/fixtures/scope-analysis/535.ts | 3 + .../fixtures/scope-analysis/abstract-class.ts | 4 + .../scope-analysis/class-properties.ts | 5 + .../computed-properties-in-interface.ts | 5 + .../computed-properties-in-type.ts | 5 + .../scope-analysis/declare-function.ts | 2 + .../fixtures/scope-analysis/declare-global.ts | 7 + .../fixtures/scope-analysis/declare-module.ts | 6 + .../fixtures/scope-analysis/decorators.ts | 13 + .../tests/fixtures/scope-analysis/enum.ts | 6 + .../scope-analysis/function-overload-2.ts | 2 + .../scope-analysis/function-overload.ts | 5 + .../scope-analysis/ignore-type-only-stuff.ts | 9 + .../scope-analysis/method-overload.ts | 8 + .../fixtures/scope-analysis/namespace.ts | 7 + .../scope-analysis/type-annotations.ts | 7 + .../scope-analysis/type-assertions.ts | 3 + .../scope-analysis/typeof-in-assertions.ts | 3 + .../typeof-in-call-signature.ts | 5 + .../scope-analysis/typeof-in-return-type.ts | 3 + .../typeof-in-type-parameters.ts | 3 + .../fixtures/scope-analysis/typeof-in-var.ts | 4 + .../tests/fixtures/scope-analysis/typeof.ts | 2 + .../lib/__snapshots__/scope-analysis.js.snap | 5465 +++++++++++++++++ .../tests/lib/basics.js | 59 +- .../tests/lib/scope-analysis.js | 354 ++ .../typescript-eslint-parser/visitor-keys.js | 39 +- 30 files changed, 6647 insertions(+), 28 deletions(-) create mode 100644 packages/typescript-eslint-parser/analyze-scope.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/535.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/abstract-class.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-properties.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-function.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-global.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-module.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/decorators.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload-2.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/method-overload.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/namespace.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-annotations.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-assertions.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-var.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof.ts create mode 100644 packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap create mode 100644 packages/typescript-eslint-parser/tests/lib/scope-analysis.js diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js new file mode 100644 index 000000000000..d0902901301f --- /dev/null +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -0,0 +1,598 @@ +"use strict"; + +/* eslint-disable new-cap, no-underscore-dangle */ + +const escope = require("eslint-scope"); +const { Definition, ParameterDefinition } = require("eslint-scope/lib/definition"); +const OriginalPatternVisitor = require("eslint-scope/lib/pattern-visitor"); +const Reference = require("eslint-scope/lib/reference"); +const OriginalReferencer = require("eslint-scope/lib/referencer"); +const Scope = require("eslint-scope/lib/scope").Scope; +const fallback = require("eslint-visitor-keys").getKeys; +const lodash = require("lodash"); +const childVisitorKeys = require("./visitor-keys"); + +/** + * Get `.range[0]` of a given object. + * @param {{range: number[]}} x The object to get. + * @returns {number} The gotten value. + */ +function byRange0(x) { + return x.range[0]; +} + +/** + * Check the TSModuleDeclaration node is `declare global {}` or not. + * @param {TSModuleDeclaration} node The TSModuleDeclaration node to check. + * @param {Token[]} tokens The token list. + * @returns {boolean} `true` if the node is `declare global {}`. + */ +function isGlobalAugmentation(node, tokens) { + const i = lodash.sortedIndexBy(tokens, node, byRange0); + const token1 = tokens[i]; + const token2 = tokens[i + 1]; + + return Boolean( + token1 && + token2 && + (token1.type === "Keyword" || token1.type === "Identifier") && + token1.value === "declare" && + (token2.type === "Keyword" || token2.type === "Identifier") && + token2.value === "global" + ); +} + +/** + * Define the override function of `Scope#__define` for global augmentation. + * @param {Function} define The original Scope#__define method. + * @returns {Function} The override function. + */ +function overrideDefine(define) { + return /* @this {Scope} */ function(node, definition) { + define.call(this, node, definition); + + // Set `variable.eslintUsed` to tell ESLint that the variable is exported. + const variable = this.set.get(node.name); + if (variable) { + variable.eslintUsed = true; + } + }; +} + +/** The scope class for enum. */ +class EnumScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "enum", upperScope, block, false); + } +} + +class PatternVisitor extends OriginalPatternVisitor { + Identifier(node) { + super.Identifier(node); + if (node.typeAnnotation) { + this.rightHandNodes.push(node.typeAnnotation); + } + } + + ArrayPattern(node) { + node.elements.forEach(this.visit, this); + if (node.typeAnnotation) { + this.rightHandNodes.push(node.typeAnnotation); + } + } + + ObjectPattern(node) { + node.properties.forEach(this.visit, this); + if (node.typeAnnotation) { + this.rightHandNodes.push(node.typeAnnotation); + } + } +} + +class Referencer extends OriginalReferencer { + constructor(...args) { + super(...args); + this.typeMode = false; + } + + /** + * Override to use PatternVisitor we overrode. + * @param {Identifier} node The Identifier node to visit. + * @param {Object} [options] The flag to visit right-hand side nodes. + * @param {Function} callback The callback function for left-hand side nodes. + * @returns {void} + */ + visitPattern(node, options, callback) { + if (!node) { + return; + } + + if (typeof options === "function") { + callback = options; + options = { processRightHandNodes: false }; + } + + const visitor = new PatternVisitor(this.options, node, callback); + visitor.visit(node); + + if (options.processRightHandNodes) { + visitor.rightHandNodes.forEach(this.visit, this); + } + } + + /** + * Override. + * Visit `node.typeParameters` and `node.returnType` additionally to find `typeof` expressions. + * @param {FunctionDeclaration|FunctionExpression|ArrowFunctionExpression} node The function node to visit. + * @returns {void} + */ + visitFunction(node) { + const { type, id, typeParameters, params, returnType, body } = node; + const scopeManager = this.scopeManager; + const upperScope = this.currentScope(); + + // Process the name. + if (type === "FunctionDeclaration" && id) { + upperScope.__define( + id, + new Definition("FunctionName", id, node, null, null, null) + ); + + // Remove overload definition to avoid confusion of no-redeclare rule. + const { defs, identifiers } = upperScope.set.get(id.name); + for (let i = 0; i < defs.length; ++i) { + const def = defs[i]; + if (def.type === "FunctionName" && def.node.type === "TSEmptyBodyFunctionDeclaration") { + defs.splice(i, 1); + identifiers.splice(i, 1); + break; + } + } + } else if (type === "FunctionExpression" && id) { + scopeManager.__nestFunctionExpressionNameScope(node); + } + + // Process the type parameters + this.visit(typeParameters); + + // Open the function scope. + scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); + const innerScope = this.currentScope(); + + // Process parameter declarations. + for (let i = 0; i < params.length; ++i) { + this.visitPattern( + params[i], + { processRightHandNodes: true }, + (pattern, info) => { + innerScope.__define( + pattern, + new ParameterDefinition( + pattern, + node, + i, + info.rest + ) + ); + this.referencingDefaultValue( + pattern, + info.assignments, + null, + true + ); + } + ); + } + + // Process the return type. + this.visit(returnType); + + // Process the body. + if (body.type === "BlockStatement") { + this.visitChildren(body); + } else { + this.visit(body); + } + + // Close the function scope. + this.close(node); + } + + /** + * Override. + * Visit decorators. + * @param {ClassDeclaration|ClassExpression} node The class node to visit. + * @returns {void} + */ + visitClass(node) { + this.visitDecorators(node.decorators); + super.visitClass(node); + } + + /** + * Override. + * Don't create the reference object in the type mode. + * @param {Identifier} node The Identifier node to visit. + * @returns {void} + */ + Identifier(node) { + if (!this.typeMode) { + super.Identifier(node); + } + this.visit(node.typeAnnotation); + } + + /** + * Override. + * Visit decorators. + * @param {MethodDefinition} node The MethodDefinition node to visit. + * @returns {void} + */ + MethodDefinition(node) { + this.visitDecorators(node.decorators); + super.MethodDefinition(node); + } + + /** + * Override. + * Don't make variable if `kind === "type"`. + * It doesn't declare variables but declare types. + * @param {VariableDeclaration} node The VariableDeclaration node to visit. + * @returns {void} + */ + VariableDeclaration(node) { + if (node.kind !== "type") { + super.VariableDeclaration(node); + return; + } + + // To detect typeof. + this.typeMode = true; + this.visitChildren(node); + this.typeMode = false; + } + + /** + * Don't create the reference object for the key if not computed. + * @param {TSEmptyBodyFunctionDeclaration} node The TSEmptyBodyFunctionDeclaration node to visit. + * @returns {void} + */ + ClassProperty(node) { + const upperTypeMode = this.typeMode; + const { computed, decorators, key, typeAnnotation, value } = node; + + this.typeMode = false; + this.visitDecorators(decorators); + if (computed) { + this.visit(key); + } + this.typeMode = true; + this.visit(typeAnnotation); + this.typeMode = false; + this.visit(value); + + this.typeMode = upperTypeMode; + } + + /** + * Define the variable of this function declaration only once. + * Because to avoid confusion of `no-redeclare` rule by overloading. + * @param {TSEmptyBodyFunctionDeclaration} node The TSEmptyBodyFunctionDeclaration node to visit. + * @returns {void} + */ + TSEmptyBodyFunctionDeclaration(node) { + const upperTypeMode = this.typeMode; + const scope = this.currentScope(); + const { id, typeParameters, params, returnType } = node; + + // Ignore this if other overloadings have already existed. + const variable = scope.set.get(id.name); + const defs = variable && variable.defs; + const existed = defs && defs.some(d => d.type === "FunctionName"); + if (!existed) { + scope.__define( + id, + new Definition("FunctionName", id, node, null, null, null) + ); + } + + // Find `typeof` expressions. + this.typeMode = true; + this.visit(typeParameters); + params.forEach(this.visit, this); + this.visit(returnType); + this.typeMode = upperTypeMode; + } + TSEmptyBodyDeclareFunction(node) { + this.TSEmptyBodyFunctionDeclaration(node); + } + + /** + * Create reference objects for the references in parameters and return type. + * @param {TSEmptyBodyFunctionExpression} node The TSEmptyBodyFunctionExpression node to visit. + * @returns {void} + */ + TSEmptyBodyFunctionExpression(node) { + const upperTypeMode = this.typeMode; + const { typeParameters, params, returnType } = node; + + this.typeMode = true; + this.visit(typeParameters); + params.forEach(this.visit, this); + this.visit(returnType); + this.typeMode = upperTypeMode; + } + + /** + * Don't make variable because it declares only types. + * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. + * @param {TSInterfaceDeclaration} node The TSInterfaceDeclaration node to visit. + * @returns {void} + */ + TSInterfaceDeclaration(node) { + if (this.typeMode) { + this.visitChildren(node); + } else { + this.typeMode = true; + this.visitChildren(node); + this.typeMode = false; + } + } + + /** + * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. + * @param {TSTypeAnnotation} node The TSTypeAnnotation node to visit. + * @returns {void} + */ + TSTypeAnnotation(node) { + if (this.typeMode) { + this.visitChildren(node); + } else { + this.typeMode = true; + this.visitChildren(node); + this.typeMode = false; + } + } + + /** + * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. + * @param {TSTypeParameterDeclaration} node The TSTypeParameterDeclaration node to visit. + * @returns {void} + */ + TSTypeParameterDeclaration(node) { + if (this.typeMode) { + this.visitChildren(node); + } else { + this.typeMode = true; + this.visitChildren(node); + this.typeMode = false; + } + } + + /** + * Create reference objects for the references in `typeof` expression. + * @param {TSTypeQuery} node The TSTypeQuery node to visit. + * @returns {void} + */ + TSTypeQuery(node) { + if (this.typeMode) { + this.typeMode = false; + this.visitChildren(node); + this.typeMode = true; + } else { + this.visitChildren(node); + } + } + + /** + * Create reference objects for the references in computed keys. + * @param {TSPropertySignature} node The TSPropertySignature node to visit. + * @returns {void} + */ + TSPropertySignature(node) { + const upperTypeMode = this.typeMode; + const { computed, key, typeAnnotation, initializer } = node; + + if (computed) { + this.typeMode = false; + this.visit(key); + this.typeMode = true; + } else { + this.typeMode = true; + this.visit(key); + } + this.visit(typeAnnotation); + this.visit(initializer); + + this.typeMode = upperTypeMode; + } + + /** + * Create reference objects for the references in computed keys. + * @param {TSMethodSignature} node The TSMethodSignature node to visit. + * @returns {void} + */ + TSMethodSignature(node) { + const upperTypeMode = this.typeMode; + const { computed, key, typeParameters, params, typeAnnotation } = node; + + if (computed) { + this.typeMode = false; + this.visit(key); + this.typeMode = true; + } else { + this.typeMode = true; + this.visit(key); + } + this.visit(typeParameters); + params.forEach(this.visit, this); + this.visit(typeAnnotation); // Maybe returnType? + + this.typeMode = upperTypeMode; + } + + /** + * Create variable object for the enum. + * The enum declaration creates a scope for the enum members. + * + * enum E { + * A, + * B, + * C = A + B // A and B are references to the enum member. + * } + * + * const a = 0 + * enum E { + * A = a // a is above constant. + * } + * + * @param {TSEnumDeclaration} node The TSEnumDeclaration node to visit. + * @returns {void} + */ + TSEnumDeclaration(node) { + const { id, members } = node; + const scopeManager = this.scopeManager; + const scope = this.currentScope(); + + if (id) { + scope.__define(id, new Definition("EnumName", id, node)); + } + + scopeManager.__nestScope(new EnumScope(scopeManager, scope, node)); + for (const member of members) { + this.visit(member); + } + this.close(node); + } + + /** + * Create variable object for the enum member and create reference object for the initializer. + * And visit the initializer. + * + * @param {TSEnumMember} node The TSEnumMember node to visit. + * @returns {void} + */ + TSEnumMember(node) { + const { id, initializer } = node; + const scope = this.currentScope(); + + scope.__define(id, new Definition("EnumMemberName", id, node)); + if (initializer) { + scope.__referencing( + id, + Reference.WRITE, + initializer, + null, + false, + true + ); + this.visit(initializer); + } + } + + /** + * Create the variable object for the module name, and visit children. + * @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit. + * @returns {void} + */ + TSModuleDeclaration(node) { + const astRoot = this.scopeManager.globalScope.block; + const scope = this.currentScope(); + const { id, body } = node; + + // https://github.com/JamesHenry/typescript-estree/issues/27 + if (isGlobalAugmentation(node, astRoot.tokens)) { + this.visitGlobalAugmentation(node); + return; + } + + if (id && id.type === "Identifier") { + scope.__define( + id, + new Definition("NamespaceName", id, node, null, null, null) + ); + } + this.visit(body); + } + + /** + * Process the module block. + * @param {TSModuleBlock} node The TSModuleBlock node to visit. + * @returns {void} + */ + TSModuleBlock(node) { + this.scopeManager.__nestBlockScope(node); + this.visitChildren(node); + this.close(node); + } + + TSAbstractClassDeclaration(node) { + this.ClassDeclaration(node); + } + TSAbstractClassProperty(node) { + this.ClassProperty(node); + } + TSAbstractMethodDefinition(node) { + this.MethodDefinition(node); + } + + /** + * Process the global augmentation. + * 1. Set the global scope as the current scope. + * 2. Configure the global scope to set `variable.eslintUsed = true` for all defined variables. This means `no-unused-vars` doesn't warn those. + * @param {TSModuleDeclaration} node The TSModuleDeclaration node to visit. + * @returns {void} + */ + visitGlobalAugmentation(node) { + const scopeManager = this.scopeManager; + const currentScope = this.currentScope(); + const globalScope = scopeManager.globalScope; + const originalDefine = globalScope.__define; + + globalScope.__define = overrideDefine(originalDefine); + scopeManager.__currentScope = globalScope; + + // Skip TSModuleBlock to avoid to create that block scope. + for (const moduleItem of node.body.body) { + this.visit(moduleItem); + } + + scopeManager.__currentScope = currentScope; + globalScope.__define = originalDefine; + } + + /** + * Process decorators. + * @param {Decorator[]|undefined} decorators The decorator nodes to visit. + * @returns {void} + */ + visitDecorators(decorators) { + if (decorators) { + decorators.forEach(this.visit, this); + } + } +} + +module.exports = function(ast, parserOptions, extraOptions) { + const options = { + ignoreEval: true, + optimistic: false, + directive: false, + nodejsScope: + ast.sourceType === "script" && + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true, + impliedStrict: false, + sourceType: extraOptions.sourceType, + ecmaVersion: parserOptions.ecmaVersion || 2018, + childVisitorKeys, + fallback + }; + + const scopeManager = new escope.ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(ast); + + return scopeManager; +}; diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index f9bf461263b9..17c350996f9d 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -7,6 +7,7 @@ "version": "20.1.1", "files": [ "parser.js", + "analyze-scope.js", "visitor-keys.js" ], "engines": { @@ -43,7 +44,9 @@ "typescript": "*" }, "dependencies": { + "eslint-scope": "^4.0.0", "eslint-visitor-keys": "^1.0.0", + "lodash": "^4.17.11", "typescript-estree": "5.0.0" }, "devDependencies": { diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 693992e27bf8..51e526a03c71 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -11,6 +11,7 @@ const parse = require("typescript-estree").parse; const astNodeTypes = require("typescript-estree").AST_NODE_TYPES; const traverser = require("eslint/lib/util/traverser"); +const analyzeScope = require("./analyze-scope"); const visitorKeys = require("./visitor-keys"); //------------------------------------------------------------------------------ @@ -33,16 +34,45 @@ exports.parseForESLint = function parseForESLint(code, options) { } const ast = parse(code, options); + const extraOptions = { + sourceType: ast.sourceType + }; + traverser.traverse(ast, { enter: node => { - if (node.type === "DeclareFunction" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration") { - if (!node.body) { - node.type = `TSEmptyBody${node.type}`; - } + switch (node.type) { + // Just for backword compatibility. + case "DeclareFunction": + if (!node.body) { + node.type = `TSEmptyBody${node.type}`; + } + break; + + // Function#body cannot be null in ESTree spec. + case "FunctionExpression": + case "FunctionDeclaration": + if (!node.body) { + node.type = `TSEmptyBody${node.type}`; + } + break; + + // Import/Export declarations cannot appear in script. + // But if those appear only in namespace/module blocks, `ast.sourceType` was `"script"`. + // This doesn't modify `ast.sourceType` directly for backrard compatibility. + case "ImportDeclaration": + case "ExportAllDeclaration": + case "ExportDefaultDeclaration": + case "ExportNamedDeclaration": + extraOptions.sourceType = "module"; + break; + + // no default } } }); - return { ast, visitorKeys }; + + const scopeManager = analyzeScope(ast, options, extraOptions); + return { ast, scopeManager, visitorKeys }; }; exports.parse = function(code, options) { diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/535.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/535.ts new file mode 100644 index 000000000000..07dfa6092589 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/535.ts @@ -0,0 +1,3 @@ +function foo({ bar }: { bar: string }) { + bar; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/abstract-class.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/abstract-class.ts new file mode 100644 index 000000000000..b71fd3e40cf7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/abstract-class.ts @@ -0,0 +1,4 @@ +abstract class A { + abstract a: string + abstract f(): number +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-properties.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-properties.ts new file mode 100644 index 000000000000..c44605051d98 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-properties.ts @@ -0,0 +1,5 @@ +const s = Symbol() +class A { + a: typeof s + [s]: number +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts new file mode 100644 index 000000000000..b821bc7f5358 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts @@ -0,0 +1,5 @@ +const s1 = Symbol(), s2 = Symbol() +interface A { + [s1]: number + [s2](s1: number, s2: number): number; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts new file mode 100644 index 000000000000..46f729479dcd --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts @@ -0,0 +1,5 @@ +const s1 = Symbol(), s2 = Symbol() +type A = { + [s1]: number + [s2](s1: number, s2: number): number; +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-function.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-function.ts new file mode 100644 index 000000000000..ea6c15bb9c9d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-function.ts @@ -0,0 +1,2 @@ +declare function f(a: number): number +f diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-global.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-global.ts new file mode 100644 index 000000000000..76c4bef203b1 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-global.ts @@ -0,0 +1,7 @@ +declare global { + let C: number +} + +C = 1 + +export {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-module.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-module.ts new file mode 100644 index 000000000000..9459128702d6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/declare-module.ts @@ -0,0 +1,6 @@ +const a = 1 +declare module "foo" { + export const a: number + export const b: typeof a +} +a diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/decorators.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/decorators.ts new file mode 100644 index 000000000000..34da4b567669 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/decorators.ts @@ -0,0 +1,13 @@ +function dec(target: any) { +} +function gec() { + return (target: any, propertyKey: string) => {} +} + +@dec +class C { + @gec() field: string + @gec() method(): string { + return "" + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum.ts new file mode 100644 index 000000000000..98464d4e9bbf --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum.ts @@ -0,0 +1,6 @@ +const a: number = 1 +enum E { + A = a, + B = a + 1, + C = A + B +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload-2.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload-2.ts new file mode 100644 index 000000000000..548267aeb2e4 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload-2.ts @@ -0,0 +1,2 @@ +function f(): void +function f(a: number): void diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload.ts new file mode 100644 index 000000000000..7d23f50f4b37 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/function-overload.ts @@ -0,0 +1,5 @@ +function f(): void +function f(a: number): void +function f(a?: number): void { + // do something. +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts new file mode 100644 index 000000000000..45cabe3919de --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts @@ -0,0 +1,9 @@ +type A = number +interface B { + prop1: A +} +interface C extends B { + method(a: { b: A }): { c: A } +} + +var a: C diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/method-overload.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/method-overload.ts new file mode 100644 index 000000000000..fd8cbbdfd270 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/method-overload.ts @@ -0,0 +1,8 @@ +const s = Symbol() +class A { + f(): void + f(a: typeof s): void + f(a?: any): void { + // do something. + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/namespace.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/namespace.ts new file mode 100644 index 000000000000..216c093e580f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/namespace.ts @@ -0,0 +1,7 @@ +const a = 1 +namespace N { + export const a = 2 + a +} +a +N.a diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-annotations.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-annotations.ts new file mode 100644 index 000000000000..f5d4e63b7d5f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-annotations.ts @@ -0,0 +1,7 @@ +type A = number +var a: { b: A } +class C { + f(a: { b: A }): { b: A } { + return {b: 1} + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-assertions.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-assertions.ts new file mode 100644 index 000000000000..0a4caa7f0b75 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-assertions.ts @@ -0,0 +1,3 @@ +type A = number; +a = b; +a = b as A; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts new file mode 100644 index 000000000000..023291c4e995 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts @@ -0,0 +1,3 @@ +var obj = { value: 1 } +a = b; +a = b as typeof obj; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts new file mode 100644 index 000000000000..e3e90ce08388 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts @@ -0,0 +1,5 @@ +const obj = { value: 1 } +interface A { + (a: typeof obj, b: T): typeof obj + new (a: typeof obj, b: T): typeof obj +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts new file mode 100644 index 000000000000..15f6b7c33f2e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts @@ -0,0 +1,3 @@ +function f(a: number): typeof a { // this `a` is the parameter `a`. + return 1 +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts new file mode 100644 index 000000000000..2bf99cbfb588 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts @@ -0,0 +1,3 @@ +function g(g: T): number { + return 1 +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-var.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-var.ts new file mode 100644 index 000000000000..c970514ecb66 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof-in-var.ts @@ -0,0 +1,4 @@ +var obj = { value: 1 } +var obj2: typeof obj = { value: 2 } +var { value }: typeof obj = { value: 2 } +var [element]: (typeof obj)[] = [{ value: 2 }] diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof.ts new file mode 100644 index 000000000000..10e4143a731d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/typeof.ts @@ -0,0 +1,2 @@ +var obj = { value: 1 } +type B = typeof obj diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap new file mode 100644 index 000000000000..5fe02864bb6d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -0,0 +1,5465 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/535.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 52, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 69, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "A": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-properties.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 110, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 54, + 56, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 71, + 73, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 107, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 51, + 53, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 68, + 70, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-function.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 37, + ], + "type": "TSEmptyBodyDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-global.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 42, + 43, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 25, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": true, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-module.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 95, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 95, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 33, + 92, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 89, + 90, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "a": Object { + "$ref": 3, + }, + "b": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 52, + 61, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 46, + 61, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 79, + 90, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 90, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 93, + 94, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/decorators.ts 1`] = ` +Object { + "$id": 18, + "block": Object { + "range": Array [ + 0, + 198, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 4, + }, + "target": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 11, + "block": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "propertyKey": Object { + "$ref": 9, + }, + "target": Object { + "$ref": 8, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + ], + "name": "propertyKey", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + Object { + "$id": 17, + "block": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 16, + "block": Object { + "range": Array [ + 159, + 195, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 17, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 15, + }, + }, + "variableScope": Object { + "$ref": 16, + }, + "variables": Array [ + Object { + "$id": 15, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 16, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 13, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 147, + 150, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "C": Object { + "$ref": 12, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 12, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 17, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "dec", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + "dec": Object { + "$ref": 0, + }, + "gec": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "dec", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + ], + "name": "gec", + "references": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 18, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum.ts 1`] = ` +Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 13, + "block": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": Object { + "range": Array [ + 48, + 53, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 63, + 68, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "type": "enum", + "upperScope": Object { + "$ref": 14, + }, + "variableMap": Object { + "A": Object { + "$ref": 3, + }, + "B": Object { + "$ref": 4, + }, + "C": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 33, + 38, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 44, + 53, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + ], + "name": "B", + "references": Array [ + Object { + "$ref": 8, + }, + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 59, + 68, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 18, + 19, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "E": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "E", + "references": Array [], + "scope": Object { + "$ref": 14, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 101, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "TSEmptyBodyFunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 115, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 110, + 114, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 106, + 114, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/method-overload.ts 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 124, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 7, + }, + "arguments": Object { + "$ref": 6, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/namespace.ts 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 24, + 56, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 47, + 48, + ], + "type": "Literal", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 43, + 48, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 37, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "N", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "N": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 56, + ], + "type": "TSModuleDeclaration", + }, + "parent": null, + "type": "NamespaceName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + ], + "name": "N", + "references": Array [ + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 103, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "a": Object { + "$ref": 4, + }, + "arguments": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 31, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "TSTypeAssertionExpression", + }, + }, + Object { + "$id": 1, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 32, + 38, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 43, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 27, + 40, + ], + "type": "TSTypeAssertionExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 46, + 61, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 165, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 24, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 125, + 128, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 140, + 143, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 159, + 162, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 24, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "g": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "g", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "g": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 5, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 46, + 58, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 87, + 99, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 132, + 146, + ], + "type": "ArrayExpression", + }, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 123, + 126, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "element": Object { + "$ref": 3, + }, + "obj": Object { + "$ref": 0, + }, + "obj2": Object { + "$ref": 1, + }, + "value": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 27, + 58, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 23, + 58, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + ], + "name": "obj2", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 63, + 99, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 59, + 99, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + ], + "name": "value", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 104, + 146, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 100, + 146, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + ], + "name": "element", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + ], +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/basics.js b/packages/typescript-eslint-parser/tests/lib/basics.js index 0217f66839e5..6542baf66287 100644 --- a/packages/typescript-eslint-parser/tests/lib/basics.js +++ b/packages/typescript-eslint-parser/tests/lib/basics.js @@ -12,9 +12,12 @@ // Requirements //------------------------------------------------------------------------------ -const path = require("path"), +const + path = require("path"), + { Linter } = require("eslint"), shelljs = require("shelljs"), - testUtils = require("../../tools/test-utils"); + testUtils = require("../../tools/test-utils"), + parser = require("../../"); //------------------------------------------------------------------------------ // Setup @@ -36,4 +39,56 @@ describe("basics", () => { const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code)); }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/476", () => { + const linter = new Linter(); + const code = ` +export const Price: React.SFC = function Price(props) {} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + test: "error" + } + }; + + linter.defineParser("typescript-eslint-parser", parser); + linter.defineRule("test", context => ({ + TSTypeReference(node) { + const name = context.getSourceCode().getText(node.typeName); + context.report({ + node, + message: "called on {{name}}", + data: { name } + }); + } + })); + + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([ + { + column: 21, + endColumn: 42, + endLine: 2, + line: 2, + message: "called on React.SFC", + nodeType: "TSTypeReference", + ruleId: "test", + severity: 2, + source: "export const Price: React.SFC = function Price(props) {}" + }, + { + column: 31, + endColumn: 41, + endLine: 2, + line: 2, + message: "called on PriceProps", + nodeType: "TSTypeReference", + ruleId: "test", + severity: 2, + source: "export const Price: React.SFC = function Price(props) {}" + } + ]); + }); }); diff --git a/packages/typescript-eslint-parser/tests/lib/scope-analysis.js b/packages/typescript-eslint-parser/tests/lib/scope-analysis.js new file mode 100644 index 000000000000..6fb0f9a62aca --- /dev/null +++ b/packages/typescript-eslint-parser/tests/lib/scope-analysis.js @@ -0,0 +1,354 @@ +/** + * @fileoverview Tests for TypeScript-specific scope analysis + * @author Toru Nagashima + */ +"use strict"; + +const fs = require("fs"); +const path = require("path"); +const { Linter } = require("eslint"); +const parser = require("../.."); + +/** Reference resolver. */ +class ReferenceResolver { + constructor() { + this.map = new Map(); + } + + resolve(obj, properties) { + const resolved = Object.assign({ $id: this.map.size }, properties); + this.map.set(obj, resolved); + return resolved; + } + + ref(obj) { + if (typeof obj !== "object" || obj === null) { + return obj; + } + + const { map } = this; + return { + get $ref() { + return map.get(obj).$id; + } + }; + } +} + +/** + * Convert a given node object to JSON object. + * This saves only type and range to know what the node is. + * @param {ASTNode} node The AST node object. + * @returns {Object} The object that can be used for JSON.stringify. + */ +function nodeToJSON(node) { + if (!node) { + return node; + } + + const { type, name, range } = node; + if (node.type === "Identifier") { + return { type, name, range }; + } + return { type, range }; +} + +/** + * Convert a given variable object to JSON object. + * @param {Variable} variable The eslint-scope's variable object. + * @param {ReferenceResolver} resolver The reference resolver. + * @returns {Object} The object that can be used for JSON.stringify. + */ +function variableToJSON(variable, resolver) { + const { name, eslintUsed } = variable; + const defs = variable.defs.map(d => ({ + type: d.type, + name: nodeToJSON(d.name), + node: nodeToJSON(d.node), + parent: nodeToJSON(d.parent) + })); + const identifiers = variable.identifiers.map(nodeToJSON); + const references = variable.references.map(resolver.ref, resolver); + const scope = resolver.ref(variable.scope); + + return resolver.resolve(variable, { + name, + defs, + identifiers, + references, + scope, + eslintUsed + }); +} + +/** + * Convert a given reference object to JSON object. + * @param {Reference} reference The eslint-scope's reference object. + * @param {ReferenceResolver} resolver The reference resolver. + * @returns {Object} The object that can be used for JSON.stringify. + */ +function referenceToJSON(reference, resolver) { + const kind = `${reference.isRead() ? "r" : ""}${reference.isWrite() ? "w" : ""}`; + const from = resolver.ref(reference.from); + const identifier = nodeToJSON(reference.identifier); + const writeExpr = nodeToJSON(reference.writeExpr); + const resolved = resolver.ref(reference.resolved); + + return resolver.resolve(reference, { + kind, + from, + identifier, + writeExpr, + resolved + }); +} + +/** + * Convert a given scope object to JSON object. + * @param {Scope} scope The eslint-scope's scope object. + * @param {ReferenceResolver} resolver The reference resolver. + * @returns {Object} The object that can be used for JSON.stringify. + */ +function scopeToJSON(scope, resolver = new ReferenceResolver()) { + const { type, functionExpressionScope, isStrict } = scope; + const block = nodeToJSON(scope.block); + const variables = scope.variables.map(v => variableToJSON(v, resolver)); + const references = scope.references.map(r => referenceToJSON(r, resolver)); + const variableMap = Array.from(scope.set.entries()).reduce((map, [name, variable]) => { + map[name] = resolver.ref(variable); + return map; + }, {}); + const throughReferences = scope.through.map(resolver.ref, resolver); + const variableScope = resolver.ref(scope.variableScope); + const upperScope = resolver.ref(scope.upper); + const childScopes = scope.childScopes.map(c => scopeToJSON(c, resolver)); + + return resolver.resolve(scope, { + type, + functionExpressionScope, + isStrict, + block, + variables, + references, + variableMap, + throughReferences, + variableScope, + upperScope, + childScopes + }); +} + +describe("TypeScript scope analysis", () => { + const root = "tests/fixtures/scope-analysis"; + const files = fs.readdirSync(root).map(filename => path.join(root, filename).replace(/\\/g, "/")); + + for (const filePath of files) { + test(filePath, () => { + const code = fs.readFileSync(filePath, "utf8"); + const { scopeManager } = parser.parseForESLint(code, { + loc: true, + range: true, + tokens: true, + ecmaFeatures: {} + }); + const { globalScope } = scopeManager; + + // Do the postprocess to test. + // https://github.com/eslint/eslint/blob/4fe328787dd02d7a1f6fc21167f6175c860825e3/lib/linter.js#L222 + globalScope.through = globalScope.through.filter(reference => { + const name = reference.identifier.name; + const variable = globalScope.set.get(name); + if (variable) { + reference.resolved = variable; + variable.references.push(reference); + return false; + } + return true; + }); + + const scopeTree = scopeToJSON(globalScope); + expect(scopeTree).toMatchSnapshot(); + }); + } + + const linter = new Linter(); + linter.defineParser("typescript-eslint-parser", parser); + + test("https://github.com/eslint/typescript-eslint-parser/issues/416", () => { + const code = ` +export type SomeThing = { + id: string; +} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-undef": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue416.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/435", () => { + const code = ` +interface Foo { + bar: string +} +const bar = 'blah' +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-use-before-define": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue435.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/437", () => { + const code = ` +interface Runnable { + run (): Result + toString (): string +} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-undef": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue437.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/443", () => { + const code = ` +const Foo = 1; +type Foo = 1; +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-redeclare": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue443.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/459", () => { + const code = ` +type foo = any; +function bar(foo: any) {} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-shadow": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/466", () => { + const code = ` +/*globals document, selector */ +const links = document.querySelectorAll( selector ) as NodeListOf +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-undef": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/471", () => { + const code = ` +class X { + field = {} +} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-undef": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/487", () => { + const code = ` +export default class Test { + private status: string; + getStatus() { + return this.status; + } +} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-restricted-globals": ["error", "status"] + } + }; + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/535", () => { + const code = ` +function foo({ bar }: { bar: string }) { + console.log(bar); +} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-dupe-args": "error", + "no-redeclare": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([]); + }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/535", () => { + const code = ` +import { + observable, +} from 'mobx'; + +export default class ListModalStore { + @observable + orderList: IObservableArray = observable([]); +} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-unused-vars": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([]); + }); +}); diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 18cf5920f70c..2fbefd5a1ab6 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -9,28 +9,20 @@ const Evk = require("eslint-visitor-keys"); module.exports = Evk.unionWith({ - ArrayPattern: ["typeAnnotation"], - ArrowFunctionExpression: ["returnType", "typeParameters"], - AssignmentPattern: ["typeAnnotation"], - CallExpression: ["typeParameters"], - ClassDeclaration: ["superTypeParameters", "typeParameters"], - ClassExpression: ["superTypeParameters", "typeParameters"], - ClassImplements: ["typeParameters"], - ClassProperty: ["typeAnnotation"], - FunctionDeclaration: ["returnType", "typeParameters"], - FunctionExpression: ["returnType", "typeParameters"], + // Additional Properties. + ArrayPattern: ["elements", "typeAnnotation"], + ArrowFunctionExpression: ["typeParameters", "params", "returnType", "body"], + ClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "body"], + ClassExpression: ["decorators", "id", "typeParameters", "superClass", "body"], + FunctionDeclaration: ["id", "typeParameters", "params", "returnType", "body"], + FunctionExpression: ["id", "typeParameters", "params", "returnType", "body"], Identifier: ["typeAnnotation"], - InterfaceDeclaration: ["typeParameters"], - NewExpression: ["typeParameters"], - ObjectPattern: ["typeAnnotation"], - /** - * According to https://github.com/estree/estree/blob/master/extensions/type-annotations.md - * RestElement should have "typeAnnotation", but has not. Annotation is added on the "parameter" node - */ - RestElement: [], - TaggedTemplateExpression: ["typeParameters"], - VariableDeclarator: ["typeParameters"], + MethodDefinition: ["decorators", "key", "value"], + ObjectPattern: ["properties", "typeAnnotation"], + // Additional Nodes. + ClassProperty: ["decorators", "key", "typeAnnotation", "value"], + Decorator: ["expression"], TSAbstractClassProperty: ["typeAnnotation", "key", "value"], TSAbstractClassDeclaration: ["id", "body", "superClass", "implements"], TSAbstractKeyword: [], @@ -39,9 +31,13 @@ module.exports = Evk.unionWith({ TSArrayType: ["elementType"], TSAsyncKeyword: [], TSBooleanKeyword: [], + TSCallSignature: ["typeParameters", "parameters", "typeAnnotation"], + TSConstructSignature: ["typeParameters", "params", "typeAnnotation"], TSConstructorType: ["typeAnnotation", "parameters"], - TSConstructSignature: ["typeAnnotation", "typeParameters"], TSDeclareKeyword: [], + TSEmptyBodyDeclareFunction: ["id", "typeParameters", "params", "returnType"], + TSEmptyBodyFunctionDeclaration: ["id", "typeParameters", "params", "returnType"], + TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumDeclaration: ["members"], TSEnumMember: ["initializer"], TSExportAssignment: ["expression"], @@ -81,6 +77,7 @@ module.exports = Evk.unionWith({ TSTypeParameterInstantiation: ["params"], TSTypePredicate: ["typeAnnotation", "parameterName"], TSTypeReference: ["typeName", "typeParameters"], + TSTypeQuery: ["exprName"], TSUnionType: ["types"], TSUndefinedKeyword: [], TSVoidKeyword: [] From 87c3e830ec6ac8b3650144dd8a39a32a60869d63 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 13 Nov 2018 16:18:58 -0500 Subject: [PATCH 306/326] Build: changelog update for 21.0.0 --- packages/typescript-eslint-parser/CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index 05f923658bdd..c18aca6dfdb7 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,13 @@ +v21.0.0 - November 13, 2018 + +* eb23b26 Update: add proper scope analysis (fixes #535) (#540) (Toru Nagashima) +* 150ffe8 Breaking: make 'useJSXTextNode:true' by default (#544) (Toru Nagashima) +* 2d22321 Breaking: switch 'jsx' option by filename (fixes #517) (#543) (Toru Nagashima) +* 3b1ed17 Breaking: make eslint a peerDep/devDep (#541) (Kai Cataldo) +* 1d54346 Chore: test Node v11 in CI (#542) (Kai Cataldo) +* a9d932a Breaking: typescript-estree v5 (#538) (Kai Cataldo) +* 6a9b629 Docs: add options to README (#530) (Joe Pea) + v20.1.1 - October 31, 2018 * 1683169 Revert "Chore: Make ESLint a devDependency/peerDependency (fixes #523)" (#537) (Kevin Partington) From 32106a676358d744bff6fe905174f1c2cb86f421 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Tue, 13 Nov 2018 16:18:58 -0500 Subject: [PATCH 307/326] 21.0.0 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 17c350996f9d..f1c4fd764cd6 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "20.1.1", + "version": "21.0.0", "files": [ "parser.js", "analyze-scope.js", From a27fa12fe0061649d8defbc92af06767803bec5d Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Wed, 14 Nov 2018 17:49:44 -0500 Subject: [PATCH 308/326] Upgrade: eslint-release v1.2.0 (#549) Just ran a release and noticed this could be updated, so made a quick PR. --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index f1c4fd764cd6..0bc11dbdb74c 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -53,7 +53,7 @@ "eslint": "^4.19.1", "eslint-config-eslint": "4.0.0", "eslint-plugin-node": "6.0.1", - "eslint-release": "1.1.0", + "eslint-release": "1.2.0", "jest": "23.1.0", "npm-license": "0.3.3", "shelljs": "0.8.2", From fb2122fe6a30561ff0653630f6a92c0ed13d2cb8 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Fri, 16 Nov 2018 01:38:59 +0900 Subject: [PATCH 309/326] Fix: wrong reference on TSQualifiedName (fixes #550) (#551) --- .../typescript-eslint-parser/analyze-scope.js | 9 +++++++++ .../tests/lib/scope-analysis.js | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index d0902901301f..339091e49a6e 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -384,6 +384,15 @@ class Referencer extends OriginalReferencer { } } + /** + * Create reference objects for the object part. (This is `obj.prop`) + * @param {TSTypeQuery} node The TSTypeQuery node to visit. + * @returns {void} + */ + TSQualifiedName(node) { + this.visit(node.left); + } + /** * Create reference objects for the references in computed keys. * @param {TSPropertySignature} node The TSPropertySignature node to visit. diff --git a/packages/typescript-eslint-parser/tests/lib/scope-analysis.js b/packages/typescript-eslint-parser/tests/lib/scope-analysis.js index 6fb0f9a62aca..f56714b8f79b 100644 --- a/packages/typescript-eslint-parser/tests/lib/scope-analysis.js +++ b/packages/typescript-eslint-parser/tests/lib/scope-analysis.js @@ -351,4 +351,23 @@ export default class ListModalStore { expect(messages).toStrictEqual([]); }); + + test("https://github.com/eslint/typescript-eslint-parser/issues/550", () => { + const code = ` +function test(file: Blob) { + const slice: typeof file.slice = + file.slice || (file as any).webkitSlice || (file as any).mozSlice + return slice +} +`; + const config = { + parser: "typescript-eslint-parser", + rules: { + "no-use-before-define": "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue.ts" }); + + expect(messages).toStrictEqual([]); + }); }); From a03fbcabb900ba3741d44438cad1b0343785fa98 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 15 Nov 2018 11:40:34 -0500 Subject: [PATCH 310/326] Build: changelog update for 21.0.1 --- packages/typescript-eslint-parser/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index c18aca6dfdb7..fe518d12b1c3 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,8 @@ +v21.0.1 - November 15, 2018 + +* [`3715584`](https://github.com/eslint/typescript-eslint-parser/commit/3715584404de566c9b6db975328122e819993768) Fix: wrong reference on TSQualifiedName (fixes #550) (#551) (Toru Nagashima) +* [`15b32d0`](https://github.com/eslint/typescript-eslint-parser/commit/15b32d0c9430111cdcdc7d187dfdc00b049bf3fb) Upgrade: eslint-release v1.2.0 (#549) (Kai Cataldo) + v21.0.0 - November 13, 2018 * eb23b26 Update: add proper scope analysis (fixes #535) (#540) (Toru Nagashima) From d40e0e09ff5cf16dd6f352dafe37f6b1552ccb00 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Thu, 15 Nov 2018 11:40:35 -0500 Subject: [PATCH 311/326] 21.0.1 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 0bc11dbdb74c..de0704b4b0db 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "21.0.0", + "version": "21.0.1", "files": [ "parser.js", "analyze-scope.js", From 3d1a2be19c25a6346d27c35b88e3ebfcef35ee87 Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 20 Nov 2018 03:26:32 +0100 Subject: [PATCH 312/326] Fix: missing visitor-keys (#554) - typeParameters in TSInterfaceDeclaration - decorators in Identifier - parameters in TSFunctionType --- .../typescript-eslint-parser/analyze-scope.js | 12 + .../scope-analysis/identifier-decorators.ts | 4 + .../fixtures/scope-analysis/interface-type.ts | 7 + .../lib/__snapshots__/scope-analysis.js.snap | 308 ++++++++++++++++++ .../typescript-eslint-parser/visitor-keys.js | 6 +- 5 files changed, 334 insertions(+), 3 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/identifier-decorators.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/interface-type.ts diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index 339091e49a6e..0fb87e9ee6b2 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -69,6 +69,9 @@ class EnumScope extends Scope { class PatternVisitor extends OriginalPatternVisitor { Identifier(node) { super.Identifier(node); + if (node.decorators) { + this.rightHandNodes.push(...node.decorators); + } if (node.typeAnnotation) { this.rightHandNodes.push(node.typeAnnotation); } @@ -76,6 +79,9 @@ class PatternVisitor extends OriginalPatternVisitor { ArrayPattern(node) { node.elements.forEach(this.visit, this); + if (node.decorators) { + this.rightHandNodes.push(...node.decorators); + } if (node.typeAnnotation) { this.rightHandNodes.push(node.typeAnnotation); } @@ -83,6 +89,9 @@ class PatternVisitor extends OriginalPatternVisitor { ObjectPattern(node) { node.properties.forEach(this.visit, this); + if (node.decorators) { + this.rightHandNodes.push(...node.decorators); + } if (node.typeAnnotation) { this.rightHandNodes.push(node.typeAnnotation); } @@ -216,9 +225,12 @@ class Referencer extends OriginalReferencer { * @returns {void} */ Identifier(node) { + this.visitDecorators(node.decorators); + if (!this.typeMode) { super.Identifier(node); } + this.visit(node.typeAnnotation); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/identifier-decorators.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/identifier-decorators.ts new file mode 100644 index 000000000000..00d04632efb9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/identifier-decorators.ts @@ -0,0 +1,4 @@ +export class Test { + constructor(@Decorator config) { + } +} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/interface-type.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/interface-type.ts new file mode 100644 index 000000000000..2590bf7a9136 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/interface-type.ts @@ -0,0 +1,7 @@ +interface C { + +} + +interface R { + foo: C +} diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 5fe02864bb6d..5d4c7419dc08 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -2927,6 +2927,289 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "Decorator", + "range": Array [ + 37, + 46, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "config": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + ], + "name": "config", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "Test": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "Test": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` Object { "$id": 1, @@ -3003,6 +3286,31 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/interface-type.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/method-overload.ts 1`] = ` Object { "$id": 10, diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 2fbefd5a1ab6..945da9e592ea 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -16,7 +16,7 @@ module.exports = Evk.unionWith({ ClassExpression: ["decorators", "id", "typeParameters", "superClass", "body"], FunctionDeclaration: ["id", "typeParameters", "params", "returnType", "body"], FunctionExpression: ["id", "typeParameters", "params", "returnType", "body"], - Identifier: ["typeAnnotation"], + Identifier: ["decorators", "typeAnnotation"], MethodDefinition: ["decorators", "key", "value"], ObjectPattern: ["properties", "typeAnnotation"], @@ -46,9 +46,9 @@ module.exports = Evk.unionWith({ TSLiteralType: ["literal"], TSIndexSignature: ["typeAnnotation", "index"], TSInterfaceBody: ["body"], - TSInterfaceDeclaration: ["body", "id", "heritage"], + TSInterfaceDeclaration: ["id", "typeParameters", "heritage", "body"], TSInterfaceHeritage: ["id", "typeParameters"], - TSFunctionType: ["typeAnnotation"], + TSFunctionType: ["parameters", "typeAnnotation"], TSMethodSignature: ["typeAnnotation", "typeParameters", "key", "params"], TSModuleBlock: ["body"], TSModuleDeclaration: ["id", "body"], From 079d1109cec74938c9e4808005dfaba7885eaa2e Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 21 Nov 2018 04:30:01 +0100 Subject: [PATCH 313/326] Fix: crash in no-unused-vars when using enum (#556) --- .../fixtures/scope-analysis/enum-string.ts | 3 + .../lib/__snapshots__/scope-analysis.js.snap | 170 ++++++++++++++++++ .../typescript-eslint-parser/visitor-keys.js | 2 +- 3 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum-string.ts diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum-string.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum-string.ts new file mode 100644 index 000000000000..754e32637722 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/enum-string.ts @@ -0,0 +1,3 @@ +enum Foo { + BAR = 'bar' +} diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 5d4c7419dc08..8cf1838d5633 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -2703,6 +2703,176 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum-string.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "enum", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "BAR": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 26, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "BAR", + "references": Array [ + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload.ts 1`] = ` Object { "$id": 4, diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 945da9e592ea..1de50cd045a0 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -39,7 +39,7 @@ module.exports = Evk.unionWith({ TSEmptyBodyFunctionDeclaration: ["id", "typeParameters", "params", "returnType"], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumDeclaration: ["members"], - TSEnumMember: ["initializer"], + TSEnumMember: ["id", "initializer"], TSExportAssignment: ["expression"], TSExportKeyword: [], TSImportType: ["parameter", "qualifier", "typeParameters"], From 815f6b54833deda31373ac9da9e6ff9bf7b9fcae Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 28 Nov 2018 22:25:15 +0100 Subject: [PATCH 314/326] Fix: visitor-keys for TSAbstractClassProperty (#560) * Fix: order of visiting in TSAbstractClassProperty * Add missing decorators to TSAbstractClassProperty its already supported in ClassProperty --- packages/typescript-eslint-parser/visitor-keys.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 1de50cd045a0..96b5f80905d3 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -23,7 +23,7 @@ module.exports = Evk.unionWith({ // Additional Nodes. ClassProperty: ["decorators", "key", "typeAnnotation", "value"], Decorator: ["expression"], - TSAbstractClassProperty: ["typeAnnotation", "key", "value"], + TSAbstractClassProperty: ["decorators", "key", "typeAnnotation", "value"], TSAbstractClassDeclaration: ["id", "body", "superClass", "implements"], TSAbstractKeyword: [], TSAbstractMethodDefinition: ["key", "value"], From aec2d7936d9c47355cffc26edf9522c0a914db1d Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 28 Nov 2018 22:32:05 +0100 Subject: [PATCH 315/326] Fix: visiting typeParameters in expressions (#565) * Fix: missing typeParameters in expressions * ignoreEval is always set to true, than we can ignore this case --- .../typescript-eslint-parser/analyze-scope.js | 42 ++ .../expression-type-parameters.ts | 5 + .../lib/__snapshots__/scope-analysis.js.snap | 501 ++++++++++++++++++ .../typescript-eslint-parser/visitor-keys.js | 2 + 4 files changed, 550 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-type-parameters.ts diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index 0fb87e9ee6b2..a44532f90a82 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -218,6 +218,20 @@ class Referencer extends OriginalReferencer { super.visitClass(node); } + /** + * Visit typeParameters. + * @param {*} node The node to visit. + * @returns {void} + */ + visitTypeParameters(node) { + if (node.typeParameters) { + const upperTypeMode = this.typeMode; + this.typeMode = true; + this.visit(node.typeParameters); + this.typeMode = upperTypeMode; + } + } + /** * Override. * Don't create the reference object in the type mode. @@ -286,6 +300,34 @@ class Referencer extends OriginalReferencer { this.typeMode = upperTypeMode; } + /** + * Visit new expression. + * @param {NewExpression} node The NewExpression node to visit. + * @returns {void} + */ + NewExpression(node) { + this.visitTypeParameters(node); + this.visit(node.callee); + if (node.arguments) { + node.arguments.forEach(this.visit, this); + } + } + + /** + * Override. + * Visit call expression. + * @param {CallExpression} node The CallExpression node to visit. + * @returns {void} + */ + CallExpression(node) { + this.visitTypeParameters(node); + + this.visit(node.callee); + if (node.arguments) { + node.arguments.forEach(this.visit, this); + } + } + /** * Define the variable of this function declaration only once. * Because to avoid confusion of `no-redeclare` rule by overloading. diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-type-parameters.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-type-parameters.ts new file mode 100644 index 000000000000..f6f14f665928 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-type-parameters.ts @@ -0,0 +1,5 @@ +const a, b, c, d, e, f + +new foo(a, b, c); + +baz(d, e, f); diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 8cf1838d5633..3172c939e610 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -2873,6 +2873,507 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` +Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "foo", + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "c", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "baz", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "d", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 60, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 10, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + "b": Object { + "$ref": 1, + }, + "c": Object { + "$ref": 2, + }, + "d": Object { + "$ref": 3, + }, + "e": Object { + "$ref": 4, + }, + "f": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 7, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [ + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 13, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "name": "c", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 16, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "d", + "references": Array [ + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 18, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + ], + "name": "e", + "references": Array [ + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + ], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload.ts 1`] = ` Object { "$id": 4, diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 96b5f80905d3..2b8c9ef32484 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -19,6 +19,8 @@ module.exports = Evk.unionWith({ Identifier: ["decorators", "typeAnnotation"], MethodDefinition: ["decorators", "key", "value"], ObjectPattern: ["properties", "typeAnnotation"], + NewExpression: ["callee", "typeParameters", "arguments"], + CallExpression: ["callee", "typeParameters", "arguments"], // Additional Nodes. ClassProperty: ["decorators", "key", "typeAnnotation", "value"], From 5576d81adee373b080272df833be533476a04546 Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 28 Nov 2018 22:42:56 +0100 Subject: [PATCH 316/326] Fix: visiting superTypeParameters in classes (#561) * Fix: visiting superTypeParameters in classes * Add missing decorators in TSAbstractClassDeclaration its already supported in visitClass * Add missing typeParameters in TSAbstractClassDeclaration its using same logic as ClassDeclaration --- .../typescript-eslint-parser/analyze-scope.js | 8 + .../scope-analysis/class-supper-type.ts | 11 + .../lib/__snapshots__/scope-analysis.js.snap | 383 ++++++++++++++++++ .../typescript-eslint-parser/visitor-keys.js | 6 +- 4 files changed, 405 insertions(+), 3 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-supper-type.ts diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index a44532f90a82..df37a54268f4 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -215,6 +215,14 @@ class Referencer extends OriginalReferencer { */ visitClass(node) { this.visitDecorators(node.decorators); + + if (node.superTypeParameters) { + const upperTypeMode = this.typeMode; + this.typeMode = true; + this.visit(node.superTypeParameters); + this.typeMode = upperTypeMode; + } + super.visitClass(node); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-supper-type.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-supper-type.ts new file mode 100644 index 000000000000..14ad843ebe63 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-supper-type.ts @@ -0,0 +1,11 @@ +abstract class Foo extends Bar { + +} + +declare class Foo2 extends Bar { + +} + +class Foo3 extends Bar { + +} diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 3172c939e610..13475efcc4db 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -565,6 +565,389 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 117, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 8, + "block": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo2": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + Object { + "$id": 10, + "block": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo3": Object { + "$ref": 9, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Foo2": Object { + "$ref": 0, + }, + "Foo3": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` Object { "$id": 8, diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 2b8c9ef32484..568baa7e3fe4 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -12,8 +12,8 @@ module.exports = Evk.unionWith({ // Additional Properties. ArrayPattern: ["elements", "typeAnnotation"], ArrowFunctionExpression: ["typeParameters", "params", "returnType", "body"], - ClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "body"], - ClassExpression: ["decorators", "id", "typeParameters", "superClass", "body"], + ClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "body"], + ClassExpression: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "body"], FunctionDeclaration: ["id", "typeParameters", "params", "returnType", "body"], FunctionExpression: ["id", "typeParameters", "params", "returnType", "body"], Identifier: ["decorators", "typeAnnotation"], @@ -26,7 +26,7 @@ module.exports = Evk.unionWith({ ClassProperty: ["decorators", "key", "typeAnnotation", "value"], Decorator: ["expression"], TSAbstractClassProperty: ["decorators", "key", "typeAnnotation", "value"], - TSAbstractClassDeclaration: ["id", "body", "superClass", "implements"], + TSAbstractClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "implements", "body"], TSAbstractKeyword: [], TSAbstractMethodDefinition: ["key", "value"], TSAnyKeyword: [], From 04939f4c114bf18a9885e4fc901ea46dc6f6d1e9 Mon Sep 17 00:00:00 2001 From: Armano Date: Wed, 28 Nov 2018 23:13:04 +0100 Subject: [PATCH 317/326] Fix: missing implements in classes (#562) --- .../typescript-eslint-parser/analyze-scope.js | 11 +- .../scope-analysis/class-implements.ts | 3 + .../lib/__snapshots__/scope-analysis.js.snap | 140 ++++++++++++++++++ .../typescript-eslint-parser/visitor-keys.js | 4 +- 4 files changed, 152 insertions(+), 6 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-implements.ts diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index df37a54268f4..cfec9f5d7d09 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -210,18 +210,21 @@ class Referencer extends OriginalReferencer { /** * Override. * Visit decorators. - * @param {ClassDeclaration|ClassExpression} node The class node to visit. + * @param {ClassDeclaration|ClassExpression|TSAbstractClassDeclaration} node The class node to visit. * @returns {void} */ visitClass(node) { this.visitDecorators(node.decorators); + const upperTypeMode = this.typeMode; + this.typeMode = true; if (node.superTypeParameters) { - const upperTypeMode = this.typeMode; - this.typeMode = true; this.visit(node.superTypeParameters); - this.typeMode = upperTypeMode; } + if (node.implements) { + this.visit(node.implements); + } + this.typeMode = upperTypeMode; super.visitClass(node); } diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-implements.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-implements.ts new file mode 100644 index 000000000000..8da64a025317 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/class-implements.ts @@ -0,0 +1,3 @@ +class Foo implements Component, {}>, Component2 { + +} diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 13475efcc4db..2ae68e0bc78b 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -273,6 +273,146 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-implements.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-properties.ts 1`] = ` Object { "$id": 8, diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 568baa7e3fe4..4beead8c7cff 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -12,8 +12,8 @@ module.exports = Evk.unionWith({ // Additional Properties. ArrayPattern: ["elements", "typeAnnotation"], ArrowFunctionExpression: ["typeParameters", "params", "returnType", "body"], - ClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "body"], - ClassExpression: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "body"], + ClassDeclaration: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "implements", "body"], + ClassExpression: ["decorators", "id", "typeParameters", "superClass", "superTypeParameters", "implements", "body"], FunctionDeclaration: ["id", "typeParameters", "params", "returnType", "body"], FunctionExpression: ["id", "typeParameters", "params", "returnType", "body"], Identifier: ["decorators", "typeAnnotation"], From d4e2421ebc982f844b72046e739584ff1a3ec463 Mon Sep 17 00:00:00 2001 From: Armano Date: Fri, 30 Nov 2018 01:07:49 +0100 Subject: [PATCH 318/326] Fix: scope for TSImportEqualsDeclaration (#571) --- .../typescript-eslint-parser/analyze-scope.js | 16 ++++ .../fixtures/scope-analysis/import-equals.ts | 1 + .../lib/__snapshots__/scope-analysis.js.snap | 95 +++++++++++++++++++ .../typescript-eslint-parser/visitor-keys.js | 2 + 4 files changed, 114 insertions(+) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/import-equals.ts diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index cfec9f5d7d09..95c378d8dbb0 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -610,6 +610,22 @@ class Referencer extends OriginalReferencer { this.MethodDefinition(node); } + /** + * Process import equal declaration + * @param {TSImportEqualsDeclaration} node The TSImportEqualsDeclaration node to visit. + * @returns {void} + */ + TSImportEqualsDeclaration(node) { + const { name, moduleReference } = node; + if (name && name.type === "Identifier") { + this.currentScope().__define( + name, + new Definition("ImportBinding", name, node, null, null, null) + ); + } + this.visit(moduleReference); + } + /** * Process the global augmentation. * 1. Set the global scope as the current scope. diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/import-equals.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/import-equals.ts new file mode 100644 index 000000000000..be7ce5184772 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/import-equals.ts @@ -0,0 +1 @@ +import foo = require('bar') diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 2ae68e0bc78b..6316b14bbf45 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -4480,6 +4480,101 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/import-equals.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 27, + ], + "type": "TSImportEqualsDeclaration", + }, + "parent": null, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/interface-type.ts 1`] = ` Object { "$id": 0, diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 4beead8c7cff..40a5e498c720 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -44,12 +44,14 @@ module.exports = Evk.unionWith({ TSEnumMember: ["id", "initializer"], TSExportAssignment: ["expression"], TSExportKeyword: [], + TSExternalModuleReference: ["expression"], TSImportType: ["parameter", "qualifier", "typeParameters"], TSLiteralType: ["literal"], TSIndexSignature: ["typeAnnotation", "index"], TSInterfaceBody: ["body"], TSInterfaceDeclaration: ["id", "typeParameters", "heritage", "body"], TSInterfaceHeritage: ["id", "typeParameters"], + TSImportEqualsDeclaration: ["name", "moduleReference"], TSFunctionType: ["parameters", "typeAnnotation"], TSMethodSignature: ["typeAnnotation", "typeParameters", "key", "params"], TSModuleBlock: ["body"], From 574fea36b430961c9c0700d6e9f18cfde112da4e Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 3 Dec 2018 16:12:45 +0100 Subject: [PATCH 319/326] Fix: issue with global augmentation when tokens are not present (#574) --- .../typescript-eslint-parser/analyze-scope.js | 35 +------------------ .../typescript-eslint-parser/package.json | 3 +- packages/typescript-eslint-parser/parser.js | 4 +-- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index 95c378d8dbb0..a542a22d4d5f 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -9,39 +9,8 @@ const Reference = require("eslint-scope/lib/reference"); const OriginalReferencer = require("eslint-scope/lib/referencer"); const Scope = require("eslint-scope/lib/scope").Scope; const fallback = require("eslint-visitor-keys").getKeys; -const lodash = require("lodash"); const childVisitorKeys = require("./visitor-keys"); -/** - * Get `.range[0]` of a given object. - * @param {{range: number[]}} x The object to get. - * @returns {number} The gotten value. - */ -function byRange0(x) { - return x.range[0]; -} - -/** - * Check the TSModuleDeclaration node is `declare global {}` or not. - * @param {TSModuleDeclaration} node The TSModuleDeclaration node to check. - * @param {Token[]} tokens The token list. - * @returns {boolean} `true` if the node is `declare global {}`. - */ -function isGlobalAugmentation(node, tokens) { - const i = lodash.sortedIndexBy(tokens, node, byRange0); - const token1 = tokens[i]; - const token2 = tokens[i + 1]; - - return Boolean( - token1 && - token2 && - (token1.type === "Keyword" || token1.type === "Identifier") && - token1.value === "declare" && - (token2.type === "Keyword" || token2.type === "Identifier") && - token2.value === "global" - ); -} - /** * Define the override function of `Scope#__define` for global augmentation. * @param {Function} define The original Scope#__define method. @@ -570,12 +539,10 @@ class Referencer extends OriginalReferencer { * @returns {void} */ TSModuleDeclaration(node) { - const astRoot = this.scopeManager.globalScope.block; const scope = this.currentScope(); const { id, body } = node; - // https://github.com/JamesHenry/typescript-estree/issues/27 - if (isGlobalAugmentation(node, astRoot.tokens)) { + if (node.global) { this.visitGlobalAugmentation(node); return; } diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index de0704b4b0db..d3ed222dc6a7 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -46,8 +46,7 @@ "dependencies": { "eslint-scope": "^4.0.0", "eslint-visitor-keys": "^1.0.0", - "lodash": "^4.17.11", - "typescript-estree": "5.0.0" + "typescript-estree": "5.3.0" }, "devDependencies": { "eslint": "^4.19.1", diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 51e526a03c71..59f5836babcc 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -41,7 +41,7 @@ exports.parseForESLint = function parseForESLint(code, options) { traverser.traverse(ast, { enter: node => { switch (node.type) { - // Just for backword compatibility. + // Just for backward compatibility. case "DeclareFunction": if (!node.body) { node.type = `TSEmptyBody${node.type}`; @@ -58,7 +58,7 @@ exports.parseForESLint = function parseForESLint(code, options) { // Import/Export declarations cannot appear in script. // But if those appear only in namespace/module blocks, `ast.sourceType` was `"script"`. - // This doesn't modify `ast.sourceType` directly for backrard compatibility. + // This doesn't modify `ast.sourceType` directly for backward compatibility. case "ImportDeclaration": case "ExportAllDeclaration": case "ExportDefaultDeclaration": From 3ae0d0d5499c39272567a49f3d106eee5c41f5b6 Mon Sep 17 00:00:00 2001 From: dudiharush Date: Mon, 3 Dec 2018 17:15:28 +0200 Subject: [PATCH 320/326] Docs: Update README.md (#567) Typescript support is 3.1.1 according to package.json file --- packages/typescript-eslint-parser/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index e49bbb07fea1..f2c444299e09 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -59,7 +59,7 @@ The following additional configuration options are available by specifying them We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~3.0.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~3.1.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. From 39958c8a389aee74c19fb334b637f043e267a25a Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 3 Dec 2018 13:11:31 -0500 Subject: [PATCH 321/326] Build: changelog update for 21.0.2 --- packages/typescript-eslint-parser/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/typescript-eslint-parser/CHANGELOG.md b/packages/typescript-eslint-parser/CHANGELOG.md index fe518d12b1c3..8fba7c0d5622 100644 --- a/packages/typescript-eslint-parser/CHANGELOG.md +++ b/packages/typescript-eslint-parser/CHANGELOG.md @@ -1,3 +1,15 @@ +v21.0.2 - December 3, 2018 + +* [`fed0a5a`](https://github.com/eslint/typescript-eslint-parser/commit/fed0a5a4bc7b3c6a242081adf91af50e848fcf62) Docs: Update README.md (#567) (dudiharush) +* [`47abd82`](https://github.com/eslint/typescript-eslint-parser/commit/47abd8282384617793d800209b5eb5d71d0c5730) Fix: issue with global augmentation when tokens are not present (#574) (Armano) +* [`c5ffad3`](https://github.com/eslint/typescript-eslint-parser/commit/c5ffad3ecafdc9596174d1a2de5fd978d386035a) Fix: scope for TSImportEqualsDeclaration (#571) (Armano) +* [`8ff0ad1`](https://github.com/eslint/typescript-eslint-parser/commit/8ff0ad153cf66b873c21624b7af31d33ce9d7073) Fix: missing implements in classes (#562) (Armano) +* [`cc92044`](https://github.com/eslint/typescript-eslint-parser/commit/cc920441093356a7a47ff5fdb752643b6c42cff8) Fix: visiting superTypeParameters in classes (#561) (Armano) +* [`83dbabb`](https://github.com/eslint/typescript-eslint-parser/commit/83dbabb626e5592c07085743a44586378956a153) Fix: visiting typeParameters in expressions (#565) (Armano) +* [`c19e479`](https://github.com/eslint/typescript-eslint-parser/commit/c19e4798ae6067daf9994b90fabcdf2d1953d70c) Fix: visitor-keys for TSAbstractClassProperty (#560) (Armano) +* [`491ebca`](https://github.com/eslint/typescript-eslint-parser/commit/491ebcaff9815071d4194584e3d94d0edf601e3b) Fix: crash in no-unused-vars when using enum (#556) (Armano) +* [`ae7c4e6`](https://github.com/eslint/typescript-eslint-parser/commit/ae7c4e661737b0db8cb0f7b612f58a94e1cced7c) Fix: missing visitor-keys (#554) (Armano) + v21.0.1 - November 15, 2018 * [`3715584`](https://github.com/eslint/typescript-eslint-parser/commit/3715584404de566c9b6db975328122e819993768) Fix: wrong reference on TSQualifiedName (fixes #550) (#551) (Toru Nagashima) From 01e47b37e90b9847c44f465b74ae9d08552a51d2 Mon Sep 17 00:00:00 2001 From: ESLint Jenkins Date: Mon, 3 Dec 2018 13:11:31 -0500 Subject: [PATCH 322/326] 21.0.2 --- packages/typescript-eslint-parser/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index d3ed222dc6a7..fc21e870c4e8 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -4,7 +4,7 @@ "author": "Nicholas C. Zakas ", "homepage": "https://github.com/eslint/typescript-eslint-parser", "main": "parser.js", - "version": "21.0.1", + "version": "21.0.2", "files": [ "parser.js", "analyze-scope.js", From 88cfcaeac192c750fc64badb6c6b7a417921baf1 Mon Sep 17 00:00:00 2001 From: Armano Date: Sat, 12 Jan 2019 21:52:23 +0100 Subject: [PATCH 323/326] Breaking: typescript-estree to 18.0.0 and typescript to 3.2.1 (#596) --- packages/typescript-eslint-parser/.gitignore | 1 + packages/typescript-eslint-parser/README.md | 2 +- .../typescript-eslint-parser/analyze-scope.js | 258 +- .../typescript-eslint-parser/package.json | 4 +- packages/typescript-eslint-parser/parser.js | 8 - .../bigIntLiterals/binary.src.js | 1 + .../bigIntLiterals/decimal.src.js | 1 + .../ecma-features/bigIntLiterals/hex.src.js | 1 + .../ecma-features/bigIntLiterals/octal.src.js | 1 + .../scope-analysis/export-as-namespace.ts | 1 + .../fixtures/scope-analysis/expression-as.ts | 1 + .../fixtures/scope-analysis/rest-element.ts | 1 + .../fixtures/scope-analysis/type-alias.ts | 1 + .../fixtures/scope-analysis/type-parameter.ts | 1 + .../scope-analysis/types-array-type.src.ts | 1 + .../types-conditional-with-null.src.ts | 1 + .../scope-analysis/types-conditional.src.ts | 1 + .../scope-analysis/types-indexed.src.ts | 1 + .../fixtures/scope-analysis/types-infer.ts | 5 + .../types-intersection-type.src.ts | 1 + .../types-mapped-readonly-minus.src.ts | 1 + .../types-mapped-readonly-plus.src.ts | 1 + .../types-mapped-readonly.src.ts | 1 + .../scope-analysis/types-mapped.src.ts | 1 + .../scope-analysis/types-nested-types.src.ts | 1 + .../types-parenthesized-type.src.ts | 1 + .../types-reference-generic-nested.src.ts | 1 + .../types-reference-generic.src.ts | 1 + .../scope-analysis/types-reference.src.ts | 1 + .../scope-analysis/types-tuple-empty.src.ts | 1 + .../types-tuple-optional.src.ts | 1 + .../scope-analysis/types-tuple-rest.src.ts | 1 + .../scope-analysis/types-tuple-type.src.ts | 1 + .../scope-analysis/types-tuple.src.ts | 1 + .../scope-analysis/types-type-literal.src.ts | 1 + .../scope-analysis/types-type-operator.src.ts | 2 + .../scope-analysis/types-typeof.src.ts | 1 + .../types-union-intersection.src.ts | 4 + .../scope-analysis/types-union-type.src.ts | 1 + .../export-default-anonymous-function.src.ts | 3 + .../package.json | 4 +- .../jsdoc-indent-issues-344-422/package.json | 4 +- .../method-overloads-issue-389/package.json | 4 +- .../package.json | 4 +- .../range-error-indent-issue-333/package.json | 4 +- .../lib/__snapshots__/ecma-features.js.snap | 417 +- .../lib/__snapshots__/scope-analysis.js.snap | 2407 +++++++- .../tests/lib/__snapshots__/tsx.js.snap | 214 +- .../lib/__snapshots__/typescript.js.snap | 5327 +++++++++-------- .../typescript-eslint-parser/visitor-keys.js | 43 +- 50 files changed, 6037 insertions(+), 2709 deletions(-) create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/binary.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/decimal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/hex.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/octal.src.js create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/export-as-namespace.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-as.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/rest-element.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-alias.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-parameter.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-array-type.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-indexed.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-infer.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-nested-types.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-literal.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-operator.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-typeof.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-type.src.ts create mode 100644 packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-anonymous-function.src.ts diff --git a/packages/typescript-eslint-parser/.gitignore b/packages/typescript-eslint-parser/.gitignore index 5f017910cbc6..34a9c5ab703e 100644 --- a/packages/typescript-eslint-parser/.gitignore +++ b/packages/typescript-eslint-parser/.gitignore @@ -7,3 +7,4 @@ _test.js .vscode yarn.lock .eslint-release-info.json +.idea diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index f2c444299e09..97b92d15e855 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -59,7 +59,7 @@ The following additional configuration options are available by specifying them We will always endeavor to support the latest stable version of TypeScript. -The version of TypeScript currently supported by this parser is `~3.1.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. +The version of TypeScript currently supported by this parser is `~3.2.1`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. If you use a non-supported version of TypeScript, the parser will log a warning to the console. diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index a542a22d4d5f..5505973c0f77 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -65,6 +65,13 @@ class PatternVisitor extends OriginalPatternVisitor { this.rightHandNodes.push(node.typeAnnotation); } } + + RestElement(node) { + super.RestElement(node); + if (node.typeAnnotation) { + this.rightHandNodes.push(node.typeAnnotation); + } + } } class Referencer extends OriginalReferencer { @@ -120,7 +127,7 @@ class Referencer extends OriginalReferencer { const { defs, identifiers } = upperScope.set.get(id.name); for (let i = 0; i < defs.length; ++i) { const def = defs[i]; - if (def.type === "FunctionName" && def.node.type === "TSEmptyBodyFunctionDeclaration") { + if (def.type === "FunctionName" && def.node.type === "TSDeclareFunction") { defs.splice(i, 1); identifiers.splice(i, 1); break; @@ -239,28 +246,9 @@ class Referencer extends OriginalReferencer { super.MethodDefinition(node); } - /** - * Override. - * Don't make variable if `kind === "type"`. - * It doesn't declare variables but declare types. - * @param {VariableDeclaration} node The VariableDeclaration node to visit. - * @returns {void} - */ - VariableDeclaration(node) { - if (node.kind !== "type") { - super.VariableDeclaration(node); - return; - } - - // To detect typeof. - this.typeMode = true; - this.visitChildren(node); - this.typeMode = false; - } - /** * Don't create the reference object for the key if not computed. - * @param {TSEmptyBodyFunctionDeclaration} node The TSEmptyBodyFunctionDeclaration node to visit. + * @param {ClassProperty} node The ClassProperty node to visit. * @returns {void} */ ClassProperty(node) { @@ -311,23 +299,25 @@ class Referencer extends OriginalReferencer { /** * Define the variable of this function declaration only once. * Because to avoid confusion of `no-redeclare` rule by overloading. - * @param {TSEmptyBodyFunctionDeclaration} node The TSEmptyBodyFunctionDeclaration node to visit. + * @param {TSDeclareFunction} node The TSDeclareFunction node to visit. * @returns {void} */ - TSEmptyBodyFunctionDeclaration(node) { + TSDeclareFunction(node) { const upperTypeMode = this.typeMode; const scope = this.currentScope(); const { id, typeParameters, params, returnType } = node; // Ignore this if other overloadings have already existed. - const variable = scope.set.get(id.name); - const defs = variable && variable.defs; - const existed = defs && defs.some(d => d.type === "FunctionName"); - if (!existed) { - scope.__define( - id, - new Definition("FunctionName", id, node, null, null, null) - ); + if (id) { + const variable = scope.set.get(id.name); + const defs = variable && variable.defs; + const existed = defs && defs.some(d => d.type === "FunctionName"); + if (!existed) { + scope.__define( + id, + new Definition("FunctionName", id, node, null, null, null) + ); + } } // Find `typeof` expressions. @@ -337,9 +327,6 @@ class Referencer extends OriginalReferencer { this.visit(returnType); this.typeMode = upperTypeMode; } - TSEmptyBodyDeclareFunction(node) { - this.TSEmptyBodyFunctionDeclaration(node); - } /** * Create reference objects for the references in parameters and return type. @@ -364,43 +351,79 @@ class Referencer extends OriginalReferencer { * @returns {void} */ TSInterfaceDeclaration(node) { + this.visitTypeNodes(node); + } + + /** + * Don't make variable because it declares only types. + * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. + * @param {TSClassImplements} node The TSClassImplements node to visit. + * @returns {void} + */ + TSClassImplements(node) { + this.visitTypeNodes(node); + } + + /** + * Don't make variable because it declares only types. + * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. + * @param {TSIndexSignature} node The TSIndexSignature node to visit. + * @returns {void} + */ + TSIndexSignature(node) { + this.visitTypeNodes(node); + } + + /** + * Visit type assertion. + * @param {TSTypeAssertion} node The TSTypeAssertion node to visit. + * @returns {void} + */ + TSTypeAssertion(node) { if (this.typeMode) { - this.visitChildren(node); + this.visit(node.typeAnnotation); } else { this.typeMode = true; - this.visitChildren(node); + this.visit(node.typeAnnotation); this.typeMode = false; } + + this.visit(node.expression); } /** - * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. - * @param {TSTypeAnnotation} node The TSTypeAnnotation node to visit. + * Visit as expression. + * @param {TSAsExpression} node The TSAsExpression node to visit. * @returns {void} */ - TSTypeAnnotation(node) { + TSAsExpression(node) { + this.visit(node.expression); + if (this.typeMode) { - this.visitChildren(node); + this.visit(node.typeAnnotation); } else { this.typeMode = true; - this.visitChildren(node); + this.visit(node.typeAnnotation); this.typeMode = false; } } + /** + * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. + * @param {TSTypeAnnotation} node The TSTypeAnnotation node to visit. + * @returns {void} + */ + TSTypeAnnotation(node) { + this.visitTypeNodes(node); + } + /** * Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations. * @param {TSTypeParameterDeclaration} node The TSTypeParameterDeclaration node to visit. * @returns {void} */ TSTypeParameterDeclaration(node) { - if (this.typeMode) { - this.visitChildren(node); - } else { - this.typeMode = true; - this.visitChildren(node); - this.typeMode = false; - } + this.visitTypeNodes(node); } /** @@ -418,9 +441,113 @@ class Referencer extends OriginalReferencer { } } + /** + * @param {TSTypeParameter} node The TSTypeParameter node to visit. + * @returns {void} + */ + TSTypeParameter(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSInferType} node The TSInferType node to visit. + * @returns {void} + */ + TSInferType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSTypeReference} node The TSTypeReference node to visit. + * @returns {void} + */ + TSTypeReference(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSTypeLiteral} node The TSTypeLiteral node to visit. + * @returns {void} + */ + TSTypeLiteral(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSLiteralType} node The TSLiteralType node to visit. + * @returns {void} + */ + TSLiteralType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSIntersectionType} node The TSIntersectionType node to visit. + * @returns {void} + */ + TSIntersectionType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSConditionalType} node The TSConditionalType node to visit. + * @returns {void} + */ + TSConditionalType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSIndexedAccessType} node The TSIndexedAccessType node to visit. + * @returns {void} + */ + TSIndexedAccessType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSMappedType} node The TSMappedType node to visit. + * @returns {void} + */ + TSMappedType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSOptionalType} node The TSOptionalType node to visit. + * @returns {void} + */ + TSOptionalType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSParenthesizedType} node The TSParenthesizedType node to visit. + * @returns {void} + */ + TSParenthesizedType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSRestType} node The TSRestType node to visit. + * @returns {void} + */ + TSRestType(node) { + this.visitTypeNodes(node); + } + + /** + * @param {TSTupleType} node The TSTupleType node to visit. + * @returns {void} + */ + TSTupleType(node) { + this.visitTypeNodes(node); + } + /** * Create reference objects for the object part. (This is `obj.prop`) - * @param {TSTypeQuery} node The TSTypeQuery node to visit. + * @param {TSQualifiedName} node The TSQualifiedName node to visit. * @returns {void} */ TSQualifiedName(node) { @@ -457,7 +584,7 @@ class Referencer extends OriginalReferencer { */ TSMethodSignature(node) { const upperTypeMode = this.typeMode; - const { computed, key, typeParameters, params, typeAnnotation } = node; + const { computed, key, typeParameters, params, returnType } = node; if (computed) { this.typeMode = false; @@ -469,7 +596,7 @@ class Referencer extends OriginalReferencer { } this.visit(typeParameters); params.forEach(this.visit, this); - this.visit(typeAnnotation); // Maybe returnType? + this.visit(returnType); this.typeMode = upperTypeMode; } @@ -556,6 +683,12 @@ class Referencer extends OriginalReferencer { this.visit(body); } + TSTypeAliasDeclaration(node) { + this.typeMode = true; + this.visitChildren(node); + this.typeMode = false; + } + /** * Process the module block. * @param {TSModuleBlock} node The TSModuleBlock node to visit. @@ -583,11 +716,11 @@ class Referencer extends OriginalReferencer { * @returns {void} */ TSImportEqualsDeclaration(node) { - const { name, moduleReference } = node; - if (name && name.type === "Identifier") { + const { id, moduleReference } = node; + if (id && id.type === "Identifier") { this.currentScope().__define( - name, - new Definition("ImportBinding", name, node, null, null, null) + id, + new Definition("ImportBinding", id, node, null, null, null) ); } this.visit(moduleReference); @@ -628,6 +761,21 @@ class Referencer extends OriginalReferencer { decorators.forEach(this.visit, this); } } + + /** + * Process all child of type nodes + * @param {any} node node to be processed + * @returns {void} + */ + visitTypeNodes(node) { + if (this.typeMode) { + this.visitChildren(node); + } else { + this.typeMode = true; + this.visitChildren(node); + this.typeMode = false; + } + } } module.exports = function(ast, parserOptions, extraOptions) { diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index fc21e870c4e8..54316fce2a27 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -46,7 +46,7 @@ "dependencies": { "eslint-scope": "^4.0.0", "eslint-visitor-keys": "^1.0.0", - "typescript-estree": "5.3.0" + "typescript-estree": "18.0.0" }, "devDependencies": { "eslint": "^4.19.1", @@ -57,7 +57,7 @@ "npm-license": "0.3.3", "shelljs": "0.8.2", "shelljs-nodecli": "0.1.1", - "typescript": "~3.1.1" + "typescript": "~3.2.1" }, "jest": { "testEnvironment": "node", diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 59f5836babcc..9774d4cb3728 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -41,16 +41,8 @@ exports.parseForESLint = function parseForESLint(code, options) { traverser.traverse(ast, { enter: node => { switch (node.type) { - // Just for backward compatibility. - case "DeclareFunction": - if (!node.body) { - node.type = `TSEmptyBody${node.type}`; - } - break; - // Function#body cannot be null in ESTree spec. case "FunctionExpression": - case "FunctionDeclaration": if (!node.body) { node.type = `TSEmptyBody${node.type}`; } diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/binary.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/binary.src.js new file mode 100644 index 000000000000..2b138015de5e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/binary.src.js @@ -0,0 +1 @@ +0b1n; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/decimal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/decimal.src.js new file mode 100644 index 000000000000..fe03424dbb56 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/decimal.src.js @@ -0,0 +1 @@ +1n; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/hex.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/hex.src.js new file mode 100644 index 000000000000..204f239e3696 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/hex.src.js @@ -0,0 +1 @@ +0x1n; diff --git a/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/octal.src.js b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/octal.src.js new file mode 100644 index 000000000000..f2ce84fefe08 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/ecma-features/bigIntLiterals/octal.src.js @@ -0,0 +1 @@ +0o1n; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/export-as-namespace.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/export-as-namespace.ts new file mode 100644 index 000000000000..ff8bbadf397d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/export-as-namespace.ts @@ -0,0 +1 @@ +export as namespace a; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-as.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-as.ts new file mode 100644 index 000000000000..952b95935afa --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/expression-as.ts @@ -0,0 +1 @@ +(a as number as any) = 42; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/rest-element.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/rest-element.ts new file mode 100644 index 000000000000..6f145407c28e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/rest-element.ts @@ -0,0 +1 @@ +function foo(...args: string[]) {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-alias.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-alias.ts new file mode 100644 index 000000000000..188a66b64f4a --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-alias.ts @@ -0,0 +1 @@ +type foo = string diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-parameter.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-parameter.ts new file mode 100644 index 000000000000..f5f233e4f83e --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/type-parameter.ts @@ -0,0 +1 @@ +function f() {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-array-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-array-type.src.ts new file mode 100644 index 000000000000..5d038fc71d95 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-array-type.src.ts @@ -0,0 +1 @@ +type Foo = string[] diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts new file mode 100644 index 000000000000..c77648689818 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional-with-null.src.ts @@ -0,0 +1 @@ +let x: number extends string ? boolean : null; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional.src.ts new file mode 100644 index 000000000000..da72fcb60124 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-conditional.src.ts @@ -0,0 +1 @@ +let x: number extends string ? boolean : string; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-indexed.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-indexed.src.ts new file mode 100644 index 000000000000..4a5809fdd554 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-indexed.src.ts @@ -0,0 +1 @@ +let x: T[K]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-infer.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-infer.ts new file mode 100644 index 000000000000..45ab5c0f905c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-infer.ts @@ -0,0 +1,5 @@ +type Unpacked = + T extends (infer U)[] ? U : + T extends infer U ? U : + T extends Promise ? U : + T; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts new file mode 100644 index 000000000000..93da9407e8c7 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-intersection-type.src.ts @@ -0,0 +1 @@ +type LinkedList = T & { next: LinkedList }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts new file mode 100644 index 000000000000..a7a1183dc9d5 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts @@ -0,0 +1 @@ +let map: { -readonly [P in string]-?: number }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts new file mode 100644 index 000000000000..854fb5dbb2a2 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts @@ -0,0 +1 @@ +let map: { +readonly [P in string]+?: number; }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts new file mode 100644 index 000000000000..ef13a053bf27 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts @@ -0,0 +1 @@ +let map: { readonly [P in string]?: number; }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped.src.ts new file mode 100644 index 000000000000..aca2ba15b93c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-mapped.src.ts @@ -0,0 +1 @@ +let map: { [P in string]: number; }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-nested-types.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-nested-types.src.ts new file mode 100644 index 000000000000..adaf9a3cf309 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-nested-types.src.ts @@ -0,0 +1 @@ +type Foo = [number, string?, boolean?] | [{}, [number?] | null & boolean[]] & {} diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts new file mode 100644 index 000000000000..5a03e27ee676 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts @@ -0,0 +1 @@ +type Foo = (string | number) diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts new file mode 100644 index 000000000000..e38dfca9d5dc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts @@ -0,0 +1 @@ +let x: Array>; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts new file mode 100644 index 000000000000..4925bd4778cc --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference-generic.src.ts @@ -0,0 +1 @@ +let x: Array; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference.src.ts new file mode 100644 index 000000000000..330fb1d2245d --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-reference.src.ts @@ -0,0 +1 @@ +let x: T; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts new file mode 100644 index 000000000000..f7cd7b5a0e25 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-empty.src.ts @@ -0,0 +1 @@ +let x: []; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts new file mode 100644 index 000000000000..3b8d21ba958c --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts @@ -0,0 +1 @@ +let x: [string, number?, (string | number)?] diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts new file mode 100644 index 000000000000..d7719b2cb4e6 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts @@ -0,0 +1 @@ +let x: [string, ...number[]] diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts new file mode 100644 index 000000000000..75a6d8e39f36 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts @@ -0,0 +1 @@ +type Foo = [string, string?] diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple.src.ts new file mode 100644 index 000000000000..53c8e72ec952 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-tuple.src.ts @@ -0,0 +1 @@ +let x: [number, number, number]; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-literal.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-literal.src.ts new file mode 100644 index 000000000000..4193f364788f --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-literal.src.ts @@ -0,0 +1 @@ +let obj: { x: number }; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-operator.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-operator.src.ts new file mode 100644 index 000000000000..1d23f962ef05 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-type-operator.src.ts @@ -0,0 +1,2 @@ +let x: keyof T; +let y: unique symbol; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-typeof.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-typeof.src.ts new file mode 100644 index 000000000000..eebcd19b13a9 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-typeof.src.ts @@ -0,0 +1 @@ +let x: typeof y.z; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts new file mode 100644 index 000000000000..93f391fdc414 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts @@ -0,0 +1,4 @@ +let union: number | null | undefined; +let intersection: number & string; +let precedence1: number | string & boolean; +let precedence2: number & string | boolean; diff --git a/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-type.src.ts b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-type.src.ts new file mode 100644 index 000000000000..a2cfaf9af408 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/scope-analysis/types-union-type.src.ts @@ -0,0 +1 @@ +type Foo = string & number diff --git a/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-anonymous-function.src.ts b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-anonymous-function.src.ts new file mode 100644 index 000000000000..70b8a557ddb3 --- /dev/null +++ b/packages/typescript-eslint-parser/tests/fixtures/typescript/basics/export-default-anonymous-function.src.ts @@ -0,0 +1,3 @@ +declare module "foo" { + export default function (): string; +} diff --git a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json index 90295710207e..494412674d64 100644 --- a/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json +++ b/packages/typescript-eslint-parser/tests/integration/declared-empty-body-functions-issue-162/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~3.1.1" + "typescript": "~3.2.1" } -} \ No newline at end of file +} diff --git a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json index 90295710207e..494412674d64 100644 --- a/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json +++ b/packages/typescript-eslint-parser/tests/integration/jsdoc-indent-issues-344-422/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~3.1.1" + "typescript": "~3.2.1" } -} \ No newline at end of file +} diff --git a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json index 90295710207e..494412674d64 100644 --- a/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json +++ b/packages/typescript-eslint-parser/tests/integration/method-overloads-issue-389/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~3.1.1" + "typescript": "~3.2.1" } -} \ No newline at end of file +} diff --git a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json index 90295710207e..494412674d64 100644 --- a/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json +++ b/packages/typescript-eslint-parser/tests/integration/no-redeclare-overloaded-functions-issue-402/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~3.1.1" + "typescript": "~3.2.1" } -} \ No newline at end of file +} diff --git a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json index 90295710207e..494412674d64 100644 --- a/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json +++ b/packages/typescript-eslint-parser/tests/integration/range-error-indent-issue-333/package.json @@ -8,6 +8,6 @@ "devDependencies": { "eslint": "4.19.1", "jest": "23.1.0", - "typescript": "~3.1.1" + "typescript": "~3.2.1" } -} \ No newline at end of file +} diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 00a985dcd472..591436ed7dd4 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -2375,6 +2375,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-default-param-eval.sr Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -2730,6 +2731,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-dup-params.src 1`] = Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -3072,6 +3074,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -3404,6 +3407,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-eval-return.src 1`] = Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -3669,6 +3673,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-octal.src 1`] = ` Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -3952,6 +3957,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-arguments.src 1 Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -4289,6 +4295,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-eval.src 1`] = Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -4626,6 +4633,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-names.src 1`] = Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -4963,6 +4971,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-no-paren-argume Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -5210,6 +5219,7 @@ exports[`ecmaFeatures fixtures/arrowFunctions/error-strict-param-no-paren-eval.s Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -9142,6 +9152,398 @@ Object { } `; +exports[`ecmaFeatures fixtures/bigIntLiterals/binary.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "raw": "0b1n", + "type": "BigIntLiteral", + "value": "0b1", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "0b1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/bigIntLiterals/decimal.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "raw": "1n", + "type": "BigIntLiteral", + "value": "1", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Identifier", + "value": "1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/bigIntLiterals/hex.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "raw": "0x1n", + "type": "BigIntLiteral", + "value": "0x1", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "0x1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`ecmaFeatures fixtures/bigIntLiterals/octal.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "raw": "0o1n", + "type": "BigIntLiteral", + "value": "0o1", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "0o1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + exports[`ecmaFeatures fixtures/binaryLiterals/invalid.src 1`] = `"';' expected."`; exports[`ecmaFeatures fixtures/binaryLiterals/lowercase.src 1`] = ` @@ -41186,7 +41588,7 @@ Object { 1, 23, ], - "type": "ObjectPattern", + "type": "ObjectExpression", }, "loc": Object { "end": Object { @@ -93032,6 +93434,7 @@ exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/error-proto-prop Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -93733,6 +94136,7 @@ exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/error-proto-stri Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -94436,6 +94840,7 @@ exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/strict-duplicate Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -94958,6 +95363,7 @@ exports[`ecmaFeatures fixtures/objectLiteralDuplicateProperties/strict-duplicate Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -99240,6 +99646,7 @@ exports[`ecmaFeatures fixtures/octalLiterals/strict-uppercase.src 1`] = ` Object { "body": Array [ Object { + "directive": "use strict", "expression": Object { "loc": Object { "end": Object { @@ -101637,7 +102044,6 @@ Object { "body": Array [ Object { "async": false, - "body": null, "expression": false, "generator": false, "id": Object { @@ -101727,7 +102133,7 @@ Object { 0, 24, ], - "type": "TSEmptyBodyFunctionDeclaration", + "type": "TSDeclareFunction", }, ], "comments": Array [], @@ -101955,7 +102361,6 @@ Object { "body": Array [ Object { "async": false, - "body": null, "expression": false, "generator": false, "id": Object { @@ -102063,7 +102468,7 @@ Object { 0, 23, ], - "type": "TSEmptyBodyFunctionDeclaration", + "type": "TSDeclareFunction", }, ], "comments": Array [], @@ -107373,6 +107778,7 @@ exports[`ecmaFeatures fixtures/unicodeCodePointEscapes/basic-string-literal.src Object { "body": Array [ Object { + "directive": "\\\\u{714E}\\\\u{8336}", "expression": Object { "loc": Object { "end": Object { @@ -107471,6 +107877,7 @@ exports[`ecmaFeatures fixtures/unicodeCodePointEscapes/complex-string-literal.sr Object { "body": Array [ Object { + "directive": "\\\\u{20BB7}\\\\u{10FFFF}\\\\u{1}", "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 6316b14bbf45..561adcd807c2 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -1689,7 +1689,7 @@ Object { 0, 37, ], - "type": "TSEmptyBodyDeclareFunction", + "type": "TSDeclareFunction", }, "parent": null, "type": "FunctionName", @@ -3396,6 +3396,100 @@ Object { } `; +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 23, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-as.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` Object { "$id": 14, @@ -4094,7 +4188,7 @@ Object { 0, 18, ], - "type": "TSEmptyBodyFunctionDeclaration", + "type": "TSDeclareFunction", }, "parent": null, "type": "FunctionName", @@ -5298,166 +5392,96 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/rest-element.ts 1`] = ` Object { - "$id": 7, + "$id": 4, "block": Object { "range": Array [ 0, - 103, + 35, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 6, + "$id": 3, "block": Object { "range": Array [ - 32, - 102, + 0, + 34, ], - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "function", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "a": Object { - "$ref": 4, - }, - "arguments": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 3, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 48, - 59, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 47, - 100, - ], - "type": "FunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 48, - 59, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, - ], + "childScopes": Array [], "functionExpressionScope": false, - "isStrict": true, + "isStrict": false, "references": Array [], "throughReferences": Array [], - "type": "class", + "type": "function", "upperScope": Object { - "$ref": 7, + "$ref": 4, }, "variableMap": Object { - "C": Object { + "args": Object { "$ref": 2, }, + "arguments": Object { + "$ref": 1, + }, }, "variableScope": Object { - "$ref": 7, + "$ref": 3, }, "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, Object { "$id": 2, "defs": Array [ Object { "name": Object { - "name": "C", + "name": "args", "range": Array [ - 38, - 39, + 16, + 20, ], "type": "Identifier", }, "node": Object { "range": Array [ - 32, - 102, + 0, + 34, ], - "type": "ClassDeclaration", + "type": "FunctionDeclaration", }, - "parent": undefined, - "type": "ClassName", + "parent": null, + "type": "Parameter", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "C", + "name": "args", "range": Array [ - 38, - 39, + 16, + 20, ], "type": "Identifier", }, ], - "name": "C", + "name": "args", "references": Array [], "scope": Object { - "$ref": 6, + "$ref": 3, }, }, ], @@ -5470,15 +5494,12 @@ Object { "type": "global", "upperScope": null, "variableMap": Object { - "C": Object { - "$ref": 1, - }, - "a": Object { + "foo": Object { "$ref": 0, }, }, "variableScope": Object { - "$ref": 7, + "$ref": 4, }, "variables": Array [ Object { @@ -5486,25 +5507,277 @@ Object { "defs": Array [ Object { "name": Object { - "name": "a", + "name": "foo", "range": Array [ - 20, - 31, + 9, + 12, ], "type": "Identifier", }, "node": Object { "range": Array [ - 20, - 31, + 0, + 34, ], - "type": "VariableDeclarator", + "type": "FunctionDeclaration", }, - "parent": Object { - "range": Array [ - 16, - 31, - ], + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-alias.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 103, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "a": Object { + "$ref": 4, + }, + "arguments": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 31, + ], "type": "VariableDeclaration", }, "type": "Variable", @@ -5605,7 +5878,7 @@ Object { 21, 26, ], - "type": "TSTypeAssertionExpression", + "type": "TSTypeAssertion", }, }, Object { @@ -5690,7 +5963,118 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = ` +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = ` Object { "$id": 3, "block": Object { @@ -5877,7 +6261,7 @@ Object { 27, 40, ], - "type": "TSTypeAssertionExpression", + "type": "TSTypeAssertion", }, }, Object { @@ -7060,3 +7444,1764 @@ Object { ], } `; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 20, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-infer.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 50, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 46, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 47, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 81, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 10, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 8, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 9, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 20, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 33, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 11, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 45, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + "y": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + ], + "name": "y", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 161, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "intersection": Object { + "$ref": 1, + }, + "precedence1": Object { + "$ref": 2, + }, + "precedence2": Object { + "$ref": 3, + }, + "union": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + ], + "name": "union", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 71, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 38, + 72, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + ], + "name": "intersection", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 77, + 115, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 116, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + ], + "name": "precedence1", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 121, + 159, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 117, + 160, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + ], + "name": "precedence2", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` +Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], +} +`; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap index 4025e7b4a92e..2c696e0ded12 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap @@ -500,148 +500,128 @@ Object { "type": "ImportDeclaration", }, Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Props", + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 31, + 63, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, }, + "name": "title", + "range": Array [ + 48, + 53, + ], + "type": "Identifier", }, - "name": "Props", - "range": Array [ - 36, - 41, - ], - "type": "Identifier", - }, - "init": Object { "loc": Object { "end": Object { - "column": 1, - "line": 4, + "column": 15, + "line": 3, }, "start": Object { - "column": 13, - "line": 2, + "column": 2, + "line": 3, }, }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 2, - "line": 3, - }, - }, - "name": "title", - "range": Array [ - 48, - 53, - ], - "type": "Identifier", + "range": Array [ + 48, + 61, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { "column": 15, "line": 3, }, "start": Object { - "column": 2, + "column": 9, "line": 3, }, }, "range": Array [ - 48, + 55, 61, ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 7, - "line": 3, - }, - }, - "range": Array [ - 53, - 61, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 3, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "range": Array [ - 55, - 61, - ], - "type": "TSStringKeyword", - }, - }, + "type": "TSStringKeyword", }, - ], - "range": Array [ - 44, - 63, - ], - "type": "TSTypeLiteral", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 2, }, }, - "range": Array [ - 36, - 63, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 1, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 2, - }, + ], + "range": Array [ + 44, + 63, + ], + "type": "TSTypeLiteral", }, - "range": Array [ - 31, - 63, - ], - "type": "VariableDeclaration", }, Object { "declaration": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index dc2954371e30..dcb703d6f1a7 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -82,7 +82,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, "range": Array [ 13, 14, @@ -398,7 +415,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, "range": Array [ 11, 36, @@ -2892,7 +2926,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -3301,7 +3334,24 @@ Object { "line": 1, }, }, - "name": "X", + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, "range": Array [ 1, 2, @@ -6855,7 +6905,7 @@ Object { }, "implements": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 77, @@ -6887,7 +6937,7 @@ Object { 66, 77, ], - "type": "ClassImplements", + "type": "TSClassImplements", }, ], "loc": Object { @@ -7241,7 +7291,24 @@ Object { "line": 1, }, }, - "name": "A", + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, "range": Array [ 10, 11, @@ -7715,7 +7782,24 @@ Object { "line": 1, }, }, - "name": "A", + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, "range": Array [ 10, 21, @@ -8146,7 +8230,24 @@ Object { "line": 2, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, "range": Array [ 21, 22, @@ -8593,7 +8694,24 @@ Object { "line": 2, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, "range": Array [ 21, 28, @@ -8978,7 +9096,7 @@ Object { }, "implements": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 24, @@ -9010,7 +9128,7 @@ Object { 21, 24, ], - "type": "ClassImplements", + "type": "TSClassImplements", }, ], "loc": Object { @@ -9203,7 +9321,7 @@ Object { }, "implements": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 56, @@ -9235,7 +9353,7 @@ Object { 45, 56, ], - "type": "ClassImplements", + "type": "TSClassImplements", }, ], "loc": Object { @@ -9481,7 +9599,7 @@ Object { }, "implements": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 24, @@ -9513,7 +9631,7 @@ Object { 21, 24, ], - "type": "ClassImplements", + "type": "TSClassImplements", "typeParameters": Object { "loc": Object { "end": Object { @@ -9814,7 +9932,7 @@ Object { }, "implements": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 24, @@ -9846,7 +9964,7 @@ Object { 21, 24, ], - "type": "ClassImplements", + "type": "TSClassImplements", "typeParameters": Object { "loc": Object { "end": Object { @@ -10448,29 +10566,12 @@ Object { "line": 1, }, }, + "members": Array [], "range": Array [ 33, 35, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 33, - 35, - ], - "type": "TSTypeLiteral", - }, + "type": "TSTypeLiteral", }, ], "range": Array [ @@ -10490,7 +10591,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, "range": Array [ 11, 36, @@ -10544,7 +10662,7 @@ Object { }, "implements": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 38, @@ -10576,7 +10694,7 @@ Object { 123, 124, ], - "type": "ClassImplements", + "type": "TSClassImplements", }, ], "loc": Object { @@ -10741,7 +10859,6 @@ Object { "type": "ClassDeclaration", }, Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -10760,7 +10877,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -10796,107 +10912,118 @@ Object { "type": "TSInterfaceDeclaration", }, Object { - "declarations": Array [ - Object { - "id": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "name": "Constructor", + "range": Array [ + 163, + 174, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 158, + 206, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "params": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 9, + }, + "start": Object { + "column": 30, + "line": 9, + }, + }, + "name": "args", + "range": Array [ + 188, + 192, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 16, + "column": 41, "line": 9, }, "start": Object { - "column": 5, + "column": 27, "line": 9, }, }, - "name": "Constructor", "range": Array [ - 163, - 174, + 185, + 199, ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 22, - "line": 9, + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 9, + }, }, - }, - "parameters": Array [ - Object { - "argument": Object { + "range": Array [ + 192, + 199, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { "loc": Object { "end": Object { - "column": 41, + "column": 39, "line": 9, }, "start": Object { - "column": 30, + "column": 36, "line": 9, }, }, - "name": "args", "range": Array [ - 188, - 199, + 194, + 197, ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 34, - "line": 9, - }, - }, - "range": Array [ - 192, - 199, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "elementType": Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 9, - }, - "start": Object { - "column": 36, - "line": 9, - }, - }, - "range": Array [ - 194, - 197, - ], - "type": "TSAnyKeyword", - }, - "loc": Object { - "end": Object { - "column": 41, - "line": 9, - }, - "start": Object { - "column": 36, - "line": 9, - }, - }, - "range": Array [ - 194, - 199, - ], - "type": "TSArrayType", - }, - }, + "type": "TSAnyKeyword", }, "loc": Object { "end": Object { @@ -10904,146 +11031,131 @@ Object { "line": 9, }, "start": Object { - "column": 27, + "column": 36, "line": 9, }, }, "range": Array [ - 185, + 194, 199, ], - "type": "RestElement", + "type": "TSArrayType", }, - ], + }, + }, + ], + "range": Array [ + 180, + 205, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 43, + "line": 9, + }, + }, + "range": Array [ + 201, + 205, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, "range": Array [ - 180, + 204, 205, ], - "type": "TSConstructorType", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { "column": 47, "line": 9, }, "start": Object { - "column": 44, + "column": 46, "line": 9, }, }, + "name": "T", "range": Array [ - 202, + 204, 205, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 46, - "line": 9, - }, - }, - "range": Array [ - 204, - 205, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 9, - }, - "start": Object { - "column": 46, - "line": 9, - }, - }, - "name": "T", - "range": Array [ - 204, - 205, - ], - "type": "Identifier", - }, - }, + "type": "Identifier", }, - "typeParameters": null, }, - "loc": Object { - "end": Object { - "column": 48, - "line": 9, - }, - "start": Object { - "column": 5, - "line": 9, - }, + }, + "type": "TSConstructorType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, }, - "range": Array [ - 163, - 206, - ], - "type": "VariableDeclarator", - "typeParameters": Object { + "start": Object { + "column": 16, + "line": 9, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 19, + "column": 18, "line": 9, }, "start": Object { - "column": 16, + "column": 17, "line": 9, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 9, - }, - "start": Object { - "column": 17, - "line": 9, - }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, }, - "name": "T", - "range": Array [ - 175, - 176, - ], - "type": "TSTypeParameter", }, - ], + "name": "T", + "range": Array [ + 175, + 176, + ], + "type": "Identifier", + }, "range": Array [ - 174, - 177, + 175, + 176, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeParameter", }, - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 48, - "line": 9, - }, - "start": Object { - "column": 0, - "line": 9, - }, + ], + "range": Array [ + 174, + 177, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 158, - 206, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -19188,7 +19300,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, "range": Array [ 10, 11, @@ -19466,7 +19595,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, "range": Array [ 10, 17, @@ -19745,7 +19891,24 @@ Object { "line": 1, }, }, - "name": "__P", + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "__P", + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + }, "range": Array [ 8, 11, @@ -20361,6 +20524,7 @@ Object { ], "type": "ClassBody", }, + "declare": true, "id": Object { "loc": Object { "end": Object { @@ -20640,7 +20804,7 @@ Object { "body": Array [ Object { "async": false, - "body": null, + "declare": true, "expression": false, "generator": false, "id": Object { @@ -20763,7 +20927,7 @@ Object { "type": "TSStringKeyword", }, }, - "type": "TSEmptyBodyDeclareFunction", + "type": "TSDeclareFunction", }, ], "comments": Array [], @@ -21090,7 +21254,7 @@ Object { 9, 11, ], - "type": "ArrayPattern", + "type": "ArrayExpression", }, "type": "AssignmentPattern", }, @@ -21507,83 +21671,121 @@ Object { } `; -exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` +exports[`typescript fixtures/basics/export-default-anonymous-function.src 1`] = ` Object { "body": Array [ Object { - "declaration": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 1, - "line": 3, + "body": Object { + "body": Array [ + Object { + "declaration": Object { + "async": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 42, + 62, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", }, - "start": Object { - "column": 24, - "line": 1, + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, }, + "range": Array [ + 27, + 62, + ], + "type": "ExportDefaultDeclaration", }, - "range": Array [ - 24, - 28, - ], - "type": "ClassBody", - }, - "id": null, + ], "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 15, + "column": 21, "line": 1, }, }, "range": Array [ - 15, - 28, + 21, + 64, ], - "superClass": null, - "type": "ClassDeclaration", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, + "type": "TSModuleBlock", + }, + "declare": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 21, - 22, - ], - "type": "TSTypeParameter", - }, - ], - "range": Array [ - 20, - 23, - ], - "type": "TSTypeParameterDeclaration", }, + "range": Array [ + 15, + 20, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", }, "loc": Object { "end": Object { @@ -21597,9 +21799,9 @@ Object { }, "range": Array [ 0, - 28, + 64, ], - "type": "ExportDefaultDeclaration", + "type": "TSModuleDeclaration", }, ], "comments": Array [], @@ -21615,14 +21817,14 @@ Object { }, "range": Array [ 0, - 29, + 65, ], - "sourceType": "module", + "sourceType": "script", "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 6, + "column": 7, "line": 1, }, "start": Object { @@ -21632,10 +21834,10 @@ Object { }, "range": Array [ 0, - 6, + 7, ], - "type": "Keyword", - "value": "export", + "type": "Identifier", + "value": "declare", }, Object { "loc": Object { @@ -21644,16 +21846,16 @@ Object { "line": 1, }, "start": Object { - "column": 7, + "column": 8, "line": 1, }, }, "range": Array [ - 7, + 8, 14, ], - "type": "Keyword", - "value": "default", + "type": "Identifier", + "value": "module", }, Object { "loc": Object { @@ -21670,80 +21872,170 @@ Object { 15, 20, ], - "type": "Keyword", - "value": "class", + "type": "String", + "value": "\\"foo\\"", }, Object { "loc": Object { "end": Object { - "column": 21, + "column": 22, "line": 1, }, "start": Object { - "column": 20, + "column": 21, "line": 1, }, }, "range": Array [ - 20, 21, + 22, ], "type": "Punctuator", - "value": "<", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 10, + "line": 2, }, "start": Object { - "column": 21, - "line": 1, + "column": 4, + "line": 2, }, }, "range": Array [ - 21, - 22, + 27, + 33, ], - "type": "Identifier", - "value": "T", + "type": "Keyword", + "value": "export", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 1, + "column": 18, + "line": 2, }, "start": Object { - "column": 22, - "line": 1, + "column": 11, + "line": 2, }, }, "range": Array [ - 22, - 23, + 34, + 41, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 42, + 50, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, ], "type": "Punctuator", - "value": ">", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 25, - "line": 1, + "column": 30, + "line": 2, }, "start": Object { - "column": 24, - "line": 1, + "column": 29, + "line": 2, }, }, "range": Array [ - 24, - 25, + 52, + 53, ], "type": "Punctuator", - "value": "{", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { @@ -21757,8 +22049,8 @@ Object { }, }, "range": Array [ - 27, - 28, + 63, + 64, ], "type": "Punctuator", "value": "}", @@ -21768,7 +22060,7 @@ Object { } `; -exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` +exports[`typescript fixtures/basics/export-default-class-with-generic.src 1`] = ` Object { "body": Array [ Object { @@ -21781,13 +22073,13 @@ Object { "line": 3, }, "start": Object { - "column": 27, + "column": 24, "line": 1, }, }, "range": Array [ - 27, - 31, + 24, + 28, ], "type": "ClassBody", }, @@ -21804,14 +22096,14 @@ Object { }, "range": Array [ 15, - 31, + 28, ], "superClass": null, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { "end": Object { - "column": 26, + "column": 23, "line": 1, }, "start": Object { @@ -21831,35 +22123,34 @@ Object { "line": 1, }, }, - "name": "T", - "range": Array [ - 21, - 22, - ], - "type": "TSTypeParameter", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, + "name": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", }, - "name": "U", "range": Array [ - 24, - 25, + 21, + 22, ], "type": "TSTypeParameter", }, ], "range": Array [ 20, - 26, + 23, ], "type": "TSTypeParameterDeclaration", }, @@ -21876,7 +22167,7 @@ Object { }, "range": Array [ 0, - 31, + 28, ], "type": "ExportDefaultDeclaration", }, @@ -21894,7 +22185,7 @@ Object { }, "range": Array [ 0, - 32, + 29, ], "sourceType": "module", "tokens": Array [ @@ -22004,7 +22295,7 @@ Object { 23, ], "type": "Punctuator", - "value": ",", + "value": ">", }, Object { "loc": Object { @@ -22021,42 +22312,6 @@ Object { 24, 25, ], - "type": "Identifier", - "value": "U", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 27, - "line": 1, - }, - }, - "range": Array [ - 27, - 28, - ], "type": "Punctuator", "value": "{", }, @@ -22072,8 +22327,8 @@ Object { }, }, "range": Array [ - 30, - 31, + 27, + 28, ], "type": "Punctuator", "value": "}", @@ -22083,7 +22338,7 @@ Object { } `; -exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` +exports[`typescript fixtures/basics/export-default-class-with-multiple-generics.src 1`] = ` Object { "body": Array [ Object { @@ -22096,58 +22351,41 @@ Object { "line": 3, }, "start": Object { - "column": 20, + "column": 27, "line": 1, }, }, "range": Array [ - 20, - 24, + 27, + 31, ], "type": "ClassBody", }, - "id": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "name": "Foo", - "range": Array [ - 13, - 16, - ], - "type": "Identifier", - }, + "id": null, "loc": Object { "end": Object { "column": 1, "line": 3, }, "start": Object { - "column": 7, + "column": 15, "line": 1, }, }, "range": Array [ - 7, - 24, + 15, + 31, ], "superClass": null, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { "end": Object { - "column": 19, + "column": 26, "line": 1, }, "start": Object { - "column": 16, + "column": 20, "line": 1, }, }, @@ -22155,25 +22393,77 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { - "column": 17, + "column": 21, "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, "range": Array [ - 17, - 18, + 21, + 22, + ], + "type": "TSTypeParameter", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + }, + "range": Array [ + 24, + 25, ], "type": "TSTypeParameter", }, ], "range": Array [ - 16, - 19, + 20, + 26, ], "type": "TSTypeParameterDeclaration", }, @@ -22190,11 +22480,9 @@ Object { }, "range": Array [ 0, - 24, + 31, ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", + "type": "ExportDefaultDeclaration", }, ], "comments": Array [], @@ -22210,7 +22498,7 @@ Object { }, "range": Array [ 0, - 25, + 32, ], "sourceType": "module", "tokens": Array [ @@ -22235,7 +22523,7 @@ Object { Object { "loc": Object { "end": Object { - "column": 12, + "column": 14, "line": 1, }, "start": Object { @@ -22245,43 +22533,43 @@ Object { }, "range": Array [ 7, - 12, + 14, ], "type": "Keyword", - "value": "class", + "value": "default", }, Object { "loc": Object { "end": Object { - "column": 16, + "column": 20, "line": 1, }, "start": Object { - "column": 13, + "column": 15, "line": 1, }, }, "range": Array [ - 13, - 16, + 15, + 20, ], - "type": "Identifier", - "value": "Foo", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 17, + "column": 21, "line": 1, }, "start": Object { - "column": 16, + "column": 20, "line": 1, }, }, "range": Array [ - 16, - 17, + 20, + 21, ], "type": "Punctuator", "value": "<", @@ -22289,17 +22577,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 18, + "column": 22, "line": 1, }, "start": Object { - "column": 17, + "column": 21, "line": 1, }, }, "range": Array [ - 17, - 18, + 21, + 22, ], "type": "Identifier", "value": "T", @@ -22307,17 +22595,53 @@ Object { Object { "loc": Object { "end": Object { - "column": 19, + "column": 23, "line": 1, }, "start": Object { - "column": 18, + "column": 22, "line": 1, }, }, "range": Array [ - 18, - 19, + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, ], "type": "Punctuator", "value": ">", @@ -22325,17 +22649,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 21, + "column": 28, "line": 1, }, "start": Object { - "column": 20, + "column": 27, "line": 1, }, }, "range": Array [ - 20, - 21, + 27, + 28, ], "type": "Punctuator", "value": "{", @@ -22352,8 +22676,8 @@ Object { }, }, "range": Array [ - 23, - 24, + 30, + 31, ], "type": "Punctuator", "value": "}", @@ -22363,7 +22687,7 @@ Object { } `; -exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` +exports[`typescript fixtures/basics/export-named-class-with-generic.src 1`] = ` Object { "body": Array [ Object { @@ -22376,13 +22700,13 @@ Object { "line": 3, }, "start": Object { - "column": 23, + "column": 20, "line": 1, }, }, "range": Array [ - 23, - 27, + 20, + 24, ], "type": "ClassBody", }, @@ -22416,14 +22740,14 @@ Object { }, "range": Array [ 7, - 27, + 24, ], "superClass": null, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { "end": Object { - "column": 22, + "column": 19, "line": 1, }, "start": Object { @@ -22443,35 +22767,34 @@ Object { "line": 1, }, }, - "name": "T", - "range": Array [ - 17, - 18, - ], - "type": "TSTypeParameter", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", }, - "name": "U", "range": Array [ - 20, - 21, + 17, + 18, ], "type": "TSTypeParameter", }, ], "range": Array [ 16, - 22, + 19, ], "type": "TSTypeParameterDeclaration", }, @@ -22488,7 +22811,7 @@ Object { }, "range": Array [ 0, - 27, + 24, ], "source": null, "specifiers": Array [], @@ -22508,7 +22831,339 @@ Object { }, "range": Array [ 0, - 28, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; + +exports[`typescript fixtures/basics/export-named-class-with-multiple-generics.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 27, + ], + "superClass": null, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeParameter", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 16, + 22, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, ], "sourceType": "module", "tokens": Array [ @@ -23053,112 +23708,92 @@ Object { "body": Array [ Object { "declaration": Object { - "declarations": Array [ - Object { - "id": Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestAlias", + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 40, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 39, + ], + "type": "TSUnionType", + "types": Array [ + Object { "loc": Object { "end": Object { - "column": 21, + "column": 30, "line": 1, }, "start": Object { - "column": 12, + "column": 24, "line": 1, }, }, - "name": "TestAlias", "range": Array [ - 12, - 21, + 24, + 30, ], - "type": "Identifier", + "type": "TSStringKeyword", }, - "init": Object { + Object { "loc": Object { "end": Object { "column": 39, "line": 1, }, "start": Object { - "column": 24, + "column": 33, "line": 1, }, }, "range": Array [ - 24, + 33, 39, ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 30, - ], - "type": "TSStringKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 39, - "line": 1, - }, - "start": Object { - "column": 33, - "line": 1, - }, - }, - "range": Array [ - 33, - 39, - ], - "type": "TSNumberKeyword", - }, - ], - }, - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "type": "TSNumberKeyword", }, - "range": Array [ - 12, - 40, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 40, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, + ], }, - "range": Array [ - 7, - 40, - ], - "type": "VariableDeclaration", }, "loc": Object { "end": Object { @@ -23350,133 +23985,24 @@ Object { "body": Array [ Object { "declaration": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "TestClassProps", - "range": Array [ - 12, - 26, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, }, - "init": Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 3, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "name": "count", - "range": Array [ - 35, - 40, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 35, - 48, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "range": Array [ - 40, - 48, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 2, - }, - "start": Object { - "column": 11, - "line": 2, - }, - }, - "range": Array [ - 42, - 48, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], - "range": Array [ - 29, - 50, - ], - "type": "TSTypeLiteral", - }, - "loc": Object { - "end": Object { - "column": 2, - "line": 3, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "start": Object { + "column": 12, + "line": 1, }, - "range": Array [ - 12, - 51, - ], - "type": "VariableDeclarator", }, - ], - "kind": "type", + "name": "TestClassProps", + "range": Array [ + 12, + 26, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { "column": 2, @@ -23491,7 +24017,96 @@ Object { 7, 51, ], - "type": "VariableDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "count", + "range": Array [ + 35, + 40, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 29, + 50, + ], + "type": "TSTypeLiteral", + }, }, "loc": Object { "end": Object { @@ -23719,165 +24334,144 @@ Object { "body": Array [ Object { "declaration": Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "TestCallback", - "range": Array [ - 12, - 24, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, }, - "init": Object { + }, + "name": "TestCallback", + "range": Array [ + 12, + 24, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 46, + "column": 37, "line": 1, }, "start": Object { - "column": 27, + "column": 28, "line": 1, }, }, - "parameters": Array [ - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 28, - 37, - ], - "type": "Identifier", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 37, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 31, - "line": 1, - }, - }, - "range": Array [ - 31, - 37, - ], - "type": "TSNumberKeyword", - }, - }, - }, - ], + "name": "a", "range": Array [ - 27, - 46, + 28, + 37, ], - "type": "TSFunctionType", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 46, + "column": 37, "line": 1, }, "start": Object { - "column": 40, + "column": 29, "line": 1, }, }, "range": Array [ - 40, - 46, + 29, + 37, ], "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 46, + "column": 37, "line": 1, }, "start": Object { - "column": 42, + "column": 31, "line": 1, }, }, "range": Array [ - 42, - 46, + 31, + 37, ], - "type": "TSVoidKeyword", + "type": "TSNumberKeyword", }, }, - "typeParameters": null, }, + ], + "range": Array [ + 27, + 46, + ], + "returnType": Object { "loc": Object { "end": Object { - "column": 47, + "column": 46, "line": 1, }, "start": Object { - "column": 12, + "column": 39, "line": 1, }, }, "range": Array [ - 12, - 47, + 39, + 46, ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "TSVoidKeyword", + }, }, + "type": "TSFunctionType", }, - "range": Array [ - 7, - 47, - ], - "type": "VariableDeclaration", }, "loc": Object { "end": Object { @@ -26170,7 +26764,24 @@ Object { "line": 1, }, }, - "name": "X", + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, "range": Array [ 11, 12, @@ -26596,7 +27207,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, "range": Array [ 28, 29, @@ -27074,7 +27702,24 @@ Object { "line": 1, }, }, - "name": "X", + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + }, "range": Array [ 11, 23, @@ -28164,7 +28809,7 @@ Object { "argument": Object { "loc": Object { "end": Object { - "column": 69, + "column": 55, "line": 1, }, "start": Object { @@ -28175,9 +28820,41 @@ Object { "name": "args", "range": Array [ 51, - 69, + 55, ], "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 69, + ], + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 69, + ], + "type": "TSTypeAnnotation", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -28185,19 +28862,19 @@ Object { "line": 1, }, "start": Object { - "column": 55, + "column": 56, "line": 1, }, }, "range": Array [ - 55, + 56, 69, ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { + "type": "TSTypeReference", + "typeName": Object { "loc": Object { "end": Object { - "column": 69, + "column": 61, "line": 1, }, "start": Object { @@ -28205,83 +28882,51 @@ Object { "line": 1, }, }, + "name": "Array", "range": Array [ 56, - 69, + 61, ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 61, - "line": 1, - }, - "start": Object { - "column": 56, - "line": 1, - }, + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, }, - "name": "Array", - "range": Array [ - 56, - 61, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, + "start": Object { + "column": 61, + "line": 1, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 68, - "line": 1, - }, - "start": Object { - "column": 62, - "line": 1, - }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, }, - "range": Array [ - 62, - 68, - ], - "type": "TSStringKeyword", }, - ], - "range": Array [ - 61, - 69, - ], - "type": "TSTypeParameterInstantiation", - }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 61, + 69, + ], + "type": "TSTypeParameterInstantiation", }, }, }, - "loc": Object { - "end": Object { - "column": 69, - "line": 1, - }, - "start": Object { - "column": 48, - "line": 1, - }, - }, - "range": Array [ - 48, - 69, - ], - "type": "RestElement", }, ], "range": Array [ @@ -28855,296 +29500,256 @@ exports[`typescript fixtures/basics/import-type.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, }, - "init": Object { - "isTypeOf": true, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "A", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "isTypeOf": true, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "parameter": Object { + "literal": Object { "loc": Object { "end": Object { - "column": 27, + "column": 26, "line": 1, }, "start": Object { - "column": 9, + "column": 23, "line": 1, }, }, - "parameter": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 26, - ], - "raw": "'A'", - "type": "Literal", - "value": "A", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 26, - ], - "type": "TSLiteralType", - }, - "qualifier": null, "range": Array [ - 9, - 27, + 23, + 26, ], - "type": "TSImportType", - "typeParameters": null, + "raw": "'A'", + "type": "Literal", + "value": "A", }, "loc": Object { "end": Object { - "column": 28, + "column": 26, "line": 1, }, "start": Object { - "column": 5, + "column": 23, "line": 1, }, }, "range": Array [ - 5, - 28, + 23, + 26, ], - "type": "VariableDeclarator", + "type": "TSLiteralType", }, - ], - "kind": "type", + "qualifier": null, + "range": Array [ + 9, + 27, + ], + "type": "TSImportType", + "typeParameters": null, + }, + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "B", + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { - "column": 28, - "line": 1, + "column": 26, + "line": 2, }, "start": Object { "column": 0, - "line": 1, + "line": 2, }, }, "range": Array [ - 0, - 28, + 29, + 55, ], - "type": "VariableDeclaration", - }, - Object { - "declarations": Array [ - Object { - "id": Object { + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "isTypeOf": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "parameter": Object { + "literal": Object { "loc": Object { "end": Object { - "column": 6, + "column": 19, "line": 2, }, "start": Object { - "column": 5, + "column": 16, "line": 2, }, }, - "name": "B", "range": Array [ - 34, - 35, + 45, + 48, ], - "type": "Identifier", + "raw": "\\"B\\"", + "type": "Literal", + "value": "B", }, - "init": Object { - "isTypeOf": false, - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, }, - "parameter": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 45, - 48, - ], - "raw": "\\"B\\"", - "type": "Literal", - "value": "B", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 2, - }, - "start": Object { - "column": 16, - "line": 2, - }, - }, - "range": Array [ - 45, - 48, - ], - "type": "TSLiteralType", + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "TSLiteralType", + }, + "qualifier": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "X", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "range": Array [ + 38, + 54, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, }, - "qualifier": Object { + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 22, + "column": 24, "line": 2, }, "start": Object { - "column": 21, + "column": 23, "line": 2, }, }, - "name": "X", "range": Array [ - 50, - 51, + 52, + 53, ], - "type": "Identifier", - }, - "range": Array [ - 38, - 54, - ], - "type": "TSImportType", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 22, - "line": 2, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, }, - "range": Array [ - 52, - 53, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 2, - }, - "start": Object { - "column": 23, - "line": 2, - }, - }, - "name": "Y", - "range": Array [ - 52, - 53, - ], - "type": "Identifier", + "start": Object { + "column": 23, + "line": 2, }, }, - ], - "range": Array [ - 51, - 54, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 5, - "line": 2, + "name": "Y", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, }, - }, + ], "range": Array [ - 34, - 55, + 51, + 54, ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 26, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, + "type": "TSTypeParameterInstantiation", }, }, - "range": Array [ - 29, - 55, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -29569,221 +30174,201 @@ exports[`typescript fixtures/basics/import-type-with-type-parameters-in-type-ref Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "X", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, }, - "name": "X", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", }, - "init": Object { - "loc": Object { - "end": Object { - "column": 29, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, + "name": "A", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, }, - "range": Array [ - 9, - 29, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 9, - 10, - ], - "type": "Identifier", + "start": Object { + "column": 10, + "line": 1, }, - "typeParameters": Object { + }, + "params": Array [ + Object { + "isTypeOf": false, "loc": Object { "end": Object { - "column": 29, + "column": 28, "line": 1, }, "start": Object { - "column": 10, + "column": 11, "line": 1, }, }, - "params": Array [ - Object { - "isTypeOf": false, + "parameter": Object { + "literal": Object { "loc": Object { "end": Object { - "column": 28, + "column": 20, "line": 1, }, "start": Object { - "column": 11, + "column": 18, "line": 1, }, }, - "parameter": Object { - "literal": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "raw": "\\"\\"", - "type": "Literal", - "value": "", - }, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 20, - ], - "type": "TSLiteralType", - }, - "qualifier": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "name": "B", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, "range": Array [ - 11, - 28, + 18, + 20, ], - "type": "TSImportType", - "typeParameters": Object { + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "TSLiteralType", + }, + "qualifier": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "B", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "range": Array [ + 11, + 28, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 28, + "column": 27, "line": 1, }, "start": Object { - "column": 23, + "column": 24, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 27, - ], - "type": "TSAnyKeyword", - }, - ], "range": Array [ - 23, - 28, + 24, + 27, ], - "type": "TSTypeParameterInstantiation", + "type": "TSAnyKeyword", }, - }, - ], - "range": Array [ - 10, - 29, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + ], + "range": Array [ + 23, + 28, + ], + "type": "TSTypeParameterInstantiation", + }, }, - }, + ], "range": Array [ - 5, - 30, + 10, + 29, ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "TSTypeParameterInstantiation", }, }, - "range": Array [ - 0, - 30, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -30100,7 +30685,6 @@ exports[`typescript fixtures/basics/interface-extends.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -30119,9 +30703,9 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [ + "extends": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 25, @@ -30325,7 +30909,6 @@ exports[`typescript fixtures/basics/interface-extends-multiple.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -30344,9 +30927,9 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [ + "extends": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 25, @@ -30381,7 +30964,7 @@ Object { "type": "TSInterfaceHeritage", }, Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 29, @@ -30621,7 +31204,6 @@ exports[`typescript fixtures/basics/interface-type-parameters.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -30640,7 +31222,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -30697,7 +31278,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, "range": Array [ 14, 15, @@ -30865,7 +31463,6 @@ exports[`typescript fixtures/basics/interface-with-all-property-types.src 1`] = Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -31151,39 +31748,34 @@ Object { }, }, Object { - "index": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 6, - }, - "start": Object { - "column": 5, - "line": 6, - }, + "loc": Object { + "end": Object { + "column": 26, + "line": 6, }, - "name": "eee", - "range": Array [ - 95, - 106, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 6, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 16, "line": 6, }, "start": Object { - "column": 8, + "column": 5, "line": 6, }, }, + "name": "eee", "range": Array [ - 98, + 95, 106, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -31191,33 +31783,39 @@ Object { "line": 6, }, "start": Object { - "column": 10, + "column": 8, "line": 6, }, }, "range": Array [ - 100, + 98, 106, ], - "type": "TSNumberKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSNumberKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, + ], "range": Array [ 94, 116, ], - "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -31255,40 +31853,35 @@ Object { }, }, Object { - "index": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 7, - }, - "start": Object { - "column": 5, - "line": 7, - }, + "loc": Object { + "end": Object { + "column": 27, + "line": 7, }, - "name": "fff", - "optional": true, - "range": Array [ - 122, - 134, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 7, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 17, "line": 7, }, "start": Object { - "column": 9, + "column": 5, "line": 7, }, }, + "name": "fff", + "optional": true, "range": Array [ - 126, + 122, 134, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -31296,33 +31889,39 @@ Object { "line": 7, }, "start": Object { - "column": 11, + "column": 9, "line": 7, }, }, "range": Array [ - 128, + 126, 134, ], - "type": "TSNumberKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 134, + ], + "type": "TSNumberKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, + ], "range": Array [ 121, 144, ], - "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -31389,15 +31988,12 @@ Object { "line": 8, }, }, - "optional": false, "params": Array [], "range": Array [ 149, 161, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 15, @@ -31431,6 +32027,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, Object { "computed": false, @@ -31523,9 +32120,7 @@ Object { 166, 186, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 23, @@ -31559,6 +32154,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, Object { "computed": true, @@ -31651,9 +32247,7 @@ Object { 191, 213, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 25, @@ -31687,6 +32281,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, Object { "computed": false, @@ -31718,7 +32313,6 @@ Object { "line": 11, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -31779,9 +32373,7 @@ Object { 218, 240, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 25, @@ -31815,6 +32407,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", "typeParameters": Object { "loc": Object { "end": Object { @@ -31838,7 +32431,24 @@ Object { "line": 11, }, }, - "name": "J", + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "J", + "range": Array [ + 222, + 223, + ], + "type": "Identifier", + }, "range": Array [ 222, 223, @@ -31907,8 +32517,7 @@ Object { 245, 265, ], - "type": "TSConstructSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 23, @@ -31942,6 +32551,7 @@ Object { "type": "TSStringKeyword", }, }, + "type": "TSConstructSignatureDeclaration", }, Object { "loc": Object { @@ -31997,8 +32607,7 @@ Object { 270, 293, ], - "type": "TSConstructSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 26, @@ -32032,6 +32641,7 @@ Object { "type": "TSStringKeyword", }, }, + "type": "TSConstructSignatureDeclaration", "typeParameters": Object { "loc": Object { "end": Object { @@ -32055,7 +32665,24 @@ Object { "line": 13, }, }, - "name": "F", + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 9, + "line": 13, + }, + }, + "name": "F", + "range": Array [ + 275, + 276, + ], + "type": "Identifier", + }, "range": Array [ 275, 276, @@ -32087,7 +32714,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -34165,7 +34791,6 @@ exports[`typescript fixtures/basics/interface-with-construct-signature-with-para Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -34257,8 +34882,7 @@ Object { 21, 47, ], - "type": "TSConstructSignature", - "typeAnnotation": null, + "type": "TSConstructSignatureDeclaration", }, ], "loc": Object { @@ -34277,7 +34901,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -34573,7 +35196,6 @@ exports[`typescript fixtures/basics/interface-with-extends-type-parameters.src 1 Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -34592,9 +35214,9 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [ + "extends": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 28, @@ -34739,7 +35361,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, "range": Array [ 14, 15, @@ -34997,7 +35636,6 @@ exports[`typescript fixtures/basics/interface-with-generic.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -35016,7 +35654,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -35073,7 +35710,24 @@ Object { "line": 1, }, }, - "name": "T", + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, "range": Array [ 15, 16, @@ -35241,7 +35895,6 @@ exports[`typescript fixtures/basics/interface-with-jsdoc.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -35274,7 +35927,6 @@ Object { "line": 6, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -35299,9 +35951,7 @@ Object { 76, 85, ], - "static": false, "type": "TSMethodSignature", - "typeAnnotation": null, }, ], "loc": Object { @@ -35320,7 +35970,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -35566,7 +36215,6 @@ exports[`typescript fixtures/basics/interface-with-optional-properties.src 1`] = Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -35804,9 +36452,7 @@ Object { 49, 79, ], - "static": false, "type": "TSMethodSignature", - "typeAnnotation": null, }, ], "loc": Object { @@ -35825,7 +36471,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -36355,7 +37000,6 @@ exports[`typescript fixtures/basics/interface-without-type-annotation.src 1`] = Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -36411,7 +37055,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -36581,97 +37224,24 @@ exports[`typescript fixtures/basics/keyof-operator.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "x", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "operator": "keyof", - "range": Array [ - 9, - 18, - ], - "type": "TSTypeOperator", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 18, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 15, - 18, - ], - "type": "Identifier", - }, - }, + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + "start": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 5, - 19, - ], - "type": "VariableDeclarator", }, - ], - "kind": "type", + "name": "x", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { "column": 19, @@ -36686,7 +37256,60 @@ Object { 0, 19, ], - "type": "VariableDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "keyof", + "range": Array [ + 9, + 18, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + }, + }, }, ], "comments": Array [], @@ -40623,30 +41246,60 @@ exports[`typescript fixtures/basics/type-alias-declaration.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Result", - "range": Array [ - 5, - 11, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - "init": Object { + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 37, + ], + "type": "TSUnionType", + "types": Array [ + Object { "loc": Object { "end": Object { - "column": 37, + "column": 27, "line": 1, }, "start": Object { @@ -40656,206 +41309,173 @@ Object { }, "range": Array [ 17, - 37, + 27, ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, }, - "range": Array [ - 17, - 27, - ], - "type": "TSTypeReference", - "typeName": Object { + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 24, + "column": 26, "line": 1, }, "start": Object { - "column": 17, + "column": 25, "line": 1, }, }, - "name": "Success", "range": Array [ - 17, - 24, + 25, + 26, ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, }, - "range": Array [ - 25, - 26, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 25, - 26, - ], - "type": "Identifier", + "start": Object { + "column": 25, + "line": 1, }, }, - ], - "range": Array [ - 24, - 27, - ], - "type": "TSTypeParameterInstantiation", + "name": "T", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, }, - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, }, - "range": Array [ - 30, - 37, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 30, - "line": 1, - }, - }, - "name": "Failure", - "range": Array [ - 30, - 37, - ], - "type": "Identifier", + "start": Object { + "column": 30, + "line": 1, }, }, - ], - }, - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "name": "Failure", + "range": Array [ + 30, + 37, + ], + "type": "Identifier", }, }, - "range": Array [ - 5, - 37, - ], - "type": "VariableDeclarator", - "typeParameters": Object { + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 14, + "column": 13, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, }, - "name": "T", - "range": Array [ - 12, - 13, - ], - "type": "TSTypeParameter", }, - ], + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, "range": Array [ - 11, - 14, + 12, + 13, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeParameter", }, - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + ], + "range": Array [ + 11, + 14, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 0, - 37, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -41100,30 +41720,60 @@ exports[`typescript fixtures/basics/type-alias-declaration-with-constrained-type Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "Result", - "range": Array [ - 5, - 11, - ], - "type": "Identifier", + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, }, - "init": Object { + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 48, + ], + "type": "TSUnionType", + "types": Array [ + Object { "loc": Object { "end": Object { - "column": 48, + "column": 38, "line": 1, }, "start": Object { @@ -41133,224 +41783,191 @@ Object { }, "range": Array [ 28, - 48, + 38, ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 28, - "line": 1, - }, + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, }, - "range": Array [ - 28, - 38, - ], - "type": "TSTypeReference", - "typeName": Object { + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "Success", + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "params": Array [ + Object { "loc": Object { "end": Object { - "column": 35, + "column": 37, "line": 1, }, "start": Object { - "column": 28, + "column": 36, "line": 1, }, }, - "name": "Success", "range": Array [ - 28, - 35, + 36, + 37, ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 35, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, }, - "range": Array [ - 36, - 37, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 37, - "line": 1, - }, - "start": Object { - "column": 36, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 36, - 37, - ], - "type": "Identifier", + "start": Object { + "column": 36, + "line": 1, }, }, - ], - "range": Array [ - 35, - 38, - ], - "type": "TSTypeParameterInstantiation", + "name": "T", + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + }, }, + ], + "range": Array [ + 35, + 38, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, }, - "range": Array [ - 41, - 48, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 41, - "line": 1, - }, - }, - "name": "Failure", - "range": Array [ - 41, - 48, - ], - "type": "Identifier", + "start": Object { + "column": 41, + "line": 1, }, }, - ], - }, - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "name": "Failure", + "range": Array [ + 41, + 48, + ], + "type": "Identifier", }, }, - "range": Array [ - 5, - 48, - ], - "type": "VariableDeclarator", - "typeParameters": Object { + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 22, + 24, + ], + "type": "TSTypeLiteral", + }, "loc": Object { "end": Object { - "column": 25, + "column": 24, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, - "params": Array [ - Object { - "constraint": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "members": Array [], - "range": Array [ - 22, - 24, - ], - "type": "TSTypeLiteral", + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "start": Object { + "column": 12, + "line": 1, }, - "name": "T", - "range": Array [ - 12, - 24, - ], - "type": "TSTypeParameter", }, - ], + "name": "T", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, "range": Array [ - 11, - 25, + 12, + 24, ], - "type": "TSTypeParameterDeclaration", + "type": "TSTypeParameter", }, - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 48, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + ], + "range": Array [ + 11, + 25, + ], + "type": "TSTypeParameterDeclaration", }, - "range": Array [ - 0, - 48, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -41649,184 +42266,164 @@ exports[`typescript fixtures/basics/type-alias-object-without-annotation.src 1`] Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, + "id": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, }, + "name": "bar", + "range": Array [ + 12, + 15, + ], + "type": "Identifier", }, - "name": "foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, - "init": Object { "loc": Object { "end": Object { - "column": 29, + "column": 24, "line": 1, }, "start": Object { - "column": 11, + "column": 12, "line": 1, }, }, - "members": Array [ - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "bar", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, + "range": Array [ + 12, + 24, + ], + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, }, - "range": Array [ - 12, - 24, - ], - "type": "TSPropertySignature", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 23, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 23, - ], - "type": "TSStringKeyword", - }, + "start": Object { + "column": 15, + "line": 1, }, }, - Object { - "computed": false, - "key": Object { - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "name": "baz", - "range": Array [ - 25, - 28, - ], - "type": "Identifier", - }, + "range": Array [ + 15, + 23, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { "loc": Object { "end": Object { - "column": 28, + "column": 23, "line": 1, }, "start": Object { - "column": 25, + "column": 17, "line": 1, }, }, "range": Array [ - 25, - 28, + 17, + 23, ], - "type": "TSPropertySignature", + "type": "TSStringKeyword", }, - ], - "range": Array [ - 11, - 29, - ], - "type": "TSTypeLiteral", + }, }, - "loc": Object { - "end": Object { - "column": 30, - "line": 1, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "baz", + "range": Array [ + 25, + 28, + ], + "type": "Identifier", }, - "start": Object { - "column": 5, - "line": 1, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, }, + "range": Array [ + 25, + 28, + ], + "type": "TSPropertySignature", }, - "range": Array [ - 5, - 30, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "type", - "loc": Object { - "end": Object { - "column": 30, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, + ], + "range": Array [ + 11, + 29, + ], + "type": "TSTypeLiteral", }, - "range": Array [ - 0, - 30, - ], - "type": "VariableDeclaration", }, ], "comments": Array [], @@ -42876,7 +43473,24 @@ Object { "line": 2, }, }, - "name": "A", + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "A", + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + }, "range": Array [ 68, 69, @@ -43005,7 +43619,24 @@ Object { "line": 3, }, }, - "name": "A", + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "A", + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + }, "range": Array [ 112, 129, @@ -44137,7 +44768,6 @@ exports[`typescript fixtures/basics/typed-this.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -44170,7 +44800,6 @@ Object { "line": 2, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -44216,7 +44845,7 @@ Object { "line": 2, }, }, - "parameters": Array [ + "params": Array [ Object { "loc": Object { "end": Object { @@ -44344,20 +44973,19 @@ Object { 49, 79, ], - "type": "TSFunctionType", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 57, "line": 2, }, "start": Object { - "column": 51, + "column": 50, "line": 2, }, }, "range": Array [ - 73, + 72, 79, ], "type": "TSTypeAnnotation", @@ -44379,7 +45007,7 @@ Object { "type": "TSVoidKeyword", }, }, - "typeParameters": null, + "type": "TSFunctionType", }, }, }, @@ -44388,9 +45016,7 @@ Object { 23, 87, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 64, @@ -44424,6 +45050,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, ], "loc": Object { @@ -44442,7 +45069,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -44918,79 +45544,24 @@ exports[`typescript fixtures/basics/unique-symbol.src 1`] = ` Object { "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "A", - "range": Array [ - 5, - 6, - ], - "type": "Identifier", - }, - "init": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "operator": "unique", - "range": Array [ - 9, - 22, - ], - "type": "TSTypeOperator", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 22, - ], - "type": "TSSymbolKeyword", - }, + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, + "start": Object { + "column": 5, + "line": 1, }, - "range": Array [ - 5, - 23, - ], - "type": "VariableDeclarator", }, - ], - "kind": "type", + "name": "A", + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + }, "loc": Object { "end": Object { "column": 23, @@ -45005,7 +45576,42 @@ Object { 0, 23, ], - "type": "VariableDeclaration", + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "unique", + "range": Array [ + 9, + 22, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSSymbolKeyword", + }, + }, }, ], "comments": Array [], @@ -58128,7 +58734,7 @@ Object { }, "implements": Array [ Object { - "id": Object { + "expression": Object { "loc": Object { "end": Object { "column": 32, @@ -58160,7 +58766,7 @@ Object { 29, 32, ], - "type": "ClassImplements", + "type": "TSClassImplements", }, ], "loc": Object { @@ -58764,7 +59370,6 @@ exports[`typescript fixtures/errorRecovery/decorator-on-interface-declaration.sr Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -58838,7 +59443,6 @@ Object { "type": "Decorator", }, ], - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -59722,7 +60326,6 @@ exports[`typescript fixtures/errorRecovery/interface-empty-extends.src 1`] = ` Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -59741,7 +60344,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -59893,7 +60495,6 @@ exports[`typescript fixtures/errorRecovery/interface-property-modifiers.src 1`] Object { "body": Array [ Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -60413,39 +61014,34 @@ Object { }, Object { "accessibility": "public", - "index": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 10, - }, - "start": Object { - "column": 12, - "line": 10, - }, + "loc": Object { + "end": Object { + "column": 33, + "line": 10, }, - "name": "baz", - "range": Array [ - 190, - 201, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 10, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 23, "line": 10, }, "start": Object { - "column": 15, + "column": 12, "line": 10, }, }, + "name": "baz", "range": Array [ - 193, + 190, 201, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -60453,33 +61049,39 @@ Object { "line": 10, }, "start": Object { - "column": 17, + "column": 15, "line": 10, }, }, "range": Array [ - 195, + 193, 201, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 195, + 201, + ], + "type": "TSStringKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 10, - }, - "start": Object { - "column": 4, - "line": 10, - }, - }, + ], "range": Array [ 182, 211, ], - "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -60518,39 +61120,34 @@ Object { }, Object { "accessibility": "private", - "index": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 11, - }, - "start": Object { - "column": 13, - "line": 11, - }, + "loc": Object { + "end": Object { + "column": 34, + "line": 11, }, - "name": "baz", - "range": Array [ - 225, - 236, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 11, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 24, "line": 11, }, "start": Object { - "column": 16, + "column": 13, "line": 11, }, }, + "name": "baz", "range": Array [ - 228, + 225, 236, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -60558,33 +61155,39 @@ Object { "line": 11, }, "start": Object { - "column": 18, + "column": 16, "line": 11, }, }, "range": Array [ - 230, + 228, 236, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "TSStringKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 34, - "line": 11, - }, - "start": Object { - "column": 4, - "line": 11, - }, - }, + ], "range": Array [ 216, 246, ], - "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -60623,39 +61226,34 @@ Object { }, Object { "accessibility": "protected", - "index": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 12, - }, - "start": Object { - "column": 15, - "line": 12, - }, + "loc": Object { + "end": Object { + "column": 36, + "line": 12, }, - "name": "baz", - "range": Array [ - 262, - 273, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 12, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 26, "line": 12, }, "start": Object { - "column": 18, + "column": 15, "line": 12, }, }, + "name": "baz", "range": Array [ - 265, + 262, 273, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -60663,33 +61261,39 @@ Object { "line": 12, }, "start": Object { - "column": 20, + "column": 18, "line": 12, }, }, "range": Array [ - 267, + 265, 273, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 267, + 273, + ], + "type": "TSStringKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 36, - "line": 12, - }, - "start": Object { - "column": 4, - "line": 12, - }, - }, + ], "range": Array [ 251, 283, ], - "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -60727,39 +61331,34 @@ Object { }, }, Object { - "index": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 13, - }, - "start": Object { - "column": 12, - "line": 13, - }, + "loc": Object { + "end": Object { + "column": 33, + "line": 13, }, - "name": "baz", - "range": Array [ - 296, - 307, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 13, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 23, "line": 13, }, "start": Object { - "column": 15, + "column": 12, "line": 13, }, }, + "name": "baz", "range": Array [ - 299, + 296, 307, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -60767,28 +61366,35 @@ Object { "line": 13, }, "start": Object { - "column": 17, + "column": 15, "line": 13, }, }, "range": Array [ - 301, + 299, 307, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 17, + "line": 13, + }, + }, + "range": Array [ + 301, + 307, + ], + "type": "TSStringKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 13, - }, - "start": Object { - "column": 4, - "line": 13, - }, - }, + ], "range": Array [ 288, 317, @@ -60832,39 +61438,34 @@ Object { }, Object { "export": true, - "index": Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 14, - }, - "start": Object { - "column": 12, - "line": 14, - }, + "loc": Object { + "end": Object { + "column": 33, + "line": 14, }, - "name": "baz", - "range": Array [ - 330, - 341, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 14, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 23, "line": 14, }, "start": Object { - "column": 15, + "column": 12, "line": 14, }, }, + "name": "baz", "range": Array [ - 333, + 330, 341, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -60872,33 +61473,39 @@ Object { "line": 14, }, "start": Object { - "column": 17, + "column": 15, "line": 14, }, }, "range": Array [ - 335, + 333, 341, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 335, + 341, + ], + "type": "TSStringKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 33, - "line": 14, - }, - "start": Object { - "column": 4, - "line": 14, - }, - }, + ], "range": Array [ 322, 351, ], - "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -60936,39 +61543,34 @@ Object { }, }, Object { - "index": Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 15, - }, - "start": Object { - "column": 14, - "line": 15, - }, + "loc": Object { + "end": Object { + "column": 35, + "line": 15, }, - "name": "baz", - "range": Array [ - 366, - 377, - ], - "type": "Identifier", - "typeAnnotation": Object { + "start": Object { + "column": 4, + "line": 15, + }, + }, + "parameters": Array [ + Object { "loc": Object { "end": Object { "column": 25, "line": 15, }, "start": Object { - "column": 17, + "column": 14, "line": 15, }, }, + "name": "baz", "range": Array [ - 369, + 366, 377, ], - "type": "TSTypeAnnotation", + "type": "Identifier", "typeAnnotation": Object { "loc": Object { "end": Object { @@ -60976,34 +61578,40 @@ Object { "line": 15, }, "start": Object { - "column": 19, + "column": 17, "line": 15, }, }, "range": Array [ - 371, + 369, 377, ], - "type": "TSStringKeyword", + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 15, + }, + "start": Object { + "column": 19, + "line": 15, + }, + }, + "range": Array [ + 371, + 377, + ], + "type": "TSStringKeyword", + }, }, }, - }, - "loc": Object { - "end": Object { - "column": 35, - "line": 15, - }, - "start": Object { - "column": 4, - "line": 15, - }, - }, + ], "range": Array [ 356, 387, ], "readonly": true, - "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -61071,7 +61679,6 @@ Object { "line": 17, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -61130,9 +61737,7 @@ Object { 393, 421, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 31, @@ -61166,6 +61771,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, Object { "accessibility": "private", @@ -61198,7 +61804,6 @@ Object { "line": 18, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -61257,9 +61862,7 @@ Object { 426, 455, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 32, @@ -61293,6 +61896,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, Object { "accessibility": "protected", @@ -61325,7 +61929,6 @@ Object { "line": 19, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -61384,9 +61987,7 @@ Object { 460, 491, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 34, @@ -61420,6 +62021,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, Object { "computed": false, @@ -61451,7 +62053,6 @@ Object { "line": 20, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -61510,9 +62111,7 @@ Object { 496, 524, ], - "static": true, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 31, @@ -61546,6 +62145,8 @@ Object { "type": "TSVoidKeyword", }, }, + "static": true, + "type": "TSMethodSignature", }, Object { "computed": false, @@ -61578,7 +62179,6 @@ Object { "line": 21, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -61637,9 +62237,7 @@ Object { 529, 557, ], - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 31, @@ -61673,6 +62271,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, Object { "computed": false, @@ -61704,7 +62303,6 @@ Object { "line": 22, }, }, - "optional": false, "params": Array [ Object { "loc": Object { @@ -61764,9 +62362,7 @@ Object { 592, ], "readonly": true, - "static": false, - "type": "TSMethodSignature", - "typeAnnotation": Object { + "returnType": Object { "loc": Object { "end": Object { "column": 33, @@ -61800,6 +62396,7 @@ Object { "type": "TSVoidKeyword", }, }, + "type": "TSMethodSignature", }, ], "loc": Object { @@ -61818,7 +62415,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { @@ -66117,7 +66713,6 @@ Object { Object { "declaration": Object { "async": false, - "body": null, "expression": false, "generator": false, "id": Object { @@ -66294,7 +66889,7 @@ Object { }, }, }, - "type": "TSEmptyBodyFunctionDeclaration", + "type": "TSDeclareFunction", }, "loc": Object { "end": Object { @@ -67954,7 +68549,6 @@ Object { "body": Array [ Object { "declaration": Object { - "abstract": false, "body": Object { "body": Array [ Object { @@ -68044,7 +68638,6 @@ Object { ], "type": "TSInterfaceBody", }, - "heritage": Array [], "id": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-eslint-parser/visitor-keys.js b/packages/typescript-eslint-parser/visitor-keys.js index 40a5e498c720..210a5ac4d9a6 100644 --- a/packages/typescript-eslint-parser/visitor-keys.js +++ b/packages/typescript-eslint-parser/visitor-keys.js @@ -19,10 +19,12 @@ module.exports = Evk.unionWith({ Identifier: ["decorators", "typeAnnotation"], MethodDefinition: ["decorators", "key", "value"], ObjectPattern: ["properties", "typeAnnotation"], + RestElement: ["argument", "typeAnnotation"], NewExpression: ["callee", "typeParameters", "arguments"], CallExpression: ["callee", "typeParameters", "arguments"], // Additional Nodes. + BigIntLiteral: [], ClassProperty: ["decorators", "key", "typeAnnotation", "value"], Decorator: ["expression"], TSAbstractClassProperty: ["decorators", "key", "typeAnnotation", "value"], @@ -31,14 +33,17 @@ module.exports = Evk.unionWith({ TSAbstractMethodDefinition: ["key", "value"], TSAnyKeyword: [], TSArrayType: ["elementType"], + TSAsExpression: ["expression", "typeAnnotation"], TSAsyncKeyword: [], + TSBigIntKeyword: [], TSBooleanKeyword: [], - TSCallSignature: ["typeParameters", "parameters", "typeAnnotation"], - TSConstructSignature: ["typeParameters", "params", "typeAnnotation"], - TSConstructorType: ["typeAnnotation", "parameters"], + TSCallSignatureDeclaration: ["typeParameters", "params", "returnType"], + TSClassImplements: ["expression", "typeParameters"], + TSConditionalType: ["checkType", "extendsType", "trueType", "falseType"], + TSConstructSignatureDeclaration: ["typeParameters", "params", "returnType"], + TSConstructorType: ["typeParameters", "params", "returnType"], + TSDeclareFunction: ["id", "typeParameters", "params", "returnType"], TSDeclareKeyword: [], - TSEmptyBodyDeclareFunction: ["id", "typeParameters", "params", "returnType"], - TSEmptyBodyFunctionDeclaration: ["id", "typeParameters", "params", "returnType"], TSEmptyBodyFunctionExpression: ["id", "typeParameters", "params", "returnType"], TSEnumDeclaration: ["members"], TSEnumMember: ["id", "initializer"], @@ -46,23 +51,29 @@ module.exports = Evk.unionWith({ TSExportKeyword: [], TSExternalModuleReference: ["expression"], TSImportType: ["parameter", "qualifier", "typeParameters"], + TSInferType: ["typeParameter"], TSLiteralType: ["literal"], - TSIndexSignature: ["typeAnnotation", "index"], + TSIntersectionType: ["types"], + TSIndexedAccessType: ["indexType", "objectType"], + TSIndexSignature: ["typeAnnotation", "parameters"], TSInterfaceBody: ["body"], - TSInterfaceDeclaration: ["id", "typeParameters", "heritage", "body"], - TSInterfaceHeritage: ["id", "typeParameters"], - TSImportEqualsDeclaration: ["name", "moduleReference"], - TSFunctionType: ["parameters", "typeAnnotation"], - TSMethodSignature: ["typeAnnotation", "typeParameters", "key", "params"], + TSInterfaceDeclaration: ["id", "typeParameters", "extends", "body"], + TSInterfaceHeritage: ["expression", "typeParameters"], + TSImportEqualsDeclaration: ["id", "moduleReference"], + TSFunctionType: ["typeParameters", "params", "returnType"], + TSMappedType: ["typeParameter"], + TSMethodSignature: ["typeParameters", "key", "params", "returnType"], TSModuleBlock: ["body"], TSModuleDeclaration: ["id", "body"], - TSNamespaceFunctionDeclaration: [], + TSNamespaceExportDeclaration: ["id"], TSNonNullExpression: ["expression"], TSNeverKeyword: [], TSNullKeyword: [], TSNumberKeyword: [], TSObjectKeyword: [], + TSOptionalType: ["typeAnnotation"], TSParameterProperty: ["parameter"], + TSParenthesizedType: ["typeAnnotation"], TSPrivateKeyword: [], TSPropertySignature: ["typeAnnotation", "key", "initializer"], TSProtectedKeyword: [], @@ -70,13 +81,18 @@ module.exports = Evk.unionWith({ TSQualifiedName: ["left", "right"], TSQuestionToken: [], TSReadonlyKeyword: [], + TSRestType: ["typeAnnotation"], TSStaticKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], + TSThisType: [], + TSTupleType: ["elementTypes"], + TSTypeAliasDeclaration: ["id", "typeParameters", "typeAnnotation"], TSTypeAnnotation: ["typeAnnotation"], + TSTypeAssertion: ["typeAnnotation", "expression"], TSTypeLiteral: ["members"], TSTypeOperator: ["typeAnnotation"], - TSTypeParameter: ["constraint", "default"], + TSTypeParameter: ["name", "constraint", "default"], TSTypeParameterDeclaration: ["params"], TSTypeParameterInstantiation: ["params"], TSTypePredicate: ["typeAnnotation", "parameterName"], @@ -84,5 +100,6 @@ module.exports = Evk.unionWith({ TSTypeQuery: ["exprName"], TSUnionType: ["types"], TSUndefinedKeyword: [], + TSUnknownKeyword: [], TSVoidKeyword: [] }); From 435ebf88af693719c398552723a6564d1255d0fe Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 13 Jan 2019 18:15:46 +0100 Subject: [PATCH 324/326] Fix: sourceType not correctly set in AST when provided in options. (#583) --- .../typescript-eslint-parser/analyze-scope.js | 6 +- packages/typescript-eslint-parser/parser.js | 24 +- .../tests/lib/__snapshots__/basics.js.snap | 18 +- .../tests/lib/__snapshots__/comments.js.snap | 40 +- .../lib/__snapshots__/ecma-features.js.snap | 484 +- .../tests/lib/__snapshots__/jsx.js.snap | 48 +- .../lib/__snapshots__/scope-analysis.js.snap | 12877 ++++++++++++++-- .../tests/lib/__snapshots__/tsx.js.snap | 2 +- .../lib/__snapshots__/typescript.js.snap | 224 +- .../tests/lib/comments.js | 3 +- .../tests/lib/scope-analysis.js | 116 +- .../tools/test-utils.js | 3 +- 12 files changed, 12213 insertions(+), 1632 deletions(-) diff --git a/packages/typescript-eslint-parser/analyze-scope.js b/packages/typescript-eslint-parser/analyze-scope.js index 5505973c0f77..f911769fa41e 100644 --- a/packages/typescript-eslint-parser/analyze-scope.js +++ b/packages/typescript-eslint-parser/analyze-scope.js @@ -778,17 +778,17 @@ class Referencer extends OriginalReferencer { } } -module.exports = function(ast, parserOptions, extraOptions) { +module.exports = function(ast, parserOptions) { const options = { ignoreEval: true, optimistic: false, directive: false, nodejsScope: - ast.sourceType === "script" && + parserOptions.sourceType === "script" && (parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn) === true, impliedStrict: false, - sourceType: extraOptions.sourceType, + sourceType: parserOptions.sourceType, ecmaVersion: parserOptions.ecmaVersion || 2018, childVisitorKeys, fallback diff --git a/packages/typescript-eslint-parser/parser.js b/packages/typescript-eslint-parser/parser.js index 9774d4cb3728..dec3cd6e5039 100644 --- a/packages/typescript-eslint-parser/parser.js +++ b/packages/typescript-eslint-parser/parser.js @@ -33,10 +33,15 @@ exports.parseForESLint = function parseForESLint(code, options) { } } + // https://eslint.org/docs/user-guide/configuring#specifying-parser-options + // if sourceType is not provided by default eslint expect that it will be set to "script" + options.sourceType = options.sourceType || "script"; + if (options.sourceType !== "module" && options.sourceType !== "script") { + options.sourceType = "script"; + } + const ast = parse(code, options); - const extraOptions = { - sourceType: ast.sourceType - }; + ast.sourceType = options.sourceType; traverser.traverse(ast, { enter: node => { @@ -47,23 +52,12 @@ exports.parseForESLint = function parseForESLint(code, options) { node.type = `TSEmptyBody${node.type}`; } break; - - // Import/Export declarations cannot appear in script. - // But if those appear only in namespace/module blocks, `ast.sourceType` was `"script"`. - // This doesn't modify `ast.sourceType` directly for backward compatibility. - case "ImportDeclaration": - case "ExportAllDeclaration": - case "ExportDefaultDeclaration": - case "ExportNamedDeclaration": - extraOptions.sourceType = "module"; - break; - // no default } } }); - const scopeManager = analyzeScope(ast, options, extraOptions); + const scopeManager = analyzeScope(ast, options); return { ast, scopeManager, visitorKeys }; }; diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap index d952c5af516e..6aeaa22d3849 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/basics.js.snap @@ -109,7 +109,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -515,7 +515,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1194,7 +1194,7 @@ Object { 0, 60, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1562,7 +1562,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1731,7 +1731,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1993,7 +1993,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2236,7 +2236,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2537,7 +2537,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2997,7 +2997,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap index 5672625c2e4c..cf52cd5abb37 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/comments.js.snap @@ -110,7 +110,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -335,7 +335,7 @@ Object { 10, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -984,7 +984,7 @@ Object { 99, 137, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1489,7 +1489,7 @@ Object { 0, 98, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2193,7 +2193,7 @@ Object { 0, 129, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2598,7 +2598,7 @@ Object { 12, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [], "type": "Program", } @@ -2752,7 +2752,7 @@ Object { 6, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2946,7 +2946,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3204,7 +3204,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3504,7 +3504,7 @@ Object { 0, 61, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3822,7 +3822,7 @@ Object { 0, 64, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4105,7 +4105,7 @@ Object { 0, 62, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4406,7 +4406,7 @@ Object { 0, 64, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4799,7 +4799,7 @@ Object { 0, 69, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5297,7 +5297,7 @@ Object { 0, 92, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5890,7 +5890,7 @@ Object { 0, 142, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6442,7 +6442,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6911,7 +6911,7 @@ Object { 0, 134, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7996,7 +7996,7 @@ Object { 0, 288, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9115,7 +9115,7 @@ Object { 0, 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap index 591436ed7dd4..570124e64f76 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/ecma-features.js.snap @@ -113,7 +113,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -432,7 +432,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -732,7 +732,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1074,7 +1074,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1645,7 +1645,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1945,7 +1945,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2210,7 +2210,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2540,7 +2540,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2878,7 +2878,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3234,7 +3234,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3536,7 +3536,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3802,7 +3802,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4104,7 +4104,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4442,7 +4442,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4780,7 +4780,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5100,7 +5100,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5348,7 +5348,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5578,7 +5578,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5826,7 +5826,7 @@ Object { 0, 9, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6095,7 +6095,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6396,7 +6396,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6697,7 +6697,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6998,7 +6998,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7173,7 +7173,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7366,7 +7366,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7613,7 +7613,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7865,7 +7865,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8189,7 +8189,7 @@ Object { 0, 29, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8652,7 +8652,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8827,7 +8827,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9037,7 +9037,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9207,7 +9207,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9305,7 +9305,7 @@ Object { 0, 4, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9403,7 +9403,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9501,7 +9501,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9601,7 +9601,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9699,7 +9699,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9834,7 +9834,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10023,7 +10023,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10306,7 +10306,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10867,7 +10867,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -11385,7 +11385,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -11717,7 +11717,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12001,7 +12001,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12357,7 +12357,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12714,7 +12714,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13052,7 +13052,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13461,7 +13461,7 @@ Object { 0, 45, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13889,7 +13889,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14282,7 +14282,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14692,7 +14692,7 @@ Object { 0, 29, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -15259,7 +15259,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -15981,7 +15981,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -16631,7 +16631,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -17157,7 +17157,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -17717,7 +17717,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18259,7 +18259,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18837,7 +18837,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19397,7 +19397,7 @@ Object { 0, 56, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19879,7 +19879,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20255,7 +20255,7 @@ Object { 0, 34, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20647,7 +20647,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20980,7 +20980,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21258,7 +21258,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21499,7 +21499,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21686,7 +21686,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21873,7 +21873,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22096,7 +22096,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22302,7 +22302,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22550,7 +22550,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -22847,7 +22847,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -23088,7 +23088,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -23464,7 +23464,7 @@ Object { 0, 47, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -23894,7 +23894,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24248,7 +24248,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24584,7 +24584,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24996,7 +24996,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -25460,7 +25460,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -25901,7 +25901,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26216,7 +26216,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26550,7 +26550,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26909,7 +26909,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -27448,7 +27448,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28137,7 +28137,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28754,7 +28754,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -29221,7 +29221,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -29760,7 +29760,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -30449,7 +30449,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31066,7 +31066,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31470,7 +31470,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31858,7 +31858,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -32529,7 +32529,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -33133,7 +33133,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -33594,7 +33594,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -34055,7 +34055,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -34482,7 +34482,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35005,7 +35005,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35504,7 +35504,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36081,7 +36081,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36802,7 +36802,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37451,7 +37451,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38028,7 +38028,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38606,7 +38606,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -39220,7 +39220,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -39908,7 +39908,7 @@ Object { 0, 72, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -40869,7 +40869,7 @@ Object { 0, 72, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -41657,7 +41657,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42064,7 +42064,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42497,7 +42497,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -43358,7 +43358,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44037,7 +44037,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44374,7 +44374,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44675,7 +44675,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45069,7 +45069,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45631,7 +45631,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46147,7 +46147,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46519,7 +46519,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46966,7 +46966,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47359,7 +47359,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47939,7 +47939,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -48533,7 +48533,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -48983,7 +48983,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49370,7 +49370,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49653,7 +49653,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49955,7 +49955,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50446,7 +50446,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50973,7 +50973,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51457,7 +51457,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51758,7 +51758,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52116,7 +52116,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52662,7 +52662,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53158,7 +53158,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53420,7 +53420,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53721,7 +53721,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54058,7 +54058,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54359,7 +54359,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54696,7 +54696,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55033,7 +55033,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55575,7 +55575,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -56193,7 +56193,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -56651,7 +56651,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57079,7 +57079,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57501,7 +57501,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57945,7 +57945,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58517,7 +58517,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58902,7 +58902,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59197,7 +59197,7 @@ Object { 0, 11, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59591,7 +59591,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60033,7 +60033,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60438,7 +60438,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60753,7 +60753,7 @@ Object { 0, 15, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60980,7 +60980,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -61318,7 +61318,7 @@ Object { 0, 70, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -61795,7 +61795,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -62170,7 +62170,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -62669,7 +62669,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -63077,7 +63077,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -63508,7 +63508,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -64224,7 +64224,7 @@ Object { 0, 49, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65141,7 +65141,7 @@ Object { 0, 84, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65920,7 +65920,7 @@ Object { 0, 109, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66611,7 +66611,7 @@ Object { 0, 114, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -67330,7 +67330,7 @@ Object { 0, 70, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -68049,7 +68049,7 @@ Object { 0, 80, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -68674,7 +68674,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69227,7 +69227,7 @@ Object { 0, 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69721,7 +69721,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69944,7 +69944,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -70315,7 +70315,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -70815,7 +70815,7 @@ Object { 0, 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -71419,7 +71419,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -71824,7 +71824,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -72193,7 +72193,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -72562,7 +72562,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -72897,7 +72897,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -73178,7 +73178,7 @@ Object { 1, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -73591,7 +73591,7 @@ Object { 0, 66, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -74107,7 +74107,7 @@ Object { 0, 34, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -74423,7 +74423,7 @@ Object { 0, 17, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -74721,7 +74721,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -75056,7 +75056,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -75392,7 +75392,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -75747,7 +75747,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76119,7 +76119,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76360,7 +76360,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76458,7 +76458,7 @@ Object { 0, 8, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -76556,7 +76556,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -77266,7 +77266,7 @@ Object { 0, 43, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -89169,7 +89169,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -89487,7 +89487,7 @@ Object { 0, 45, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -89895,7 +89895,7 @@ Object { 0, 41, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -90324,7 +90324,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -90736,7 +90736,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -91227,7 +91227,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -91799,7 +91799,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -92154,7 +92154,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -92476,7 +92476,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -92814,7 +92814,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -93171,7 +93171,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -93747,7 +93747,7 @@ Object { 0, 81, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -94451,7 +94451,7 @@ Object { 0, 85, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -95082,7 +95082,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -95607,7 +95607,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -96094,7 +96094,7 @@ Object { 0, 51, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -96540,7 +96540,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -96932,7 +96932,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -97324,7 +97324,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -97735,7 +97735,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -98146,7 +98146,7 @@ Object { 0, 32, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -98560,7 +98560,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99211,7 +99211,7 @@ Object { 0, 67, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99599,7 +99599,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99734,7 +99734,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -99868,7 +99868,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100008,7 +100008,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100206,7 +100206,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100404,7 +100404,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100602,7 +100602,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -100800,7 +100800,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -101048,7 +101048,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -101441,7 +101441,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -101834,7 +101834,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -102151,7 +102151,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -102486,7 +102486,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -102841,7 +102841,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -103214,7 +103214,7 @@ Object { 0, 29, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -103642,7 +103642,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -103976,7 +103976,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -104275,7 +104275,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -104552,7 +104552,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -104811,7 +104811,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -105205,7 +105205,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -105470,7 +105470,7 @@ Object { 0, 7, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -105631,7 +105631,7 @@ Object { 0, 40, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106072,7 +106072,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106491,7 +106491,7 @@ Object { 0, 111, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106617,7 +106617,7 @@ Object { 0, 5, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106776,7 +106776,7 @@ Object { 0, 13, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -106986,7 +106986,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -107407,7 +107407,7 @@ Object { 0, 76, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -107830,7 +107830,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -107929,7 +107929,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap index 0f1119402496..08c6203a9da6 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/jsx.js.snap @@ -306,7 +306,7 @@ Object { 0, 45, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1052,7 +1052,7 @@ Object { 0, 60, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1657,7 +1657,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2136,7 +2136,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2705,7 +2705,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3107,7 +3107,7 @@ Object { 0, 10, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3782,7 +3782,7 @@ Object { 0, 84, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4467,7 +4467,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4746,7 +4746,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5111,7 +5111,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5586,7 +5586,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6027,7 +6027,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6290,7 +6290,7 @@ Object { 0, 6, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6612,7 +6612,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7039,7 +7039,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7462,7 +7462,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7813,7 +7813,7 @@ Object { 0, 19, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8178,7 +8178,7 @@ Object { 0, 12, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8667,7 +8667,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9108,7 +9108,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9547,7 +9547,7 @@ Object { 0, 54, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10025,7 +10025,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10401,7 +10401,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10790,7 +10790,7 @@ Object { 0, 25, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap index 561adcd807c2..a6b210ac8583 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/scope-analysis.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/535.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/535.ts 1`] = ` Object { - "$id": 5, + "$id": 6, "block": Object { "range": Array [ 0, @@ -12,75 +12,149 @@ Object { }, "childScopes": Array [ Object { - "$id": 4, + "$id": 5, "block": Object { "range": Array [ 0, - 51, + 52, ], - "type": "FunctionDeclaration", + "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [ + "childScopes": Array [ Object { - "$id": 3, - "from": Object { - "$ref": 4, - }, - "identifier": Object { - "name": "bar", + "$id": 4, + "block": Object { "range": Array [ - 45, - 48, + 0, + 51, ], - "type": "Identifier", + "type": "FunctionDeclaration", }, - "kind": "r", - "resolved": Object { - "$ref": 2, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, }, - "writeExpr": undefined, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], "throughReferences": Array [], - "type": "function", + "type": "module", "upperScope": Object { - "$ref": 5, + "$ref": 6, }, "variableMap": Object { - "arguments": Object { - "$ref": 1, - }, - "bar": Object { - "$ref": 2, + "foo": Object { + "$ref": 0, }, }, "variableScope": Object { - "$ref": 4, + "$ref": 5, }, "variables": Array [ Object { - "$id": 1, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 4, - }, - }, - Object { - "$id": 2, + "$id": 0, "defs": Array [ Object { "name": Object { - "name": "bar", + "name": "foo", "range": Array [ - 15, - 18, + 9, + 12, ], "type": "Identifier", }, @@ -92,28 +166,24 @@ Object { "type": "FunctionDeclaration", }, "parent": null, - "type": "Parameter", + "type": "FunctionName", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "bar", + "name": "foo", "range": Array [ - 15, - 18, + 9, + 12, ], "type": "Identifier", }, ], - "name": "bar", - "references": Array [ - Object { - "$ref": 3, - }, - ], + "name": "foo", + "references": Array [], "scope": Object { - "$ref": 4, + "$ref": 5, }, }, ], @@ -125,62 +195,17 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "foo": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 5, + "$ref": 6, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 51, - ], - "type": "FunctionDeclaration", - }, - "parent": null, - "type": "FunctionName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 9, - 12, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` Object { - "$id": 2, + "$id": 3, "block": Object { "range": Array [ 0, @@ -190,73 +215,98 @@ Object { }, "childScopes": Array [ Object { - "$id": 1, + "$id": 2, "block": Object { "range": Array [ 0, - 68, + 69, ], - "type": "TSAbstractClassDeclaration", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "class", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "A": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 2, + "type": "Program", }, - "variables": Array [ + "childScopes": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "A", - "range": Array [ - 15, - 16, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 68, - ], - "type": "TSAbstractClassDeclaration", - }, - "parent": undefined, - "type": "ClassName", + "$id": 1, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "A": Object { + "$ref": 0, }, - ], - "eslintUsed": undefined, - "identifiers": Array [ + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ Object { - "name": "A", - "range": Array [ - 15, - 16, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, ], - "type": "Identifier", + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], - "name": "A", - "references": Array [], - "scope": Object { - "$ref": 1, - }, }, ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], }, ], "functionExpressionScope": false, @@ -267,15 +317,15 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 2, + "$ref": 3, }, "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-implements.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/class-implements.ts 1`] = ` Object { - "$id": 3, + "$id": 4, "block": Object { "range": Array [ 0, @@ -285,26 +335,96 @@ Object { }, "childScopes": Array [ Object { - "$id": 2, + "$id": 3, "block": Object { "range": Array [ 0, - 82, + 83, ], - "type": "ClassDeclaration", + "type": "Program", }, - "childScopes": Array [], + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], "functionExpressionScope": false, "isStrict": true, "references": Array [], "throughReferences": Array [], - "type": "class", + "type": "module", "upperScope": Object { - "$ref": 3, + "$ref": 4, }, "variableMap": Object { "Foo": Object { - "$ref": 1, + "$ref": 0, }, }, "variableScope": Object { @@ -312,7 +432,7 @@ Object { }, "variables": Array [ Object { - "$id": 1, + "$id": 0, "defs": Array [ Object { "name": Object { @@ -330,7 +450,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -348,7 +468,7 @@ Object { "name": "Foo", "references": Array [], "scope": Object { - "$ref": 2, + "$ref": 3, }, }, ], @@ -360,62 +480,17 @@ Object { "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object { - "Foo": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 3, + "$ref": 4, }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 82, - ], - "type": "ClassDeclaration", - }, - "parent": null, - "type": "ClassName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "Foo", - "range": Array [ - 6, - 9, - ], - "type": "Identifier", - }, - ], - "name": "Foo", - "references": Array [], - "scope": Object { - "$ref": 3, - }, - }, - ], + "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-properties.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/class-properties.ts 1`] = ` Object { - "$id": 8, + "$id": 9, "block": Object { "range": Array [ 0, @@ -425,72 +500,192 @@ Object { }, "childScopes": Array [ Object { - "$id": 7, + "$id": 8, "block": Object { "range": Array [ - 19, - 62, + 0, + 63, ], - "type": "ClassDeclaration", + "type": "Program", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "childScopes": Array [ Object { - "$id": 5, - "from": Object { - "$ref": 7, - }, - "identifier": Object { - "name": "s", + "$id": 7, + "block": Object { "range": Array [ - 43, - 44, + 19, + 62, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 6, - "from": Object { - "$ref": 7, + "type": "ClassDeclaration", }, - "identifier": Object { - "name": "s", - "range": Array [ - 50, - 51, - ], - "type": "Identifier", + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 8, }, - "kind": "r", + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", "resolved": Object { "$ref": 0, }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, "writeExpr": undefined, }, ], "throughReferences": Array [ Object { - "$ref": 5, - }, - Object { - "$ref": 6, + "$ref": 3, }, ], - "type": "class", + "type": "module", "upperScope": Object { - "$ref": 8, + "$ref": 9, }, "variableMap": Object { "A": Object { - "$ref": 4, + "$ref": 1, + }, + "s": Object { + "$ref": 0, }, }, "variableScope": Object { @@ -498,7 +693,63 @@ Object { }, "variables": Array [ Object { - "$id": 4, + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, "defs": Array [ Object { "name": Object { @@ -516,7 +767,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": undefined, + "parent": null, "type": "ClassName", }, ], @@ -534,7 +785,7 @@ Object { "name": "A", "references": Array [], "scope": Object { - "$ref": 7, + "$ref": 8, }, }, ], @@ -542,50 +793,7 @@ Object { ], "functionExpressionScope": false, "isStrict": false, - "references": Array [ - Object { - "$id": 2, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "s", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 10, - 18, - ], - "type": "CallExpression", - }, - }, - Object { - "$id": 3, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "Symbol", - "range": Array [ - 10, - 16, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], + "references": Array [], "throughReferences": Array [ Object { "$ref": 3, @@ -593,18 +801,10468 @@ Object { ], "type": "global", "upperScope": null, - "variableMap": Object { - "A": Object { - "$ref": 1, - }, - "s": Object { - "$ref": 0, - }, - }, + "variableMap": Object {}, "variableScope": Object { - "$ref": 8, + "$ref": 9, }, - "variables": Array [ + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` +Object { + "$id": 12, + "block": Object { + "range": Array [ + 0, + 117, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 117, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 40, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 8, + "block": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo2": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + Object { + "$id": 10, + "block": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "Foo3": Object { + "$ref": 9, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "Bar", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 12, + }, + "variableMap": Object { + "Foo2": Object { + "$ref": 0, + }, + "Foo3": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo2", + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + }, + ], + "name": "Foo2", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 84, + 116, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo3", + "range": Array [ + 90, + 94, + ], + "type": "Identifier", + }, + ], + "name": "Foo3", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 12, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 110, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 110, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 54, + 56, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 71, + 73, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 107, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 107, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 11, + 19, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 26, + 34, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s1", + "range": Array [ + 51, + 53, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s2", + "range": Array [ + 68, + 70, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "s1": Object { + "$ref": 0, + }, + "s2": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s1", + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + }, + ], + "name": "s1", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 6, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s2", + "range": Array [ + 21, + 23, + ], + "type": "Identifier", + }, + ], + "name": "s2", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + Object { + "$ref": 5, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/declare-function.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 37, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/declare-global.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 55, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 42, + 43, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "C": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 25, + 34, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 21, + 34, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": true, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/declare-module.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 95, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 95, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 33, + 92, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 89, + 90, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "a": Object { + "$ref": 3, + }, + "b": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 52, + 61, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 46, + 61, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 79, + 90, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 90, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 93, + 94, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/decorators.ts 1`] = ` +Object { + "$id": 19, + "block": Object { + "range": Array [ + 0, + 198, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 18, + "block": Object { + "range": Array [ + 0, + 198, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 4, + }, + "target": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 13, + 24, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + Object { + "$id": 11, + "block": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "propertyKey": Object { + "$ref": 9, + }, + "target": Object { + "$ref": 8, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "target", + "range": Array [ + 59, + 70, + ], + "type": "Identifier", + }, + ], + "name": "target", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 58, + 98, + ], + "type": "ArrowFunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "propertyKey", + "range": Array [ + 72, + 91, + ], + "type": "Identifier", + }, + ], + "name": "propertyKey", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 7, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 7, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + Object { + "$id": 17, + "block": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 16, + "block": Object { + "range": Array [ + 159, + 195, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 17, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 15, + }, + }, + "variableScope": Object { + "$ref": 16, + }, + "variables": Array [ + Object { + "$id": 15, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 16, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 13, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 14, + "from": Object { + "$ref": 17, + }, + "identifier": Object { + "name": "gec", + "range": Array [ + 147, + 150, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 18, + }, + "variableMap": Object { + "C": Object { + "$ref": 12, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 12, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 17, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 18, + }, + "identifier": Object { + "name": "dec", + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 19, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + "dec": Object { + "$ref": 0, + }, + "gec": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 18, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 29, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "dec", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "dec", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 30, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "gec", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + ], + "name": "gec", + "references": Array [ + Object { + "$ref": 13, + }, + Object { + "$ref": 14, + }, + ], + "scope": Object { + "$ref": 18, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 102, + 197, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 113, + 114, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 18, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 19, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/enum.ts 1`] = ` +Object { + "$id": 15, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 71, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 13, + "block": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": Object { + "range": Array [ + 48, + 53, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 63, + 68, + ], + "type": "BinaryExpression", + }, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "A", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 13, + }, + "identifier": Object { + "name": "B", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "type": "enum", + "upperScope": Object { + "$ref": 14, + }, + "variableMap": Object { + "A": Object { + "$ref": 3, + }, + "B": Object { + "$ref": 4, + }, + "C": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 33, + 38, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 44, + 53, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "B", + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + }, + ], + "name": "B", + "references": Array [ + Object { + "$ref": 8, + }, + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 59, + 68, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [ + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 13, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 18, + 19, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 15, + }, + "variableMap": Object { + "E": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 7, + }, + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 70, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "E", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "E", + "references": Array [], + "scope": Object { + "$ref": 14, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 15, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/enum-string.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "enum", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "BAR": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 26, + ], + "type": "TSEnumMember", + }, + "parent": undefined, + "type": "EnumMemberName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "BAR", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "BAR", + "references": Array [ + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 28, + ], + "type": "TSEnumDeclaration", + }, + "parent": undefined, + "type": "EnumName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 23, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 23, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/expression-as.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 1, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` +Object { + "$id": 15, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 14, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "foo", + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "c", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "baz", + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 11, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "d", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + Object { + "$id": 12, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "e", + "range": Array [ + 60, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 4, + }, + "writeExpr": undefined, + }, + Object { + "$id": 13, + "from": Object { + "$ref": 14, + }, + "identifier": Object { + "name": "f", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 10, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 15, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + "b": Object { + "$ref": 1, + }, + "c": Object { + "$ref": 2, + }, + "d": Object { + "$ref": 3, + }, + "e": Object { + "$ref": 4, + }, + "f": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 14, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 7, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "b", + "references": Array [ + Object { + "$ref": 8, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 13, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "c", + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + }, + ], + "name": "c", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 15, + 16, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "d", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "d", + "references": Array [ + Object { + "$ref": 11, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 18, + 19, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "e", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + ], + "name": "e", + "references": Array [ + Object { + "$ref": 12, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 21, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [ + Object { + "$ref": 13, + }, + ], + "scope": Object { + "$ref": 14, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 10, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 15, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/function-overload.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 101, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 101, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 58, + 68, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "TSDeclareFunction", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "Decorator", + "range": Array [ + 37, + 46, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "config": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "config", + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + }, + ], + "name": "config", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "Test": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "Test": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 4, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 115, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 115, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 110, + 114, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 106, + 114, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/import-equals.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 27, + ], + "type": "TSImportEqualsDeclaration", + }, + "parent": null, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/interface-type.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 67, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/method-overload.ts 1`] = ` +Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 124, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 124, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 7, + }, + "arguments": Object { + "$ref": 6, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 6, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 73, + 121, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 74, + 81, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 10, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 11, + }, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 18, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "s", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 10, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 123, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 10, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/namespace.ts 1`] = ` +Object { + "$id": 10, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 24, + 56, + ], + "type": "TSModuleBlock", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": Object { + "range": Array [ + 47, + 48, + ], + "type": "Literal", + }, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 5, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "a": Object { + "$ref": 5, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 43, + 48, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 37, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "N", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 10, + }, + "variableMap": Object { + "N": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 56, + ], + "type": "TSModuleDeclaration", + }, + "parent": null, + "type": "NamespaceName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + ], + "name": "N", + "references": Array [ + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 10, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/rest-element.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 35, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 35, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "args": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "args", + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + }, + ], + "name": "args", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 34, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-alias.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 103, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 103, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "a": Object { + "$ref": 4, + }, + "arguments": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 47, + 100, + ], + "type": "FunctionExpression", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "C": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 6, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "C": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 31, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 102, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + ], + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 40, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 0, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 21, + 26, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 1, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 32, + 38, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 0, + }, + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 18, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof.ts 1`] = ` +Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 43, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 43, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 3, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 4, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + ], + "scope": Object { + "$ref": 3, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 27, + 40, + ], + "type": "TSTypeAssertion", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": null, + "writeExpr": Object { + "range": Array [ + 46, + 61, + ], + "type": "TSAsExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "b", + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` +Object { + "$id": 9, + "block": Object { + "range": Array [ + 0, + 165, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 165, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 12, + 24, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 125, + 128, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 140, + 143, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 159, + 162, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 9, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 24, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + Object { + "$ref": 4, + }, + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 8, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 9, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` +Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "a": Object { + "$ref": 2, + }, + "arguments": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "f": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "f", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "f", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` +Object { + "$id": 6, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 62, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 2, + }, + "g": Object { + "$ref": 3, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "g", + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 6, + }, + "variableMap": Object { + "g": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 61, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "g", + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + }, + ], + "name": "g", + "references": Array [ + Object { + "$ref": 1, + }, + ], + "scope": Object { + "$ref": 5, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 6, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` +Object { + "$id": 12, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 11, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 22, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 5, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": Object { + "range": Array [ + 46, + 58, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 7, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": Object { + "range": Array [ + 87, + 99, + ], + "type": "ObjectExpression", + }, + }, + Object { + "$id": 8, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 9, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": Object { + "range": Array [ + 132, + 146, + ], + "type": "ArrayExpression", + }, + }, + Object { + "$id": 10, + "from": Object { + "$ref": 11, + }, + "identifier": Object { + "name": "obj", + "range": Array [ + 123, + 126, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 12, + }, + "variableMap": Object { + "element": Object { + "$ref": 3, + }, + "obj": Object { + "$ref": 0, + }, + "obj2": Object { + "$ref": 1, + }, + "value": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 11, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [ + Object { + "$ref": 4, + }, + Object { + "$ref": 6, + }, + Object { + "$ref": 8, + }, + Object { + "$ref": 10, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 27, + 58, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 23, + 58, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj2", + "range": Array [ + 27, + 43, + ], + "type": "Identifier", + }, + ], + "name": "obj2", + "references": Array [ + Object { + "$ref": 5, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 63, + 99, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 59, + 99, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "value", + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + }, + ], + "name": "value", + "references": Array [ + Object { + "$ref": 7, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 104, + 146, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 100, + 146, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "element", + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + }, + ], + "name": "element", + "references": Array [ + Object { + "$ref": 9, + }, + ], + "scope": Object { + "$ref": 11, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 12, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 20, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 20, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 13, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-infer.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 147, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 50, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 50, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 37, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 47, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 48, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 46, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 47, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 49, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "map": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "map", + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + }, + ], + "name": "map", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 81, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 81, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 10, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 10, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 8, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 9, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 22, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 20, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 33, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 33, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 11, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 11, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 45, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 45, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 29, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 24, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "obj": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "obj", + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + }, + ], + "name": "obj", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 38, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + "y": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 20, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 16, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "y", + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + }, + ], + "name": "y", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 19, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "y", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "module", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "x": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [ + Object { + "$ref": 1, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 161, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 161, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "intersection": Object { + "$ref": 1, + }, + "precedence1": Object { + "$ref": 2, + }, + "precedence2": Object { + "$ref": 3, + }, + "union": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 4, + 36, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "union", + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + }, + ], + "name": "union", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 42, + 71, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 38, + 72, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "intersection", + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + }, + ], + "name": "intersection", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 77, + 115, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 116, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence1", + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + }, + ], + "name": "precedence1", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 121, + 159, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 117, + 160, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "precedence2", + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + }, + ], + "name": "precedence2", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: module tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 0, + "block": Object { + "range": Array [ + 0, + 27, + ], + "type": "Program", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 1, + }, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 0, + }, + "variables": Array [], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 1, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/535.ts 1`] = ` +Object { + "$id": 5, + "block": Object { + "range": Array [ + 0, + 52, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 4, + "block": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 3, + "from": Object { + "$ref": 4, + }, + "identifier": Object { + "name": "bar", + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 2, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 5, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 1, + }, + "bar": Object { + "$ref": 2, + }, + }, + "variableScope": Object { + "$ref": 4, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 4, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "Parameter", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bar", + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + }, + ], + "name": "bar", + "references": Array [ + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 4, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 5, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 51, + ], + "type": "FunctionDeclaration", + }, + "parent": null, + "type": "FunctionName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/abstract-class.ts 1`] = ` +Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 69, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 2, + }, + "variableMap": Object { + "A": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 68, + ], + "type": "TSAbstractClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object {}, + "variableScope": Object { + "$ref": 2, + }, + "variables": Array [], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/class-implements.ts 1`] = ` +Object { + "$id": 3, + "block": Object { + "range": Array [ + 0, + 83, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 2, + "block": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 3, + }, + "variableMap": Object { + "Foo": Object { + "$ref": 1, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 2, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "Foo": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 3, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 82, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Foo", + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + }, + ], + "name": "Foo", + "references": Array [], + "scope": Object { + "$ref": 3, + }, + }, + ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/class-properties.ts 1`] = ` +Object { + "$id": 8, + "block": Object { + "range": Array [ + 0, + 63, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 7, + "block": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 5, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 6, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 5, + }, + Object { + "$ref": 6, + }, + ], + "type": "class", + "upperScope": Object { + "$ref": 8, + }, + "variableMap": Object { + "A": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 19, + 62, + ], + "type": "ClassDeclaration", + }, + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "A", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + ], + "name": "A", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "s", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 18, + ], + "type": "CallExpression", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 8, + }, + "identifier": Object { + "name": "Symbol", + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [ + Object { + "$ref": 3, + }, + ], + "type": "global", + "upperScope": null, + "variableMap": Object { + "A": Object { + "$ref": 1, + }, + "s": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 8, + }, + "variables": Array [ Object { "$id": 0, "defs": Array [ @@ -705,7 +11363,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/class-supper-type.ts 1`] = ` Object { "$id": 11, "block": Object { @@ -1088,7 +11746,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/computed-properties-in-interface.ts 1`] = ` Object { "$id": 8, "block": Object { @@ -1357,7 +12015,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/computed-properties-in-type.ts 1`] = ` Object { "$id": 8, "block": Object { @@ -1626,7 +12284,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-function.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/declare-function.ts 1`] = ` Object { "$id": 2, "block": Object { @@ -1720,9 +12378,9 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-global.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/declare-global.ts 1`] = ` Object { - "$id": 3, + "$id": 2, "block": Object { "range": Array [ 0, @@ -1730,65 +12388,36 @@ Object { ], "type": "Program", }, - "childScopes": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ Object { - "$id": 2, - "block": Object { + "$id": 1, + "from": Object { + "$ref": 2, + }, + "identifier": Object { + "name": "C", "range": Array [ - 0, - 55, + 38, + 39, ], - "type": "Program", + "type": "Identifier", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 1, - "from": Object { - "$ref": 2, - }, - "identifier": Object { - "name": "C", - "range": Array [ - 38, - 39, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { - "range": Array [ - 42, - 43, - ], - "type": "Literal", - }, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 1, - }, - ], - "type": "module", - "upperScope": Object { - "$ref": 3, + "kind": "w", + "resolved": Object { + "$ref": 0, }, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 2, + "writeExpr": Object { + "range": Array [ + 42, + 43, + ], + "type": "Literal", }, - "variables": Array [], }, ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, @@ -1798,7 +12427,7 @@ Object { }, }, "variableScope": Object { - "$ref": 3, + "$ref": 2, }, "variables": Array [ Object { @@ -1848,16 +12477,16 @@ Object { }, ], "scope": Object { - "$ref": 3, + "$ref": 2, }, }, ], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/declare-module.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/declare-module.ts 1`] = ` Object { - "$id": 8, + "$id": 7, "block": Object { "range": Array [ 0, @@ -1867,173 +12496,219 @@ Object { }, "childScopes": Array [ Object { - "$id": 7, + "$id": 6, "block": Object { "range": Array [ - 0, - 95, + 33, + 92, ], - "type": "Program", + "type": "TSModuleBlock", }, - "childScopes": Array [ + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ Object { - "$id": 6, - "block": Object { + "$id": 5, + "from": Object { + "$ref": 6, + }, + "identifier": Object { + "name": "a", "range": Array [ - 33, - 92, + 89, + 90, ], - "type": "TSModuleBlock", + "type": "Identifier", }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + "kind": "r", + "resolved": Object { + "$ref": 3, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 7, + }, + "variableMap": Object { + "a": Object { + "$ref": 3, + }, + "b": Object { + "$ref": 4, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 3, + "defs": Array [ Object { - "$id": 5, - "from": Object { - "$ref": 6, - }, - "identifier": Object { + "name": Object { "name": "a", "range": Array [ - 89, - 90, + 52, + 61, ], "type": "Identifier", }, - "kind": "r", - "resolved": Object { - "$ref": 3, + "node": Object { + "range": Array [ + 52, + 61, + ], + "type": "VariableDeclarator", }, - "writeExpr": undefined, + "parent": Object { + "range": Array [ + 46, + 61, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", }, ], - "throughReferences": Array [], - "type": "block", - "upperScope": Object { - "$ref": 7, - }, - "variableMap": Object { - "a": Object { - "$ref": 3, + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 52, + 61, + ], + "type": "Identifier", }, - "b": Object { - "$ref": 4, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 5, }, + ], + "scope": Object { + "$ref": 6, }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ + }, + Object { + "$id": 4, + "defs": Array [ Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 52, - 61, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 52, - 61, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 46, - 61, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 52, - 61, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 5, - }, - ], - "scope": Object { - "$ref": 6, + "name": Object { + "name": "b", + "range": Array [ + 79, + 90, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 79, + 90, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 73, + 90, + ], + "type": "VariableDeclaration", }, + "type": "Variable", }, + ], + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$id": 4, - "defs": Array [ - Object { - "name": Object { - "name": "b", - "range": Array [ - 79, - 90, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 79, - 90, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 73, - 90, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "b", - "range": Array [ - 79, - 90, - ], - "type": "Identifier", - }, - ], "name": "b", - "references": Array [], - "scope": Object { - "$ref": 6, - }, + "range": Array [ + 79, + 90, + ], + "type": "Identifier", }, ], + "name": "b", + "references": Array [], + "scope": Object { + "$ref": 6, + }, }, ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ + }, + ], + "functionExpressionScope": false, + "isStrict": false, + "references": Array [ + Object { + "$id": 1, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 2, + "from": Object { + "$ref": 7, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 93, + 94, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + ], + "throughReferences": Array [], + "type": "global", + "upperScope": null, + "variableMap": Object { + "a": Object { + "$ref": 0, + }, + }, + "variableScope": Object { + "$ref": 7, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ Object { - "$id": 1, - "from": Object { - "$ref": 7, - }, - "identifier": Object { + "name": Object { "name": "a", "range": Array [ 6, @@ -2041,123 +12716,52 @@ Object { ], "type": "Identifier", }, - "kind": "w", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": Object { + "node": Object { "range": Array [ - 10, + 6, 11, ], - "type": "Literal", - }, - }, - Object { - "$id": 2, - "from": Object { - "$ref": 7, + "type": "VariableDeclarator", }, - "identifier": Object { - "name": "a", + "parent": Object { "range": Array [ - 93, - 94, + 0, + 11, ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, + "type": "VariableDeclaration", }, - "writeExpr": undefined, + "type": "Variable", }, ], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 8, - }, - "variableMap": Object { - "a": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 7, - }, - "variables": Array [ + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 6, - 11, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 0, - 11, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 6, - 7, - ], - "type": "Identifier", - }, - ], "name": "a", - "references": Array [ - Object { - "$ref": 1, - }, - Object { - "$ref": 2, - }, + "range": Array [ + 6, + 7, ], - "scope": Object { - "$ref": 7, - }, + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 1, + }, + Object { + "$ref": 2, }, ], + "scope": Object { + "$ref": 7, + }, }, ], - "functionExpressionScope": false, - "isStrict": false, - "references": Array [], - "throughReferences": Array [], - "type": "global", - "upperScope": null, - "variableMap": Object {}, - "variableScope": Object { - "$ref": 8, - }, - "variables": Array [], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/decorators.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/decorators.ts 1`] = ` Object { "$id": 18, "block": Object { @@ -2737,7 +13341,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/enum.ts 1`] = ` Object { "$id": 14, "block": Object { @@ -3226,7 +13830,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/enum-string.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/enum-string.ts 1`] = ` Object { "$id": 4, "block": Object { @@ -3396,7 +14000,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/export-as-namespace.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -3443,7 +14047,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-as.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/expression-as.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -3490,7 +14094,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/expression-type-parameters.ts 1`] = ` Object { "$id": 14, "block": Object { @@ -3991,7 +14595,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/function-overload.ts 1`] = ` Object { "$id": 4, "block": Object { @@ -4145,7 +14749,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/function-overload-2.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -4213,204 +14817,130 @@ Object { }, ], } -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` -Object { - "$id": 8, - "block": Object { - "range": Array [ - 0, - 65, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 7, - "block": Object { - "range": Array [ - 0, - 65, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 6, - "block": Object { - "range": Array [ - 7, - 64, - ], - "type": "ClassDeclaration", - }, - "childScopes": Array [ - Object { - "$id": 5, - "block": Object { - "range": Array [ - 35, - 62, - ], - "type": "FunctionExpression", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 4, - "from": Object { - "$ref": 5, - }, - "identifier": Object { - "name": "Decorator", - "range": Array [ - 37, - 46, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": null, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [ - Object { - "$ref": 4, - }, - ], - "type": "function", - "upperScope": Object { - "$ref": 6, - }, - "variableMap": Object { - "arguments": Object { - "$ref": 2, - }, - "config": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 5, - }, - "variables": Array [ - Object { - "$id": 2, - "defs": Array [], - "eslintUsed": undefined, - "identifiers": Array [], - "name": "arguments", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - Object { - "$id": 3, - "defs": Array [ - Object { - "name": Object { - "name": "config", - "range": Array [ - 47, - 53, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 35, - 62, - ], - "type": "FunctionExpression", - }, - "parent": null, - "type": "Parameter", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "config", - "range": Array [ - 47, - 53, - ], - "type": "Identifier", - }, - ], - "name": "config", - "references": Array [], - "scope": Object { - "$ref": 5, - }, - }, - ], - }, - ], +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/identifier-decorators.ts 1`] = ` +Object { + "$id": 7, + "block": Object { + "range": Array [ + 0, + 65, + ], + "type": "Program", + }, + "childScopes": Array [ + Object { + "$id": 6, + "block": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 5, + "block": Object { + "range": Array [ + 35, + 62, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], "functionExpressionScope": false, "isStrict": true, - "references": Array [], + "references": Array [ + Object { + "$id": 4, + "from": Object { + "$ref": 5, + }, + "identifier": Object { + "name": "Decorator", + "range": Array [ + 37, + 46, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": null, + "writeExpr": undefined, + }, + ], "throughReferences": Array [ Object { "$ref": 4, }, ], - "type": "class", + "type": "function", "upperScope": Object { - "$ref": 7, + "$ref": 6, }, "variableMap": Object { - "Test": Object { - "$ref": 1, + "arguments": Object { + "$ref": 2, + }, + "config": Object { + "$ref": 3, }, }, "variableScope": Object { - "$ref": 7, + "$ref": 5, }, "variables": Array [ Object { - "$id": 1, + "$id": 2, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 5, + }, + }, + Object { + "$id": 3, "defs": Array [ Object { "name": Object { - "name": "Test", + "name": "config", "range": Array [ - 13, - 17, + 47, + 53, ], "type": "Identifier", }, "node": Object { "range": Array [ - 7, - 64, + 35, + 62, ], - "type": "ClassDeclaration", + "type": "FunctionExpression", }, - "parent": undefined, - "type": "ClassName", + "parent": null, + "type": "Parameter", }, ], "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "Test", + "name": "config", "range": Array [ - 13, - 17, + 47, + 53, ], "type": "Identifier", }, ], - "name": "Test", + "name": "config", "references": Array [], "scope": Object { - "$ref": 6, + "$ref": 5, }, }, ], @@ -4424,13 +14954,13 @@ Object { "$ref": 4, }, ], - "type": "module", + "type": "class", "upperScope": Object { - "$ref": 8, + "$ref": 7, }, "variableMap": Object { "Test": Object { - "$ref": 0, + "$ref": 1, }, }, "variableScope": Object { @@ -4438,7 +14968,7 @@ Object { }, "variables": Array [ Object { - "$id": 0, + "$id": 1, "defs": Array [ Object { "name": Object { @@ -4456,7 +14986,7 @@ Object { ], "type": "ClassDeclaration", }, - "parent": null, + "parent": undefined, "type": "ClassName", }, ], @@ -4474,7 +15004,7 @@ Object { "name": "Test", "references": Array [], "scope": Object { - "$ref": 7, + "$ref": 6, }, }, ], @@ -4490,15 +15020,60 @@ Object { ], "type": "global", "upperScope": null, - "variableMap": Object {}, + "variableMap": Object { + "Test": Object { + "$ref": 0, + }, + }, "variableScope": Object { - "$ref": 8, + "$ref": 7, }, - "variables": Array [], + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 7, + 64, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "Test", + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + }, + ], + "name": "Test", + "references": Array [], + "scope": Object { + "$ref": 7, + }, + }, + ], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/ignore-type-only-stuff.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -4544,132 +15119,107 @@ Object { "type": "VariableDeclarator", }, "parent": Object { - "range": Array [ - 106, - 114, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 110, - 114, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [], - "scope": Object { - "$ref": 1, - }, - }, - ], -} -`; - -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/import-equals.ts 1`] = ` -Object { - "$id": 2, - "block": Object { - "range": Array [ - 0, - 28, - ], - "type": "Program", - }, - "childScopes": Array [ - Object { - "$id": 1, - "block": Object { - "range": Array [ - 0, - 28, - ], - "type": "Program", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 2, - }, - "variableMap": Object { - "foo": Object { - "$ref": 0, - }, - }, - "variableScope": Object { - "$ref": 1, - }, - "variables": Array [ - Object { - "$id": 0, - "defs": Array [ - Object { - "name": Object { - "name": "foo", - "range": Array [ - 7, - 10, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 0, - 27, - ], - "type": "TSImportEqualsDeclaration", - }, - "parent": null, - "type": "ImportBinding", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "foo", - "range": Array [ - 7, - 10, - ], - "type": "Identifier", - }, - ], - "name": "foo", - "references": Array [], - "scope": Object { - "$ref": 1, + "range": Array [ + 106, + 114, + ], + "type": "VariableDeclaration", }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 110, + 114, + ], + "type": "Identifier", }, ], + "name": "a", + "references": Array [], + "scope": Object { + "$ref": 1, + }, }, ], +} +`; + +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/import-equals.ts 1`] = ` +Object { + "$id": 1, + "block": Object { + "range": Array [ + 0, + 28, + ], + "type": "Program", + }, + "childScopes": Array [], "functionExpressionScope": false, "isStrict": false, "references": Array [], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object {}, + "variableMap": Object { + "foo": Object { + "$ref": 0, + }, + }, "variableScope": Object { - "$ref": 2, + "$ref": 1, }, - "variables": Array [], + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 0, + 27, + ], + "type": "TSImportEqualsDeclaration", + }, + "parent": null, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "foo", + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + }, + ], + "name": "foo", + "references": Array [], + "scope": Object { + "$ref": 1, + }, + }, + ], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/interface-type.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/interface-type.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -4694,7 +15244,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/method-overload.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/method-overload.ts 1`] = ` Object { "$id": 10, "block": Object { @@ -5045,9 +15595,9 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/namespace.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/namespace.ts 1`] = ` Object { - "$id": 10, + "$id": 9, "block": Object { "range": Array [ 0, @@ -5057,221 +15607,71 @@ Object { }, "childScopes": Array [ Object { - "$id": 9, + "$id": 8, "block": Object { "range": Array [ - 0, - 63, + 24, + 56, ], - "type": "Program", + "type": "TSModuleBlock", }, - "childScopes": Array [ - Object { - "$id": 8, - "block": Object { - "range": Array [ - 24, - 56, - ], - "type": "TSModuleBlock", - }, - "childScopes": Array [], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [ - Object { - "$id": 6, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "kind": "w", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": Object { - "range": Array [ - 47, - 48, - ], - "type": "Literal", - }, - }, - Object { - "$id": 7, - "from": Object { - "$ref": 8, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 53, - 54, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 5, - }, - "writeExpr": undefined, - }, - ], - "throughReferences": Array [], - "type": "block", - "upperScope": Object { - "$ref": 9, - }, - "variableMap": Object { - "a": Object { - "$ref": 5, - }, - }, - "variableScope": Object { - "$ref": 9, - }, - "variables": Array [ - Object { - "$id": 5, - "defs": Array [ - Object { - "name": Object { - "name": "a", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 43, - 48, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 37, - 48, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "a", - "range": Array [ - 43, - 44, - ], - "type": "Identifier", - }, - ], - "name": "a", - "references": Array [ - Object { - "$ref": 6, - }, - Object { - "$ref": 7, - }, - ], - "scope": Object { - "$ref": 8, - }, - }, - ], - }, - ], + "childScopes": Array [], "functionExpressionScope": false, - "isStrict": true, + "isStrict": false, "references": Array [ Object { - "$id": 2, + "$id": 6, "from": Object { - "$ref": 9, + "$ref": 8, }, "identifier": Object { "name": "a", "range": Array [ - 6, - 7, + 43, + 44, ], "type": "Identifier", }, "kind": "w", "resolved": Object { - "$ref": 0, + "$ref": 5, }, "writeExpr": Object { "range": Array [ - 10, - 11, + 47, + 48, ], "type": "Literal", }, }, Object { - "$id": 3, - "from": Object { - "$ref": 9, - }, - "identifier": Object { - "name": "a", - "range": Array [ - 57, - 58, - ], - "type": "Identifier", - }, - "kind": "r", - "resolved": Object { - "$ref": 0, - }, - "writeExpr": undefined, - }, - Object { - "$id": 4, + "$id": 7, "from": Object { - "$ref": 9, + "$ref": 8, }, "identifier": Object { - "name": "N", + "name": "a", "range": Array [ - 59, - 60, + 53, + 54, ], "type": "Identifier", }, "kind": "r", "resolved": Object { - "$ref": 1, + "$ref": 5, }, "writeExpr": undefined, }, ], "throughReferences": Array [], - "type": "module", + "type": "block", "upperScope": Object { - "$ref": 10, + "$ref": 9, }, "variableMap": Object { - "N": Object { - "$ref": 1, - }, "a": Object { - "$ref": 0, + "$ref": 5, }, }, "variableScope": Object { @@ -5279,28 +15679,28 @@ Object { }, "variables": Array [ Object { - "$id": 0, + "$id": 5, "defs": Array [ Object { "name": Object { "name": "a", "range": Array [ - 6, - 7, + 43, + 44, ], "type": "Identifier", }, "node": Object { "range": Array [ - 6, - 11, + 43, + 48, ], "type": "VariableDeclarator", }, "parent": Object { "range": Array [ - 0, - 11, + 37, + 48, ], "type": "VariableDeclaration", }, @@ -5312,8 +15712,8 @@ Object { Object { "name": "a", "range": Array [ - 6, - 7, + 43, + 44, ], "type": "Identifier", }, @@ -5321,58 +15721,14 @@ Object { "name": "a", "references": Array [ Object { - "$ref": 2, - }, - Object { - "$ref": 3, - }, - ], - "scope": Object { - "$ref": 9, - }, - }, - Object { - "$id": 1, - "defs": Array [ - Object { - "name": Object { - "name": "N", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 12, - 56, - ], - "type": "TSModuleDeclaration", - }, - "parent": null, - "type": "NamespaceName", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "N", - "range": Array [ - 22, - 23, - ], - "type": "Identifier", + "$ref": 6, }, - ], - "name": "N", - "references": Array [ Object { - "$ref": 4, + "$ref": 7, }, ], "scope": Object { - "$ref": 9, + "$ref": 8, }, }, ], @@ -5380,19 +15736,188 @@ Object { ], "functionExpressionScope": false, "isStrict": false, - "references": Array [], + "references": Array [ + Object { + "$id": 2, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": Object { + "range": Array [ + 10, + 11, + ], + "type": "Literal", + }, + }, + Object { + "$id": 3, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "a", + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 0, + }, + "writeExpr": undefined, + }, + Object { + "$id": 4, + "from": Object { + "$ref": 9, + }, + "identifier": Object { + "name": "N", + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + }, + "kind": "r", + "resolved": Object { + "$ref": 1, + }, + "writeExpr": undefined, + }, + ], "throughReferences": Array [], "type": "global", "upperScope": null, - "variableMap": Object {}, + "variableMap": Object { + "N": Object { + "$ref": 1, + }, + "a": Object { + "$ref": 0, + }, + }, "variableScope": Object { - "$ref": 10, + "$ref": 9, }, - "variables": Array [], + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 0, + 11, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "a", + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + }, + ], + "name": "a", + "references": Array [ + Object { + "$ref": 2, + }, + Object { + "$ref": 3, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 12, + 56, + ], + "type": "TSModuleDeclaration", + }, + "parent": null, + "type": "NamespaceName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "N", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + ], + "name": "N", + "references": Array [ + Object { + "$ref": 4, + }, + ], + "scope": Object { + "$ref": 9, + }, + }, + ], } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/rest-element.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/rest-element.ts 1`] = ` Object { "$id": 4, "block": Object { @@ -5546,7 +16071,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-alias.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-alias.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -5571,7 +16096,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-annotations.ts 1`] = ` Object { "$id": 7, "block": Object { @@ -5844,7 +16369,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-assertions.ts 1`] = ` Object { "$id": 4, "block": Object { @@ -5963,7 +16488,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/type-parameter.ts 1`] = ` Object { "$id": 3, "block": Object { @@ -6074,7 +16599,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof.ts 1`] = ` Object { "$id": 3, "block": Object { @@ -6202,7 +16727,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-assertions.ts 1`] = ` Object { "$id": 8, "block": Object { @@ -6445,7 +16970,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-call-signature.ts 1`] = ` Object { "$id": 8, "block": Object { @@ -6683,7 +17208,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-return-type.ts 1`] = ` Object { "$id": 5, "block": Object { @@ -6861,7 +17386,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-type-parameters.ts 1`] = ` Object { "$id": 5, "block": Object { @@ -7039,7 +17564,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/typeof-in-var.ts 1`] = ` Object { "$id": 11, "block": Object { @@ -7445,7 +17970,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-array-type.src.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -7470,7 +17995,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-conditional.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -7546,7 +18071,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-conditional-with-null.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -7622,7 +18147,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-indexed.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -7698,7 +18223,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-infer.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-infer.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -7723,7 +18248,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-intersection-type.src.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -7748,7 +18273,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -7824,7 +18349,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped-readonly.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -7900,7 +18425,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped-readonly-minus.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -7976,7 +18501,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8052,7 +18577,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-nested-types.src.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -8077,7 +18602,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-parenthesized-type.src.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -8102,7 +18627,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-reference.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8178,7 +18703,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-reference-generic.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8254,7 +18779,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-reference-generic-nested.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8330,7 +18855,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8406,7 +18931,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-empty.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8482,7 +19007,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-optional.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8558,7 +19083,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-rest.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8634,7 +19159,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-tuple-type.src.ts 1`] = ` Object { "$id": 0, "block": Object { @@ -8659,7 +19184,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-type-literal.src.ts 1`] = ` Object { "$id": 1, "block": Object { @@ -8735,7 +19260,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-type-operator.src.ts 1`] = ` Object { "$id": 2, "block": Object { @@ -8860,7 +19385,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-typeof.src.ts 1`] = ` Object { "$id": 2, "block": Object { @@ -8958,7 +19483,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-union-intersection.src.ts 1`] = ` Object { "$id": 4, "block": Object { @@ -9181,7 +19706,7 @@ Object { } `; -exports[`TypeScript scope analysis tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` +exports[`TypeScript scope analysis sourceType: script tests/fixtures/scope-analysis/types-union-type.src.ts 1`] = ` Object { "$id": 0, "block": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap index 2c696e0ded12..34119d84c9ad 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/tsx.js.snap @@ -200,7 +200,7 @@ Object { 0, 34, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap index dcb703d6f1a7..320bf39a58a7 100644 --- a/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap +++ b/packages/typescript-eslint-parser/tests/lib/__snapshots__/typescript.js.snap @@ -130,7 +130,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -463,7 +463,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -1768,7 +1768,7 @@ Object { 0, 63, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -2141,7 +2141,7 @@ Object { 0, 66, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3398,7 +3398,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -3804,7 +3804,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -4326,7 +4326,7 @@ Object { 0, 97, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -5338,7 +5338,7 @@ Object { 0, 174, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6230,7 +6230,7 @@ Object { 0, 26, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6622,7 +6622,7 @@ Object { 0, 58, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -6990,7 +6990,7 @@ Object { 0, 81, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7339,7 +7339,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -7830,7 +7830,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8331,7 +8331,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -8795,7 +8795,7 @@ Object { 0, 37, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9164,7 +9164,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9406,7 +9406,7 @@ Object { 0, 81, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -9721,7 +9721,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -10089,7 +10089,7 @@ Object { 0, 36, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -11173,7 +11173,7 @@ Object { 0, 207, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -12464,7 +12464,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13016,7 +13016,7 @@ Object { 0, 68, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -13715,7 +13715,7 @@ Object { 0, 64, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14177,7 +14177,7 @@ Object { 0, 41, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -14871,7 +14871,7 @@ Object { 0, 203, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -15997,7 +15997,7 @@ Object { 0, 211, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -17123,7 +17123,7 @@ Object { 0, 199, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18071,7 +18071,7 @@ Object { 0, 109, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18570,7 +18570,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -18980,7 +18980,7 @@ Object { 0, 59, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19348,7 +19348,7 @@ Object { 0, 18, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19643,7 +19643,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -19939,7 +19939,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20218,7 +20218,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20576,7 +20576,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -20945,7 +20945,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21333,7 +21333,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -21819,7 +21819,7 @@ Object { 0, 65, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -24878,7 +24878,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -25437,7 +25437,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26174,7 +26174,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -26812,7 +26812,7 @@ Object { 0, 41, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -27274,7 +27274,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -27750,7 +27750,7 @@ Object { 0, 52, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28316,7 +28316,7 @@ Object { 0, 58, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -28985,7 +28985,7 @@ Object { 0, 97, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -29767,7 +29767,7 @@ Object { 0, 56, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -30386,7 +30386,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -30790,7 +30790,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31049,7 +31049,7 @@ Object { 0, 35, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -31326,7 +31326,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -32764,7 +32764,7 @@ Object { 0, 297, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -34951,7 +34951,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35409,7 +35409,7 @@ Object { 0, 37, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -35758,7 +35758,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36042,7 +36042,7 @@ Object { 0, 88, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -36521,7 +36521,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37105,7 +37105,7 @@ Object { 0, 28, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37327,7 +37327,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -37713,7 +37713,7 @@ Object { 0, 44, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38242,7 +38242,7 @@ Object { 0, 46, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -38902,7 +38902,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -39522,7 +39522,7 @@ Object { 0, 30, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -40146,7 +40146,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -40983,7 +40983,7 @@ Object { 0, 42, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -41493,7 +41493,7 @@ Object { 0, 37, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -41985,7 +41985,7 @@ Object { 0, 48, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42441,7 +42441,7 @@ Object { 0, 31, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -42953,7 +42953,7 @@ Object { 0, 75, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -43776,7 +43776,7 @@ Object { 0, 138, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -44523,7 +44523,7 @@ Object { 0, 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45119,7 +45119,7 @@ Object { 0, 90, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -45629,7 +45629,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46036,7 +46036,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46564,7 +46564,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -46968,7 +46968,7 @@ Object { 0, 55, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47336,7 +47336,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -47731,7 +47731,7 @@ Object { 0, 72, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -48454,7 +48454,7 @@ Object { 0, 82, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49171,7 +49171,7 @@ Object { 0, 55, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -49799,7 +49799,7 @@ Object { 0, 78, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50276,7 +50276,7 @@ Object { 0, 20, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -50597,7 +50597,7 @@ Object { 0, 58, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51083,7 +51083,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -51569,7 +51569,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52035,7 +52035,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -52429,7 +52429,7 @@ Object { 0, 50, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53092,7 +53092,7 @@ Object { 0, 116, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -53829,7 +53829,7 @@ Object { 0, 53, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -54422,7 +54422,7 @@ Object { 0, 66, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55105,7 +55105,7 @@ Object { 0, 98, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -55842,7 +55842,7 @@ Object { 0, 111, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -56540,7 +56540,7 @@ Object { 0, 88, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57225,7 +57225,7 @@ Object { 0, 93, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -57816,7 +57816,7 @@ Object { 0, 39, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58263,7 +58263,7 @@ Object { 0, 54, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58595,7 +58595,7 @@ Object { 0, 23, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -58802,7 +58802,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59026,7 +59026,7 @@ Object { 0, 38, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59251,7 +59251,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59493,7 +59493,7 @@ Object { 0, 22, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -59789,7 +59789,7 @@ Object { 0, 16, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -60394,7 +60394,7 @@ Object { 0, 27, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -62465,7 +62465,7 @@ Object { 0, 596, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65459,7 +65459,7 @@ Object { 0, 24, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -65882,7 +65882,7 @@ Object { 0, 21, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66254,7 +66254,7 @@ Object { 0, 14, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66517,7 +66517,7 @@ Object { 0, 57, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -66977,7 +66977,7 @@ Object { 0, 84, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -67676,7 +67676,7 @@ Object { 0, 114, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -68826,7 +68826,7 @@ Object { 0, 231, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { @@ -69645,7 +69645,7 @@ Object { 0, 33, ], - "sourceType": "script", + "sourceType": "module", "tokens": Array [ Object { "loc": Object { diff --git a/packages/typescript-eslint-parser/tests/lib/comments.js b/packages/typescript-eslint-parser/tests/lib/comments.js index 008924e7329a..e6714f16e8f0 100644 --- a/packages/typescript-eslint-parser/tests/lib/comments.js +++ b/packages/typescript-eslint-parser/tests/lib/comments.js @@ -35,7 +35,8 @@ describe("Comments", () => { testFiles.forEach(filename => { const code = shelljs.cat(`${path.resolve(FIXTURES_DIR, filename)}.src.js`); const config = { - jsx: true + jsx: true, + sourceType: "module" }; test(`fixtures/${filename}.src`, testUtils.createSnapshotTestBlock(code, config)); }); diff --git a/packages/typescript-eslint-parser/tests/lib/scope-analysis.js b/packages/typescript-eslint-parser/tests/lib/scope-analysis.js index f56714b8f79b..eb608905381f 100644 --- a/packages/typescript-eslint-parser/tests/lib/scope-analysis.js +++ b/packages/typescript-eslint-parser/tests/lib/scope-analysis.js @@ -142,34 +142,69 @@ describe("TypeScript scope analysis", () => { const root = "tests/fixtures/scope-analysis"; const files = fs.readdirSync(root).map(filename => path.join(root, filename).replace(/\\/g, "/")); - for (const filePath of files) { - test(filePath, () => { - const code = fs.readFileSync(filePath, "utf8"); - const { scopeManager } = parser.parseForESLint(code, { - loc: true, - range: true, - tokens: true, - ecmaFeatures: {} - }); - const { globalScope } = scopeManager; - - // Do the postprocess to test. - // https://github.com/eslint/eslint/blob/4fe328787dd02d7a1f6fc21167f6175c860825e3/lib/linter.js#L222 - globalScope.through = globalScope.through.filter(reference => { - const name = reference.identifier.name; - const variable = globalScope.set.get(name); - if (variable) { - reference.resolved = variable; - variable.references.push(reference); - return false; - } - return true; + describe("sourceType: module", () => { + for (const filePath of files) { + test(filePath, () => { + const code = fs.readFileSync(filePath, "utf8"); + const { scopeManager } = parser.parseForESLint(code, { + loc: true, + range: true, + tokens: true, + sourceType: "module", + ecmaFeatures: {} + }); + const { globalScope } = scopeManager; + + // Do the postprocess to test. + // https://github.com/eslint/eslint/blob/4fe328787dd02d7a1f6fc21167f6175c860825e3/lib/linter.js#L222 + globalScope.through = globalScope.through.filter(reference => { + const name = reference.identifier.name; + const variable = globalScope.set.get(name); + if (variable) { + reference.resolved = variable; + variable.references.push(reference); + return false; + } + return true; + }); + + const scopeTree = scopeToJSON(globalScope); + expect(scopeTree).toMatchSnapshot(); }); + } + }); - const scopeTree = scopeToJSON(globalScope); - expect(scopeTree).toMatchSnapshot(); - }); - } + describe("sourceType: script", () => { + for (const filePath of files) { + test(filePath, () => { + const code = fs.readFileSync(filePath, "utf8"); + const { scopeManager } = parser.parseForESLint(code, { + loc: true, + range: true, + tokens: true, + sourceType: "script", + ecmaFeatures: {} + }); + const { globalScope } = scopeManager; + + // Do the postprocess to test. + // https://github.com/eslint/eslint/blob/4fe328787dd02d7a1f6fc21167f6175c860825e3/lib/linter.js#L222 + globalScope.through = globalScope.through.filter(reference => { + const name = reference.identifier.name; + const variable = globalScope.set.get(name); + if (variable) { + reference.resolved = variable; + variable.references.push(reference); + return false; + } + return true; + }); + + const scopeTree = scopeToJSON(globalScope); + expect(scopeTree).toMatchSnapshot(); + }); + } + }); const linter = new Linter(); linter.defineParser("typescript-eslint-parser", parser); @@ -312,7 +347,7 @@ export default class Test { expect(messages).toStrictEqual([]); }); - test("https://github.com/eslint/typescript-eslint-parser/issues/535", () => { + test("1: https://github.com/eslint/typescript-eslint-parser/issues/535", () => { const code = ` function foo({ bar }: { bar: string }) { console.log(bar); @@ -330,7 +365,7 @@ function foo({ bar }: { bar: string }) { expect(messages).toStrictEqual([]); }); - test("https://github.com/eslint/typescript-eslint-parser/issues/535", () => { + test("2: https://github.com/eslint/typescript-eslint-parser/issues/535", () => { const code = ` import { observable, @@ -345,6 +380,9 @@ export default class ListModalStore { parser: "typescript-eslint-parser", rules: { "no-unused-vars": "error" + }, + parserOptions: { + sourceType: "module" } }; const messages = linter.verify(code, config, { filename: "issue.ts" }); @@ -370,4 +408,26 @@ function test(file: Blob) { expect(messages).toStrictEqual([]); }); + + test("https://github.com/bradzacher/eslint-plugin-typescript/issues/255", () => { + const code = ` +window.whatevs = { + myFunc() { + console.log('yep'); + } +}; +`; + const config = { + parser: "typescript-eslint-parser", + parserOptions: { + sourceType: "module" + }, + rules: { + strict: "error" + } + }; + const messages = linter.verify(code, config, { filename: "issue255.ts" }); + + expect(messages).toStrictEqual([]); + }); }); diff --git a/packages/typescript-eslint-parser/tools/test-utils.js b/packages/typescript-eslint-parser/tools/test-utils.js index f8dfdc5cf87f..f9d2e942b3ea 100644 --- a/packages/typescript-eslint-parser/tools/test-utils.js +++ b/packages/typescript-eslint-parser/tools/test-utils.js @@ -48,7 +48,8 @@ function createSnapshotTestBlock(code, config = {}) { raw: true, tokens: true, comment: true, - errorOnUnknownASTType: true + errorOnUnknownASTType: true, + sourceType: "module" }; config = Object.assign({}, defaultConfig, config); From 6aed53b696b038c9a229e3214e31f2597628cae7 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 13 Jan 2019 19:42:00 -0500 Subject: [PATCH 325/326] chore: chores after typescript-eslint-parser migration --- .../typescript-eslint-parser.md | 5 - .../typescript-estree.md} | 0 .prettierignore | 5 +- .travis.yml | 4 + package.json | 1 + .../typescript-eslint-parser/.eslintignore | 1 - .../typescript-eslint-parser/.eslintrc.yml | 11 - .../typescript-eslint-parser/.gitattributes | 5 - packages/typescript-eslint-parser/.gitignore | 10 - packages/typescript-eslint-parser/.npmrc | 1 - packages/typescript-eslint-parser/.travis.yml | 18 -- .../typescript-eslint-parser/CONTRIBUTING.md | 8 - packages/typescript-eslint-parser/Makefile.js | 162 ---------- packages/typescript-eslint-parser/README.md | 7 +- .../typescript-eslint-parser/package.json | 28 +- .../templates/pr-create.md.ejs | 50 --- yarn.lock | 300 +++++++++++++++++- 17 files changed, 302 insertions(+), 314 deletions(-) rename packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE/typescript-eslint-parser.md (97%) rename .github/{ISSUE_TEMPLATE.md => ISSUE_TEMPLATE/typescript-estree.md} (100%) delete mode 100644 packages/typescript-eslint-parser/.eslintignore delete mode 100644 packages/typescript-eslint-parser/.eslintrc.yml delete mode 100644 packages/typescript-eslint-parser/.gitattributes delete mode 100644 packages/typescript-eslint-parser/.gitignore delete mode 100644 packages/typescript-eslint-parser/.npmrc delete mode 100644 packages/typescript-eslint-parser/.travis.yml delete mode 100644 packages/typescript-eslint-parser/CONTRIBUTING.md delete mode 100644 packages/typescript-eslint-parser/Makefile.js delete mode 100644 packages/typescript-eslint-parser/templates/pr-create.md.ejs diff --git a/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/typescript-eslint-parser.md similarity index 97% rename from packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE/typescript-eslint-parser.md index 7271d0acc824..1bdc5686f090 100644 --- a/packages/typescript-eslint-parser/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE/typescript-eslint-parser.md @@ -1,9 +1,7 @@ **What version of TypeScript are you using?** - **What version of `typescript-eslint-parser` are you using?** - **What code were you trying to parse?** ```ts @@ -12,7 +10,4 @@ **What did you expect to happen?** - **What happened?** - - diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/typescript-estree.md similarity index 100% rename from .github/ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE/typescript-estree.md diff --git a/.prettierignore b/.prettierignore index 5423305f2b10..76f70f7201b5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,6 @@ **/tests/fixtures/**/* **/dist -**/coverage \ No newline at end of file +**/coverage + +# Temp ignore typescript-eslint-parser +**/typescript-eslint-parser \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index e144d4f26fe1..84bc718be51a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,14 @@ node_js: install: - yarn --ignore-engines script: + # TODO: Reenable after migrations are complete # - commitlint-travis - yarn check-format - yarn test - yarn build + # TODO: Reimplement automated integration-tests from typescript-eslint-parser + # for the monorepo, after the migrations are complete + # yarn integration-tests - yarn global add codecov after_success: - codecov diff --git a/package.json b/package.json index 0ea3906786d5..54aa6f77241f 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@types/semver": "^5.5.0", "@types/shelljs": "^0.8.0", "cz-conventional-changelog": "2.1.0", + "eslint": "^4.19.1", "glob": "7.1.2", "husky": "0.14.3", "jest": "23.6.0", diff --git a/packages/typescript-eslint-parser/.eslintignore b/packages/typescript-eslint-parser/.eslintignore deleted file mode 100644 index da86dd0097ea..000000000000 --- a/packages/typescript-eslint-parser/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -tests/integration/* \ No newline at end of file diff --git a/packages/typescript-eslint-parser/.eslintrc.yml b/packages/typescript-eslint-parser/.eslintrc.yml deleted file mode 100644 index b706d16bc7eb..000000000000 --- a/packages/typescript-eslint-parser/.eslintrc.yml +++ /dev/null @@ -1,11 +0,0 @@ -root: true - -plugins: - - node -extends: - - "eslint" - - "plugin:node/recommended" -rules: - no-undefined: "off" - lines-around-comment: "off" - newline-after-var: "off" diff --git a/packages/typescript-eslint-parser/.gitattributes b/packages/typescript-eslint-parser/.gitattributes deleted file mode 100644 index 8db1f2632df7..000000000000 --- a/packages/typescript-eslint-parser/.gitattributes +++ /dev/null @@ -1,5 +0,0 @@ -* text=auto -*.js eol=lf -*.ts eol=lf -*.tsx eol=lf -*.yml eol=lf diff --git a/packages/typescript-eslint-parser/.gitignore b/packages/typescript-eslint-parser/.gitignore deleted file mode 100644 index 34a9c5ab703e..000000000000 --- a/packages/typescript-eslint-parser/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -build -coverage -node_modules -npm-debug.log -_test.js -.DS_Store -.vscode -yarn.lock -.eslint-release-info.json -.idea diff --git a/packages/typescript-eslint-parser/.npmrc b/packages/typescript-eslint-parser/.npmrc deleted file mode 100644 index 9cf9495031ec..000000000000 --- a/packages/typescript-eslint-parser/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false \ No newline at end of file diff --git a/packages/typescript-eslint-parser/.travis.yml b/packages/typescript-eslint-parser/.travis.yml deleted file mode 100644 index 4077e9b1ad79..000000000000 --- a/packages/typescript-eslint-parser/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: required - -services: - - docker - -language: node_js - -node_js: - - "6" - - "8" - - "9" - - "10" - - "11" - -script: npm test && npm run integration-tests - -after_success: - - npm run coveralls diff --git a/packages/typescript-eslint-parser/CONTRIBUTING.md b/packages/typescript-eslint-parser/CONTRIBUTING.md deleted file mode 100644 index 15897e0cefa5..000000000000 --- a/packages/typescript-eslint-parser/CONTRIBUTING.md +++ /dev/null @@ -1,8 +0,0 @@ -# Contributing Code - -Please sign our [Contributor License Agreement](http://eslint.org/cla) - -# Full Documentation - -Our full contribution guidelines can be found at: -http://eslint.org/docs/developer-guide/contributing diff --git a/packages/typescript-eslint-parser/Makefile.js b/packages/typescript-eslint-parser/Makefile.js deleted file mode 100644 index 3cf9d1fdc452..000000000000 --- a/packages/typescript-eslint-parser/Makefile.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * @fileoverview Build file - * @author nzakas - * @copyright jQuery Foundation and other contributors, https://jquery.org/ - * MIT License - */ -/* global echo, exit, find, target */ - -"use strict"; - -/* eslint no-console: 0*/ -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -require("shelljs/make"); - -const checker = require("npm-license"), - nodeCLI = require("shelljs-nodecli"); - -//------------------------------------------------------------------------------ -// Settings -//------------------------------------------------------------------------------ - -const OPEN_SOURCE_LICENSES = [ - /MIT/, /BSD/, /Apache/, /ISC/, /WTF/, /Public Domain/ -]; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Generates a function that matches files with a particular extension. - * @param {string} extension The file extension (i.e. "js") - * @returns {Function} The function to pass into a filter method. - * @private - */ -function fileType(extension) { - return function(filename) { - return filename.substring(filename.lastIndexOf(".") + 1) === extension; - }; -} - -//------------------------------------------------------------------------------ -// Data -//------------------------------------------------------------------------------ - -const JEST = "jest", - LINT_OPTIONS = "--report-unused-disable-directives", - - // Files - MAKEFILE = "./Makefile.js", - JS_FILES = "parser.js visitor-keys.js", - TEST_FILES = find("tests/lib/").filter(fileType("js")).join(" "), - TOOLS_FILES = find("tools/").filter(fileType("js")).join(" "); - -//------------------------------------------------------------------------------ -// Tasks -//------------------------------------------------------------------------------ - -target.all = function() { - target.test(); -}; - -target.lint = function() { - let errors = 0, - lastReturn; - - echo("Validating Makefile.js"); - lastReturn = nodeCLI.exec("eslint", MAKEFILE, LINT_OPTIONS); - if (lastReturn.code !== 0) { - errors++; - } - - echo("Validating JavaScript files"); - lastReturn = nodeCLI.exec("eslint", JS_FILES, LINT_OPTIONS); - if (lastReturn.code !== 0) { - errors++; - } - - echo("Validating JavaScript test files"); - lastReturn = nodeCLI.exec("eslint", TEST_FILES, LINT_OPTIONS); - if (lastReturn.code !== 0) { - errors++; - } - - echo("Validating JavaScript tools files"); - lastReturn = nodeCLI.exec("eslint", TOOLS_FILES, LINT_OPTIONS); - if (lastReturn.code !== 0) { - errors++; - } - - if (errors) { - exit(1); - } -}; - -target.test = function() { - target.lint(); - - const lastReturn = nodeCLI.exec(JEST); - let errors = 0; - - if (lastReturn.code !== 0) { - errors++; - } - - if (errors) { - exit(1); - } - - // target.checkLicenses(); -}; - -target.docs = function() { - echo("Generating documentation"); - nodeCLI.exec("jsdoc", "-d jsdoc lib"); - echo("Documentation has been output to /jsdoc"); -}; - -target.checkLicenses = function() { - - /** - * Returns true if the given dependency's licenses are all permissable for use in OSS - * @param {Object} dependency object containing the name and licenses of the given dependency - * @returns {boolean} is permissable dependency - */ - function isPermissible(dependency) { - const licenses = dependency.licenses; - - if (Array.isArray(licenses)) { - return licenses.some(license => isPermissible({ - name: dependency.name, - licenses: license - })); - } - - return OPEN_SOURCE_LICENSES.some(license => license.test(licenses)); - } - - echo("Validating licenses"); - - checker.init({ - start: __dirname - }, deps => { - const impermissible = Object.keys(deps).map(dependency => ({ - name: dependency, - licenses: deps[dependency].licenses - })).filter(dependency => !isPermissible(dependency)); - - if (impermissible.length) { - impermissible.forEach(dependency => { - console.error("%s license for %s is impermissible.", - dependency.licenses, - dependency.name - ); - }); - exit(1); - } - }); -}; diff --git a/packages/typescript-eslint-parser/README.md b/packages/typescript-eslint-parser/README.md index 97b92d15e855..72ceeb5b8389 100644 --- a/packages/typescript-eslint-parser/README.md +++ b/packages/typescript-eslint-parser/README.md @@ -1,9 +1,6 @@ ->

Help Wanted!

-> If you're familiar with TypeScript and ESLint, and you'd like to see this project progress, please consider contributing. We need people with a good knowledge of TypeScript to ensure that the integration with the ESLint ecosystem is useful. - # TypeScript ESLint Parser -An ESLint custom parser which leverages [TypeScript ESTree](https://github.com/JamesHenry/typescript-estree) to allow for ESLint to lint TypeScript source code. +An ESLint custom parser which leverages [TypeScript ESTree](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/typescript-estree) to allow for ESLint to lint TypeScript source code. ## Installation: @@ -67,8 +64,6 @@ If you use a non-supported version of TypeScript, the parser will log a warning ## Reporting Issues -Please **do not report parsing/AST issues in this repo**, report them directly to [TypeScript ESTree](https://github.com/JamesHenry/typescript-estree). - Please check the current list of open and known issues and ensure the issue has not been reported before. When creating a new issue provide as much information about your environment as possible. This includes: - ESLint Version diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 54316fce2a27..784a80696b11 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -2,7 +2,7 @@ "name": "typescript-eslint-parser", "description": "An ESLint custom parser which leverages TypeScript ESTree", "author": "Nicholas C. Zakas ", - "homepage": "https://github.com/eslint/typescript-eslint-parser", + "homepage": "https://github.com/typescript-eslint/typescript-eslint", "main": "parser.js", "version": "21.0.2", "files": [ @@ -13,9 +13,9 @@ "engines": { "node": ">=6.14.0" }, - "repository": "eslint/typescript-eslint-parser", + "repository": "typescript-eslint/typescript-eslint", "bugs": { - "url": "https://github.com/eslint/typescript-eslint-parser/issues" + "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "BSD-2-Clause", "keywords": [ @@ -28,16 +28,9 @@ "eslint" ], "scripts": { - "test": "node Makefile.js test", - "jest": "jest", + "test": "jest", "integration-tests": "docker-compose -f tests/integration/docker-compose.yml up", - "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local", - "lint": "node Makefile.js lint", - "generate-release": "eslint-generate-release", - "generate-alpharelease": "eslint-generate-prerelease alpha", - "generate-betarelease": "eslint-generate-prerelease beta", - "generate-rcrelease": "eslint-generate-prerelease rc", - "publish-release": "eslint-publish-release" + "kill-integration-test-containers": "docker-compose -f tests/integration/docker-compose.yml down -v --rmi local" }, "peerDependencies": { "eslint": ">=4.19.1", @@ -48,17 +41,6 @@ "eslint-visitor-keys": "^1.0.0", "typescript-estree": "18.0.0" }, - "devDependencies": { - "eslint": "^4.19.1", - "eslint-config-eslint": "4.0.0", - "eslint-plugin-node": "6.0.1", - "eslint-release": "1.2.0", - "jest": "23.1.0", - "npm-license": "0.3.3", - "shelljs": "0.8.2", - "shelljs-nodecli": "0.1.1", - "typescript": "~3.2.1" - }, "jest": { "testEnvironment": "node", "testRegex": "tests/lib/.+\\.js$", diff --git a/packages/typescript-eslint-parser/templates/pr-create.md.ejs b/packages/typescript-eslint-parser/templates/pr-create.md.ejs deleted file mode 100644 index de9295b93f82..000000000000 --- a/packages/typescript-eslint-parser/templates/pr-create.md.ejs +++ /dev/null @@ -1,50 +0,0 @@ -<% - -var FLAG_PATTERN = /^(Fix|Update|New|Breaking|Build|Docs|Upgrade|Chore):/, - ISSUE_REF_PATTERN = /\((fixes|refs) #\d+.*?\)$/; - -function isValidCommitFlag(log) { - var result = log.match(FLAG_PATTERN); - return !!result || log.indexOf("Revert \"") === 0; -} - -function needsIssueRef(log) { - var result = log.match(ISSUE_REF_PATTERN); - return !result && log.indexOf("Docs:") !== 0; -} - -var problems = []; - -// Check for one commit per pull request -if (payload.commits > 1) { - problems.push("We require one commit per pull request. Please [squash](https://egghead.io/lessons/javascript-how-to-squash-multiple-git-commits) your commits."); -} else if (meta.commits) { - // get just the first line of the commit message - var log = meta.commits[0].commit.message.split(/\r?\n/g)[0]; - - if (!isValidCommitFlag(log)) { - problems.push("The commit summary needs to begin with a tag (such as `Fix:` or `Update:`). Please check out our [guide](http://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes) for how to properly format your commit summary and [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) it on this pull request.") - } - - if (log.length > 72) { - problems.push("The commit summary must be 72 characters or shorter. Please check out our [guide](http://eslint.org/docs/developer-guide/contributing/pull-requests#step-2-make-your-changes) for how to properly format your commit summary and [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) it on this pull request."); - } - - if (needsIssueRef(log)) { - problems.push("Pull requests with code require an issue to be mentioned at the end of the commit summary, such as `(fixes #1234)`. Please [update](http://eslint.org/docs/developer-guide/contributing/pull-requests#updating-the-commit-message) the commit summary with an issue (file a new issue if one doesn't already exist).") - } -} - -if (problems.length) { %> -Thanks for the pull request, @<%= payload.sender.login %>! I took a look to make sure it's ready for merging and found some changes are needed: - -<% problems.forEach(function(problem) { %> -* <%- problem %> -<% }); %> - -Can you please update the pull request to address these? - -(More information can be found in our [pull request guide](http://eslint.org/docs/developer-guide/contributing/pull-requests).) -<% } else { %> -LGTM -<% } %> diff --git a/yarn.lock b/yarn.lock index fdb9df6ed183..f18b0d5be8ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -875,12 +875,24 @@ acorn-globals@^4.1.0: acorn "^6.0.1" acorn-walk "^6.0.1" +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= + dependencies: + acorn "^3.0.4" + acorn-walk@^6.0.1: version "6.1.1" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.1.1.tgz#d363b66f5fac5f018ff9c3a1e7b6f8e310cc3913" integrity sha512-OtUw6JUTgxA2QoqqmrmQ7F2NYqiBPi/L2jqHyFtllhOUvXYQXf0Z1CYUinIfyT4bTCGmrA7gX9FvHA81uzCoVw== -acorn@^5.5.3: +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= + +acorn@^5.5.0, acorn@^5.5.3: version "5.7.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== @@ -904,6 +916,21 @@ agentkeepalive@^3.4.1: dependencies: humanize-ms "^1.2.1" +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" + integrity sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I= + +ajv@^5.2.3, ajv@^5.3.0: + version "5.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" + integrity sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU= + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + ajv@^6.5.5: version "6.7.0" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.7.0.tgz#e3ce7bb372d6577bb1839f1dfdfcbf5ad2948d96" @@ -1119,7 +1146,7 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== -babel-code-frame@^6.26.0: +babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= @@ -1556,7 +1583,7 @@ chalk@^1.0.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.1, chalk@^2.4.1: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1, chalk@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1565,6 +1592,11 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.1, chalk@^2.4.1: escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + integrity sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I= + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -1580,6 +1612,11 @@ ci-info@^1.5.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== + class-utils@^0.3.5: version "0.3.6" resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" @@ -1891,7 +1928,7 @@ cosmiconfig@^5.0.2: js-yaml "^3.9.0" parse-json "^4.0.0" -cross-spawn@^5.0.1: +cross-spawn@^5.0.1, cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= @@ -2134,6 +2171,13 @@ dir-glob@2.0.0: arrify "^1.0.1" path-type "^3.0.0" +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" @@ -2259,6 +2303,79 @@ escodegen@^1.9.1: optionalDependencies: source-map "~0.6.1" +eslint-scope@^3.7.1: + version "3.7.3" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.3.tgz#bb507200d3d17f60247636160b4826284b108535" + integrity sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-scope@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" + integrity sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== + +eslint@^4.19.1: + version "4.19.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" + integrity sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ== + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.1.0" + doctrine "^2.1.0" + eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.4" + esquery "^1.0.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + regexpp "^1.0.1" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "4.0.2" + text-table "~0.2.0" + +espree@^3.5.4: + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" + integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== + dependencies: + acorn "^5.5.0" + acorn-jsx "^3.0.0" + esprima@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" @@ -2269,7 +2386,21 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -estraverse@^4.2.0: +esquery@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" + integrity sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA== + dependencies: + estraverse "^4.0.0" + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= @@ -2389,6 +2520,15 @@ extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== +external-editor@^2.0.4: + version "2.2.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" + integrity sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A== + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + external-editor@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.0.3.tgz#5866db29a97826dbe4bf3afd24070ead9ea43a27" @@ -2429,6 +2569,11 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= +fast-deep-equal@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" + integrity sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ= + fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" @@ -2483,6 +2628,14 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" @@ -2549,6 +2702,16 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" +flat-cache@^1.2.1: + version "1.3.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" + integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== + dependencies: + circular-json "^0.3.1" + graceful-fs "^4.1.2" + rimraf "~2.6.2" + write "^0.2.1" + flush-write-stream@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.3.tgz#c5d586ef38af6097650b49bc41b55fabb19f35bd" @@ -2661,6 +2824,11 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -2858,6 +3026,11 @@ global-dirs@^0.1.0: dependencies: ini "^1.3.4" +globals@^11.0.1: + version "11.10.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.10.0.tgz#1e09776dffda5e01816b3bb4077c8b59c24eaa50" + integrity sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ== + globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -3041,7 +3214,7 @@ husky@0.14.3: normalize-path "^1.0.0" strip-indent "^2.0.0" -iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: +iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -3060,7 +3233,7 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.5: +ignore@^3.3.3, ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== @@ -3130,6 +3303,26 @@ init-package-json@^1.10.3: validate-npm-package-license "^3.0.1" validate-npm-package-name "^3.0.0" +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" + integrity sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ== + dependencies: + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.4" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" + through "^2.3.6" + inquirer@^6.2.0: version "6.2.1" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.1.tgz#9943fc4882161bdb0b0c9276769c75b32dbfcd52" @@ -3415,6 +3608,11 @@ is-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= +is-resolvable@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== + is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -3878,7 +4076,7 @@ js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@^3.7.0, js-yaml@^3.9.0: +js-yaml@^3.7.0, js-yaml@^3.9.0, js-yaml@^3.9.1: version "3.12.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.1.tgz#295c8632a18a23e054cf5c9d3cecafe678167600" integrity sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA== @@ -3933,6 +4131,11 @@ json-parse-better-errors@^1.0.0, json-parse-better-errors@^1.0.1: resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + integrity sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A= + json-schema-traverse@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" @@ -3943,6 +4146,11 @@ json-schema@0.2.3: resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -4058,7 +4266,7 @@ leven@^2.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" integrity sha1-wuep93IJTe6dNCAq6KzORoeHVYA= -levn@~0.3.0: +levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= @@ -4327,7 +4535,7 @@ lodash.unescape@4.0.1: resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= -lodash@4.17.11, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1: +lodash@4.17.11, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== @@ -4594,7 +4802,7 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -minimatch@^3.0.0, minimatch@^3.0.3, minimatch@^3.0.4: +minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -5044,7 +5252,7 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1: +optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= @@ -5355,6 +5563,11 @@ please-upgrade-node@^3.0.2: dependencies: semver-compare "^1.0.0" +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + integrity sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow== + pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" @@ -5398,6 +5611,11 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" integrity sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw== +progress@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" + integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" @@ -5666,6 +5884,11 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +regexpp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" + integrity sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" @@ -5822,7 +6045,7 @@ right-pad@^1.0.1: resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" integrity sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA= -rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: +rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@~2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -5848,6 +6071,18 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + integrity sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74= + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" + integrity sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ= + rxjs@^6.1.0, rxjs@^6.3.3: version "6.3.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.3.3.tgz#3c6a7fa420e844a81390fb1158a9ec614f4bad55" @@ -5984,6 +6219,13 @@ slice-ansi@0.0.4: resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + integrity sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg== + dependencies: + is-fullwidth-code-point "^2.0.0" + slide@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" @@ -6342,6 +6584,18 @@ symbol-tree@^3.2.2: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" integrity sha1-rifbOPZgp64uHDt9G8KQgZuFGeY= +table@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + integrity sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA== + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" + tar@^2.0.0: version "2.2.1" resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" @@ -6397,6 +6651,11 @@ text-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + throat@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" @@ -6553,6 +6812,14 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= +typescript-estree@18.0.0: + version "18.0.0" + resolved "https://registry.yarnpkg.com/typescript-estree/-/typescript-estree-18.0.0.tgz#a309f6c6502c64d74b3f88c205d871a9af0b1d40" + integrity sha512-HxTWrzFyYOPWA91Ij7xL9mNUVpGTKLH2KiaBn28CMbYgX2zgWdJqU9hO7Are+pAPAqY91NxAYoaAyDDZ3rLj2A== + dependencies: + lodash.unescape "4.0.1" + semver "5.5.0" + typescript@~3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.2.tgz#fe8101c46aa123f8353523ebdcf5730c2ae493e5" @@ -6820,6 +7087,13 @@ write-pkg@^3.1.0: sort-keys "^2.0.0" write-json-file "^2.2.0" +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= + dependencies: + mkdirp "^0.5.1" + ws@^5.2.0: version "5.2.2" resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" From 409cf82c7c071186118a9339ccf5c1ae4793d6c7 Mon Sep 17 00:00:00 2001 From: James Henry Date: Sun, 13 Jan 2019 20:04:03 -0500 Subject: [PATCH 326/326] chore: generate lcov coverage from typescript-eslint-parser --- packages/typescript-eslint-parser/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/typescript-eslint-parser/package.json b/packages/typescript-eslint-parser/package.json index 784a80696b11..3846710b364e 100644 --- a/packages/typescript-eslint-parser/package.json +++ b/packages/typescript-eslint-parser/package.json @@ -47,7 +47,8 @@ "testPathIgnorePatterns": [], "collectCoverage": true, "coverageReporters": [ - "text-summary" + "text-summary", + "lcov" ] } }